1 /* Copyright (C) 1995-2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
22 #include <kernel-features.h>
27 #define SVRSP 16 /* saved register space */
28 #define PARMS LINKAGE+SVRSP /* space for 4 saved regs */
30 #define LEN ADDR+PTR_SIZE
38 ENTRY (BP_SYM (__mmap64))
42 cfi_adjust_cfa_offset (4)
44 cfi_adjust_cfa_offset (4)
46 cfi_adjust_cfa_offset (4)
48 cfi_adjust_cfa_offset (4)
50 movl OFFLO(%esp), %edx
51 movl OFFHI(%esp), %ecx
54 shrdl $12, %ecx, %edx /* mmap2 takes the offset in pages. */
58 cfi_rel_offset (ebp, 12)
61 cfi_rel_offset (ebx, 8)
64 movl FLAGS(%esp), %esi
65 cfi_rel_offset (esi, 4)
67 cfi_rel_offset (edi, 0)
69 movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
71 /* Do the system call trap. */
75 /* Restore registers. */
77 cfi_adjust_cfa_offset (-4)
80 cfi_adjust_cfa_offset (-4)
83 cfi_adjust_cfa_offset (-4)
86 cfi_adjust_cfa_offset (-4)
89 /* If 0 > %eax > -4096 there was an error. */
91 ja SYSCALL_ERROR_LABEL
93 /* Successful; return the syscall's value. */
96 cfi_adjust_cfa_offset (16)
97 cfi_rel_offset (ebp, 12)
98 cfi_rel_offset (ebx, 8)
99 cfi_rel_offset (esi, 4)
100 cfi_rel_offset (edi, 0)
101 /* This means the offset value is too large. */
104 cfi_adjust_cfa_offset (-4)
107 cfi_adjust_cfa_offset (-4)
110 cfi_adjust_cfa_offset (-4)
113 cfi_adjust_cfa_offset (-4)
116 jmp SYSCALL_ERROR_LABEL
118 PSEUDO_END (BP_SYM (__mmap64))
120 weak_alias (BP_SYM (__mmap64), BP_SYM (mmap64))