Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / arm / mmap.S
blob0383bb5547de9fe5d719bded2c36c4fbe7d59ce0
1 /* Copyright (C) 1998-2014 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         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]
36         /* convert offset to pages */
37         movs    ip, r5, lsl #20
38         bne     .Linval
39         mov     r5, r5, lsr #12
41         /* do the syscall */
42         DO_CALL (mmap2, 0)
44         /* restore registers */
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)
53         cmn     r0, $4096
54         it      cc
55         RETINSTR(cc, lr)
56         b       PLTJMP(syscall_error)
58         cfi_restore_state
59 .Linval:
60         mov     r0, #-EINVAL
61         b       2b
62 PSEUDO_END (__mmap)
64 weak_alias (__mmap, mmap)