1 /* Copyright (C) 1995-2014 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/>. */
20 #include <kernel-features.h>
25 #define SVRSP 16 /* saved register space */
26 #define PARMS 4+SVRSP /* space for 4 saved regs */
40 cfi_adjust_cfa_offset (4)
42 cfi_adjust_cfa_offset (4)
44 cfi_adjust_cfa_offset (4)
46 cfi_adjust_cfa_offset (4)
48 movl OFFLO(%esp), %edx
49 movl OFFHI(%esp), %ecx
52 shrdl $12, %ecx, %edx /* mmap2 takes the offset in pages. */
56 cfi_rel_offset (ebp, 12)
59 cfi_rel_offset (ebx, 8)
62 movl FLAGS(%esp), %esi
63 cfi_rel_offset (esi, 4)
65 cfi_rel_offset (edi, 0)
67 movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
69 /* Do the system call trap. */
73 /* Restore registers. */
75 cfi_adjust_cfa_offset (-4)
78 cfi_adjust_cfa_offset (-4)
81 cfi_adjust_cfa_offset (-4)
84 cfi_adjust_cfa_offset (-4)
87 /* If 0 > %eax > -4096 there was an error. */
89 ja SYSCALL_ERROR_LABEL
91 /* Successful; return the syscall's value. */
94 cfi_adjust_cfa_offset (16)
95 cfi_rel_offset (ebp, 12)
96 cfi_rel_offset (ebx, 8)
97 cfi_rel_offset (esi, 4)
98 cfi_rel_offset (edi, 0)
99 /* This means the offset value is too large. */
102 cfi_adjust_cfa_offset (-4)
105 cfi_adjust_cfa_offset (-4)
108 cfi_adjust_cfa_offset (-4)
111 cfi_adjust_cfa_offset (-4)
114 jmp SYSCALL_ERROR_LABEL
116 PSEUDO_END (__mmap64)
118 weak_alias (__mmap64, mmap64)