summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/arm/bits')
-rw-r--r--libc/sysdeps/linux/arm/bits/setjmp.h12
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h33
2 files changed, 42 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/arm/bits/setjmp.h b/libc/sysdeps/linux/arm/bits/setjmp.h
index ad42f96cd..745cdb8f7 100644
--- a/libc/sysdeps/linux/arm/bits/setjmp.h
+++ b/libc/sysdeps/linux/arm/bits/setjmp.h
@@ -27,14 +27,22 @@
#ifndef _ASM
/* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not
saved. */
-#ifdef __MAVERICK__
+#ifdef __ARM_EABI__
+/* The exact set of registers saved may depend on the particular core
+ in use, as some coprocessor registers may need to be saved. The C
+ Library ABI requires that the buffer be 8-byte aligned, and
+ recommends that the buffer contain 64 words. The first 28 words
+ are occupied by v1-v6, sl, fp, sp, pc, d8-d15, and fpscr. (Note
+ that d8-15 require 17 words, due to the use of fstmx.) */
+typedef int __jmp_buf[64] __attribute__((aligned (8)));
+#elif defined __MAVERICK__
typedef int __jmp_buf[34];
#else
typedef int __jmp_buf[22];
#endif
#endif
-#define __JMP_BUF_SP 20
+#define __JMP_BUF_SP 8
/* Test if longjmp to JMPBUF would unwind the frame
containing a local variable at ADDRESS. */
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) \