1 /* Copyright (C) 1995, 96, 97, 98, 99, 2000 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 Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
23 #include "kernel-features.h"
28 #define SVRSP 16 /* saved register space */
29 #define PARMS LINKAGE+SVRSP /* space for 4 saved regs */
31 #define LEN ADDR+PTR_SIZE
39 ENTRY (BP_SYM (__mmap64))
49 movl OFFLO(%esp), %edx
50 movl OFFHI(%esp), %ecx
53 shrdl $12, %ecx, %edx /* mmap2 takes the offset in pages. */
61 movl FLAGS(%esp), %esi
64 movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
66 /* Do the system call trap. */
70 /* Restore registers. */
76 #ifndef __ASSUME_MMAP2_SYSCALL
82 /* If 0 > %eax > -4096 there was an error. */
84 ja SYSCALL_ERROR_LABEL
86 /* Successful; return the syscall's value. */
90 /* This means the offset value is too large. */
97 jmp SYSCALL_ERROR_LABEL
100 #if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2
102 /* Save registers. */
105 cmpl $0, OFFHI-SVRSP(%esp)
108 movl $SYS_ify(mmap), %eax /* System call number in %eax. */
110 lea ADDR-SVRSP(%esp), %ebx /* Address of args is 1st arg. */
112 /* Do the system call trap. */
115 /* Restore registers. */
118 /* If 0 > %eax > -4096 there was an error. */
120 ja SYSCALL_ERROR_LABEL
122 /* Successful; return the syscall's value. */
131 jmp SYSCALL_ERROR_LABEL
134 PSEUDO_END (BP_SYM (__mmap64))
136 weak_alias (BP_SYM (__mmap64), BP_SYM (mmap64))