1 /* Copyright (C) 2001 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
21 #include "kernel-features.h"
23 #include <asm/errno.h>
25 /* Rather than dragging in yet another kernel file, <asm/page.h>, we
26 define it here. Provide for easy override. */
32 __mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd,
35 /* This was done in C, but the resulting code didn't look anywhere near
36 nice, and mmap64 is important enough to have fast code. Rather than
37 fixing (the generic bits in) gcc, we make sure not to depend on it by
38 writing code that GCC cannot reasonably generate. */
40 .syntax no_register_prefix
47 /* Only accept an offset being a multiple of PAGE_SIZE, ditto address. */
48 btstq (PAGE_SHIFT - 1),r9
52 btstq (PAGE_SHIFT - 1),r10
56 /* We have to store the adjusted part somewhere we can "or" from.
57 No registers available, so let's re-use the incoming low-part
58 parameter location. */
62 /* Check if the highest bits (now the lowest bits) are zero. They
63 must be, since we're actually calling a system function
64 specifying the size in *pages* in a single dword. Thus you can
65 mmap64 PAGE_SIZE * 4 Gbyte. */
66 btstq (PAGE_SHIFT - 1),r9
70 lslq (32 - PAGE_SHIFT),r9
75 movu.b SYS_ify (mmap2),r9
85 /* Local error handler. */
88 /* Drop through into the ordinary error handler. */
91 weak_alias (__mmap64, mmap64)