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
24 #include <kernel-features.h>
29 #define SVRSP 16 /* saved register space */
30 #define PARMS LINKAGE+SVRSP /* space for 4 saved regs */
32 #define LEN ADDR+PTR_SIZE
40 ENTRY (BP_SYM (__mmap64))
46 cfi_adjust_cfa_offset (4)
48 cfi_adjust_cfa_offset (4)
50 cfi_adjust_cfa_offset (4)
52 cfi_adjust_cfa_offset (4)
54 movl OFFLO(%esp), %edx
55 movl OFFHI(%esp), %ecx
58 shrdl $12, %ecx, %edx /* mmap2 takes the offset in pages. */
62 cfi_rel_offset (ebp, 12)
65 cfi_rel_offset (ebx, 8)
68 movl FLAGS(%esp), %esi
69 cfi_rel_offset (esi, 4)
71 cfi_rel_offset (edi, 0)
73 movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
75 /* Do the system call trap. */
79 /* Restore registers. */
81 cfi_adjust_cfa_offset (-4)
84 cfi_adjust_cfa_offset (-4)
87 cfi_adjust_cfa_offset (-4)
90 cfi_adjust_cfa_offset (-4)
93 #ifndef __ASSUME_MMAP2_SYSCALL
99 /* If 0 > %eax > -4096 there was an error. */
101 ja SYSCALL_ERROR_LABEL
103 /* Successful; return the syscall's value. */
107 cfi_adjust_cfa_offset (16)
108 cfi_rel_offset (ebp, 12)
109 cfi_rel_offset (ebx, 8)
110 cfi_rel_offset (esi, 4)
111 cfi_rel_offset (edi, 0)
112 /* This means the offset value is too large. */
115 cfi_adjust_cfa_offset (-4)
118 cfi_adjust_cfa_offset (-4)
121 cfi_adjust_cfa_offset (-4)
124 cfi_adjust_cfa_offset (-4)
127 jmp SYSCALL_ERROR_LABEL
130 #if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2
132 /* Save registers. */
134 cfi_register (ebx, edx)
136 cmpl $0, OFFHI-SVRSP(%esp)
139 movl $SYS_ify(mmap), %eax /* System call number in %eax. */
141 lea ADDR-SVRSP(%esp), %ebx /* Address of args is 1st arg. */
143 /* Do the system call trap. */
146 /* Restore registers. */
150 /* If 0 > %eax > -4096 there was an error. */
152 ja SYSCALL_ERROR_LABEL
154 /* Successful; return the syscall's value. */
160 cfi_register (ebx, edx)
165 jmp SYSCALL_ERROR_LABEL
168 PSEUDO_END (BP_SYM (__mmap64))
170 weak_alias (BP_SYM (__mmap64), BP_SYM (mmap64))