]>
Commit | Line | Data |
---|---|---|
ffeac417 | 1 | /* Wrapper around mmap system call. 64 bit S/390 version. |
d4697bc9 | 2 | Copyright (C) 2001-2014 Free Software Foundation, Inc. |
ffeac417 UD |
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 | |
41bdb6e2 AJ |
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. | |
ffeac417 UD |
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 | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
ffeac417 | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
ffeac417 UD |
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) | |
844a34a2 UD |
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) | |
ffeac417 UD |
39 | lgr %r1,%r15 |
40 | lg %r0,8(%r15) /* Load eos. */ | |
41 | aghi %r15,-208 /* Buy stack space. */ | |
844a34a2 | 42 | cfi_adjust_cfa_offset (208) |
ffeac417 UD |
43 | stg %r1,0(%r15) /* Store back chain. */ |
44 | stg %r0,8(%r15) /* Store eos. */ | |
45 | ||
9c84384c | 46 | /* Store parameters on stack, because old_mmap |
ffeac417 UD |
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. */ | |
844a34a2 | 63 | cfi_adjust_cfa_offset (-208) |
ffeac417 UD |
64 | lmg %r6,%r15,48(%r15) /* Load registers. */ |
65 | ||
9c84384c | 66 | /* Check gpr 2 for error. */ |
ffeac417 UD |
67 | lghi %r0,-4096 |
68 | clgr %r2,%r0 | |
e6ebd2e4 | 69 | jgnl SYSCALL_ERROR_LABEL |
ffeac417 UD |
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) | |
d555194c | 78 | weak_alias (__mmap, __mmap64) |