]>
Commit | Line | Data |
---|---|---|
1 | /* Copyright (C) 1998-2015 Free Software Foundation, Inc. | |
2 | This file is part of the GNU C Library. | |
3 | ||
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. | |
8 | ||
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. | |
13 | ||
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/>. */ | |
17 | ||
18 | #include <sysdep.h> | |
19 | ||
20 | #define EINVAL 22 | |
21 | ||
22 | .text | |
23 | ||
24 | ENTRY (__mmap) | |
25 | /* shuffle args */ | |
26 | push { r5 } | |
27 | cfi_adjust_cfa_offset (4) | |
28 | cfi_rel_offset (r5, 0) | |
29 | ldr r5, [sp, #8] | |
30 | push { r4 } | |
31 | cfi_adjust_cfa_offset (4) | |
32 | cfi_rel_offset (r4, 0) | |
33 | cfi_remember_state | |
34 | ldr r4, [sp, #8] | |
35 | ||
36 | /* convert offset to pages */ | |
37 | movs ip, r5, lsl #20 | |
38 | bne .Linval | |
39 | mov r5, r5, lsr #12 | |
40 | ||
41 | /* do the syscall */ | |
42 | DO_CALL (mmap2, 0) | |
43 | ||
44 | /* restore registers */ | |
45 | 2: | |
46 | pop { r4 } | |
47 | cfi_adjust_cfa_offset (-4) | |
48 | cfi_restore (r4) | |
49 | pop { r5 } | |
50 | cfi_adjust_cfa_offset (-4) | |
51 | cfi_restore (r5) | |
52 | ||
53 | cmn r0, $4096 | |
54 | it cc | |
55 | RETINSTR(cc, lr) | |
56 | b PLTJMP(syscall_error) | |
57 | ||
58 | cfi_restore_state | |
59 | .Linval: | |
60 | mov r0, #-EINVAL | |
61 | b 2b | |
62 | PSEUDO_END (__mmap) | |
63 | ||
64 | weak_alias (__mmap, mmap) |