[uClibc-cvs] uClibc/libc/sysdeps/linux/arm/bits syscalls.h,1.4,1.5

Erik Andersen andersen at uclibc.org
Wed Jun 11 01:45:35 UTC 2003


Update of /var/cvs/uClibc/libc/sysdeps/linux/arm/bits
In directory winder:/home/andersen/CVS/uClibc/libc/sysdeps/linux/arm/bits

Modified Files:
	syscalls.h 
Log Message:
Fix arm syscall implementation so it does not blow chunks with gcc 3.3
 -Erik


Index: syscalls.h
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/arm/bits/syscalls.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- syscalls.h	5 Sep 2002 05:29:41 -0000	1.4
+++ syscalls.h	11 Jun 2003 01:45:01 -0000	1.5
@@ -18,7 +18,7 @@
 
 /*
    Some of the sneaky macros in the code were taken from 
-   glibc-2.2.5/sysdeps/unix/sysv/linux/arm/sysdep.h
+   glibc-2.3.2/sysdeps/unix/sysv/linux/arm/sysdep.h
 */
 
 #ifndef __ASSEMBLER__
@@ -84,7 +84,20 @@
 
 
 #undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)			\
+#define INLINE_SYSCALL(name, nr, args...)				\
+  ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
+     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))	\
+       {								\
+	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
+	 _sys_result = (unsigned int) -1;				\
+       }								\
+     (int) _sys_result; })
+
+#undef INTERNAL_SYSCALL_DECL
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
+#undef INTERNAL_SYSCALL
+#define INTERNAL_SYSCALL(name, err, nr, args...)		\
   ({ unsigned int _sys_result;					\
      {								\
        register int _a1 asm ("a1");				\
@@ -92,16 +105,18 @@
        asm volatile ("swi	%1	@ syscall " #name	\
 		     : "=r" (_a1)				\
 		     : "i" (SYS_ify(name)) ASM_ARGS_##nr	\
-		     : "a1", "memory");				\
+		     : "memory");				\
        _sys_result = _a1;					\
      }								\
-     if (_sys_result >= (unsigned int) -4095)			\
-       {							\
-	 __set_errno (-_sys_result);				\
-	 _sys_result = (unsigned int) -1;			\
-       }							\
      (int) _sys_result; })
 
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+  ((unsigned int) (val) >= 0xfffff001u)
+
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
+
 #define LOAD_ARGS_0()
 #define ASM_ARGS_0
 #define LOAD_ARGS_1(a1)				\
@@ -132,6 +147,7 @@
   register int _v3 asm ("v3") = (int) (a7);	\
   LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6)
 #define ASM_ARGS_7	ASM_ARGS_6, "r" (_v3)
+
 
 #endif /* __ASSEMBLER__ */
 #endif /* _BITS_SYSCALLS_H */



More information about the uClibc-cvs mailing list