summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/arm/mmap64.S
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/arm/mmap64.S')
-rw-r--r--libc/sysdeps/linux/arm/mmap64.S42
1 files changed, 38 insertions, 4 deletions
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
index dd6f3c477..ba8cb2fca 100644
--- a/libc/sysdeps/linux/arm/mmap64.S
+++ b/libc/sysdeps/linux/arm/mmap64.S
@@ -27,8 +27,42 @@
.text
.global mmap64
.type mmap64,%function
-.align 4
+.align 2
mmap64:
+
+#ifdef __ARM_EABI__
+#ifdef __ARMEB__
+# define LOW_OFFSET 8 + 4
+/* The initial + 4 is for the stack postdecrement. */
+# define HIGH_OFFSET 4 + 8 + 0
+#else
+# define LOW_OFFSET 8 + 0
+# define HIGH_OFFSET 4 + 8 + 4
+#endif
+ ldr ip, [sp, $LOW_OFFSET]
+ str r5, [sp, #-4]!
+ ldr r5, [sp, $HIGH_OFFSET]
+ str r4, [sp, #-4]!
+ movs r4, ip, lsl $20 @ check that offset is page-aligned
+ mov ip, ip, lsr $12
+ moveqs r4, r5, lsr $12 @ check for overflow
+ bne .Linval
+ ldr r4, [sp, $8] @ load fd
+ orr r5, ip, r5, lsl $20 @ compose page offset
+ DO_CALL (mmap2)
+ cmn r0, $4096
+ ldmfd sp!, {r4, r5}
+#if defined(__USE_BX__)
+ bxcc lr
+#else
+ movcc pc, lr
+#endif
+ b __syscall_error
+.Linval:
+ mov r0, $-EINVAL
+ ldmfd sp!, {r4, r5}
+ b __syscall_error
+#else
stmfd sp!, {r4, r5, lr}
ldr r5, [sp, $16]
ldr r4, [sp, $12]
@@ -40,7 +74,7 @@ mmap64:
movs ip, ip, lsr $12
bne .Linval @ check for overflow
mov ip, r0
- swi __NR_mmap2
+ DO_CALL (mmap2)
cmn r0, $4096
ldmccfd sp!, {r4, r5, pc}
cmn r0, $ENOSYS
@@ -52,7 +86,7 @@ mmap64:
mov r0, ip @ first arg was clobbered
teq r5, $0
ldmeqfd sp!, {r4, r5, lr}
- beq __mmap
+ beq HIDDEN_JUMPTARGET(mmap)
.Linval:
mov r0, $-EINVAL
ldmfd sp!, {r4, r5, lr}
@@ -60,7 +94,7 @@ mmap64:
__error:
b __syscall_error
-
+#endif
.size mmap64,.-mmap64
#endif