]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/s390/s390-64/mmap.S
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / s390 / s390-64 / mmap.S
1 /* Wrapper around mmap system call. 64 bit S/390 version.
2 Copyright (C) 2001-2014 Free Software Foundation, Inc.
3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20 #include <sysdep.h>
21
22 #define EINVAL 22
23
24 .text
25
26 ENTRY(__mmap)
27 /* Save registers and setup stack frame. */
28 stmg %r6,%r15,48(%r15)
29 cfi_offset (%r15,-40)
30 cfi_offset (%r14,-48)
31 cfi_offset (%r13,-56)
32 cfi_offset (%r12,-64)
33 cfi_offset (%r11,-72)
34 cfi_offset (%r10,-80)
35 cfi_offset (%r9,-88)
36 cfi_offset (%r8,-96)
37 cfi_offset (%r7,-104)
38 cfi_offset (%r6,-112)
39 lgr %r1,%r15
40 lg %r0,8(%r15) /* Load eos. */
41 aghi %r15,-208 /* Buy stack space. */
42 cfi_adjust_cfa_offset (208)
43 stg %r1,0(%r15) /* Store back chain. */
44 stg %r0,8(%r15) /* Store eos. */
45
46 /* Store parameters on stack, because old_mmap
47 takes only one parameter: a pointer to the parameter area. */
48 mvc 200(8,%r15),368(%r15) /* Move 'offset'. */
49 lgfr %r6,%r6
50 stg %r6,192(%r15) /* Store 'fd'. */
51 lgfr %r5,%r5
52 stg %r5,184(%r15) /* Store 'flags'. */
53 lgfr %r4,%r4
54 stg %r4,176(%r15) /* Store 'prot'. */
55 stg %r3,168(%r15) /* Store 'length'. */
56 stg %r2,160(%r15) /* Store 'start'. */
57
58 la %r2,160(%r15) /* Load address of parameter list. */
59 /* Do the system call trap. */
60 svc SYS_ify(mmap)
61
62 lg %r15,0(%r15) /* Load back chain. */
63 cfi_adjust_cfa_offset (-208)
64 lmg %r6,%r15,48(%r15) /* Load registers. */
65
66 /* Check gpr 2 for error. */
67 lghi %r0,-4096
68 clgr %r2,%r0
69 jgnl SYSCALL_ERROR_LABEL
70
71 /* Successful; return the syscall's value. */
72 br %r14
73
74 PSEUDO_END (__mmap)
75
76 weak_alias (__mmap, mmap)
77 weak_alias (__mmap, mmap64)
78 weak_alias (__mmap, __mmap64)