summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/syscall-eabi.S
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/arm/syscall-eabi.S')
-rw-r--r--libc/sysdeps/linux/arm/syscall-eabi.S26
1 files changed, 26 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/arm/syscall-eabi.S b/libc/sysdeps/linux/arm/syscall-eabi.S
index efc30690c..b9318821b 100644
--- a/libc/sysdeps/linux/arm/syscall-eabi.S
+++ b/libc/sysdeps/linux/arm/syscall-eabi.S
@@ -17,6 +17,7 @@
02111-1307 USA. */
#include <sys/syscall.h>
+#include <bits/arm_asm.h>
/* In the EABI syscall interface, we don't need a special syscall to
implement syscall(). It won't work reliably with 64-bit arguments
@@ -26,6 +27,29 @@
.global syscall
.type syscall,%function
.align 4
+#if defined(THUMB1_ONLY)
+.thumb_func
+syscall:
+ push {r4, r5, r6, r7}
+ mov ip, r0
+ mov r0, r1
+ mov r1, r2
+ mov r2, r3
+ add r7, sp, #(4 * 4)
+ ldmia r7!, {r3, r4, r5, r6}
+ mov r7, ip
+ swi 0x0
+ pop {r4, r5, r6, r7}
+ ldr r1, =0xfffff000
+ cmp r0, r1
+ bcs 1f
+ bx lr
+1:
+ push {r3, lr}
+ bl __syscall_error
+ POP_RET
+.pool
+#else
syscall:
mov ip, sp
stmfd sp!, {r4, r5, r6, r7}
@@ -37,11 +61,13 @@ syscall:
swi 0x0
ldmfd sp!, {r4, r5, r6, r7}
cmn r0, #4096
+ IT(t, cc)
#if defined(__USE_BX__)
bxcc lr
#else
movcc pc, lr
#endif
b __syscall_error
+#endif
.size syscall,.-syscall