summaryrefslogtreecommitdiff
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.S34
1 files changed, 32 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
index 784d73440..d0be0380e 100644
--- a/libc/sysdeps/linux/arm/mmap64.S
+++ b/libc/sysdeps/linux/arm/mmap64.S
@@ -29,6 +29,36 @@
.type mmap64,%function
.align 4
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}
+ movcc pc, lr
+ 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 +70,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
@@ -60,7 +90,7 @@ mmap64:
__error:
b __syscall_error
-
+#endif
.size mmap64,.-mmap64
#endif