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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 #include <kernel-features.h>
30 /* I don't think it is worthwhile trying to use mmap2 whenever it
31 is available. Only use it when we are sure the syscall exists. */
32 #ifdef __ASSUME_MMAP2_SYSCALL
36 cfi_adjust_cfa_offset (4)
38 cfi_adjust_cfa_offset (4)
40 cfi_adjust_cfa_offset (4)
42 cfi_adjust_cfa_offset (4)
45 cfi_rel_offset (ebx, 8)
49 cfi_rel_offset (esi, 4)
51 cfi_rel_offset (edi, 0)
53 cfi_rel_offset (ebp, 12)
57 shrl $12, %ebp /* mmap2 takes the offset in pages. */
59 movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
61 /* Do the system call trap. */
64 /* Restore registers. */
66 cfi_adjust_cfa_offset (-4)
69 cfi_adjust_cfa_offset (-4)
72 cfi_adjust_cfa_offset (-4)
75 cfi_adjust_cfa_offset (-4)
82 cfi_register (ebx, edx)
84 movl $SYS_ify(mmap), %eax /* System call number in %eax. */
86 lea 4(%esp), %ebx /* Address of args is 1st arg. */
88 /* Do the system call trap. */
91 /* Restore registers. */
97 /* If 0 > %eax > -4096 there was an error. */
99 ja SYSCALL_ERROR_LABEL
101 /* Successful; return the syscall's value. */
107 weak_alias (__mmap, mmap)