summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/bits/syscalls.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-29 21:02:08 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-29 21:02:08 +0000
commit2607bee41906da4f47d98a92749c11533396838c (patch)
tree0ac6b10026422c6863e63d843305c2ac2f3030f8 /libc/sysdeps/linux/arm/bits/syscalls.h
parentceb83067f2248eb6f9517440c127250c98bbd8f3 (diff)
Patch by Joseph S. Myers to add support for ARM EABI
Diffstat (limited to 'libc/sysdeps/linux/arm/bits/syscalls.h')
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h
index 2beaf24d8..c6ab3ecf7 100644
--- a/libc/sysdeps/linux/arm/bits/syscalls.h
+++ b/libc/sysdeps/linux/arm/bits/syscalls.h
@@ -21,7 +21,22 @@
glibc-2.3.2/sysdeps/unix/sysv/linux/arm/sysdep.h
*/
-#ifndef __ASSEMBLER__
+#ifdef __ASSEMBLER__
+/* Call a given syscall, with arguments loaded. For EABI, we must
+ save and restore r7 for the syscall number. Unlike the DO_CALL
+ macro in glibc, this macro does not load syscall arguments. */
+#undef DO_CALL
+#if defined(__ARM_EABI__)
+#define DO_CALL(syscall_name) \
+ mov ip, r7; \
+ ldr r7, =SYS_ify (syscall_name); \
+ swi 0x0; \
+ mov r7, ip;
+#else
+#define DO_CALL(syscall_name) \
+ swi SYS_ify (syscall_name);
+#endif
+#else
#undef _syscall0
#define _syscall0(type,name) \
@@ -97,6 +112,21 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL
+#if defined(__ARM_EABI__)
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({unsigned int _sys_result; \
+ { \
+ register int _a1 asm ("r0"), _nr asm ("r7"); \
+ LOAD_ARGS_##nr (args) \
+ _nr = SYS_ify(name); \
+ asm volatile ("swi 0x0 @ syscall " #name \
+ : "=r" (_a1) \
+ : "r" (_nr) ASM_ARGS_##nr \
+ : "memory"); \
+ _sys_result = _a1; \
+ } \
+ (int) _sys_result; })
+#else /* !defined(__ARM_EABI__) */
#if !defined(__thumb__)
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({ unsigned int _sys_result; \
@@ -125,6 +155,7 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
} \
(int) _sys_result; })
#endif
+#endif /* !defined(__ARM_EABI__) */
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \