[PATCH] Complete PPC INLINE_SYSCALL macro

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Tue Sep 24 13:45:00 GMT 2002


Hi,

after comparing the INLINE_SYSCALL macro with the stuff we have in 
asm/unistd.h, I noticed a few missing bits. Main thing are the missing 
register clobbers which may lead to subtle bugs.

Build&check with this patch completed without problems.

Franz.

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INLINE_SYSCALL):
	Add missing bits.

-------------- next part --------------
Index: sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h,v
retrieving revision 1.2
diff -u -p -r1.2 sysdep.h
--- sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h	17 Sep 2002 06:56:11 -0000	1.2
+++ sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h	23 Sep 2002 10:57:58 -0000
@@ -41,13 +41,17 @@
   ({						\
     long ret, err;				\
     LOADARGS_##nr(name, args);			\
-    __asm__ ("sc\n\t"				\
-	     "mfcr	%1\n\t"			\
-	     : "=r" (r3), "=r" (err)		\
-	     : ASM_INPUT_##nr			\
-	     : "cc", "memory");			\
+    __asm__ __volatile__			\
+      ("sc\n\t"					\
+       "mfcr	%1\n\t"				\
+       : "=&r" (r3), "=&r" (r0)			\
+       : ASM_INPUT_##nr				\
+       : "r4", "r5",  "r6",  "r7",  "r8",	\
+	 "r9", "r10", "r11", "r12", "cc",	\
+	 "memory");				\
     ret = r3;					\
-    if (err & 1 << 28)				\
+    err = r0;					\
+    if (err & (1 << 28))			\
       {						\
 	__set_errno (ret);			\
 	ret = -1L;				\
@@ -76,7 +80,7 @@
 	LOADARGS_5(name, arg1, arg2, arg3, arg4, arg5); \
 	register long r8 __asm__ ("r8") = (long) (arg6)
 
-# define ASM_INPUT_0 "r" (r0)
+# define ASM_INPUT_0 "1" (r0)
 # define ASM_INPUT_1 ASM_INPUT_0, "0" (r3)
 # define ASM_INPUT_2 ASM_INPUT_1, "r" (r4)
 # define ASM_INPUT_3 ASM_INPUT_2, "r" (r5)


More information about the Libc-alpha mailing list