svn commit: branches/uClibc-nptl/libc/sysdeps/linux/arm/bits

kraj at uclibc.org kraj at uclibc.org
Thu Jul 10 01:09:10 UTC 2008


Author: kraj
Date: 2008-07-09 18:09:10 -0700 (Wed, 09 Jul 2008)
New Revision: 22731

Log:
Do not use push/pop in inline asm. It breaks unwinding

Modified:
   branches/uClibc-nptl/libc/sysdeps/linux/arm/bits/syscalls.h


Changeset:
Modified: branches/uClibc-nptl/libc/sysdeps/linux/arm/bits/syscalls.h
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/arm/bits/syscalls.h	2008-07-10 01:06:46 UTC (rev 22730)
+++ branches/uClibc-nptl/libc/sysdeps/linux/arm/bits/syscalls.h	2008-07-10 01:09:10 UTC (rev 22731)
@@ -137,17 +137,21 @@
      (int) __sys_result; })
 #endif
 #else /* !defined(__thumb__) */
-
+/* We can't use push/pop inside the asm because that breaks
+   unwinding (ie. thread cancellation).
+ */
 #define INTERNAL_SYSCALL(name, err, nr, args...)			\
   ({ unsigned int __sys_result;						\
     {									\
+      int _sys_buf[2];							\
       register int _a1 __asm__ ("a1");					\
+      register int *_v3 asm ("v3") = _sys_buf;				\
+      *_v3 = (int) (SYS_ify(name));					\
       LOAD_ARGS_##nr (args)						\
-      register int _v3 __asm__ ("v3") = (int) (SYS_ify(name));		\
-      __asm__ __volatile__ ("push       {r7}\n"				\
-			    "\tmov      r7, v3\n"			\
-			    "\tswi      0       @ syscall " #name "\n"	\
-			    "\tpop      {r7}"				\
+      asm volatile ("str	r7, [v3, #4]\n"				\
+		    "\tldr      r7, [v3]\n"                     	\
+		    "\tswi      0       @ syscall " #name "\n"		\
+		    "\tldr      r7, [v3, #4]"                   	\
 		    : "=r" (_a1)					\
 		    : "r" (_v3) ASM_ARGS_##nr				\
                     : "memory");					\




More information about the uClibc-cvs mailing list