2012-08-20 14:37:27 +00:00
|
|
|
/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
|
2000-11-10 04:15:55 +00:00
|
|
|
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2000-11-10 04:15:55 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2001-07-06 04:58:11 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2000-11-10 04:15:55 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2000-11-10 04:15:55 +00:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
2007-08-13 18:33:31 +00:00
|
|
|
#include <kernel-features.h>
|
2000-11-10 04:15:55 +00:00
|
|
|
|
2000-12-05 09:29:23 +00:00
|
|
|
#define EINVAL 22
|
|
|
|
#define ENOSYS 38
|
2000-11-10 04:15:55 +00:00
|
|
|
|
|
|
|
.text
|
|
|
|
ENTRY(__mmap64)
|
|
|
|
/* Save registers and setup stack frame. */
|
2000-12-05 09:29:23 +00:00
|
|
|
stm %r6,%r15,24(%r15)
|
Update.
2003-12-05 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/s390/s390-32/elf/setjmp.S (setjmp, __setjmp): Add END
statements.
* sysdeps/s390/s390-64/elf/setjmp.S (setjmp, __setjmp): Likewise.
* sysdeps/s390/s390-32/sysdep.h (ENTRY): Add cfi_startproc directive.
(END): Add cfi_endproc directive.
* sysdeps/s390/s390-64/sysdep.h (ENTRY, END): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/socket.S (__socket): Remove
cfi_startproc and cfi_endproc directive.
* sysdeps/unix/sysv/linux/s390/s390-64/socket.S (__socket): Likewise.
* sysdeps/s390/s390-32/addmul_1.S (__mpn_addmul_1): Add CFI directives.
* sysdeps/s390/s390-32/add_n.S (__mpn_add_n): Likewise.
* sysdeps/s390/s390-64/add_n.S (__mpn_add_n): Likewise.
* sysdeps/s390/s390-32/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
Likewise.
* sysdeps/s390/s390-64/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
Likewise.
* sysdeps/s390/s390-32/mul_1.S (__mpn_mul_1): Likewise.
* sysdeps/s390/s390-32/sub_n.S (__mpn_sub_n): Likewise.
* sysdeps/s390/s390-64/sub_n.S (__mpn_sub_n): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S (__mmap64): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap.S (__mmap): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/mmap.S (__mmap): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S (__syscall_error):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S (__syscall_error):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/clone.S (__clone): Add CFI
directives. Move thread_start out of ENTRY/PSEUDO_END block to
make backchain terminate.
* sysdeps/unix/sysv/linux/s390/s390-64/clone.S (__clone): Likewise.
* sysdeps/s390/s390-32/backtrace.c (trace_arg): New structure.
(unwind_backtrace, unwind_getip): New variables.
(init, __backchain_backtrace, backtrace_helper): New functions.
(__backtrace): Use unwind info for backtrace instead of backchain
walking if the unwind functions can be found.
* sysdeps/s390/s390-64/backtrace.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/s390/sys/procfs.h (ELF_NGREG32): New #define.
(elf_greg_t32, elf_gregset_t32, elf_fpregset_t32): New types.
(elf_prstatus32, elf_prpsinfo32): New structures.
(prgregset32_t, prfpregset32_t, prstatus32_t, prpsinfo32_t): New types.
* scripts/data/c++-types-s390-linux-gnu.data: New file.
* scripts/data/c++-types-s390x-linux-gnu.data: New file.
2003-12-06 00:20:16 +00:00
|
|
|
cfi_offset (%r15, -36)
|
|
|
|
cfi_offset (%r14, -40)
|
|
|
|
cfi_offset (%r13, -44)
|
|
|
|
cfi_offset (%r12, -48)
|
|
|
|
cfi_offset (%r11, -52)
|
|
|
|
cfi_offset (%r10, -56)
|
|
|
|
cfi_offset (%r9, -60)
|
|
|
|
cfi_offset (%r8, -64)
|
|
|
|
cfi_offset (%r7, -68)
|
|
|
|
cfi_offset (%r6, -72)
|
2000-12-05 09:29:23 +00:00
|
|
|
lr %r1,%r15
|
|
|
|
ahi %r15,-120 /* Buy stack space. */
|
Update.
2003-12-05 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/s390/s390-32/elf/setjmp.S (setjmp, __setjmp): Add END
statements.
* sysdeps/s390/s390-64/elf/setjmp.S (setjmp, __setjmp): Likewise.
* sysdeps/s390/s390-32/sysdep.h (ENTRY): Add cfi_startproc directive.
(END): Add cfi_endproc directive.
* sysdeps/s390/s390-64/sysdep.h (ENTRY, END): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/socket.S (__socket): Remove
cfi_startproc and cfi_endproc directive.
* sysdeps/unix/sysv/linux/s390/s390-64/socket.S (__socket): Likewise.
* sysdeps/s390/s390-32/addmul_1.S (__mpn_addmul_1): Add CFI directives.
* sysdeps/s390/s390-32/add_n.S (__mpn_add_n): Likewise.
* sysdeps/s390/s390-64/add_n.S (__mpn_add_n): Likewise.
* sysdeps/s390/s390-32/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
Likewise.
* sysdeps/s390/s390-64/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
Likewise.
* sysdeps/s390/s390-32/mul_1.S (__mpn_mul_1): Likewise.
* sysdeps/s390/s390-32/sub_n.S (__mpn_sub_n): Likewise.
* sysdeps/s390/s390-64/sub_n.S (__mpn_sub_n): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S (__mmap64): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap.S (__mmap): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/mmap.S (__mmap): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S (__syscall_error):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S (__syscall_error):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/clone.S (__clone): Add CFI
directives. Move thread_start out of ENTRY/PSEUDO_END block to
make backchain terminate.
* sysdeps/unix/sysv/linux/s390/s390-64/clone.S (__clone): Likewise.
* sysdeps/s390/s390-32/backtrace.c (trace_arg): New structure.
(unwind_backtrace, unwind_getip): New variables.
(init, __backchain_backtrace, backtrace_helper): New functions.
(__backtrace): Use unwind info for backtrace instead of backchain
walking if the unwind functions can be found.
* sysdeps/s390/s390-64/backtrace.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/s390/sys/procfs.h (ELF_NGREG32): New #define.
(elf_greg_t32, elf_gregset_t32, elf_fpregset_t32): New types.
(elf_prstatus32, elf_prpsinfo32): New structures.
(prgregset32_t, prfpregset32_t, prstatus32_t, prpsinfo32_t): New types.
* scripts/data/c++-types-s390-linux-gnu.data: New file.
* scripts/data/c++-types-s390x-linux-gnu.data: New file.
2003-12-06 00:20:16 +00:00
|
|
|
cfi_adjust_cfa_offset (120)
|
2000-12-05 09:29:23 +00:00
|
|
|
st %r1,0(%r15) /* Store back chain. */
|
2000-11-10 04:15:55 +00:00
|
|
|
|
2012-08-20 14:37:27 +00:00
|
|
|
/* Store parameters on stack, because mmap2
|
|
|
|
* takes only one parameter: a pointer to the parameter area. */
|
2000-12-05 09:29:23 +00:00
|
|
|
st %r6,0x70(%r15) /* Store 'fd'. */
|
|
|
|
st %r5,0x6C(%r15) /* Store 'flags'. */
|
|
|
|
st %r4,0x68(%r15) /* Store 'prot'. */
|
|
|
|
st %r3,0x64(%r15) /* Store 'length'. */
|
|
|
|
st %r2,0x60(%r15) /* Store 'start'. */
|
2000-11-10 04:15:55 +00:00
|
|
|
|
2000-12-05 09:29:23 +00:00
|
|
|
lm %r0,%r1,216(%r15) /* Load 64 bit offset. */
|
|
|
|
tml %r1,0x0fff /* Offset page aligned ? */
|
|
|
|
jnz 2f /* No -> EINVAL. */
|
|
|
|
srdl %r0,12 /* mmap2 takes the offset in pages. */
|
|
|
|
ltr %r0,%r0 /* Offset > 2^44 ? */
|
|
|
|
jnz 2f
|
|
|
|
st %r1,0x74(%r15) /* Store page offset. */
|
2000-11-10 04:15:55 +00:00
|
|
|
|
2000-12-05 09:29:23 +00:00
|
|
|
la %r2,0x60(%r15) /* Load address of parameter list. */
|
|
|
|
svc SYS_ify(mmap2) /* Do the system call trap. */
|
2000-11-10 04:15:55 +00:00
|
|
|
|
2000-12-05 09:29:23 +00:00
|
|
|
l %r15,0(%r15) /* Load back chain. */
|
Update.
2003-12-05 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/s390/s390-32/elf/setjmp.S (setjmp, __setjmp): Add END
statements.
* sysdeps/s390/s390-64/elf/setjmp.S (setjmp, __setjmp): Likewise.
* sysdeps/s390/s390-32/sysdep.h (ENTRY): Add cfi_startproc directive.
(END): Add cfi_endproc directive.
* sysdeps/s390/s390-64/sysdep.h (ENTRY, END): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/socket.S (__socket): Remove
cfi_startproc and cfi_endproc directive.
* sysdeps/unix/sysv/linux/s390/s390-64/socket.S (__socket): Likewise.
* sysdeps/s390/s390-32/addmul_1.S (__mpn_addmul_1): Add CFI directives.
* sysdeps/s390/s390-32/add_n.S (__mpn_add_n): Likewise.
* sysdeps/s390/s390-64/add_n.S (__mpn_add_n): Likewise.
* sysdeps/s390/s390-32/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
Likewise.
* sysdeps/s390/s390-64/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
Likewise.
* sysdeps/s390/s390-32/mul_1.S (__mpn_mul_1): Likewise.
* sysdeps/s390/s390-32/sub_n.S (__mpn_sub_n): Likewise.
* sysdeps/s390/s390-64/sub_n.S (__mpn_sub_n): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S (__mmap64): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap.S (__mmap): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/mmap.S (__mmap): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S (__syscall_error):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S (__syscall_error):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/clone.S (__clone): Add CFI
directives. Move thread_start out of ENTRY/PSEUDO_END block to
make backchain terminate.
* sysdeps/unix/sysv/linux/s390/s390-64/clone.S (__clone): Likewise.
* sysdeps/s390/s390-32/backtrace.c (trace_arg): New structure.
(unwind_backtrace, unwind_getip): New variables.
(init, __backchain_backtrace, backtrace_helper): New functions.
(__backtrace): Use unwind info for backtrace instead of backchain
walking if the unwind functions can be found.
* sysdeps/s390/s390-64/backtrace.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/s390/sys/procfs.h (ELF_NGREG32): New #define.
(elf_greg_t32, elf_gregset_t32, elf_fpregset_t32): New types.
(elf_prstatus32, elf_prpsinfo32): New structures.
(prgregset32_t, prfpregset32_t, prstatus32_t, prpsinfo32_t): New types.
* scripts/data/c++-types-s390-linux-gnu.data: New file.
* scripts/data/c++-types-s390x-linux-gnu.data: New file.
2003-12-06 00:20:16 +00:00
|
|
|
cfi_adjust_cfa_offset (-120)
|
2000-12-05 09:29:23 +00:00
|
|
|
lm %r6,%r15,24(%r15) /* Load registers. */
|
2000-11-10 04:15:55 +00:00
|
|
|
|
|
|
|
/* Check gpr 2 for error. */
|
2000-12-05 09:29:23 +00:00
|
|
|
lhi %r0,-4096
|
|
|
|
clr %r2,%r0
|
|
|
|
jnl SYSCALL_ERROR_LABEL
|
2000-11-10 04:15:55 +00:00
|
|
|
|
|
|
|
/* Successful; return the syscall's value. */
|
2000-12-05 09:29:23 +00:00
|
|
|
br %r14
|
2000-11-10 04:15:55 +00:00
|
|
|
|
2000-12-05 09:29:23 +00:00
|
|
|
2: lhi %r2,-EINVAL
|
|
|
|
l %r15,0(%r15) /* Load back chain. */
|
|
|
|
lm %r6,%r15,24(%r15) /* Load registers. */
|
|
|
|
j SYSCALL_ERROR_LABEL
|
|
|
|
|
2000-11-10 04:15:55 +00:00
|
|
|
PSEUDO_END (__mmap64)
|
|
|
|
|
|
|
|
weak_alias (__mmap64, mmap64)
|