]>
Commit | Line | Data |
---|---|---|
ffeac417 UD |
1 | /* Wrapper around mmap system call. 64 bit S/390 version. |
2 | Copyright (C) 2001 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 | |
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 AJ |
16 | You should have received a copy of the GNU Lesser General Public |
17 | License along with the GNU C Library; if not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
19 | 02111-1307 USA. */ | |
ffeac417 UD |
20 | |
21 | #include <sysdep.h> | |
22 | ||
23 | #define EINVAL 22 | |
24 | ||
25 | .text | |
26 | ||
27 | ENTRY(__mmap) | |
28 | /* Save registers and setup stack frame. */ | |
29 | stmg %r6,%r15,48(%r15) | |
30 | lgr %r1,%r15 | |
31 | lg %r0,8(%r15) /* Load eos. */ | |
32 | aghi %r15,-208 /* Buy stack space. */ | |
33 | stg %r1,0(%r15) /* Store back chain. */ | |
34 | stg %r0,8(%r15) /* Store eos. */ | |
35 | ||
36 | /* Store parameters on stack, because old_mmap | |
37 | takes only one parameter: a pointer to the parameter area. */ | |
38 | mvc 200(8,%r15),368(%r15) /* Move 'offset'. */ | |
39 | lgfr %r6,%r6 | |
40 | stg %r6,192(%r15) /* Store 'fd'. */ | |
41 | lgfr %r5,%r5 | |
42 | stg %r5,184(%r15) /* Store 'flags'. */ | |
43 | lgfr %r4,%r4 | |
44 | stg %r4,176(%r15) /* Store 'prot'. */ | |
45 | stg %r3,168(%r15) /* Store 'length'. */ | |
46 | stg %r2,160(%r15) /* Store 'start'. */ | |
47 | ||
48 | la %r2,160(%r15) /* Load address of parameter list. */ | |
49 | /* Do the system call trap. */ | |
50 | svc SYS_ify(mmap) | |
51 | ||
52 | lg %r15,0(%r15) /* Load back chain. */ | |
53 | lmg %r6,%r15,48(%r15) /* Load registers. */ | |
54 | ||
55 | /* Check gpr 2 for error. */ | |
56 | lghi %r0,-4096 | |
57 | clgr %r2,%r0 | |
58 | jnl SYSCALL_ERROR_LABEL | |
59 | ||
60 | /* Successful; return the syscall's value. */ | |
61 | br %r14 | |
62 | ||
63 | PSEUDO_END (__mmap) | |
64 | ||
65 | weak_alias (__mmap, mmap) | |
66 | weak_alias (__mmap, mmap64) | |
d555194c | 67 | weak_alias (__mmap, __mmap64) |