1 /* Copyright (C) 1998, 2000, 2003, 2005, 2009 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <kernel-features.h>
27 # ifdef __ASSUME_MMAP2_SYSCALL
28 /* This code is actually a couple of cycles slower than the
29 sys_mmap version below, so it might seem like a loss. But the
30 code path inside the kernel is sufficiently much shorter to
31 make it a net gain to use mmap2 when it's known to be
36 cfi_adjust_cfa_offset (4)
37 cfi_rel_offset (r5, 0)
40 cfi_adjust_cfa_offset (4)
41 cfi_rel_offset (r4, 0)
45 /* convert offset to pages */
53 /* restore registers */
56 cfi_adjust_cfa_offset (-4)
59 cfi_adjust_cfa_offset (-4)
64 b PLTJMP(syscall_error)
71 /* Because we can only get five args through the syscall interface, and
72 mmap() takes six, we need to build a parameter block and pass its
73 address instead. The 386 port does a similar trick. */
75 /* This code previously moved sp into ip and stored the args using
76 stmdb ip!, {a1-a4}. It did not modify sp, so the stack never had
77 to be restored after the syscall completed. It saved an
78 instruction and meant no stack cleanup work was required.
80 This will not work in the case of a mmap call being interrupted
81 by a signal. If the signal handler uses any stack the arguments
82 to mmap will be trashed. The results of a restart of mmap are
83 then unpredictable. */
85 /* store args on the stack */
87 cfi_adjust_cfa_offset (16)
93 /* pop args off the stack. */
95 cfi_adjust_cfa_offset (-16)
99 b PLTJMP(syscall_error);
104 weak_alias (__mmap, mmap)