svn commit: trunk/uClibc/libc/sysdeps/linux/arm: bits

kraj at uclibc.org kraj at uclibc.org
Sat Oct 7 06:50:45 UTC 2006


Author: kraj
Date: 2006-10-06 23:50:44 -0700 (Fri, 06 Oct 2006)
New Revision: 16334

Log:
Add mmap function needed for ARM EABI and define thumb specific INTERNAL_SYSCALL macro which saves r7 before making the call and pops it back after return. 


Modified:
   trunk/uClibc/libc/sysdeps/linux/arm/Makefile.arch
   trunk/uClibc/libc/sysdeps/linux/arm/bits/syscalls.h


Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/arm/Makefile.arch
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/arm/Makefile.arch	2006-10-07 06:40:33 UTC (rev 16333)
+++ trunk/uClibc/libc/sysdeps/linux/arm/Makefile.arch	2006-10-07 06:50:44 UTC (rev 16334)
@@ -5,7 +5,7 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-CSRC := brk.c ioperm.c iopl.c sigaction.c __syscall_error.c
+CSRC := brk.c ioperm.c iopl.c mmap.c sigaction.c __syscall_error.c
 
 SSRC := \
 	__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \

Modified: trunk/uClibc/libc/sysdeps/linux/arm/bits/syscalls.h
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/arm/bits/syscalls.h	2006-10-07 06:40:33 UTC (rev 16333)
+++ trunk/uClibc/libc/sysdeps/linux/arm/bits/syscalls.h	2006-10-07 06:50:44 UTC (rev 16334)
@@ -112,6 +112,7 @@
 
 #undef INTERNAL_SYSCALL
 #if defined(__ARM_EABI__)
+#if !defined(__thumb__)
 #define INTERNAL_SYSCALL(name, err, nr, args...)			\
   ({unsigned int _sys_result;						\
      {									\
@@ -125,6 +126,28 @@
        _sys_result = _a1;						\
      }									\
      (int) _sys_result; })
+#else /* !defined(__thumb__) */
+/* So hide the use of r7 from the compiler, this would be a lot
+ * easier but for the fact that the syscalls can exceed 255.
+ * For the moment the LOAD_ARG_7 is sacrificed.
+ */
+#define INTERNAL_SYSCALL(name, err, nr, args...)                \
+  ({ unsigned int _sys_result;                                  \
+    {                                                           \
+      register int _a1 asm ("a1");                              \
+      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}"                           \
+                   : "=r" (_a1)                                 \
+                    : "r" (_v3) ASM_ARGS_##nr                   \
+                    : "memory");                                \
+      _sys_result = _a1;                                        \
+    }                                                           \
+    (int) _sys_result; })
+#endif /*!defined(__thumb__)*/
 #else /* !defined(__ARM_EABI__) */ 
 #if !defined(__thumb__)
 #define INTERNAL_SYSCALL(name, err, nr, args...)		\




More information about the uClibc-cvs mailing list