1 /* Copyright (C) 1995,96,97,98,99,2000,2002,2005,2006
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
21 #include <kernel-features.h>
29 /* I don't think it is worthwhile trying to use mmap2 whenever it
30 is available. Only use it when we are sure the syscall exists. */
31 #ifdef __ASSUME_MMAP2_SYSCALL
35 cfi_adjust_cfa_offset (4)
37 cfi_adjust_cfa_offset (4)
39 cfi_adjust_cfa_offset (4)
41 cfi_adjust_cfa_offset (4)
44 cfi_rel_offset (ebx, 8)
48 cfi_rel_offset (esi, 4)
50 cfi_rel_offset (edi, 0)
52 cfi_rel_offset (ebp, 12)
56 shrl $12, %ebp /* mmap2 takes the offset in pages. */
58 movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
60 /* Do the system call trap. */
63 /* Restore registers. */
65 cfi_adjust_cfa_offset (-4)
68 cfi_adjust_cfa_offset (-4)
71 cfi_adjust_cfa_offset (-4)
74 cfi_adjust_cfa_offset (-4)
81 cfi_register (ebx, edx)
83 movl $SYS_ify(mmap), %eax /* System call number in %eax. */
85 lea 4(%esp), %ebx /* Address of args is 1st arg. */
87 /* Do the system call trap. */
90 /* Restore registers. */
96 /* If 0 > %eax > -4096 there was an error. */
98 ja SYSCALL_ERROR_LABEL
100 /* Successful; return the syscall's value. */
106 weak_alias (__mmap, mmap)