aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-14 19:54:40 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-14 19:54:40 +0000
commit2c65912458927f5ccc934e5caa6dfb5f101c97b4 (patch)
tree705a907d2da8f82cb8d7e87e32125c9b1dfa7772 /sysdeps/unix
parent7e7d334885507579fc9114cca9ae730b8e7740ee (diff)
downloadglibc-2c65912458927f5ccc934e5caa6dfb5f101c97b4.tar
glibc-2c65912458927f5ccc934e5caa6dfb5f101c97b4.tar.gz
glibc-2c65912458927f5ccc934e5caa6dfb5f101c97b4.tar.bz2
glibc-2c65912458927f5ccc934e5caa6dfb5f101c97b4.zip
Use sys_mmap2 if it's known to be available.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap.S39
1 files changed, 38 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/arm/mmap.S b/sysdeps/unix/sysv/linux/arm/mmap.S
index af93c7bce7..7beba6841c 100644
--- a/sysdeps/unix/sysv/linux/arm/mmap.S
+++ b/sysdeps/unix/sysv/linux/arm/mmap.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,11 +17,47 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <kernel-features.h>
+
+#define EINVAL 22
.text
ENTRY (__mmap)
+# ifdef __ASSUME_MMAP2_SYSCALL
+ /* This code is actually a couple of cycles slower than the
+ sys_mmap version below, so it might seem like a loss. But the
+ code path inside the kernel is sufficiently much shorter to
+ make it a net gain to use mmap2 when it's known to be
+ available. */
+
+ /* shuffle args */
+ str r5, [sp, #-4]!
+ ldr r5, [sp, #8]
+ str r4, [sp, #-4]!
+ ldr r4, [sp, #8]
+
+ /* convert offset to pages */
+ movs ip, r5, lsl #20
+ bne .Linval
+ mov r5, r5, lsr #12
+
+ /* do the syscall */
+ swi SYS_ify (mmap2)
+
+ /* restore registers */
+2:
+ ldr r4, [sp], #4
+ ldr r5, [sp], #4
+
+ cmn r0, $4096
+ RETINSTR(movcc, pc, lr)
+ b PLTJMP(syscall_error)
+.Linval:
+ mov r0, #-EINVAL
+ b 2b
+# else
/* Because we can only get five args through the syscall interface, and
mmap() takes six, we need to build a parameter block and pass its
address instead. The 386 port does a similar trick. */
@@ -49,6 +85,7 @@ ENTRY (__mmap)
cmn r0, $4096
RETINSTR(movcc, pc, lr)
b PLTJMP(syscall_error);
+#endif
PSEUDO_END (__mmap)