summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/bits/syscalls.h
diff options
context:
space:
mode:
authorKhem Raj <kraj@mvista.com>2006-10-07 06:50:44 +0000
committerKhem Raj <kraj@mvista.com>2006-10-07 06:50:44 +0000
commitd0fa769212b66743c533c87735ca14adfddfc077 (patch)
treea501e01bbbe9b02f8523d7b9a5cf49645e56aafb /libc/sysdeps/linux/arm/bits/syscalls.h
parenta6b914d56ab283bd9d75ce84849e37a0f75fa99d (diff)
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.
Diffstat (limited to 'libc/sysdeps/linux/arm/bits/syscalls.h')
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h
index b1b840586..c67364441 100644
--- a/libc/sysdeps/linux/arm/bits/syscalls.h
+++ b/libc/sysdeps/linux/arm/bits/syscalls.h
@@ -112,6 +112,7 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#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 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
_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...) \