Add Changelog ...
[glibc.git] / sysdeps / unix / sysv / linux / arm / mmap.S
blob3276a3b4750493b151a587a70c3ac1354acec004
1 /* Copyright (C) 1998-2012 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/>.  */
18 #include <sysdep.h>
20 #define EINVAL          22
22         .text
24 ENTRY (__mmap)
25         /* shuffle args */
26         str     r5, [sp, #-4]!
27         cfi_adjust_cfa_offset (4)
28         cfi_rel_offset (r5, 0)
29         ldr     r5, [sp, #8]
30         str     r4, [sp, #-4]!
31         cfi_adjust_cfa_offset (4)
32         cfi_rel_offset (r4, 0)
33         cfi_remember_state
34         ldr     r4, [sp, #8]
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)
44         /* restore registers */
46         ldr     r4, [sp], #4
47         cfi_adjust_cfa_offset (-4)
48         cfi_restore (r4)
49         ldr     r5, [sp], #4
50         cfi_adjust_cfa_offset (-4)
51         cfi_restore (r5)
53         cmn     r0, $4096
54         RETINSTR(cc, lr)
55         b       PLTJMP(syscall_error)
57         cfi_restore_state
58 .Linval:
59         mov     r0, #-EINVAL
60         b       2b
61 PSEUDO_END (__mmap)
63 weak_alias (__mmap, mmap)