summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/mmap64.S
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-29 21:02:08 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-29 21:02:08 +0000
commit2607bee41906da4f47d98a92749c11533396838c (patch)
tree0ac6b10026422c6863e63d843305c2ac2f3030f8 /libc/sysdeps/linux/arm/mmap64.S
parentceb83067f2248eb6f9517440c127250c98bbd8f3 (diff)
Patch by Joseph S. Myers to add support for ARM EABI
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