summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/i386/mmap.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-12-08 23:48:24 +0000
committerUlrich Drepper <drepper@redhat.com>1999-12-08 23:48:24 +0000
commitd587d83bd9825c431456774321bfd0d5eabe7fee (patch)
tree26a083c0bf27e914ae70e4e8a03e62b0f52c8c9d /sysdeps/unix/sysv/linux/i386/mmap.S
parent49f2be5b0eea30507a77e9467d0ef2c697953bca (diff)
Update.
* sysdeps/unix/sysv/linux/getrlimit.c: Remove K&R compatibility. * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_TRUNCATE64_SYSCALL and __ASSUME_MMAP2_SYSCALL for 2.3.31 on x86. * sysdeps/unix/sysv/linux/ftruncate64.c: New file. * sysdeps/unix/sysv/linux/truncate64.c: New file. * sysdeps/unix/sysv/linux/i386/mmap.S: Allow using mmap2. * sysdeps/unix/sysv/linux/i386/mmap64.S: New file.
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/mmap.S')
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap.S40
1 files changed, 38 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S
index a9929c8be1..0397f841f1 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap.S
+++ b/sysdeps/unix/sysv/linux/i386/mmap.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999 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
@@ -18,10 +18,45 @@
#include <sysdep.h>
+#include "kernel-features.h"
+
+#define EINVAL 22
+
.text
ENTRY (__mmap)
+/* I don't think it is worthwhile trzing to use mmap2 whenever it
+ is available. Only use it when we are sure the syscall exists. */
+#ifdef __ASSUME_MMAP2_SYSCALL
+
+ /* Save registers. */
+ pushl %ebp
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+
+ movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
+
+ movl 20(%esp), %ebx
+ movl 24(%esp), %ecx
+ movl 28(%esp), %edx
+ movl 32(%esp), %esi
+ movl 36(%esp), %edi
+ movl 40(%esp), %ebp
+ shrl $12, %ebp /* mmap2 takes the offset in pages. */
+
+ /* Do the system call trap. */
+ int $0x80
+
+ /* Restore registers. */
+ popl %edi
+ popl %esi
+ popl %ebx
+ popl %ebp
+
+#else
+
/* Save registers. */
movl %ebx, %edx
@@ -35,6 +70,8 @@ ENTRY (__mmap)
/* Restore registers. */
movl %edx, %ebx
+#endif
+
/* If 0 > %eax > -4096 there was an error. */
cmpl $-4096, %eax
ja SYSCALL_ERROR_LABEL
@@ -46,4 +83,3 @@ L(pseudo_end):
PSEUDO_END (__mmap)
weak_alias (__mmap, mmap)
-weak_alias (__mmap, mmap64)