From ffeac41785dc86f48b0241af27f0bcf6d8307bf5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 16 Mar 2001 09:57:45 +0000 Subject: Update. 2001-03-13 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/Dist: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/Dist: ...here. * sysdeps/unix/sysv/linux/s390/Makefile: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/Makefile: ...here. * sysdeps/unix/sysv/linux/s390/Versions: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/Versions: ...here. * sysdeps/unix/sysv/linux/s390/alphasort64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c: ...here. * sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h: ...here. * sysdeps/unix/sysv/linux/s390/bits/mman.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h: ...here. * sysdeps/unix/sysv/linux/s390/bits/resource.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h: ...here. * sysdeps/unix/sysv/linux/s390/bits/stat.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h: ...here. * sysdeps/unix/sysv/linux/s390/chown.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/chown.c: ...here. * sysdeps/unix/sysv/linux/s390/clone.S: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/clone.S: ...here. * sysdeps/unix/sysv/linux/s390/fchown.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/fchown.c: ...here. * sysdeps/unix/sysv/linux/s390/fcntl.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c: ...here. * sysdeps/unix/sysv/linux/s390/fxstat.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c: ...here. * sysdeps/unix/sysv/linux/s390/getdents64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c: ...here. * sysdeps/unix/sysv/linux/s390/getegid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getegid.c: ...here. * sysdeps/unix/sysv/linux/s390/geteuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c: ...here. * sysdeps/unix/sysv/linux/s390/getgid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getgid.c: ...here. * sysdeps/unix/sysv/linux/s390/getgroups.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c: ...here. * sysdeps/unix/sysv/linux/s390/getresgid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c: ...here. * sysdeps/unix/sysv/linux/s390/getresuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c: ...here. * sysdeps/unix/sysv/linux/s390/getrlimit.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c: ...here. * sysdeps/unix/sysv/linux/s390/getrlimit64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c: ...here. * sysdeps/unix/sysv/linux/s390/getuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/getuid.c: ...here. * sysdeps/unix/sysv/linux/s390/lchown.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/lchown.c: ...here. * sysdeps/unix/sysv/linux/s390/lockf64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c: ...here. * sysdeps/unix/sysv/linux/s390/lxstat.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c: ...here. * sysdeps/unix/sysv/linux/s390/mmap.S: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/mmap.S: ...here. * sysdeps/unix/sysv/linux/s390/mmap64.S: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S: ...here. * sysdeps/unix/sysv/linux/s390/msgctl.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c: ...here. * sysdeps/unix/sysv/linux/s390/oldgetrlimit64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c: ...here. * sysdeps/unix/sysv/linux/s390/readdir64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c: ...here. * sysdeps/unix/sysv/linux/s390/readdir64_r.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c: ...here. * sysdeps/unix/sysv/linux/s390/register-dump.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h: ...here. * sysdeps/unix/sysv/linux/s390/scandir64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c: ...here. * sysdeps/unix/sysv/linux/s390/semctl.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/semctl.c: ...here. * sysdeps/unix/sysv/linux/s390/setegid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: ...here. * sysdeps/unix/sysv/linux/s390/seteuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: ...here. * sysdeps/unix/sysv/linux/s390/setfsgid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c: ...here. * sysdeps/unix/sysv/linux/s390/setfsuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c: ...here. * sysdeps/unix/sysv/linux/s390/setgid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: ...here. * sysdeps/unix/sysv/linux/s390/setgroups.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: ...here. * sysdeps/unix/sysv/linux/s390/setregid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: ...here. * sysdeps/unix/sysv/linux/s390/setresgid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: ...here. * sysdeps/unix/sysv/linux/s390/setresuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: ...here. * sysdeps/unix/sysv/linux/s390/setreuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: ...here. * sysdeps/unix/sysv/linux/s390/setrlimit.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c: ...here. * sysdeps/unix/sysv/linux/s390/setuid.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: ...here. * sysdeps/unix/sysv/linux/s390/shmctl.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c: ...here. * sysdeps/unix/sysv/linux/s390/socket.S: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/socket.S: ...here. * sysdeps/unix/sysv/linux/s390/sys/procfs.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h: ...here. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h: ...here. * sysdeps/unix/sysv/linux/s390/syscall.S: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/syscall.S: ...here. * sysdeps/unix/sysv/linux/s390/syscalls.list: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list: ...here. * sysdeps/unix/sysv/linux/s390/sysdep.S: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: ...here. * sysdeps/unix/sysv/linux/s390/sysdep.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: ...here. * sysdeps/unix/sysv/linux/s390/versionsort64.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c: ...here. * sysdeps/unix/sysv/linux/s390/xstat.c: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/xstat.c: ...here. 2001-03-13 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/s390-64/Dist: New file. * sysdeps/unix/sysv/linux/s390/s390-64/Makefile: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/clone.S: New file. * sysdeps/unix/sysv/linux/s390/s390-64/fstatfs64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/ftruncate64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/fxstat.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/fxstat64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/getdents.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/getdents64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/getrlimit64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/glob.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/glob64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/lxstat.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/lxstat64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/mmap.S: New file. * sysdeps/unix/sysv/linux/s390/s390-64/mmap64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/pread64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/readdir.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/readdir64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/readdir64_r.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/readdir_r.c : New file. * sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/setrlimit64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sigpending.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/socket.S: New file. * sysdeps/unix/sysv/linux/s390/s390-64/statfs64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: New file. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: New file. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: New file. * sysdeps/unix/sysv/linux/s390/s390-64/truncate64.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/xstat.c: New file. * sysdeps/unix/sysv/linux/s390/s390-64/xstat64.c: New file. 2001-03-13 Martin Schwidefsky * sysdeps/s390/Dist: Move to... * sysdeps/s390/390-32/Dist: ...here. * sysdeps/s390/Implies: Move to... * sysdeps/s390/s390-32/Implies: ...here. * sysdeps/s390/Makefile: Move to... * sysdeps/s390/s390-32/Makefile: ...here. * sysdeps/s390/Versions: Move to... * sysdeps/s390-32/s390/Versions: ...here. * sysdeps/s390/add_n.S: Move to... * sysdeps/s390/s390-32/add_n.S: ...here. * sysdeps/s390/addmul_1.S: Move to... * sysdeps/s390/s390-32/addmul_1.S: ...here. * sysdeps/s390/atomicity.h: Move to... * sysdeps/s390/s390-32/atomicity.h: ...here. * sysdeps/s390/backtrace.c: Move to... * sysdeps/s390/s390-32/backtrace.c: ...here. * sysdeps/s390/bcopy.S: Move to... * sysdeps/s390/s390-32/bcopy.S: ...here. * sysdeps/s390/bits/byteswap.h: Move to... * sysdeps/s390/s390-32/bits/byteswap.h: ...here. * sysdeps/s390/bits/huge_val.h: Move to... * sysdeps/s390/s390-32/bits/huge_val.h: ...here. * sysdeps/s390/bsd-_setjmp.S: Move to... * sysdeps/s390/s390-32/bsd-_setjmp.S: ...here. * sysdeps/s390/bsd-setjmp.S: Move to... * sysdeps/s390/s390-32/bsd-setjmp.S: ...here. * sysdeps/s390/bzero.S: Move to... * sysdeps/s390/s390-32/bzero.S: ...here. * sysdeps/s390/elf/bsd-_setjmp.S: Move to... * sysdeps/s390/s390-32/elf/bsd-_setjmp.S: ...here. * sysdeps/s390/elf/bsd-setjmp.S: Move to... * sysdeps/s390/s390-32/elf/bsd-setjmp.S: ...here. * sysdeps/s390/elf/start.S: Move to... * sysdeps/s390/s390-32/elf/start.S: ...here. * sysdeps/s390/ffs.c: Move to... * sysdeps/s390/s390-32/ffs.c: ...here. * sysdeps/s390/memchr.S: Move to... * sysdeps/s390/s390-32/memchr.S: ...here. * sysdeps/s390/memcpy.S: Move to... * sysdeps/s390/s390-32/memcpy.S: ...here. * sysdeps/s390/memset.S: Move to... * sysdeps/s390/s390-32/memset.S: ...here. * sysdeps/s390/mul_1.S: Move to... * sysdeps/s390/s390-32/mul_1.S: ...here. * sysdeps/s390/s390-mcount.S: Move to... * sysdeps/s390/s390-32/s390-mcount.S: ...here. * sysdeps/s390/strcpy.S: Move to... * sysdeps/s390/s390-32/strcpy.S: ...here. * sysdeps/s390/strncpy.S: Move to... * sysdeps/s390/s390-32/strncpy.S: ...here. * sysdeps/s390/sub_n.S: Move to... * sysdeps/s390/s390-32/sub_n.S: ...here. 2001-03-13 Martin Schwidefsky * sysdeps/s390/s390-64/Dist: New file. * sysdeps/s390/s390-64/Implies: New file. * sysdeps/s390/s390-64/Makefile: New file. * sysdeps/s390/s390-64/__longjmp.c: New file. * sysdeps/s390/s390-64/add_n.S: New file. * sysdeps/s390/s390-64/atomicity.h: New file. * sysdeps/s390/s390-64/backtrace.c: New file. * sysdeps/s390/s390-64/bcopy.S: New file. * sysdeps/s390/s390-64/bits/byteswap.h: New file. * sysdeps/s390/s390-64/bits/huge_val.h: New file. * sysdeps/s390/s390-64/bits/setjmp.h: New file. * sysdeps/s390/s390-64/bits/string.h: New file. * sysdeps/s390/s390-64/bsd-_setjmp.S: New file. * sysdeps/s390/s390-64/bsd-setjmp.S: New file. * sysdeps/s390/s390-64/bzero.S: New file. * sysdeps/s390/s390-64/dl-machine.h: New file. * sysdeps/s390/s390-64/elf/bsd-_setjmp.S: New file. * sysdeps/s390/s390-64/elf/bsd-setjmp.S: New file. * sysdeps/s390/s390-64/elf/setjmp.S: New file. * sysdeps/s390/s390-64/elf/start.S: New file. * sysdeps/s390/s390-64/ffs.c: New file. * sysdeps/s390/s390-64/initfini.c: New file. * sysdeps/s390/s390-64/memchr.S: New file. * sysdeps/s390/s390-64/memcpy.S: New file. * sysdeps/s390/s390-64/memset.S: New file. * sysdeps/s390/s390-64/s390x-mcount.S: New file. * sysdeps/s390/s390-64/setjmp.S: New file. * sysdeps/s390/s390-64/strcpy.S: New file. * sysdeps/s390/s390-64/strncpy.S: New file. * sysdeps/s390/s390-64/sub_n.S: New file. * sysdeps/s390/s390-64/sysdep.h: New file. 2001-03-13 Martin Schwidefsky * scripts/config.guess: Add support for Linux on 64 bit S/390. * scripts/config.sub: Likewise. 2001-03-13 Martin Schwidefsky * configure.in: Add support for 64 bit S/390. * elf/elf.h: Add new relocations for 64 bit S/390. * shlib-versions: Add rules for Linux on 64 bit S/390. 2001-03-13 Martin Schwidefsky * sysdeps/s390/__longjmp.c: Move to... * sysdeps/s390/s390-32/__longjmp.c: ...here. Add code to load the floating point registers that should be saved according to the ABI. * sysdeps/s390/bits/setjmp.h: Move to... * sysdeps/s390/s390-32/bits/setjmp.h: ...here. Avoid the use of long long in the __jmp_buf type definition. * sysdeps/s390/bits/string.h: Move to... * sysdeps/s390/s390-32/bits/string.h: ...here. Add several missing #ifndef _FORCE_INLINES. * sysdeps/s390/dl-machine.h: Move to... * sysdeps/s390/s390-32/dl-machine.h: ...here. Add a check for the executables EI_CLASS in elf_machine_matches_host. * sysdeps/s390/elf/setjmp.S: Move to... * sysdeps/s390/s390-32/elf/setjmp.S: ...here. Replace branches to globally defined symbol __sigsetjmp by branches to a local label (this avoids the generation of a R_390_PC16DBL relocation in -fpic code). * sysdeps/s390/gmp-mparam.h: Use defines from to calculate BITS_PER_MP_LIMB, BYTES_PER_MP_LIMB and BITS_PER_LONGINT. * sysdeps/s390/initfini.c: Move to... * sysdeps/s390/s390-32/initfini.c: ...here. Replace ALIGN with ".align 4,0x07". * sysdeps/s390/setjmp.S: Move to... * sysdeps/s390/s390-32/setjmp.S: ...here. Add code to store the floating point registers that should be saved according to the ABI. * sysdeps/s390/sys/ucontext.h: Remove since it is unused. * sysdeps/unix/sysv/linux/s390/sysdep.h: Move to... * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: ...here. Include sysdeps/s390/s390-32/sysdep.h instead of sysdeps/s390/sysdep.h. 2001-03-13 Martin Schwidefsky * configure.in: Change machine=s390 to machine=s390/s390-32. * elf/elf.h: Correct comment for R_390_PLT16DBL. --- sysdeps/s390/Dist | 3 - sysdeps/s390/Implies | 4 - sysdeps/s390/Makefile | 11 - sysdeps/s390/Versions | 6 - sysdeps/s390/__longjmp.c | 41 -- sysdeps/s390/add_n.S | 63 --- sysdeps/s390/addmul_1.S | 58 --- sysdeps/s390/atomicity.h | 76 ---- sysdeps/s390/backtrace.c | 81 ---- sysdeps/s390/bcopy.S | 69 ---- sysdeps/s390/bits/byteswap.h | 86 ---- sysdeps/s390/bits/huge_val.h | 73 ---- sysdeps/s390/bits/setjmp.h | 52 --- sysdeps/s390/bits/string.h | 144 ------- sysdeps/s390/bsd-_setjmp.S | 46 --- sysdeps/s390/bsd-setjmp.S | 46 --- sysdeps/s390/bzero.S | 43 -- sysdeps/s390/dl-machine.h | 453 -------------------- sysdeps/s390/elf/bsd-_setjmp.S | 1 - sysdeps/s390/elf/bsd-setjmp.S | 1 - sysdeps/s390/elf/setjmp.S | 56 --- sysdeps/s390/elf/start.S | 95 ----- sysdeps/s390/ffs.c | 68 --- sysdeps/s390/gmp-mparam.h | 16 +- sysdeps/s390/initfini.c | 149 ------- sysdeps/s390/memchr.S | 40 -- sysdeps/s390/memcpy.S | 41 -- sysdeps/s390/memset.S | 43 -- sysdeps/s390/mul_1.S | 55 --- sysdeps/s390/s390-32/Dist | 3 + sysdeps/s390/s390-32/Implies | 4 + sysdeps/s390/s390-32/Makefile | 11 + sysdeps/s390/s390-32/Versions | 6 + sysdeps/s390/s390-32/__longjmp.c | 43 ++ sysdeps/s390/s390-32/add_n.S | 63 +++ sysdeps/s390/s390-32/addmul_1.S | 58 +++ sysdeps/s390/s390-32/atomicity.h | 76 ++++ sysdeps/s390/s390-32/backtrace.c | 81 ++++ sysdeps/s390/s390-32/bcopy.S | 69 ++++ sysdeps/s390/s390-32/bits/byteswap.h | 86 ++++ sysdeps/s390/s390-32/bits/huge_val.h | 73 ++++ sysdeps/s390/s390-32/bits/setjmp.h | 52 +++ sysdeps/s390/s390-32/bits/string.h | 154 +++++++ sysdeps/s390/s390-32/bsd-_setjmp.S | 46 +++ sysdeps/s390/s390-32/bsd-setjmp.S | 46 +++ sysdeps/s390/s390-32/bzero.S | 43 ++ sysdeps/s390/s390-32/dl-machine.h | 454 +++++++++++++++++++++ sysdeps/s390/s390-32/elf/bsd-_setjmp.S | 1 + sysdeps/s390/s390-32/elf/bsd-setjmp.S | 1 + sysdeps/s390/s390-32/elf/setjmp.S | 61 +++ sysdeps/s390/s390-32/elf/start.S | 95 +++++ sysdeps/s390/s390-32/ffs.c | 68 +++ sysdeps/s390/s390-32/initfini.c | 149 +++++++ sysdeps/s390/s390-32/memchr.S | 40 ++ sysdeps/s390/s390-32/memcpy.S | 41 ++ sysdeps/s390/s390-32/memset.S | 43 ++ sysdeps/s390/s390-32/mul_1.S | 55 +++ sysdeps/s390/s390-32/s390-mcount.S | 84 ++++ sysdeps/s390/s390-32/setjmp.S | 51 +++ sysdeps/s390/s390-32/strcpy.S | 36 ++ sysdeps/s390/s390-32/strncpy.S | 79 ++++ sysdeps/s390/s390-32/sub_n.S | 62 +++ sysdeps/s390/s390-32/sysdep.h | 121 ++++++ sysdeps/s390/s390-64/Dist | 3 + sysdeps/s390/s390-64/Implies | 4 + sysdeps/s390/s390-64/Makefile | 11 + sysdeps/s390/s390-64/__longjmp.c | 46 +++ sysdeps/s390/s390-64/add_n.S | 63 +++ sysdeps/s390/s390-64/atomicity.h | 76 ++++ sysdeps/s390/s390-64/backtrace.c | 81 ++++ sysdeps/s390/s390-64/bcopy.S | 61 +++ sysdeps/s390/s390-64/bits/byteswap.h | 93 +++++ sysdeps/s390/s390-64/bits/huge_val.h | 69 ++++ sysdeps/s390/s390-64/bits/setjmp.h | 53 +++ sysdeps/s390/s390-64/bits/string.h | 153 +++++++ sysdeps/s390/s390-64/bsd-_setjmp.S | 35 ++ sysdeps/s390/s390-64/bsd-setjmp.S | 34 ++ sysdeps/s390/s390-64/bzero.S | 42 ++ sysdeps/s390/s390-64/dl-machine.h | 434 ++++++++++++++++++++ sysdeps/s390/s390-64/elf/bsd-_setjmp.S | 1 + sysdeps/s390/s390-64/elf/bsd-setjmp.S | 1 + sysdeps/s390/s390-64/elf/setjmp.S | 53 +++ sysdeps/s390/s390-64/elf/start.S | 84 ++++ sysdeps/s390/s390-64/ffs.c | 68 +++ sysdeps/s390/s390-64/initfini.c | 136 ++++++ sysdeps/s390/s390-64/memchr.S | 40 ++ sysdeps/s390/s390-64/memcpy.S | 41 ++ sysdeps/s390/s390-64/memset.S | 43 ++ sysdeps/s390/s390-64/s390x-mcount.S | 72 ++++ sysdeps/s390/s390-64/setjmp.S | 43 ++ sysdeps/s390/s390-64/strcpy.S | 35 ++ sysdeps/s390/s390-64/strncpy.S | 90 ++++ sysdeps/s390/s390-64/sub_n.S | 60 +++ sysdeps/s390/s390-64/sysdep.h | 112 +++++ sysdeps/s390/s390-mcount.S | 84 ---- sysdeps/s390/setjmp.S | 49 --- sysdeps/s390/strcpy.S | 36 -- sysdeps/s390/strncpy.S | 79 ---- sysdeps/s390/sub_n.S | 62 --- sysdeps/s390/sys/ucontext.h | 95 ----- sysdeps/s390/sysdep.h | 121 ------ sysdeps/unix/sysv/linux/s390/Dist | 9 - sysdeps/unix/sysv/linux/s390/Makefile | 12 - sysdeps/unix/sysv/linux/s390/Versions | 28 -- sysdeps/unix/sysv/linux/s390/alphasort64.c | 1 - sysdeps/unix/sysv/linux/s390/bits/fcntl.h | 179 -------- sysdeps/unix/sysv/linux/s390/bits/mman.h | 93 ----- sysdeps/unix/sysv/linux/s390/bits/resource.h | 205 ---------- sysdeps/unix/sysv/linux/s390/bits/stat.h | 134 ------ sysdeps/unix/sysv/linux/s390/chown.c | 118 ------ sysdeps/unix/sysv/linux/s390/clone.S | 66 --- sysdeps/unix/sysv/linux/s390/fchown.c | 1 - sysdeps/unix/sysv/linux/s390/fcntl.c | 1 - sysdeps/unix/sysv/linux/s390/fxstat.c | 1 - sysdeps/unix/sysv/linux/s390/getdents64.c | 1 - sysdeps/unix/sysv/linux/s390/getegid.c | 1 - sysdeps/unix/sysv/linux/s390/geteuid.c | 1 - sysdeps/unix/sysv/linux/s390/getgid.c | 1 - sysdeps/unix/sysv/linux/s390/getgroups.c | 1 - sysdeps/unix/sysv/linux/s390/getresgid.c | 1 - sysdeps/unix/sysv/linux/s390/getresuid.c | 1 - sysdeps/unix/sysv/linux/s390/getrlimit.c | 1 - sysdeps/unix/sysv/linux/s390/getrlimit64.c | 1 - sysdeps/unix/sysv/linux/s390/getuid.c | 1 - sysdeps/unix/sysv/linux/s390/lchown.c | 75 ---- sysdeps/unix/sysv/linux/s390/lockf64.c | 1 - sysdeps/unix/sysv/linux/s390/lxstat.c | 1 - sysdeps/unix/sysv/linux/s390/mmap.S | 72 ---- sysdeps/unix/sysv/linux/s390/mmap64.S | 101 ----- sysdeps/unix/sysv/linux/s390/msgctl.c | 1 - sysdeps/unix/sysv/linux/s390/oldgetrlimit64.c | 1 - sysdeps/unix/sysv/linux/s390/readdir64.c | 1 - sysdeps/unix/sysv/linux/s390/readdir64_r.c | 1 - sysdeps/unix/sysv/linux/s390/register-dump.h | 130 ------ sysdeps/unix/sysv/linux/s390/s390-32/Dist | 9 + sysdeps/unix/sysv/linux/s390/s390-32/Makefile | 12 + sysdeps/unix/sysv/linux/s390/s390-32/Versions | 28 ++ sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h | 179 ++++++++ sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h | 93 +++++ .../unix/sysv/linux/s390/s390-32/bits/resource.h | 205 ++++++++++ sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h | 134 ++++++ sysdeps/unix/sysv/linux/s390/s390-32/chown.c | 118 ++++++ sysdeps/unix/sysv/linux/s390/s390-32/clone.S | 66 +++ sysdeps/unix/sysv/linux/s390/s390-32/fchown.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getegid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getgid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/getuid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/lchown.c | 75 ++++ sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/mmap.S | 72 ++++ sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S | 101 +++++ sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c | 1 + .../unix/sysv/linux/s390/s390-32/oldgetrlimit64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c | 1 + .../unix/sysv/linux/s390/s390-32/register-dump.h | 130 ++++++ sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/semctl.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setegid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setgid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c | 2 + sysdeps/unix/sysv/linux/s390/s390-32/setregid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/setuid.c | 2 + sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/socket.S | 98 +++++ sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h | 118 ++++++ .../unix/sysv/linux/s390/s390-32/sys/ucontext.h | 76 ++++ sysdeps/unix/sysv/linux/s390/s390-32/syscall.S | 51 +++ sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list | 4 + sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S | 104 +++++ sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 212 ++++++++++ .../unix/sysv/linux/s390/s390-32/versionsort64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-32/xstat.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/Dist | 4 + sysdeps/unix/sysv/linux/s390/s390-64/Makefile | 8 + .../unix/sysv/linux/s390/s390-64/bits/elfclass.h | 34 ++ sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h | 174 ++++++++ sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h | 78 ++++ sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h | 94 +++++ sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h | 68 +++ .../unix/sysv/linux/s390/s390-64/bits/resource.h | 196 +++++++++ sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h | 85 ++++ sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h | 87 ++++ .../unix/sysv/linux/s390/s390-64/bits/sigaction.h | 72 ++++ .../unix/sysv/linux/s390/s390-64/bits/siginfo.h | 297 ++++++++++++++ .../unix/sysv/linux/s390/s390-64/bits/sigstack.h | 59 +++ sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h | 107 +++++ sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h | 115 ++++++ sysdeps/unix/sysv/linux/s390/s390-64/clone.S | 55 +++ sysdeps/unix/sysv/linux/s390/s390-64/fstatfs64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/ftruncate64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/fxstat.c | 42 ++ sysdeps/unix/sysv/linux/s390/s390-64/fxstat64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/getdents.c | 4 + sysdeps/unix/sysv/linux/s390/s390-64/getdents64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/getrlimit64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/glob.c | 7 + sysdeps/unix/sysv/linux/s390/s390-64/glob64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h | 46 +++ sysdeps/unix/sysv/linux/s390/s390-64/lxstat.c | 42 ++ sysdeps/unix/sysv/linux/s390/s390-64/lxstat64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/mmap.S | 67 +++ sysdeps/unix/sysv/linux/s390/s390-64/mmap64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/pread64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/readdir.c | 7 + sysdeps/unix/sysv/linux/s390/s390-64/readdir64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/readdir64_r.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/readdir_r.c | 4 + .../unix/sysv/linux/s390/s390-64/register-dump.h | 133 ++++++ sysdeps/unix/sysv/linux/s390/s390-64/setrlimit64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c | 50 +++ sysdeps/unix/sysv/linux/s390/s390-64/sigpending.c | 41 ++ sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c | 44 ++ sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c | 39 ++ sysdeps/unix/sysv/linux/s390/s390-64/socket.S | 99 +++++ sysdeps/unix/sysv/linux/s390/s390-64/statfs64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h | 118 ++++++ .../unix/sysv/linux/s390/s390-64/sys/ucontext.h | 77 ++++ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S | 52 +++ sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 55 +++ sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S | 90 ++++ sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 164 ++++++++ sysdeps/unix/sysv/linux/s390/s390-64/truncate64.c | 1 + sysdeps/unix/sysv/linux/s390/s390-64/xstat.c | 42 ++ sysdeps/unix/sysv/linux/s390/s390-64/xstat64.c | 1 + sysdeps/unix/sysv/linux/s390/scandir64.c | 1 - sysdeps/unix/sysv/linux/s390/semctl.c | 1 - sysdeps/unix/sysv/linux/s390/setegid.c | 1 - sysdeps/unix/sysv/linux/s390/seteuid.c | 1 - sysdeps/unix/sysv/linux/s390/setfsgid.c | 1 - sysdeps/unix/sysv/linux/s390/setfsuid.c | 1 - sysdeps/unix/sysv/linux/s390/setgid.c | 1 - sysdeps/unix/sysv/linux/s390/setgroups.c | 2 - sysdeps/unix/sysv/linux/s390/setregid.c | 1 - sysdeps/unix/sysv/linux/s390/setresgid.c | 1 - sysdeps/unix/sysv/linux/s390/setresuid.c | 1 - sysdeps/unix/sysv/linux/s390/setreuid.c | 1 - sysdeps/unix/sysv/linux/s390/setrlimit.c | 1 - sysdeps/unix/sysv/linux/s390/setuid.c | 2 - sysdeps/unix/sysv/linux/s390/shmctl.c | 1 - sysdeps/unix/sysv/linux/s390/socket.S | 98 ----- sysdeps/unix/sysv/linux/s390/sys/procfs.h | 118 ------ sysdeps/unix/sysv/linux/s390/sys/ucontext.h | 76 ---- sysdeps/unix/sysv/linux/s390/syscall.S | 51 --- sysdeps/unix/sysv/linux/s390/syscalls.list | 4 - sysdeps/unix/sysv/linux/s390/sysdep.S | 104 ----- sysdeps/unix/sysv/linux/s390/sysdep.h | 212 ---------- sysdeps/unix/sysv/linux/s390/versionsort64.c | 1 - sysdeps/unix/sysv/linux/s390/xstat.c | 1 - 268 files changed, 9197 insertions(+), 4361 deletions(-) delete mode 100644 sysdeps/s390/Dist delete mode 100644 sysdeps/s390/Implies delete mode 100644 sysdeps/s390/Makefile delete mode 100644 sysdeps/s390/Versions delete mode 100644 sysdeps/s390/__longjmp.c delete mode 100644 sysdeps/s390/add_n.S delete mode 100644 sysdeps/s390/addmul_1.S delete mode 100644 sysdeps/s390/atomicity.h delete mode 100644 sysdeps/s390/backtrace.c delete mode 100644 sysdeps/s390/bcopy.S delete mode 100644 sysdeps/s390/bits/byteswap.h delete mode 100644 sysdeps/s390/bits/huge_val.h delete mode 100644 sysdeps/s390/bits/setjmp.h delete mode 100644 sysdeps/s390/bits/string.h delete mode 100644 sysdeps/s390/bsd-_setjmp.S delete mode 100644 sysdeps/s390/bsd-setjmp.S delete mode 100644 sysdeps/s390/bzero.S delete mode 100644 sysdeps/s390/dl-machine.h delete mode 100644 sysdeps/s390/elf/bsd-_setjmp.S delete mode 100644 sysdeps/s390/elf/bsd-setjmp.S delete mode 100644 sysdeps/s390/elf/setjmp.S delete mode 100644 sysdeps/s390/elf/start.S delete mode 100644 sysdeps/s390/ffs.c delete mode 100644 sysdeps/s390/initfini.c delete mode 100644 sysdeps/s390/memchr.S delete mode 100644 sysdeps/s390/memcpy.S delete mode 100644 sysdeps/s390/memset.S delete mode 100644 sysdeps/s390/mul_1.S create mode 100644 sysdeps/s390/s390-32/Dist create mode 100644 sysdeps/s390/s390-32/Implies create mode 100644 sysdeps/s390/s390-32/Makefile create mode 100644 sysdeps/s390/s390-32/Versions create mode 100644 sysdeps/s390/s390-32/__longjmp.c create mode 100644 sysdeps/s390/s390-32/add_n.S create mode 100644 sysdeps/s390/s390-32/addmul_1.S create mode 100644 sysdeps/s390/s390-32/atomicity.h create mode 100644 sysdeps/s390/s390-32/backtrace.c create mode 100644 sysdeps/s390/s390-32/bcopy.S create mode 100644 sysdeps/s390/s390-32/bits/byteswap.h create mode 100644 sysdeps/s390/s390-32/bits/huge_val.h create mode 100644 sysdeps/s390/s390-32/bits/setjmp.h create mode 100644 sysdeps/s390/s390-32/bits/string.h create mode 100644 sysdeps/s390/s390-32/bsd-_setjmp.S create mode 100644 sysdeps/s390/s390-32/bsd-setjmp.S create mode 100644 sysdeps/s390/s390-32/bzero.S create mode 100644 sysdeps/s390/s390-32/dl-machine.h create mode 100644 sysdeps/s390/s390-32/elf/bsd-_setjmp.S create mode 100644 sysdeps/s390/s390-32/elf/bsd-setjmp.S create mode 100644 sysdeps/s390/s390-32/elf/setjmp.S create mode 100644 sysdeps/s390/s390-32/elf/start.S create mode 100644 sysdeps/s390/s390-32/ffs.c create mode 100644 sysdeps/s390/s390-32/initfini.c create mode 100644 sysdeps/s390/s390-32/memchr.S create mode 100644 sysdeps/s390/s390-32/memcpy.S create mode 100644 sysdeps/s390/s390-32/memset.S create mode 100644 sysdeps/s390/s390-32/mul_1.S create mode 100644 sysdeps/s390/s390-32/s390-mcount.S create mode 100644 sysdeps/s390/s390-32/setjmp.S create mode 100644 sysdeps/s390/s390-32/strcpy.S create mode 100644 sysdeps/s390/s390-32/strncpy.S create mode 100644 sysdeps/s390/s390-32/sub_n.S create mode 100644 sysdeps/s390/s390-32/sysdep.h create mode 100644 sysdeps/s390/s390-64/Dist create mode 100644 sysdeps/s390/s390-64/Implies create mode 100644 sysdeps/s390/s390-64/Makefile create mode 100644 sysdeps/s390/s390-64/__longjmp.c create mode 100644 sysdeps/s390/s390-64/add_n.S create mode 100644 sysdeps/s390/s390-64/atomicity.h create mode 100644 sysdeps/s390/s390-64/backtrace.c create mode 100644 sysdeps/s390/s390-64/bcopy.S create mode 100644 sysdeps/s390/s390-64/bits/byteswap.h create mode 100644 sysdeps/s390/s390-64/bits/huge_val.h create mode 100644 sysdeps/s390/s390-64/bits/setjmp.h create mode 100644 sysdeps/s390/s390-64/bits/string.h create mode 100644 sysdeps/s390/s390-64/bsd-_setjmp.S create mode 100644 sysdeps/s390/s390-64/bsd-setjmp.S create mode 100644 sysdeps/s390/s390-64/bzero.S create mode 100644 sysdeps/s390/s390-64/dl-machine.h create mode 100644 sysdeps/s390/s390-64/elf/bsd-_setjmp.S create mode 100644 sysdeps/s390/s390-64/elf/bsd-setjmp.S create mode 100644 sysdeps/s390/s390-64/elf/setjmp.S create mode 100644 sysdeps/s390/s390-64/elf/start.S create mode 100644 sysdeps/s390/s390-64/ffs.c create mode 100644 sysdeps/s390/s390-64/initfini.c create mode 100644 sysdeps/s390/s390-64/memchr.S create mode 100644 sysdeps/s390/s390-64/memcpy.S create mode 100644 sysdeps/s390/s390-64/memset.S create mode 100644 sysdeps/s390/s390-64/s390x-mcount.S create mode 100644 sysdeps/s390/s390-64/setjmp.S create mode 100644 sysdeps/s390/s390-64/strcpy.S create mode 100644 sysdeps/s390/s390-64/strncpy.S create mode 100644 sysdeps/s390/s390-64/sub_n.S create mode 100644 sysdeps/s390/s390-64/sysdep.h delete mode 100644 sysdeps/s390/s390-mcount.S delete mode 100644 sysdeps/s390/setjmp.S delete mode 100644 sysdeps/s390/strcpy.S delete mode 100644 sysdeps/s390/strncpy.S delete mode 100644 sysdeps/s390/sub_n.S delete mode 100644 sysdeps/s390/sys/ucontext.h delete mode 100644 sysdeps/s390/sysdep.h delete mode 100644 sysdeps/unix/sysv/linux/s390/Dist delete mode 100644 sysdeps/unix/sysv/linux/s390/Makefile delete mode 100644 sysdeps/unix/sysv/linux/s390/Versions delete mode 100644 sysdeps/unix/sysv/linux/s390/alphasort64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/bits/fcntl.h delete mode 100644 sysdeps/unix/sysv/linux/s390/bits/mman.h delete mode 100644 sysdeps/unix/sysv/linux/s390/bits/resource.h delete mode 100644 sysdeps/unix/sysv/linux/s390/bits/stat.h delete mode 100644 sysdeps/unix/sysv/linux/s390/chown.c delete mode 100644 sysdeps/unix/sysv/linux/s390/clone.S delete mode 100644 sysdeps/unix/sysv/linux/s390/fchown.c delete mode 100644 sysdeps/unix/sysv/linux/s390/fcntl.c delete mode 100644 sysdeps/unix/sysv/linux/s390/fxstat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getdents64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getegid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/geteuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getgid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getgroups.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getresgid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getresuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getrlimit.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getrlimit64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/getuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/lchown.c delete mode 100644 sysdeps/unix/sysv/linux/s390/lockf64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/lxstat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/mmap.S delete mode 100644 sysdeps/unix/sysv/linux/s390/mmap64.S delete mode 100644 sysdeps/unix/sysv/linux/s390/msgctl.c delete mode 100644 sysdeps/unix/sysv/linux/s390/oldgetrlimit64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/readdir64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/readdir64_r.c delete mode 100644 sysdeps/unix/sysv/linux/s390/register-dump.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/Dist create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/Makefile create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/Versions create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/chown.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/clone.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/fchown.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getegid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getgid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/lchown.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/mmap.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/semctl.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setegid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setgid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setregid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/setuid.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/socket.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/syscall.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/xstat.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/Dist create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/Makefile create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/clone.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/fstatfs64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/ftruncate64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/fxstat.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/fxstat64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/getdents.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/getdents64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/getrlimit64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/glob.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/glob64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/lxstat.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/lxstat64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/mmap.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/mmap64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/pread64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/readdir.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/readdir64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/readdir64_r.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/readdir_r.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/setrlimit64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sigpending.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/socket.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/statfs64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscall.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/truncate64.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/xstat.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/xstat64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/scandir64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/semctl.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setegid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/seteuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setfsgid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setfsuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setgid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setgroups.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setregid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setresgid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setresuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setreuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setrlimit.c delete mode 100644 sysdeps/unix/sysv/linux/s390/setuid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/shmctl.c delete mode 100644 sysdeps/unix/sysv/linux/s390/socket.S delete mode 100644 sysdeps/unix/sysv/linux/s390/sys/procfs.h delete mode 100644 sysdeps/unix/sysv/linux/s390/sys/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/s390/syscall.S delete mode 100644 sysdeps/unix/sysv/linux/s390/syscalls.list delete mode 100644 sysdeps/unix/sysv/linux/s390/sysdep.S delete mode 100644 sysdeps/unix/sysv/linux/s390/sysdep.h delete mode 100644 sysdeps/unix/sysv/linux/s390/versionsort64.c delete mode 100644 sysdeps/unix/sysv/linux/s390/xstat.c (limited to 'sysdeps') diff --git a/sysdeps/s390/Dist b/sysdeps/s390/Dist deleted file mode 100644 index fdba667..0000000 --- a/sysdeps/s390/Dist +++ /dev/null @@ -1,3 +0,0 @@ -s390-mcount.S -machine-gmon.h -fpu/fenv_libc.h diff --git a/sysdeps/s390/Implies b/sysdeps/s390/Implies deleted file mode 100644 index 71bec4d..0000000 --- a/sysdeps/s390/Implies +++ /dev/null @@ -1,4 +0,0 @@ -wordsize-32 -ieee754 -ieee754/dbl-64 -ieee754/flt-32 diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile deleted file mode 100644 index 057862d..0000000 --- a/sysdeps/s390/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -pic-ccflag = -fpic - -ifeq ($(subdir),gmon) -sysdep_routines += s390-mcount -endif - -ifeq ($(subdir),elf) -CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused -CFLAGS-dl-load.c += -Wno-unused -CFLAGS-dl-reloc.c += -Wno-unused -endif diff --git a/sysdeps/s390/Versions b/sysdeps/s390/Versions deleted file mode 100644 index 2b020f8..0000000 --- a/sysdeps/s390/Versions +++ /dev/null @@ -1,6 +0,0 @@ -libc { - GLIBC_2.0 { - # Functions from libgcc. - __divdi3; __moddi3; __udivdi3; __umoddi3; - } -} diff --git a/sysdeps/s390/__longjmp.c b/sysdeps/s390/__longjmp.c deleted file mode 100644 index 6f5bf12..0000000 --- a/sysdeps/s390/__longjmp.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include -#include -#include -#include - -/* Jump to the position specified by ENV, causing the - setjmp call there to return VAL, or 1 if VAL is 0. */ -void -__longjmp (__jmp_buf env, int val) -{ - /* Restore registers and jump back. */ - asm volatile ("lr %%r2,%0\n\t" /* PUT val in grp 2. */ - "lm %%r6,%%r15,%1\n\t" - "br %%r14" - : : "r" (val == 0 ? 1 : val), - "m" (env->gregs[__JB_GPR6]) : "2" ); - - /* Avoid `volatile function does return' warnings. */ - for (;;); -} diff --git a/sysdeps/s390/add_n.S b/sysdeps/s390/add_n.S deleted file mode 100644 index 4b7d841..0000000 --- a/sysdeps/s390/add_n.S +++ /dev/null @@ -1,63 +0,0 @@ -/* Add two limb vectors of the same length > 0 and store sum in a third - limb vector. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - This file is part of the GNU MP Library. - - The GNU MP Library is free software; you can redistribute it and/or modify - it under the terms of the GNU Library General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - The GNU MP Library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public - License for more details. - - You should have received a copy of the GNU Library General Public License - along with the GNU MP Library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. */ - -/* - INPUT PARAMETERS - res_ptr %r2 - s1_ptr %r3 - s2_ptr %r4 - size %r5 -*/ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(__mpn_add_n) - st %r6,24(%r15) # save register 6 - sr %r1,%r1 - lhi %r0,1 # cannot use ahi to add carry, use alr -.L0: l %r6,0(%r1,%r3) # .L0 -> no carry from last add - al %r6,0(%r1,%r4) - st %r6,0(%r1,%r2) - la %r1,4(0,%r1) - brc 3,.L3 -.L1: brct %r5,.L0 - slr %r2,%r2 # no last carry to return - j .Lexit -.L2: l %r6,0(%r1,%r3) # .L2 -> carry from last add - al %r6,0(%r1,%r4) - brc 3,.L4 - alr %r6,%r0 # no carry yet, add carry from last add - st %r6,0(%r1,%r2) - la %r1,4(0,%r1) - brc 12,.L1 # new carry ? -.L3: brct %r5,.L2 - lr %r2,%r0 # return last carry - j .Lexit -.L4: alr %r6,%r0 # already a carry, add carry from last add - st %r6,0(%r1,%r2) - la %r1,4(0,%r1) - brct %r5,.L2 - lr %r2,%r0 # return last carry -.Lexit: l %r6,24(%r15) # restore register 6 - br %r14 -END(__mpn_add_n) diff --git a/sysdeps/s390/addmul_1.S b/sysdeps/s390/addmul_1.S deleted file mode 100644 index c98a4c1..0000000 --- a/sysdeps/s390/addmul_1.S +++ /dev/null @@ -1,58 +0,0 @@ -/* S390 __mpn_addmul_1 -- Multiply a limb vector with a limb and add - the result to a second limb vector. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - This file is part of the GNU MP Library. - - The GNU MP Library is free software; you can redistribute it and/or modify - it under the terms of the GNU Library General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - The GNU MP Library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public - License for more details. - - You should have received a copy of the GNU Library General Public License - along with the GNU MP Library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. */ - -/* - INPUT PARAMETERS - res_ptr %r2 - s1_ptr %r3 - sizeP %r4 - s2_limb %r5 -*/ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(__mpn_addmul_1) - st %r6,24(%r15) - slr %r6,%r6 # cy_limb = 0 -.L0: icm %r1,15,0(%r3) # get s1_ptr[i] - mr %r0,%r5 # umul_ppmm(prod_high,prod_low,s1_ptr[j],s2_limb) - jnm .L1 - alr %r0,%r5 -.L1: ltr %r5,%r5 - jnm .L2 - al %r0,0(%r3) -.L2: alr %r1,%r6 # prod_low += cy_limb - lr %r6,%r0 # cy_limb = prod_high - brc 12,.L3 - ahi %r6,1 # + (prod_low < cy_limb) -.L3: al %r1,0(%r2) # prod_low += res_ptr[i] - brc 12,.L4 - ahi %r6,1 # cy_limb++ -.L4: st %r1,0(%r2) - la %r2,4(0,%r2) - la %r3,4(0,%r3) - brct %r4,.L0 - lr %r2,%r6 # return cy_limb - l %r6,24(%r15) -.Lexit: br %r14 -END(__mpn_addmul_1) diff --git a/sysdeps/s390/atomicity.h b/sysdeps/s390/atomicity.h deleted file mode 100644 index a5347de..0000000 --- a/sysdeps/s390/atomicity.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Low-level functions for atomic operations. S390 version. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 - -#include - -static inline int -__attribute__ ((unused)) -exchange_and_add (volatile uint32_t *mem, int val) -{ - int result; - __asm__ __volatile__( - " L %0,%2\n" - " LA 2,%1\n" - "0: LR 0,%0\n" - " AR 0,%3\n" - " CS %0,0,0(2)\n" - " JL 0b" - : "=&d" (result), "=m" (*mem) - : "1" (*mem), "d" (val) : "0", "1", "2" ); - return result; -} - -static inline void -__attribute__ ((unused)) -atomic_add (volatile uint32_t *mem, int val) -{ - __asm__ __volatile__( - " LA 2,%0\n" - "0: L 0,%1\n" - " LR 1,0\n" - " AR 1,%2\n" - " CS 0,1,0(2)\n" - " JL 0b" - : "=m" (*mem) : "0" (*mem), "d" (val) : "0", "1", "2" ); -} - -static inline int -__attribute__ ((unused)) -compare_and_swap (volatile long int *p, long int oldval, long int newval) -{ - int retval; - - __asm__ __volatile__( - " la 1,%1\n" - " lr 0,%2\n" - " cs 0,%3,0(1)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&r" (retval), "+m" (*p) - : "d" (oldval) , "d" (newval) - : "memory", "0", "1", "cc"); - return !retval; -} - -#endif /* atomicity.h */ diff --git a/sysdeps/s390/backtrace.c b/sysdeps/s390/backtrace.c deleted file mode 100644 index 5e7f802..0000000 --- a/sysdeps/s390/backtrace.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Return backtrace of current program state. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -/* This is a global variable set at program start time. It marks the - highest used stack address. */ -extern void *__libc_stack_end; - - -/* This is the stack layout we see for every non-leaf function. - size offset - %r15 -> +------------------+ - 4 | back chain | 0 - 4 | end of stack | 4 - 8 | glue | 8 - 8 | scratch | 16 - 40 | save area r6-r15 | 24 - 16 | save area f4,f6 | 64 - 16 | empty | 80 - +------------------+ - r14 in the save area holds the return address. -*/ - -struct layout -{ - int back_chain; - int end_of_stack; - int glue[2]; - int scratch[2]; - int save_grps[10]; - int save_fp[4]; - int empty[2]; -}; - -int -__backtrace (array, size) - void **array; - int size; -{ - /* We assume that all the code is generated with frame pointers set. */ - struct layout *stack; - int cnt = 0; - - asm ("LR %0,%%r15" : "=d" (stack) ); - /* We skip the call to this function, it makes no sense to record it. */ - stack = (struct layout *) stack->back_chain; - while (cnt < size) - { - if (stack == NULL || (void *) stack > __libc_stack_end) - /* This means the address is out of range. Note that for the - toplevel we see a frame pointer with value NULL which clearly is - out of range. */ - break; - - array[cnt++] = stack->save_grps[9]; - - stack = (struct layout *) stack->back_chain; - } - - return cnt; -} -weak_alias (__backtrace, backtrace) diff --git a/sysdeps/s390/bcopy.S b/sysdeps/s390/bcopy.S deleted file mode 100644 index dafe9ee..0000000 --- a/sysdeps/s390/bcopy.S +++ /dev/null @@ -1,69 +0,0 @@ -/* bcopy -- copy a block from source to destination. For IBM S390 - This file is part of the GNU C Library. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software ; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation ; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY ; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * R2 = address of source - * R3 = address of destination - * R4 = number of bytes to copy - */ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(__bcopy) - clr %r2,%r3 # check against destructive overlap - jnl .L0 - lr %r1,%r2 - alr %r1,%r4 - clr %r1,%r3 - jh .L2 -.L0: - lr %r5,%r4 # source length - lr %r4,%r2 # source address - sr %r1,%r1 # set pad byte to zero - lr %r2,%r3 # set destination - lr %r3,%r5 # destination length = source length -.L1: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend - jo .L1 - br %r14 -.L2: # destructive overlay, can not use mvcle - lr %r1,%r2 # bcopy is called with source,dest - lr %r2,%r3 # memmove with dest,source! Oh, well... - lr %r3,%r1 - basr %r1,0 -.L3: -#ifdef PIC - al %r1,.L4-.L3(%r1) # get address of global offset table - # load address of memmove - l %r1,memmove@GOT12(%r1) - br %r1 -.L4: .long _GLOBAL_OFFSET_TABLE_-.L3 -#else - al %r1,.L4-.L3(%r1) # load address of memmove - br %r1 # jump to memmove -.L4: .long memmove-.L3 -#endif - -END(__bcopy) - -#ifndef NO_WEAK_ALIAS -weak_alias (__bcopy, bcopy) -#endif diff --git a/sysdeps/s390/bits/byteswap.h b/sysdeps/s390/bits/byteswap.h deleted file mode 100644 index ad20e97..0000000 --- a/sysdeps/s390/bits/byteswap.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Macros to swap the order of bytes in integer values. s390 version. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#if !defined _BYTESWAP_H && !defined _NETINET_IN_H -# error "Never use directly; include instead." -#endif - -#define __bswap_constant_16(x) \ - ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) - -/* Swap bytes in 16 bit value. */ -#if defined __GNUC__ && __GNUC__ >= 2 -# define __bswap_16(x) \ - (__extension__ \ - ({ unsigned short int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (x); \ - else { \ - unsigned short int __tmp = (unsigned short int) (x); \ - __asm__ __volatile__ ( \ - "sr %0,%0\n" \ - "la 1,%1\n" \ - "icm %0,2,1(1)\n" \ - "ic %0,0(1)" \ - : "=&d" (__v) : "m" (__tmp) : "1"); \ - } \ - __v; })) -#else -/* This is better than nothing. */ -#define __bswap_16(x) __bswap_constant_16 (x) -#endif - -/* Swap bytes in 32 bit value. */ -#define __bswap_constant_32(x) \ - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) - -#if defined __GNUC__ && __GNUC__ >= 2 -# define __bswap_32(x) \ - (__extension__ \ - ({ unsigned int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ - else { \ - unsigned int __tmp = (unsigned int) (x); \ - __asm__ __volatile__ ( \ - "la 1,%1\n" \ - "icm %0,8,3(1)\n" \ - "icm %0,4,2(1)\n" \ - "icm %0,2,1(1)\n" \ - "ic %0,0(1)" \ - : "=&d" (__v) : "m" (__tmp) : "1"); \ - } \ - __v; })) -#else -# define __bswap_32(x) __bswap_constant_32 (x) -#endif - -#if defined __GNUC__ && __GNUC__ >= 2 -/* Swap bytes in 64 bit value. */ -# define __bswap_64(x) \ - __extension__ \ - ({ union { unsigned long long int __ll; \ - unsigned long int __l[2]; } __w, __r; \ - __w.__ll = (x); \ - __r.__l[0] = __bswap_32 (__w.__l[1]); \ - __r.__l[1] = __bswap_32 (__w.__l[0]); \ - __r.__ll; }) -#endif diff --git a/sysdeps/s390/bits/huge_val.h b/sysdeps/s390/bits/huge_val.h deleted file mode 100644 index 0c8264c..0000000 --- a/sysdeps/s390/bits/huge_val.h +++ /dev/null @@ -1,73 +0,0 @@ -/* `HUGE_VAL' constants for s390 (where it is infinity). - Used by and functions for overflow. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -#include - -/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ - -#if __GNUC_PREREQ(2,96) -# define HUGE_VAL (__extension__ 0x1.0p2047) -#else -#define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } - -#define __huge_val_t union { unsigned char __c[8]; double __d; } -#ifdef __GNUC__ -# define HUGE_VAL (__extension__ \ - ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d) -#else /* Not GCC. */ -static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; -# define HUGE_VAL (__huge_val.__d) -#endif /* GCC. */ -#endif /* GCC 2.95 */ - - -/* ISO C 99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ - -#ifdef __USE_ISOC99 - -# if __GNUC_PREREQ(2,96) - -# define HUGE_VALF (__extension__ 0x1.0p255f) -# define HUGE_VALL (__extension__ 0x1.0p255f) - -# else - -# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } - -# define __huge_valf_t union { unsigned char __c[4]; float __f; } -# ifdef __GNUC__ -# define HUGE_VALF (__extension__ \ - ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f) -# else /* Not GCC. */ -static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; -# define HUGE_VALF (__huge_valf.__f) -# endif /* GCC. */ - -/* On 390 there is no 'long double' format. Make it the same as 'double' */ -# define HUGE_VALL HUGE_VAL - -# endif /* GCC 2.95 */ - -#endif /* __USE_ISOC99. */ diff --git a/sysdeps/s390/bits/setjmp.h b/sysdeps/s390/bits/setjmp.h deleted file mode 100644 index 0e4e36e..0000000 --- a/sysdeps/s390/bits/setjmp.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Define the machine-dependent type `jmp_buf'. IBM s390 version. */ - -#ifndef __S390_SETJMP_H__ -#define __S390_SETJMP_H__ - -#define __JB_GPR6 0 -#define __JB_GPR7 1 -#define __JB_GPR8 2 -#define __JB_GPR9 3 -#define __JB_GPR10 4 -#define __JB_GPR11 5 -#define __JB_GPR12 6 -#define __JB_GPR13 7 -#define __JB_GPR14 8 -#define __JB_GPR15 9 - -#ifndef _ASM - -typedef struct { - /* We save registers 6-15. */ - long int gregs[10]; - - /* We save fpu registers 4 and 6. */ - long long fpregs[2]; -} __jmp_buf[1]; - -#endif - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((int) (address) < (jmpbuf)->gregs[__JB_GPR15]) - -#endif /* __S390_SETJMP_H__ */ diff --git a/sysdeps/s390/bits/string.h b/sysdeps/s390/bits/string.h deleted file mode 100644 index 791f939..0000000 --- a/sysdeps/s390/bits/string.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Optimized, inlined string functions. s390 version. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _STRING_H -# error "Never use directly; include instead." -#endif - -/* The s390 processors can access unaligned multi-byte variables. */ -#define _STRING_ARCH_unaligned 1 - - -/* We only provide optimizations if the user selects them and if - GNU CC is used. */ -#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \ - && defined __GNUC__ && __GNUC__ >= 2 - -#ifndef __STRING_INLINE -# ifdef __cplusplus -# define __STRING_INLINE inline -# else -# define __STRING_INLINE extern __inline -# endif -#endif - -#define _HAVE_STRING_ARCH_strlen 1 -__STRING_INLINE size_t -strlen (__const char *__str) -{ - size_t __len; - - __asm__ __volatile__ (" sr 0,0\n" - " lr %0,%1\n" - "0: srst 0,%0\n" - " jo 0b\n" - " lr %0,0\n" - " sr %0,%1" - : "=&a" (__len) : "a" (__str) - : "cc", "0" ); - return __len; -} - -/* Copy SRC to DEST. */ -#define _HAVE_STRING_ARCH_strcpy 1 -__STRING_INLINE char * -strcpy (char *__dest, __const char *__src) -{ - char *tmp = __dest; - - __asm__ __volatile__ (" sr 0,0\n" - "0: mvst %0,%1\n" - " jo 0b" - : "+&a" (__dest), "+&a" (__src) : - : "cc", "memory", "0" ); - return tmp; -} - -#define _HAVE_STRING_ARCH_strncpy 1 -__STRING_INLINE char * -strncpy (char *__dest, __const char *__src, size_t __n) -{ - char *tmp = __dest; - - if (__n <= 0) - return tmp; - __asm__ __volatile (" slr %0,%1\n" - "0: icm 0,1,0(%1)\n" - " stc 0,0(%0,%1)\n" - " jz 2f\n" - " la %1,1(%1)\n" - " brct %2,0b\n" - " j 3f\n" - "1: la %1,1(%1)\n" - " stc 0,0(%0,%1)\n" - "2: brct %2,1b\n" - "3:" - : "+&a" (__dest), "+&a" (__src), "+&d" (__n) : - : "cc", "memory", "0" ); - return tmp; -} - -/* Append SRC onto DEST. */ -#define _HAVE_STRING_ARCH_strcat 1 -__STRING_INLINE char * -strcat(char *__dest, const char *__src) -{ - char *tmp = __dest; - - __asm__ __volatile__ (" sr 0,0\n" - "0: srst 0,%0\n" - " jo 0b\n" - " lr %0,0\n" - " sr 0,0\n" - "1: mvst %0,%1\n" - " jo 1b" - : "+&a" (__dest), "+&a" (__src) : - : "cc", "memory", "0" ); - return tmp; -} - -/* Append no more than N characters from SRC onto DEST. */ -#define _HAVE_STRING_ARCH_strncat 1 -__STRING_INLINE char * -strncat (char *__dest, __const char *__src, size_t __n) -{ - char *tmp = __dest; - - if (__n <= 0) - return tmp; - __asm__ __volatile__ (" sr 0,0\n" - "0: srst 0,%0\n" - " jo 0b\n" - " lr %0,0\n" - " slr %0,%1\n" - "1: icm 0,1,0(%1)\n" - " stc 0,0(%0,%1)\n" - " jz 2f\n" - " la %1,1(%1)\n" - " brct %2,1b\n" - " la %0,0(%0,%1)\n" - " xc 0(1,%0),0(%0)\n" - "2:" - : "+&a" (__dest), "+&a" (__src), "+&d" (__n) : - : "cc", "memory", "0" ); - return tmp; -} - -#endif /* Use string inlines && GNU CC. */ diff --git a/sysdeps/s390/bsd-_setjmp.S b/sysdeps/s390/bsd-_setjmp.S deleted file mode 100644 index 2b66440..0000000 --- a/sysdeps/s390/bsd-_setjmp.S +++ /dev/null @@ -1,46 +0,0 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. s390 version. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation ; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY ; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This just does a tail-call to `__sigsetjmp (ARG, 0)'. - We cannot do it in C because it must be a tail-call, so frame-unwinding - in setjmp doesn't clobber the state restored by longjmp. */ - -#include - -ENTRY(_setjmp) -#ifdef PIC - /* We cannot use the PLT, because it requires that %r12 be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT. */ - basr %r1,0 -.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ - /* get address of __sigjmp_save from got */ - l %r1,__sigjmp_save@GOT12(0,%r1) - lhi %r3,0 /* second argument of one */ - br %r1 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -#else - basr %r1,0 -.L0: l %r1,.L1 - .L0(0,%r1) /* load address of __sigsetjmp */ - lhi %r3,0 /* second argument of zero */ - br %r1 /* branch to __sigsetjmp */ -.L1: .long __sigsetjmp -#endif -END (_setjmp) diff --git a/sysdeps/s390/bsd-setjmp.S b/sysdeps/s390/bsd-setjmp.S deleted file mode 100644 index ab5aa0c..0000000 --- a/sysdeps/s390/bsd-setjmp.S +++ /dev/null @@ -1,46 +0,0 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. s390 version. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation ; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY ; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. - We cannot do it in C because it must be a tail-call, so frame-unwinding - in setjmp doesn't clobber the state restored by longjmp. */ - -#include - -ENTRY(setjmp) -#ifdef PIC - /* We cannot use the PLT, because it requires that %r12 be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT. */ - basr %r1,0 -.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ - /* get address of __sigjmp_save from got */ - l %r1,__sigjmp_save@GOT12(0,%r1) - lhi %r3,1 /* second argument of one */ - br %r1 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -#else - basr %r1,0 -.L0: l %r1,.L1 - .L0(0,%r1) /* load address of __sigsetjmp */ - lhi %r3,1 /* second argument of zero */ - br %r1 /* branch to __sigsetjmp */ -.L1: .long __sigsetjmp -#endif -END (setjmp) diff --git a/sysdeps/s390/bzero.S b/sysdeps/s390/bzero.S deleted file mode 100644 index 4d0db82..0000000 --- a/sysdeps/s390/bzero.S +++ /dev/null @@ -1,43 +0,0 @@ -/* bzero -- set a block of memory to zero. IBM S390 version - This file is part of the GNU C Library. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * R2 = address to memory area - * R3 = number of bytes to fill - */ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(__bzero) - ltr %r3,%r3 - jz .L1 - sr %r1,%r1 # set pad byte to zero - sr %r4,%r4 # no source for MVCLE, only a pad byte - sr %r5,%r5 -.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend - jo .L0 -.L1: br %r14 -END(__bzero) - -#ifndef NO_WEAK_ALIAS -weak_alias (__bzero, bzero) -#endif diff --git a/sysdeps/s390/dl-machine.h b/sysdeps/s390/dl-machine.h deleted file mode 100644 index 0f0ec8f..0000000 --- a/sysdeps/s390/dl-machine.h +++ /dev/null @@ -1,453 +0,0 @@ -/* Machine-dependent ELF dynamic relocation inline functions. S390 Version. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - Contributed by Carl Pederson & Martin Schwidefsky. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef dl_machine_h -#define dl_machine_h - - -#define ELF_MACHINE_NAME "s390" - -#include -#include -#include - -/* This is an older, now obsolete value. */ -#define EM_S390_OLD 0xA390 - -/* Return nonzero iff ELF header is compatible with the running host. */ -static inline int -elf_machine_matches_host (const Elf32_Ehdr *ehdr) -{ - return (ehdr->e_machine == EM_S390 || ehdr->e_machine == EM_S390_OLD); -} - - -/* Return the link-time address of _DYNAMIC. Conveniently, this is the - first element of the GOT. This must be inlined in a function which - uses global data. */ - -static inline Elf32_Addr -elf_machine_dynamic (void) -{ - register Elf32_Addr *got; - - asm( " bras %0,2f\n" - "1: .long _GLOBAL_OFFSET_TABLE_-1b\n" - "2: al %0,0(%0)" - : "=&a" (got) : : "0" ); - - return *got; -} - - -/* Return the run-time load address of the shared object. */ -static inline Elf32_Addr -elf_machine_load_address (void) -{ - Elf32_Addr addr; - - asm( " bras 1,2f\n" - "1: .long _GLOBAL_OFFSET_TABLE_ - 1b\n" - " .long _dl_start - 1b - 0x80000000\n" - "2: l %0,4(1)\n" - " ar %0,1\n" - " al 1,0(1)\n" - " sl %0,_dl_start@GOT12(1)" - : "=&d" (addr) : : "1" ); - return addr; -} - -/* Set up the loaded object described by L so its unrelocated PLT - entries will jump to the on-demand fixup code in dl-runtime.c. */ - -static inline int __attribute__ ((unused)) -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) -{ - extern void _dl_runtime_resolve (Elf32_Word); - extern void _dl_runtime_profile (Elf32_Word); - - if (l->l_info[DT_JMPREL] && lazy) - { - /* The GOT entries for functions in the PLT have not yet been filled - in. Their initial contents will arrange when called to push an - offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1], - and then jump to _GLOBAL_OFFSET_TABLE[2]. */ - Elf32_Addr *got; - got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]); - got[1] = (Elf32_Addr) l; /* Identify this shared object. */ - - /* The got[2] entry contains the address of a function which gets - called to get the address of a so far unresolved function and - jump to it. The profiling extension of the dynamic linker allows - to intercept the calls to collect information. In this case we - don't store the address in the GOT so that all future calls also - end in this function. */ - if (__builtin_expect (profile, 0)) - { - got[2] = (Elf32_Addr) &_dl_runtime_profile; - - if (_dl_name_match_p (_dl_profile, l)) - /* This is the object we are looking for. Say that we really - want profiling and the timers are started. */ - _dl_profile_map = l; - } - else - /* This function will get called to fix up the GOT entry indicated by - the offset on the stack, and then jump to the resolved address. */ - got[2] = (Elf32_Addr) &_dl_runtime_resolve; - } - - return lazy; -} - -/* This code is used in dl-runtime.c to call the `fixup' function - and then redirect to the address it returns. */ - -/* s390: - Arguments are in register. - r2 - r7 holds the original parameters for the function call, fixup - and trampoline code use r0-r5 and r14-15. For the correct function - call r2-r5 and r14-15 must be restored. - Arguments from the PLT are stored at 24(r15) and 28(r15) - and must be moved to r2 and r3 for the fixup call (see elf32-s390.c - in the binutils for the PLT code). - Fixup function address in r2. -*/ -#ifndef PROF -#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ - asm ( "\ - .text\n\ - .globl _dl_runtime_resolve\n\ - .type _dl_runtime_resolve, @function\n\ - .align 16\n\ -_dl_runtime_resolve:\n\ - # save registers\n\ - stm 2,5,32(15)\n\ - st 14,48(15)\n\ - lr 0,15\n\ - ahi 15,-96\n\ - st 0,0(15)\n\ - # load args saved by PLT\n\ - lm 2,3,120(15)\n\ - basr 1,0\n\ -0: ahi 1,1f-0b\n\ - l 14,0(1)\n\ - bas 14,0(14,1) # call fixup\n\ - lr 1,2 # function addr returned in r2\n\ - # restore registers\n\ - ahi 15,96\n\ - l 14,48(15)\n\ - lm 2,5,32(15)\n\ - br 1\n\ -1: .long fixup-1b\n\ - .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ -\n\ - .globl _dl_runtime_profile\n\ - .type _dl_runtime_profile, @function\n\ - .align 16\n\ -_dl_runtime_profile:\n\ - # save registers\n\ - stm 2,5,32(15)\n\ - st 14,48(15)\n\ - lr 0,15\n\ - ahi 15,-96\n\ - st 0,0(15)\n\ - # load args saved by PLT\n\ - lm 2,3,120(15)\n\ - # load return address as third parameter\n\ - lr 4,14\n\ - basr 1,0\n\ -0: ahi 1,1f-0b\n\ - l 14,0(1)\n\ - bas 14,0(14,1) # call fixup\n\ - lr 1,2 # function addr returned in r2\n\ - # restore registers\n\ - ahi 15,96\n\ - l 14,48(15)\n\ - lm 2,5,32(15)\n\ - br 1\n\ -1: .long profile_fixup-1b\n\ - .size _dl_runtime_profile, .-_dl_runtime_profile\n\ -"); -#else -#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ - asm ( "\ - .text\n\ - .globl _dl_runtime_resolve\n\ - .globl _dl_runtime_profile\n\ - .type _dl_runtime_resolve, @function\n\ - .type _dl_runtime_profile, @function\n\ - .align 16\n\ -_dl_runtime_resolve:\n\ -_dl_runtime_profile:\n\ - # save registers\n\ - stm 2,5,32(15)\n\ - st 14,48(15)\n\ - lr 0,15\n\ - ahi 15,-96\n\ - st 0,0(15)\n\ - # load args saved by PLT\n\ - lm 2,3,120(15)\n\ - # load return address as third parameter\n\ - lr 4,14\n\ - basr 1,0\n\ -0: ahi 1,1f-0b\n\ - l 14,0(1)\n\ - bas 14,0(14,1) # call fixup\n\ - lr 1,2 # function addr returned in r2\n\ - # restore registers\n\ - ahi 15,96\n\ - l 14,48(15)\n\ - lm 2,5,32(15)\n\ - br 1\n\ -1: .long fixup-1b\n\ - .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ - .size _dl_runtime_profile, .-_dl_runtime_profile\n\ -"); -#endif - -/* Mask identifying addresses reserved for the user program, - where the dynamic linker should not map anything. */ -#define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL - -/* Initial entry point code for the dynamic linker. - The C function `_dl_start' is the real entry point; - its return value is the user program's entry point. */ - -#define RTLD_START asm ("\n\ -.text\n\ -.align 4\n\ -.globl _start\n\ -.globl _dl_start_user\n\ -_start:\n\ - basr %r13,0\n\ -.L0: ahi %r13,.Llit-.L0\n\ - lr %r2,%r15\n\ - # Alloc stack frame\n\ - ahi %r15,-96\n\ - # Set the back chain to zero\n\ - xc 0(4,%r15),0(%r15)\n\ - # Call _dl_start with %r2 pointing to arg on stack\n\ - l %r14,.Ladr1-.Llit(%r13)\n\ - bas %r14,0(%r14,%r13) # call _dl_start\n\ -_dl_start_user:\n\ - # Save the user entry point address in %r8.\n\ - lr %r8,%r2\n\ - # Point %r12 at the GOT.\n\ - l %r12,.Ladr0-.Llit(%r13)\n\ - ar %r12,%r13\n\ - # Store the highest stack address\n\ - l %r1,__libc_stack_end@GOT(%r12)\n\ - st %r15, 0(%r1)\n\ - # See if we were run as a command with the executable file\n\ - # name as an extra leading argument.\n\ - l %r1,_dl_skip_args@GOT12(0,%r12)\n\ - l %r1,0(%r1) # load _dl_skip_args\n\ - # Get the original argument count.\n\ - l %r0,96(%r15)\n\ - # Subtract _dl_skip_args from it.\n\ - sr %r0,%r1\n\ - # Adjust the stack pointer to skip _dl_skip_args words.\n\ - sll %r1,2\n\ - ar %r15,%r1\n\ - # Set the back chain to zero again\n\ - xc 0(4,%r15),0(%r15)\n\ - # Store back the modified argument count.\n\ - st %r0,96(%r15)\n\ - # The special initializer gets called with the stack just\n\ - # as the application's entry point will see it; it can\n\ - # switch stacks if it moves these contents over.\n\ -" RTLD_START_SPECIAL_INIT "\n\ - # Call the function to run the initializers.\n\ - # Load the parameters:\n\ - # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ - l %r2,_dl_loaded@GOT(%r12)\n\ - l %r2,0(%r2)\n\ - l %r3,96(%r15)\n\ - la %r4,100(%r15)\n\ - lr %r5,%r3\n\ - sll %r5,2\n\ - la %r5,104(%r5,%r15)\n\ - l %r1,.Ladr4-.Llit(%r13)\n\ - bas %r14,0(%r1,%r13)\n\ - # Pass our finalizer function to the user in %r14, as per ELF ABI.\n\ - l %r14,_dl_fini@GOT(%r12)\n\ - # Free stack frame\n\ - ahi %r15,96\n\ - # Jump to the user's entry point (saved in %r8).\n\ - br %r8\n\ -.Llit:\n\ -.Ladr0: .long _GLOBAL_OFFSET_TABLE_-.Llit\n\ -.Ladr1: .long _dl_start-.Llit\n\ -.Ladr4: .long _dl_init@PLT-.Llit\n\ -"); - -#ifndef RTLD_START_SPECIAL_INIT -#define RTLD_START_SPECIAL_INIT /* nothing */ -#endif - -/* Nonzero iff TYPE should not be allowed to resolve to one of - the main executable's symbols, as for a COPY reloc. */ -#define elf_machine_lookup_noexec_p(type) ((type) == R_390_COPY) - -/* Nonzero iff TYPE describes relocation of a PLT entry, so - PLT entries should not be allowed to define the value. */ -#define elf_machine_lookup_noplt_p(type) ((type) == R_390_JMP_SLOT) - -/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ -#define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT - -/* The S390 never uses Elf32_Rel relocations. */ -#define ELF_MACHINE_NO_REL 1 - -/* The S390 overlaps DT_RELA and DT_PLTREL. */ -#define ELF_MACHINE_PLTREL_OVERLAP 1 - -/* We define an initialization functions. This is called very early in - _dl_sysdep_start. */ -#define DL_PLATFORM_INIT dl_platform_init () - -extern const char *_dl_platform; - -static inline void __attribute__ ((unused)) -dl_platform_init (void) -{ - if (_dl_platform != NULL && *_dl_platform == '\0') - /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; -} - -static inline Elf32_Addr -elf_machine_fixup_plt (struct link_map *map, lookup_t t, - const Elf32_Rela *reloc, - Elf32_Addr *reloc_addr, Elf32_Addr value) -{ - return *reloc_addr = value; -} - -/* Return the final value of a plt relocation. */ -static inline Elf32_Addr -elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, - Elf32_Addr value) -{ - return value; -} - -#endif /* !dl_machine_h */ - - -#ifdef RESOLVE - -/* Perform the relocation specified by RELOC and SYM (which is fully resolved). - MAP is the object containing the reloc. */ - -static inline void -elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, - const Elf32_Sym *sym, const struct r_found_version *version, - Elf32_Addr *const reloc_addr) -{ - if (ELF32_R_TYPE (reloc->r_info) == R_390_RELATIVE) { -#ifndef RTLD_BOOTSTRAP - if (map != &_dl_rtld_map) /* Already done in rtld itself. */ -#endif - *reloc_addr = map->l_addr + reloc->r_addend; - } - else if (ELF32_R_TYPE (reloc->r_info) != R_390_NONE) - { - const Elf32_Sym *const refsym = sym; - Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); - if (sym) - value += sym->st_value; - - switch (ELF32_R_TYPE (reloc->r_info)) - { - case R_390_COPY: - if (sym == NULL) - /* This can happen in trace mode if an object could not be - found. */ - break; - if (__builtin_expect (sym->st_size > refsym->st_size, 0) - || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) - { - const char *strtab; - - strtab = (const char *) D_PTR(map,l_info[DT_STRTAB]); - _dl_error_printf ("\ -%s: Symbol `%s' has different size in shared object, consider re-linking\n", - _dl_argv[0] ?: "", - strtab + refsym->st_name); - } - memcpy (reloc_addr, (void *) value, MIN (sym->st_size, - refsym->st_size)); - break; - case R_390_GLOB_DAT: - case R_390_JMP_SLOT: - *reloc_addr = value; - break; - case R_390_32: - { -#ifndef RTLD_BOOTSTRAP - /* This is defined in rtld.c, but nowhere in the static - libc.a; make the reference weak so static programs can - still link. This declaration cannot be done when - compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because - rtld.c contains the common defn for _dl_rtld_map, which - is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); - if (map == &_dl_rtld_map) - /* Undo the relocation done here during bootstrapping. - Now we will relocate it anew, possibly using a - binding found in the user program or a loaded library - rather than the dynamic linker's built-in definitions - used while loading those libraries. */ - value -= map->l_addr + refsym->st_value; -#endif - *reloc_addr = value + reloc->r_addend; - break; - } - - case R_390_PC32: - *reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr; - break; - case R_390_NONE: - break; - default: - _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0); - break; - } - } -} - - -static inline void -elf_machine_lazy_rel (struct link_map *map, - Elf32_Addr l_addr, const Elf32_Rela *reloc) -{ - Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); - /* Check for unexpected PLT reloc type. */ - if (__builtin_expect (ELF32_R_TYPE (reloc->r_info), R_390_JMP_SLOT) - == R_390_JMP_SLOT) - *reloc_addr += l_addr; - else - _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1); -} - -#endif /* RESOLVE */ diff --git a/sysdeps/s390/elf/bsd-_setjmp.S b/sysdeps/s390/elf/bsd-_setjmp.S deleted file mode 100644 index 1417270..0000000 --- a/sysdeps/s390/elf/bsd-_setjmp.S +++ /dev/null @@ -1 +0,0 @@ -/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/sysdeps/s390/elf/bsd-setjmp.S b/sysdeps/s390/elf/bsd-setjmp.S deleted file mode 100644 index 1417270..0000000 --- a/sysdeps/s390/elf/bsd-setjmp.S +++ /dev/null @@ -1 +0,0 @@ -/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/sysdeps/s390/elf/setjmp.S b/sysdeps/s390/elf/setjmp.S deleted file mode 100644 index e00c903..0000000 --- a/sysdeps/s390/elf/setjmp.S +++ /dev/null @@ -1,56 +0,0 @@ -/* setjmp for s390, ELF version. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#define _ASM -#define _SETJMP_H -#include - - /* We include the BSD entry points here as well but we make - them weak. */ -ENTRY (setjmp) - .weak C_SYMBOL_NAME (setjmp) - lhi %r3,1 /* second argument of one */ - j __sigsetjmp /* branch relativ to __sigsetjmp */ -END (setjmp) - -ENTRY(_setjmp) - .weak C_SYMBOL_NAME (_setjmp) - lhi %r3,0 /* second argument of zero */ - -ENTRY(__sigsetjmp) - stm %r6,%r15,0(%r2) /* store registers in jmp_buf */ -#ifdef PIC - /* We cannot use the PLT, because it requires that %r12 be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT. */ - basr %r1,0 -.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ - /* get address of __sigjmp_save from got */ - l %r1,__sigjmp_save@GOT12(0,%r1) - br %r1 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -#else - basr %r1,0 -.L0: l %r1,.L1-.L0(0,%r1) /* load address of __sigjmp_save */ - br %r1 /* tail-call __sigjmp_save */ -.L1: .long __sigjmp_save -#endif -END (__sigsetjmp) diff --git a/sysdeps/s390/elf/start.S b/sysdeps/s390/elf/start.S deleted file mode 100644 index 1455572..0000000 --- a/sysdeps/s390/elf/start.S +++ /dev/null @@ -1,95 +0,0 @@ -/* Startup code compliant to the ELF s390 ABI. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - This is the canonical entry point, usually the first thing in the text - segment. Most registers' values are unspecified, except for: - - %r14 Contains a function pointer to be registered with `atexit'. - This is how the dynamic linker arranges to have DT_FINI - functions called for shared libraries that have been loaded - before this code runs. - - %r15 The stack contains the arguments and environment: - 0(%r15) argc - 4(%r15) argv[0] - ... - (4*argc)(%r15) NULL - (4*(argc+1))(%r15) envp[0] - ... - NULL -*/ - - .text - .globl _start -_start: - /* Setup pointer to literal pool of _start */ - basr %r13,0 -.L0: ahi %r13,.Llit-.L0 - - /* load argc and argv from stack */ - la %r4,4(%r15) # get argv - l %r3,0(%r15) # get argc - - /* align the stack to a double word boundary */ - lhi %r0,-8 - nr %r15,%r0 - - /* Setup a stack frame and a parameter area */ - ahi %r15,-104 # make room on stack - xc 0(4,%r15),0(%r15) # clear back-chain - - /* set up arguments for __libc_start_main: - main, argc, argv, envp, _init, _fini, rtld_fini, stack_end - Note that envp will be determined later in __libc_start_main - */ - stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area - la %r7,96(%r15) - l %r6,.L2-.Llit(%r13) # load pointer to _fini - l %r5,.L1-.Llit(%r13) # load pointer to _init - l %r2,.L3-.Llit(%r13) # load pointer to main - - /* ok, now branch to the libc main routine */ - l %r1,.L4-.Llit(%r13) - basr %r14,%r1 - - /* crash if __libc_start_main returns */ - .word 0 - -.Llit: -.L1: .long _init -.L2: .long _fini -.L3: .long main -.L4: .long __libc_start_main - -/* FIXME: FPU flags or what ?!? */ - - .section .rodata - .globl _fp_hw - .long 3 - .size _fp_hw, 4 - -/* Define a symbol for the first piece of initialized data. */ - .data - .globl __data_start -__data_start: - .long 0 - .weak data_start - data_start = __data_start diff --git a/sysdeps/s390/ffs.c b/sysdeps/s390/ffs.c deleted file mode 100644 index b6ed821..0000000 --- a/sysdeps/s390/ffs.c +++ /dev/null @@ -1,68 +0,0 @@ -/* ffs -- find first set bit in a word, counted from least significant end. - This file is part of the GNU C Library. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define ffsl __something_else -#include - -#undef ffs - -/* - * ffs: find first bit set. This is defined the same way as - * the libc and compiler builtin ffs routines, therefore - * differs in spirit from the above ffz (man ffs). - */ - -int -__ffs (x) - int x; -{ - int r; - - if (x == 0) - return 0; - __asm__(" lr %%r1,%1\n" - " sr %0,%0\n" - " tml %%r1,0xFFFF\n" - " jnz 0f\n" - " ahi %0,16\n" - " srl %%r1,16\n" - "0: tml %%r1,0x00FF\n" - " jnz 1f\n" - " ahi %0,8\n" - " srl %%r1,8\n" - "1: tml %%r1,0x000F\n" - " jnz 2f\n" - " ahi %0,4\n" - " srl %%r1,4\n" - "2: tml %%r1,0x0003\n" - " jnz 3f\n" - " ahi %0,2\n" - " srl %%r1,2\n" - "3: tml %%r1,0x0001\n" - " jnz 4f\n" - " ahi %0,1\n" - "4:" - : "=&d" (r) : "d" (x) : "cc", "1" ); - return r+1; -} - -weak_alias (__ffs, ffs) -#undef ffsl -weak_alias (__ffs, ffsl) diff --git a/sysdeps/s390/gmp-mparam.h b/sysdeps/s390/gmp-mparam.h index 59aaff1..a103bf6 100644 --- a/sysdeps/s390/gmp-mparam.h +++ b/sysdeps/s390/gmp-mparam.h @@ -1,5 +1,5 @@ /* gmp-mparam.h -- Compiler/machine parameter header file. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU MP Library. @@ -19,11 +19,13 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define BITS_PER_MP_LIMB 32 -#define BYTES_PER_MP_LIMB 4 -#define BITS_PER_LONGINT 32 -#define BITS_PER_INT 32 -#define BITS_PER_SHORTINT 16 -#define BITS_PER_CHAR 8 +#include + +#define BITS_PER_MP_LIMB __WORDSIZE +#define BYTES_PER_MP_LIMB (__WORDSIZE / 8) +#define BITS_PER_LONGINT __WORDSIZE +#define BITS_PER_INT 32 +#define BITS_PER_SHORTINT 16 +#define BITS_PER_CHAR 8 #define IEEE_DOUBLE_BIG_ENDIAN 0 diff --git a/sysdeps/s390/initfini.c b/sysdeps/s390/initfini.c deleted file mode 100644 index e332a1d..0000000 --- a/sysdeps/s390/initfini.c +++ /dev/null @@ -1,149 +0,0 @@ -/* Special .init and .fini section support for S/390. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it - and/or modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - In addition to the permissions in the GNU Library General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The Library General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - The GNU C Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This file is compiled into assembly code which is then munged by a sed - script into two files: crti.s and crtn.s. - - * crti.s puts a function prologue at the beginning of the - .init and .fini sections and defines global symbols for - those addresses, so they can be called as functions. - - * crtn.s puts the corresponding function epilogues - in the .init and .fini sections. */ - -__asm__ (" - -#include \"defs.h\" - -/*@HEADER_ENDS*/ - -/*@TESTS_BEGIN*/ - -/*@TESTS_END*/ - -/*@_init_PROLOG_BEGINS*/ - - .section .init -#NO_APP - .align 4 -.globl _init - .type _init,@function -_init: -# leaf function 0 -# automatics 0 -# outgoing args 0 -# need frame pointer 0 -# call alloca 0 -# has varargs 0 -# incoming args (stack) 0 -# function length 36 - STM 6,15,24(15) - BRAS 13,.LTN1_0 -.LT1_0: -.LC14: - .long __gmon_start__@GOT -.LC15: - .long _GLOBAL_OFFSET_TABLE_-.LT1_0 -.LTN1_0: - LR 1,15 - AHI 15,-96 - ST 1,0(15) - L 12,.LC15-.LT1_0(13) - AR 12,13 - L 1,.LC14-.LT1_0(13) - L 1,0(1,12) - LTR 1,1 - JE .L22 - BASR 14,1 -.L22: -#APP - ALIGN - END_INIT - -/*@_init_PROLOG_ENDS*/ - -/*@_init_EPILOG_BEGINS*/ - .align 4 - .section .init -#NO_APP - .align 4 - L 4,152(15) - LM 6,15,120(15) - BR 4 -#APP - END_INIT - -/*@_init_EPILOG_ENDS*/ - -/*@_fini_PROLOG_BEGINS*/ - .section .fini -#NO_APP - .align 4 -.globl _fini - .type _fini,@function -_fini: -# leaf function 0 -# automatics 0 -# outgoing args 0 -# need frame pointer 0 -# call alloca 0 -# has varargs 0 -# incoming args (stack) 0 -# function length 30 - STM 6,15,24(15) - BRAS 13,.LTN2_0 -.LT2_0: -.LC17: - .long _GLOBAL_OFFSET_TABLE_-.LT2_0 -.LTN2_0: - LR 1,15 - AHI 15,-96 - ST 1,0(15) - L 12,.LC17-.LT2_0(13) - AR 12,13 -#APP - ALIGN - END_FINI - -/*@_fini_PROLOG_ENDS*/ - -/*@_fini_EPILOG_BEGINS*/ - .align 4 - .section .fini -#NO_APP - .align 4 - L 4,152(15) - LM 6,15,120(15) - BR 4 -#APP - END_FINI - -/*@_fini_EPILOG_ENDS*/ - -/*@TRAILER_BEGINS*/ -"); diff --git a/sysdeps/s390/memchr.S b/sysdeps/s390/memchr.S deleted file mode 100644 index 72b4682..0000000 --- a/sysdeps/s390/memchr.S +++ /dev/null @@ -1,40 +0,0 @@ -/* Search a character in a block of memory. For IBM S390 - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * R2 = address to memory area - * R3 = character to find - * R4 = number of bytes to search - */ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(memchr) - lhi %r0,0xff - nr %r0,%r3 - lr %r1,%r2 - la %r2,0(%r4,%r1) -0: srst %r2,%r1 - jo 0b - brc 13,1f - slr %r2,%r2 -1: br %r14 -END(memchr) diff --git a/sysdeps/s390/memcpy.S b/sysdeps/s390/memcpy.S deleted file mode 100644 index 94119ea..0000000 --- a/sysdeps/s390/memcpy.S +++ /dev/null @@ -1,41 +0,0 @@ -/* Set a block of memory to some byte value. For IBM S390 - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * R2 = address to destination memory area - * R3 = address to source memory area - * R4 = number of bytes to copy - */ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(memcpy) - ltr %r5,%r4 - jz .L1 - lr %r4,%r3 # %r4/%r5 = source ptr/len - lr %r3,%r5 # %r2/%r3 = dest ptr/len - lr %r0,%r2 # save source address -.L0: mvcle %r2,%r4,0 # thats it, MVCLE is your friend - jo .L0 - lr %r2,%r0 # return value is source address -.L1: - br %r14 -END(memset) diff --git a/sysdeps/s390/memset.S b/sysdeps/s390/memset.S deleted file mode 100644 index e917fe0..0000000 --- a/sysdeps/s390/memset.S +++ /dev/null @@ -1,43 +0,0 @@ -/* Set a block of memory to some byte value. For IBM S390 - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * R2 = address to memory area - * R3 = byte to fill memory with - * R4 = number of bytes to fill - */ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(memset) - ltr %r4,%r4 - jz .L1 - lr %r0,%r2 # save source address - lr %r1,%r3 # move pad byte to R1 - lr %r3,%r4 - sr %r4,%r4 # no source for MVCLE, only a pad byte - sr %r5,%r5 -.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend - jo .L0 - lr %r2,%r0 # return value is source address -.L1: - br %r14 -END(memset) diff --git a/sysdeps/s390/mul_1.S b/sysdeps/s390/mul_1.S deleted file mode 100644 index 1804114..0000000 --- a/sysdeps/s390/mul_1.S +++ /dev/null @@ -1,55 +0,0 @@ -/* i80386 __mpn_mul_1 -- Multiply a limb vector with a limb and store - the result in a second limb vector. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - This file is part of the GNU MP Library. - - The GNU MP Library is free software; you can redistribute it and/or modify - it under the terms of the GNU Library General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - The GNU MP Library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public - License for more details. - - You should have received a copy of the GNU Library General Public License - along with the GNU MP Library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. */ - -/* - INPUT PARAMETERS - res_ptr %r2 - s1_ptr %r3 - size %r4 - s2_limb %r5 -*/ - -#include -#include "asm-syntax.h" - - .text -ENTRY(__mpn_mul_1) - st %r6,24(%r15) - slr %r6,%r6 # cy_limb = 0 -.L0: icm %r1,15,0(%r3) # get s1_ptr[i] - mr %r0,%r5 # umul_ppmm(prod_high,prod_low,s1_ptr[j],s2_limb) - jnm .L1 - alr %r0,%r5 -.L1: ltr %r5,%r5 - jnm .L2 - al %r0,0(%r3) -.L2: alr %r1,%r6 # prod_low += cy_limb - lr %r6,%r0 # cy_limb = prod_high - brc 12,.L3 - ahi %r6,1 # + (prod_low < cy_limb) -.L3: st %r1,0(%r2) - la %r2,4(0,%r2) - la %r3,4(0,%r3) - brct %r4,.L0 - lr %r2,%r6 # return cy_limb - l %r6,24(%r15) -.Lexit: br %r14 -END(__mpn_mul_1) diff --git a/sysdeps/s390/s390-32/Dist b/sysdeps/s390/s390-32/Dist new file mode 100644 index 0000000..fdba667 --- /dev/null +++ b/sysdeps/s390/s390-32/Dist @@ -0,0 +1,3 @@ +s390-mcount.S +machine-gmon.h +fpu/fenv_libc.h diff --git a/sysdeps/s390/s390-32/Implies b/sysdeps/s390/s390-32/Implies new file mode 100644 index 0000000..71bec4d --- /dev/null +++ b/sysdeps/s390/s390-32/Implies @@ -0,0 +1,4 @@ +wordsize-32 +ieee754 +ieee754/dbl-64 +ieee754/flt-32 diff --git a/sysdeps/s390/s390-32/Makefile b/sysdeps/s390/s390-32/Makefile new file mode 100644 index 0000000..057862d --- /dev/null +++ b/sysdeps/s390/s390-32/Makefile @@ -0,0 +1,11 @@ +pic-ccflag = -fpic + +ifeq ($(subdir),gmon) +sysdep_routines += s390-mcount +endif + +ifeq ($(subdir),elf) +CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused +CFLAGS-dl-load.c += -Wno-unused +CFLAGS-dl-reloc.c += -Wno-unused +endif diff --git a/sysdeps/s390/s390-32/Versions b/sysdeps/s390/s390-32/Versions new file mode 100644 index 0000000..2b020f8 --- /dev/null +++ b/sysdeps/s390/s390-32/Versions @@ -0,0 +1,6 @@ +libc { + GLIBC_2.0 { + # Functions from libgcc. + __divdi3; __moddi3; __udivdi3; __umoddi3; + } +} diff --git a/sysdeps/s390/s390-32/__longjmp.c b/sysdeps/s390/s390-32/__longjmp.c new file mode 100644 index 0000000..3020abd --- /dev/null +++ b/sysdeps/s390/s390-32/__longjmp.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include + +/* Jump to the position specified by ENV, causing the + setjmp call there to return VAL, or 1 if VAL is 0. */ +void +__longjmp (__jmp_buf env, int val) +{ + /* Restore registers and jump back. */ + asm volatile ("lr %%r2,%0\n\t" /* PUT val in grp 2. */ + "ld %%f6,48(%1)\n\t" + "ld %%f4,40(%1)\n\t" + "lm %%r6,%%r15,0(%1)\n\t" + "br %%r14" + : : "r" (val == 0 ? 1 : val), + "a" (env) : "2" ); + + /* Avoid `volatile function does return' warnings. */ + for (;;); +} diff --git a/sysdeps/s390/s390-32/add_n.S b/sysdeps/s390/s390-32/add_n.S new file mode 100644 index 0000000..7616073 --- /dev/null +++ b/sysdeps/s390/s390-32/add_n.S @@ -0,0 +1,63 @@ +/* Add two limb vectors of the same length > 0 and store sum in a third + limb vector. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + This file is part of the GNU MP Library. + + The GNU MP Library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + The GNU MP Library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with the GNU MP Library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* + INPUT PARAMETERS + res_ptr %r2 + s1_ptr %r3 + s2_ptr %r4 + size %r5 +*/ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(__mpn_add_n) + st %r6,24(%r15) # save register 6 + sr %r1,%r1 + lhi %r0,1 # cannot use ahi to add carry, use alr +.L0: l %r6,0(%r1,%r3) # .L0 -> no carry from last add + al %r6,0(%r1,%r4) + st %r6,0(%r1,%r2) + la %r1,4(0,%r1) + brc 3,.L3 +.L1: brct %r5,.L0 + slr %r2,%r2 # no last carry to return + j .Lexit +.L2: l %r6,0(%r1,%r3) # .L2 -> carry from last add + al %r6,0(%r1,%r4) + brc 3,.L4 + alr %r6,%r0 # no carry yet, add carry from last add + st %r6,0(%r1,%r2) + la %r1,4(0,%r1) + brc 12,.L1 # new carry ? +.L3: brct %r5,.L2 + lr %r2,%r0 # return last carry + j .Lexit +.L4: alr %r6,%r0 # already a carry, add carry from last add + st %r6,0(%r1,%r2) + la %r1,4(0,%r1) + brct %r5,.L2 + lr %r2,%r0 # return last carry +.Lexit: l %r6,24(%r15) # restore register 6 + br %r14 +END(__mpn_add_n) diff --git a/sysdeps/s390/s390-32/addmul_1.S b/sysdeps/s390/s390-32/addmul_1.S new file mode 100644 index 0000000..5a7ccf8 --- /dev/null +++ b/sysdeps/s390/s390-32/addmul_1.S @@ -0,0 +1,58 @@ +/* S390 __mpn_addmul_1 -- Multiply a limb vector with a limb and add + the result to a second limb vector. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + This file is part of the GNU MP Library. + + The GNU MP Library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + The GNU MP Library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with the GNU MP Library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* + INPUT PARAMETERS + res_ptr %r2 + s1_ptr %r3 + sizeP %r4 + s2_limb %r5 +*/ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(__mpn_addmul_1) + st %r6,24(%r15) + slr %r6,%r6 # cy_limb = 0 +.L0: icm %r1,15,0(%r3) # get s1_ptr[i] + mr %r0,%r5 # umul_ppmm(prod_high,prod_low,s1_ptr[j],s2_limb) + jnm .L1 + alr %r0,%r5 +.L1: ltr %r5,%r5 + jnm .L2 + al %r0,0(%r3) +.L2: alr %r1,%r6 # prod_low += cy_limb + lr %r6,%r0 # cy_limb = prod_high + brc 12,.L3 + ahi %r6,1 # + (prod_low < cy_limb) +.L3: al %r1,0(%r2) # prod_low += res_ptr[i] + brc 12,.L4 + ahi %r6,1 # cy_limb++ +.L4: st %r1,0(%r2) + la %r2,4(0,%r2) + la %r3,4(0,%r3) + brct %r4,.L0 + lr %r2,%r6 # return cy_limb + l %r6,24(%r15) +.Lexit: br %r14 +END(__mpn_addmul_1) diff --git a/sysdeps/s390/s390-32/atomicity.h b/sysdeps/s390/s390-32/atomicity.h new file mode 100644 index 0000000..f56388a --- /dev/null +++ b/sysdeps/s390/s390-32/atomicity.h @@ -0,0 +1,76 @@ +/* Low-level functions for atomic operations. S390 version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _ATOMICITY_H +#define _ATOMICITY_H 1 + +#include + +static inline int +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, int val) +{ + int result; + __asm__ __volatile__( + " L %0,%2\n" + " LA 2,%1\n" + "0: LR 0,%0\n" + " AR 0,%3\n" + " CS %0,0,0(2)\n" + " JL 0b" + : "=&d" (result), "=m" (*mem) + : "1" (*mem), "d" (val) : "0", "1", "2" ); + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + __asm__ __volatile__( + " LA 2,%0\n" + "0: L 0,%1\n" + " LR 1,0\n" + " AR 1,%2\n" + " CS 0,1,0(2)\n" + " JL 0b" + : "=m" (*mem) : "0" (*mem), "d" (val) : "0", "1", "2" ); +} + +static inline int +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + int retval; + + __asm__ __volatile__( + " la 1,%1\n" + " lr 0,%2\n" + " cs 0,%3,0(1)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&r" (retval), "+m" (*p) + : "d" (oldval) , "d" (newval) + : "memory", "0", "1", "cc"); + return !retval; +} + +#endif /* atomicity.h */ diff --git a/sysdeps/s390/s390-32/backtrace.c b/sysdeps/s390/s390-32/backtrace.c new file mode 100644 index 0000000..8e3ca7e --- /dev/null +++ b/sysdeps/s390/s390-32/backtrace.c @@ -0,0 +1,81 @@ +/* Return backtrace of current program state. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* This is a global variable set at program start time. It marks the + highest used stack address. */ +extern void *__libc_stack_end; + + +/* This is the stack layout we see for every non-leaf function. + size offset + %r15 -> +------------------+ + 4 | back chain | 0 + 4 | end of stack | 4 + 8 | glue | 8 + 8 | scratch | 16 + 40 | save area r6-r15 | 24 + 16 | save area f4,f6 | 64 + 16 | empty | 80 + +------------------+ + r14 in the save area holds the return address. +*/ + +struct layout +{ + int back_chain; + int end_of_stack; + int glue[2]; + int scratch[2]; + int save_grps[10]; + int save_fp[4]; + int empty[2]; +}; + +int +__backtrace (array, size) + void **array; + int size; +{ + /* We assume that all the code is generated with frame pointers set. */ + struct layout *stack; + int cnt = 0; + + asm ("LR %0,%%r15" : "=d" (stack) ); + /* We skip the call to this function, it makes no sense to record it. */ + stack = (struct layout *) stack->back_chain; + while (cnt < size) + { + if (stack == NULL || (void *) stack > __libc_stack_end) + /* This means the address is out of range. Note that for the + toplevel we see a frame pointer with value NULL which clearly is + out of range. */ + break; + + array[cnt++] = stack->save_grps[9]; + + stack = (struct layout *) stack->back_chain; + } + + return cnt; +} +weak_alias (__backtrace, backtrace) diff --git a/sysdeps/s390/s390-32/bcopy.S b/sysdeps/s390/s390-32/bcopy.S new file mode 100644 index 0000000..8bf5bbb --- /dev/null +++ b/sysdeps/s390/s390-32/bcopy.S @@ -0,0 +1,69 @@ +/* bcopy -- copy a block from source to destination. For IBM S390 + This file is part of the GNU C Library. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software ; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * R2 = address of source + * R3 = address of destination + * R4 = number of bytes to copy + */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(__bcopy) + clr %r2,%r3 # check against destructive overlap + jnl .L0 + lr %r1,%r2 + alr %r1,%r4 + clr %r1,%r3 + jh .L2 +.L0: + lr %r5,%r4 # source length + lr %r4,%r2 # source address + sr %r1,%r1 # set pad byte to zero + lr %r2,%r3 # set destination + lr %r3,%r5 # destination length = source length +.L1: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend + jo .L1 + br %r14 +.L2: # destructive overlay, can not use mvcle + lr %r1,%r2 # bcopy is called with source,dest + lr %r2,%r3 # memmove with dest,source! Oh, well... + lr %r3,%r1 + basr %r1,0 +.L3: +#ifdef PIC + al %r1,.L4-.L3(%r1) # get address of global offset table + # load address of memmove + l %r1,memmove@GOT12(%r1) + br %r1 +.L4: .long _GLOBAL_OFFSET_TABLE_-.L3 +#else + al %r1,.L4-.L3(%r1) # load address of memmove + br %r1 # jump to memmove +.L4: .long memmove-.L3 +#endif + +END(__bcopy) + +#ifndef NO_WEAK_ALIAS +weak_alias (__bcopy, bcopy) +#endif diff --git a/sysdeps/s390/s390-32/bits/byteswap.h b/sysdeps/s390/s390-32/bits/byteswap.h new file mode 100644 index 0000000..cc6cf41 --- /dev/null +++ b/sysdeps/s390/s390-32/bits/byteswap.h @@ -0,0 +1,86 @@ +/* Macros to swap the order of bytes in integer values. s390 version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use directly; include instead." +#endif + +#define __bswap_constant_16(x) \ + ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) + +/* Swap bytes in 16 bit value. */ +#if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_16(x) \ + (__extension__ \ + ({ unsigned short int __v; \ + if (__builtin_constant_p (x)) \ + __v = __bswap_constant_16 (x); \ + else { \ + unsigned short int __tmp = (unsigned short int) (x); \ + __asm__ __volatile__ ( \ + "sr %0,%0\n" \ + "la 1,%1\n" \ + "icm %0,2,1(1)\n" \ + "ic %0,0(1)" \ + : "=&d" (__v) : "m" (__tmp) : "1"); \ + } \ + __v; })) +#else +/* This is better than nothing. */ +#define __bswap_16(x) __bswap_constant_16 (x) +#endif + +/* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) + +#if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_32(x) \ + (__extension__ \ + ({ unsigned int __v; \ + if (__builtin_constant_p (x)) \ + __v = __bswap_constant_32 (x); \ + else { \ + unsigned int __tmp = (unsigned int) (x); \ + __asm__ __volatile__ ( \ + "la 1,%1\n" \ + "icm %0,8,3(1)\n" \ + "icm %0,4,2(1)\n" \ + "icm %0,2,1(1)\n" \ + "ic %0,0(1)" \ + : "=&d" (__v) : "m" (__tmp) : "1"); \ + } \ + __v; })) +#else +# define __bswap_32(x) __bswap_constant_32 (x) +#endif + +#if defined __GNUC__ && __GNUC__ >= 2 +/* Swap bytes in 64 bit value. */ +# define __bswap_64(x) \ + __extension__ \ + ({ union { unsigned long long int __ll; \ + unsigned long int __l[2]; } __w, __r; \ + __w.__ll = (x); \ + __r.__l[0] = __bswap_32 (__w.__l[1]); \ + __r.__l[1] = __bswap_32 (__w.__l[0]); \ + __r.__ll; }) +#endif diff --git a/sysdeps/s390/s390-32/bits/huge_val.h b/sysdeps/s390/s390-32/bits/huge_val.h new file mode 100644 index 0000000..65e0fe2 --- /dev/null +++ b/sysdeps/s390/s390-32/bits/huge_val.h @@ -0,0 +1,73 @@ +/* `HUGE_VAL' constants for s390 (where it is infinity). + Used by and functions for overflow. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#include + +/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ + +#if __GNUC_PREREQ(2,96) +# define HUGE_VAL (__extension__ 0x1.0p2047) +#else +#define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } + +#define __huge_val_t union { unsigned char __c[8]; double __d; } +#ifdef __GNUC__ +# define HUGE_VAL (__extension__ \ + ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d) +#else /* Not GCC. */ +static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; +# define HUGE_VAL (__huge_val.__d) +#endif /* GCC. */ +#endif /* GCC 2.95 */ + + +/* ISO C 99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ + +#ifdef __USE_ISOC99 + +# if __GNUC_PREREQ(2,96) + +# define HUGE_VALF (__extension__ 0x1.0p255f) +# define HUGE_VALL (__extension__ 0x1.0p255f) + +# else + +# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } + +# define __huge_valf_t union { unsigned char __c[4]; float __f; } +# ifdef __GNUC__ +# define HUGE_VALF (__extension__ \ + ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f) +# else /* Not GCC. */ +static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; +# define HUGE_VALF (__huge_valf.__f) +# endif /* GCC. */ + +/* On 390 there is no 'long double' format. Make it the same as 'double' */ +# define HUGE_VALL HUGE_VAL + +# endif /* GCC 2.95 */ + +#endif /* __USE_ISOC99. */ diff --git a/sysdeps/s390/s390-32/bits/setjmp.h b/sysdeps/s390/s390-32/bits/setjmp.h new file mode 100644 index 0000000..d3afbe5 --- /dev/null +++ b/sysdeps/s390/s390-32/bits/setjmp.h @@ -0,0 +1,52 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Define the machine-dependent type `jmp_buf'. IBM s390 version. */ + +#ifndef __S390_SETJMP_H__ +#define __S390_SETJMP_H__ + +#define __JB_GPR6 0 +#define __JB_GPR7 1 +#define __JB_GPR8 2 +#define __JB_GPR9 3 +#define __JB_GPR10 4 +#define __JB_GPR11 5 +#define __JB_GPR12 6 +#define __JB_GPR13 7 +#define __JB_GPR14 8 +#define __JB_GPR15 9 + +#ifndef _ASM + +typedef struct { + /* We save registers 6-15. */ + long int gregs[10]; + + /* We save fpu registers 4 and 6. */ + long fpregs[4]; +} __jmp_buf[1]; + +#endif + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((int) (address) < (jmpbuf)->gregs[__JB_GPR15]) + +#endif /* __S390_SETJMP_H__ */ diff --git a/sysdeps/s390/s390-32/bits/string.h b/sysdeps/s390/s390-32/bits/string.h new file mode 100644 index 0000000..7474244 --- /dev/null +++ b/sysdeps/s390/s390-32/bits/string.h @@ -0,0 +1,154 @@ +/* Optimized, inlined string functions. s390 version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _STRING_H +# error "Never use directly; include instead." +#endif + +/* The s390 processors can access unaligned multi-byte variables. */ +#define _STRING_ARCH_unaligned 1 + + +/* We only provide optimizations if the user selects them and if + GNU CC is used. */ +#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \ + && defined __GNUC__ && __GNUC__ >= 2 + +#ifndef __STRING_INLINE +# ifdef __cplusplus +# define __STRING_INLINE inline +# else +# define __STRING_INLINE extern __inline +# endif +#endif + +#define _HAVE_STRING_ARCH_strlen 1 +#ifndef _FORCE_INLINES +__STRING_INLINE size_t +strlen (__const char *__str) +{ + size_t __len; + + __asm__ __volatile__ (" sr 0,0\n" + " lr %0,%1\n" + "0: srst 0,%0\n" + " jo 0b\n" + " lr %0,0\n" + " sr %0,%1" + : "=&a" (__len) : "a" (__str) + : "cc", "0" ); + return __len; +} +#endif + +/* Copy SRC to DEST. */ +#define _HAVE_STRING_ARCH_strcpy 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strcpy (char *__dest, __const char *__src) +{ + char *tmp = __dest; + + __asm__ __volatile__ (" sr 0,0\n" + "0: mvst %0,%1\n" + " jo 0b" + : "+&a" (__dest), "+&a" (__src) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +#define _HAVE_STRING_ARCH_strncpy 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strncpy (char *__dest, __const char *__src, size_t __n) +{ + char *tmp = __dest; + + if (__n <= 0) + return tmp; + __asm__ __volatile (" slr %0,%1\n" + "0: icm 0,1,0(%1)\n" + " stc 0,0(%0,%1)\n" + " jz 2f\n" + " la %1,1(%1)\n" + " brct %2,0b\n" + " j 3f\n" + "1: la %1,1(%1)\n" + " stc 0,0(%0,%1)\n" + "2: brct %2,1b\n" + "3:" + : "+&a" (__dest), "+&a" (__src), "+&d" (__n) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +/* Append SRC onto DEST. */ +#define _HAVE_STRING_ARCH_strcat 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strcat(char *__dest, const char *__src) +{ + char *tmp = __dest; + + __asm__ __volatile__ (" sr 0,0\n" + "0: srst 0,%0\n" + " jo 0b\n" + " lr %0,0\n" + " sr 0,0\n" + "1: mvst %0,%1\n" + " jo 1b" + : "+&a" (__dest), "+&a" (__src) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +/* Append no more than N characters from SRC onto DEST. */ +#define _HAVE_STRING_ARCH_strncat 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strncat (char *__dest, __const char *__src, size_t __n) +{ + char *tmp = __dest; + + if (__n <= 0) + return tmp; + __asm__ __volatile__ (" sr 0,0\n" + "0: srst 0,%0\n" + " jo 0b\n" + " lr %0,0\n" + " slr %0,%1\n" + "1: icm 0,1,0(%1)\n" + " stc 0,0(%0,%1)\n" + " jz 2f\n" + " la %1,1(%1)\n" + " brct %2,1b\n" + " la %0,0(%0,%1)\n" + " xc 0(1,%0),0(%0)\n" + "2:" + : "+&a" (__dest), "+&a" (__src), "+&d" (__n) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +#endif /* Use string inlines && GNU CC. */ diff --git a/sysdeps/s390/s390-32/bsd-_setjmp.S b/sysdeps/s390/s390-32/bsd-_setjmp.S new file mode 100644 index 0000000..db07a3d --- /dev/null +++ b/sysdeps/s390/s390-32/bsd-_setjmp.S @@ -0,0 +1,46 @@ +/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. s390 version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This just does a tail-call to `__sigsetjmp (ARG, 0)'. + We cannot do it in C because it must be a tail-call, so frame-unwinding + in setjmp doesn't clobber the state restored by longjmp. */ + +#include + +ENTRY(_setjmp) +#ifdef PIC + /* We cannot use the PLT, because it requires that %r12 be set, but + we can't save and restore our caller's value. Instead, we do an + indirect jump through the GOT. */ + basr %r1,0 +.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ + /* get address of __sigjmp_save from got */ + l %r1,__sigjmp_save@GOT12(0,%r1) + lhi %r3,0 /* second argument of one */ + br %r1 +.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 +#else + basr %r1,0 +.L0: l %r1,.L1 - .L0(0,%r1) /* load address of __sigsetjmp */ + lhi %r3,0 /* second argument of zero */ + br %r1 /* branch to __sigsetjmp */ +.L1: .long __sigsetjmp +#endif +END (_setjmp) diff --git a/sysdeps/s390/s390-32/bsd-setjmp.S b/sysdeps/s390/s390-32/bsd-setjmp.S new file mode 100644 index 0000000..e246319 --- /dev/null +++ b/sysdeps/s390/s390-32/bsd-setjmp.S @@ -0,0 +1,46 @@ +/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. s390 version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. + We cannot do it in C because it must be a tail-call, so frame-unwinding + in setjmp doesn't clobber the state restored by longjmp. */ + +#include + +ENTRY(setjmp) +#ifdef PIC + /* We cannot use the PLT, because it requires that %r12 be set, but + we can't save and restore our caller's value. Instead, we do an + indirect jump through the GOT. */ + basr %r1,0 +.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ + /* get address of __sigjmp_save from got */ + l %r1,__sigjmp_save@GOT12(0,%r1) + lhi %r3,1 /* second argument of one */ + br %r1 +.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 +#else + basr %r1,0 +.L0: l %r1,.L1 - .L0(0,%r1) /* load address of __sigsetjmp */ + lhi %r3,1 /* second argument of zero */ + br %r1 /* branch to __sigsetjmp */ +.L1: .long __sigsetjmp +#endif +END (setjmp) diff --git a/sysdeps/s390/s390-32/bzero.S b/sysdeps/s390/s390-32/bzero.S new file mode 100644 index 0000000..b6d9811 --- /dev/null +++ b/sysdeps/s390/s390-32/bzero.S @@ -0,0 +1,43 @@ +/* bzero -- set a block of memory to zero. IBM S390 version + This file is part of the GNU C Library. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * R2 = address to memory area + * R3 = number of bytes to fill + */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(__bzero) + ltr %r3,%r3 + jz .L1 + sr %r1,%r1 # set pad byte to zero + sr %r4,%r4 # no source for MVCLE, only a pad byte + sr %r5,%r5 +.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend + jo .L0 +.L1: br %r14 +END(__bzero) + +#ifndef NO_WEAK_ALIAS +weak_alias (__bzero, bzero) +#endif diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h new file mode 100644 index 0000000..93613b0 --- /dev/null +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -0,0 +1,454 @@ +/* Machine-dependent ELF dynamic relocation inline functions. S390 Version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Carl Pederson & Martin Schwidefsky. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef dl_machine_h +#define dl_machine_h + + +#define ELF_MACHINE_NAME "s390" + +#include +#include +#include + +/* This is an older, now obsolete value. */ +#define EM_S390_OLD 0xA390 + +/* Return nonzero iff ELF header is compatible with the running host. */ +static inline int +elf_machine_matches_host (const Elf32_Ehdr *ehdr) +{ + return (ehdr->e_machine == EM_S390 || ehdr->e_machine == EM_S390_OLD) + && ehdr->e_ident[EI_CLASS] == ELFCLASS32; +} + + +/* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT. This must be inlined in a function which + uses global data. */ + +static inline Elf32_Addr +elf_machine_dynamic (void) +{ + register Elf32_Addr *got; + + asm( " bras %0,2f\n" + "1: .long _GLOBAL_OFFSET_TABLE_-1b\n" + "2: al %0,0(%0)" + : "=&a" (got) : : "0" ); + + return *got; +} + + +/* Return the run-time load address of the shared object. */ +static inline Elf32_Addr +elf_machine_load_address (void) +{ + Elf32_Addr addr; + + asm( " bras 1,2f\n" + "1: .long _GLOBAL_OFFSET_TABLE_ - 1b\n" + " .long _dl_start - 1b - 0x80000000\n" + "2: l %0,4(1)\n" + " ar %0,1\n" + " al 1,0(1)\n" + " sl %0,_dl_start@GOT12(1)" + : "=&d" (addr) : : "1" ); + return addr; +} + +/* Set up the loaded object described by L so its unrelocated PLT + entries will jump to the on-demand fixup code in dl-runtime.c. */ + +static inline int __attribute__ ((unused)) +elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +{ + extern void _dl_runtime_resolve (Elf32_Word); + extern void _dl_runtime_profile (Elf32_Word); + + if (l->l_info[DT_JMPREL] && lazy) + { + /* The GOT entries for functions in the PLT have not yet been filled + in. Their initial contents will arrange when called to push an + offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1], + and then jump to _GLOBAL_OFFSET_TABLE[2]. */ + Elf32_Addr *got; + got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]); + got[1] = (Elf32_Addr) l; /* Identify this shared object. */ + + /* The got[2] entry contains the address of a function which gets + called to get the address of a so far unresolved function and + jump to it. The profiling extension of the dynamic linker allows + to intercept the calls to collect information. In this case we + don't store the address in the GOT so that all future calls also + end in this function. */ + if (__builtin_expect (profile, 0)) + { + got[2] = (Elf32_Addr) &_dl_runtime_profile; + + if (_dl_name_match_p (_dl_profile, l)) + /* This is the object we are looking for. Say that we really + want profiling and the timers are started. */ + _dl_profile_map = l; + } + else + /* This function will get called to fix up the GOT entry indicated by + the offset on the stack, and then jump to the resolved address. */ + got[2] = (Elf32_Addr) &_dl_runtime_resolve; + } + + return lazy; +} + +/* This code is used in dl-runtime.c to call the `fixup' function + and then redirect to the address it returns. */ + +/* s390: + Arguments are in register. + r2 - r7 holds the original parameters for the function call, fixup + and trampoline code use r0-r5 and r14-15. For the correct function + call r2-r5 and r14-15 must be restored. + Arguments from the PLT are stored at 24(r15) and 28(r15) + and must be moved to r2 and r3 for the fixup call (see elf32-s390.c + in the binutils for the PLT code). + Fixup function address in r2. +*/ +#ifndef PROF +#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ + asm ( "\ + .text\n\ + .globl _dl_runtime_resolve\n\ + .type _dl_runtime_resolve, @function\n\ + .align 16\n\ +_dl_runtime_resolve:\n\ + # save registers\n\ + stm 2,5,32(15)\n\ + st 14,48(15)\n\ + lr 0,15\n\ + ahi 15,-96\n\ + st 0,0(15)\n\ + # load args saved by PLT\n\ + lm 2,3,120(15)\n\ + basr 1,0\n\ +0: ahi 1,1f-0b\n\ + l 14,0(1)\n\ + bas 14,0(14,1) # call fixup\n\ + lr 1,2 # function addr returned in r2\n\ + # restore registers\n\ + ahi 15,96\n\ + l 14,48(15)\n\ + lm 2,5,32(15)\n\ + br 1\n\ +1: .long fixup-1b\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ +\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_profile, @function\n\ + .align 16\n\ +_dl_runtime_profile:\n\ + # save registers\n\ + stm 2,5,32(15)\n\ + st 14,48(15)\n\ + lr 0,15\n\ + ahi 15,-96\n\ + st 0,0(15)\n\ + # load args saved by PLT\n\ + lm 2,3,120(15)\n\ + # load return address as third parameter\n\ + lr 4,14\n\ + basr 1,0\n\ +0: ahi 1,1f-0b\n\ + l 14,0(1)\n\ + bas 14,0(14,1) # call fixup\n\ + lr 1,2 # function addr returned in r2\n\ + # restore registers\n\ + ahi 15,96\n\ + l 14,48(15)\n\ + lm 2,5,32(15)\n\ + br 1\n\ +1: .long profile_fixup-1b\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ +"); +#else +#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ + asm ( "\ + .text\n\ + .globl _dl_runtime_resolve\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_resolve, @function\n\ + .type _dl_runtime_profile, @function\n\ + .align 16\n\ +_dl_runtime_resolve:\n\ +_dl_runtime_profile:\n\ + # save registers\n\ + stm 2,5,32(15)\n\ + st 14,48(15)\n\ + lr 0,15\n\ + ahi 15,-96\n\ + st 0,0(15)\n\ + # load args saved by PLT\n\ + lm 2,3,120(15)\n\ + # load return address as third parameter\n\ + lr 4,14\n\ + basr 1,0\n\ +0: ahi 1,1f-0b\n\ + l 14,0(1)\n\ + bas 14,0(14,1) # call fixup\n\ + lr 1,2 # function addr returned in r2\n\ + # restore registers\n\ + ahi 15,96\n\ + l 14,48(15)\n\ + lm 2,5,32(15)\n\ + br 1\n\ +1: .long fixup-1b\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ +"); +#endif + +/* Mask identifying addresses reserved for the user program, + where the dynamic linker should not map anything. */ +#define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL + +/* Initial entry point code for the dynamic linker. + The C function `_dl_start' is the real entry point; + its return value is the user program's entry point. */ + +#define RTLD_START asm ("\n\ +.text\n\ +.align 4\n\ +.globl _start\n\ +.globl _dl_start_user\n\ +_start:\n\ + basr %r13,0\n\ +.L0: ahi %r13,.Llit-.L0\n\ + lr %r2,%r15\n\ + # Alloc stack frame\n\ + ahi %r15,-96\n\ + # Set the back chain to zero\n\ + xc 0(4,%r15),0(%r15)\n\ + # Call _dl_start with %r2 pointing to arg on stack\n\ + l %r14,.Ladr1-.Llit(%r13)\n\ + bas %r14,0(%r14,%r13) # call _dl_start\n\ +_dl_start_user:\n\ + # Save the user entry point address in %r8.\n\ + lr %r8,%r2\n\ + # Point %r12 at the GOT.\n\ + l %r12,.Ladr0-.Llit(%r13)\n\ + ar %r12,%r13\n\ + # Store the highest stack address\n\ + l %r1,__libc_stack_end@GOT(%r12)\n\ + st %r15, 0(%r1)\n\ + # See if we were run as a command with the executable file\n\ + # name as an extra leading argument.\n\ + l %r1,_dl_skip_args@GOT12(0,%r12)\n\ + l %r1,0(%r1) # load _dl_skip_args\n\ + # Get the original argument count.\n\ + l %r0,96(%r15)\n\ + # Subtract _dl_skip_args from it.\n\ + sr %r0,%r1\n\ + # Adjust the stack pointer to skip _dl_skip_args words.\n\ + sll %r1,2\n\ + ar %r15,%r1\n\ + # Set the back chain to zero again\n\ + xc 0(4,%r15),0(%r15)\n\ + # Store back the modified argument count.\n\ + st %r0,96(%r15)\n\ + # The special initializer gets called with the stack just\n\ + # as the application's entry point will see it; it can\n\ + # switch stacks if it moves these contents over.\n\ +" RTLD_START_SPECIAL_INIT "\n\ + # Call the function to run the initializers.\n\ + # Load the parameters:\n\ + # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ + l %r2,_dl_loaded@GOT(%r12)\n\ + l %r2,0(%r2)\n\ + l %r3,96(%r15)\n\ + la %r4,100(%r15)\n\ + lr %r5,%r3\n\ + sll %r5,2\n\ + la %r5,104(%r5,%r15)\n\ + l %r1,.Ladr4-.Llit(%r13)\n\ + bas %r14,0(%r1,%r13)\n\ + # Pass our finalizer function to the user in %r14, as per ELF ABI.\n\ + l %r14,_dl_fini@GOT(%r12)\n\ + # Free stack frame\n\ + ahi %r15,96\n\ + # Jump to the user's entry point (saved in %r8).\n\ + br %r8\n\ +.Llit:\n\ +.Ladr0: .long _GLOBAL_OFFSET_TABLE_-.Llit\n\ +.Ladr1: .long _dl_start-.Llit\n\ +.Ladr4: .long _dl_init@PLT-.Llit\n\ +"); + +#ifndef RTLD_START_SPECIAL_INIT +#define RTLD_START_SPECIAL_INIT /* nothing */ +#endif + +/* Nonzero iff TYPE should not be allowed to resolve to one of + the main executable's symbols, as for a COPY reloc. */ +#define elf_machine_lookup_noexec_p(type) ((type) == R_390_COPY) + +/* Nonzero iff TYPE describes relocation of a PLT entry, so + PLT entries should not be allowed to define the value. */ +#define elf_machine_lookup_noplt_p(type) ((type) == R_390_JMP_SLOT) + +/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ +#define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT + +/* The S390 never uses Elf32_Rel relocations. */ +#define ELF_MACHINE_NO_REL 1 + +/* The S390 overlaps DT_RELA and DT_PLTREL. */ +#define ELF_MACHINE_PLTREL_OVERLAP 1 + +/* We define an initialization functions. This is called very early in + _dl_sysdep_start. */ +#define DL_PLATFORM_INIT dl_platform_init () + +extern const char *_dl_platform; + +static inline void __attribute__ ((unused)) +dl_platform_init (void) +{ + if (_dl_platform != NULL && *_dl_platform == '\0') + /* Avoid an empty string which would disturb us. */ + _dl_platform = NULL; +} + +static inline Elf32_Addr +elf_machine_fixup_plt (struct link_map *map, lookup_t t, + const Elf32_Rela *reloc, + Elf32_Addr *reloc_addr, Elf32_Addr value) +{ + return *reloc_addr = value; +} + +/* Return the final value of a plt relocation. */ +static inline Elf32_Addr +elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, + Elf32_Addr value) +{ + return value; +} + +#endif /* !dl_machine_h */ + + +#ifdef RESOLVE + +/* Perform the relocation specified by RELOC and SYM (which is fully resolved). + MAP is the object containing the reloc. */ + +static inline void +elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, + const Elf32_Sym *sym, const struct r_found_version *version, + Elf32_Addr *const reloc_addr) +{ + if (ELF32_R_TYPE (reloc->r_info) == R_390_RELATIVE) { +#ifndef RTLD_BOOTSTRAP + if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +#endif + *reloc_addr = map->l_addr + reloc->r_addend; + } + else if (ELF32_R_TYPE (reloc->r_info) != R_390_NONE) + { + const Elf32_Sym *const refsym = sym; + Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); + if (sym) + value += sym->st_value; + + switch (ELF32_R_TYPE (reloc->r_info)) + { + case R_390_COPY: + if (sym == NULL) + /* This can happen in trace mode if an object could not be + found. */ + break; + if (__builtin_expect (sym->st_size > refsym->st_size, 0) + || (__builtin_expect (sym->st_size < refsym->st_size, 0) + && __builtin_expect (_dl_verbose, 0))) + { + const char *strtab; + + strtab = (const char *) D_PTR(map,l_info[DT_STRTAB]); + _dl_error_printf ("\ +%s: Symbol `%s' has different size in shared object, consider re-linking\n", + _dl_argv[0] ?: "", + strtab + refsym->st_name); + } + memcpy (reloc_addr, (void *) value, MIN (sym->st_size, + refsym->st_size)); + break; + case R_390_GLOB_DAT: + case R_390_JMP_SLOT: + *reloc_addr = value; + break; + case R_390_32: + { +#ifndef RTLD_BOOTSTRAP + /* This is defined in rtld.c, but nowhere in the static + libc.a; make the reference weak so static programs can + still link. This declaration cannot be done when + compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because + rtld.c contains the common defn for _dl_rtld_map, which + is incompatible with a weak decl in the same file. */ + weak_extern (_dl_rtld_map); + if (map == &_dl_rtld_map) + /* Undo the relocation done here during bootstrapping. + Now we will relocate it anew, possibly using a + binding found in the user program or a loaded library + rather than the dynamic linker's built-in definitions + used while loading those libraries. */ + value -= map->l_addr + refsym->st_value; +#endif + *reloc_addr = value + reloc->r_addend; + break; + } + + case R_390_PC32: + *reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr; + break; + case R_390_NONE: + break; + default: + _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0); + break; + } + } +} + + +static inline void +elf_machine_lazy_rel (struct link_map *map, + Elf32_Addr l_addr, const Elf32_Rela *reloc) +{ + Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); + /* Check for unexpected PLT reloc type. */ + if (__builtin_expect (ELF32_R_TYPE (reloc->r_info), R_390_JMP_SLOT) + == R_390_JMP_SLOT) + *reloc_addr += l_addr; + else + _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1); +} + +#endif /* RESOLVE */ diff --git a/sysdeps/s390/s390-32/elf/bsd-_setjmp.S b/sysdeps/s390/s390-32/elf/bsd-_setjmp.S new file mode 100644 index 0000000..1417270 --- /dev/null +++ b/sysdeps/s390/s390-32/elf/bsd-_setjmp.S @@ -0,0 +1 @@ +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/sysdeps/s390/s390-32/elf/bsd-setjmp.S b/sysdeps/s390/s390-32/elf/bsd-setjmp.S new file mode 100644 index 0000000..1417270 --- /dev/null +++ b/sysdeps/s390/s390-32/elf/bsd-setjmp.S @@ -0,0 +1 @@ +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/sysdeps/s390/s390-32/elf/setjmp.S b/sysdeps/s390/s390-32/elf/setjmp.S new file mode 100644 index 0000000..fd0a169 --- /dev/null +++ b/sysdeps/s390/s390-32/elf/setjmp.S @@ -0,0 +1,61 @@ +/* setjmp for s390, ELF version. + Copyright (C) 2000 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#define _ASM +#define _SETJMP_H +#include + + /* We include the BSD entry points here as well but we make + them weak. */ +ENTRY (setjmp) + .weak C_SYMBOL_NAME (setjmp) + lhi %r3,1 /* second argument of one */ + j .Linternal_sigsetjmp /* branch relativ to __sigsetjmp */ +END (setjmp) + + /* Binary compatibility entry point. */ +ENTRY(_setjmp) + .weak C_SYMBOL_NAME (_setjmp) +ENTRY(__setjmp) + lhi %r3,0 /* second argument of zero */ + +ENTRY(__sigsetjmp) +.Linternal_sigsetjmp: + stm %r6,%r15,0(%r2) /* store registers in jmp_buf */ + std %f4,40(%r2) + std %f6,48(%r2) +#ifdef PIC + /* We cannot use the PLT, because it requires that %r12 be set, but + we can't save and restore our caller's value. Instead, we do an + indirect jump through the GOT. */ + basr %r1,0 +.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ + /* get address of __sigjmp_save from got */ + l %r1,__sigjmp_save@GOT12(0,%r1) + br %r1 +.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 +#else + basr %r1,0 +.L0: l %r1,.L1-.L0(0,%r1) /* load address of __sigjmp_save */ + br %r1 /* tail-call __sigjmp_save */ +.L1: .long __sigjmp_save +#endif +END (__sigsetjmp) diff --git a/sysdeps/s390/s390-32/elf/start.S b/sysdeps/s390/s390-32/elf/start.S new file mode 100644 index 0000000..7313b92 --- /dev/null +++ b/sysdeps/s390/s390-32/elf/start.S @@ -0,0 +1,95 @@ +/* Startup code compliant to the ELF s390 ABI. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + This is the canonical entry point, usually the first thing in the text + segment. Most registers' values are unspecified, except for: + + %r14 Contains a function pointer to be registered with `atexit'. + This is how the dynamic linker arranges to have DT_FINI + functions called for shared libraries that have been loaded + before this code runs. + + %r15 The stack contains the arguments and environment: + 0(%r15) argc + 4(%r15) argv[0] + ... + (4*argc)(%r15) NULL + (4*(argc+1))(%r15) envp[0] + ... + NULL +*/ + + .text + .globl _start +_start: + /* Setup pointer to literal pool of _start */ + basr %r13,0 +.L0: ahi %r13,.Llit-.L0 + + /* load argc and argv from stack */ + la %r4,4(%r15) # get argv + l %r3,0(%r15) # get argc + + /* align the stack to a double word boundary */ + lhi %r0,-8 + nr %r15,%r0 + + /* Setup a stack frame and a parameter area */ + ahi %r15,-104 # make room on stack + xc 0(4,%r15),0(%r15) # clear back-chain + + /* set up arguments for __libc_start_main: + main, argc, argv, envp, _init, _fini, rtld_fini, stack_end + Note that envp will be determined later in __libc_start_main + */ + stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area + la %r7,96(%r15) + l %r6,.L2-.Llit(%r13) # load pointer to _fini + l %r5,.L1-.Llit(%r13) # load pointer to _init + l %r2,.L3-.Llit(%r13) # load pointer to main + + /* ok, now branch to the libc main routine */ + l %r1,.L4-.Llit(%r13) + basr %r14,%r1 + + /* crash if __libc_start_main returns */ + .word 0 + +.Llit: +.L1: .long _init +.L2: .long _fini +.L3: .long main +.L4: .long __libc_start_main + +/* FIXME: FPU flags or what ?!? */ + + .section .rodata + .globl _fp_hw + .long 3 + .size _fp_hw, 4 + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start diff --git a/sysdeps/s390/s390-32/ffs.c b/sysdeps/s390/s390-32/ffs.c new file mode 100644 index 0000000..12f265d --- /dev/null +++ b/sysdeps/s390/s390-32/ffs.c @@ -0,0 +1,68 @@ +/* ffs -- find first set bit in a word, counted from least significant end. + This file is part of the GNU C Library. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define ffsl __something_else +#include + +#undef ffs + +/* + * ffs: find first bit set. This is defined the same way as + * the libc and compiler builtin ffs routines, therefore + * differs in spirit from the above ffz (man ffs). + */ + +int +__ffs (x) + int x; +{ + int r; + + if (x == 0) + return 0; + __asm__(" lr %%r1,%1\n" + " sr %0,%0\n" + " tml %%r1,0xFFFF\n" + " jnz 0f\n" + " ahi %0,16\n" + " srl %%r1,16\n" + "0: tml %%r1,0x00FF\n" + " jnz 1f\n" + " ahi %0,8\n" + " srl %%r1,8\n" + "1: tml %%r1,0x000F\n" + " jnz 2f\n" + " ahi %0,4\n" + " srl %%r1,4\n" + "2: tml %%r1,0x0003\n" + " jnz 3f\n" + " ahi %0,2\n" + " srl %%r1,2\n" + "3: tml %%r1,0x0001\n" + " jnz 4f\n" + " ahi %0,1\n" + "4:" + : "=&d" (r) : "d" (x) : "cc", "1" ); + return r+1; +} + +weak_alias (__ffs, ffs) +#undef ffsl +weak_alias (__ffs, ffsl) diff --git a/sysdeps/s390/s390-32/initfini.c b/sysdeps/s390/s390-32/initfini.c new file mode 100644 index 0000000..f6dfc32 --- /dev/null +++ b/sysdeps/s390/s390-32/initfini.c @@ -0,0 +1,149 @@ +/* Special .init and .fini section support for S/390. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it + and/or modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Library General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The Library General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + The GNU C Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file is compiled into assembly code which is then munged by a sed + script into two files: crti.s and crtn.s. + + * crti.s puts a function prologue at the beginning of the + .init and .fini sections and defines global symbols for + those addresses, so they can be called as functions. + + * crtn.s puts the corresponding function epilogues + in the .init and .fini sections. */ + +__asm__ (" + +#include \"defs.h\" + +/*@HEADER_ENDS*/ + +/*@TESTS_BEGIN*/ + +/*@TESTS_END*/ + +/*@_init_PROLOG_BEGINS*/ + + .section .init +#NO_APP + .align 4 +.globl _init + .type _init,@function +_init: +# leaf function 0 +# automatics 0 +# outgoing args 0 +# need frame pointer 0 +# call alloca 0 +# has varargs 0 +# incoming args (stack) 0 +# function length 36 + STM 6,15,24(15) + BRAS 13,.LTN1_0 +.LT1_0: +.LC14: + .long __gmon_start__@GOT +.LC15: + .long _GLOBAL_OFFSET_TABLE_-.LT1_0 +.LTN1_0: + LR 1,15 + AHI 15,-96 + ST 1,0(15) + L 12,.LC15-.LT1_0(13) + AR 12,13 + L 1,.LC14-.LT1_0(13) + L 1,0(1,12) + LTR 1,1 + JE .L22 + BASR 14,1 +.L22: +#APP + .align 4,0x07 + END_INIT + +/*@_init_PROLOG_ENDS*/ + +/*@_init_EPILOG_BEGINS*/ + .align 4 + .section .init +#NO_APP + .align 4 + L 4,152(15) + LM 6,15,120(15) + BR 4 +#APP + END_INIT + +/*@_init_EPILOG_ENDS*/ + +/*@_fini_PROLOG_BEGINS*/ + .section .fini +#NO_APP + .align 4 +.globl _fini + .type _fini,@function +_fini: +# leaf function 0 +# automatics 0 +# outgoing args 0 +# need frame pointer 0 +# call alloca 0 +# has varargs 0 +# incoming args (stack) 0 +# function length 30 + STM 6,15,24(15) + BRAS 13,.LTN2_0 +.LT2_0: +.LC17: + .long _GLOBAL_OFFSET_TABLE_-.LT2_0 +.LTN2_0: + LR 1,15 + AHI 15,-96 + ST 1,0(15) + L 12,.LC17-.LT2_0(13) + AR 12,13 +#APP + .align 4,0x07 + END_FINI + +/*@_fini_PROLOG_ENDS*/ + +/*@_fini_EPILOG_BEGINS*/ + .align 4 + .section .fini +#NO_APP + .align 4 + L 4,152(15) + LM 6,15,120(15) + BR 4 +#APP + END_FINI + +/*@_fini_EPILOG_ENDS*/ + +/*@TRAILER_BEGINS*/ +"); diff --git a/sysdeps/s390/s390-32/memchr.S b/sysdeps/s390/s390-32/memchr.S new file mode 100644 index 0000000..81cefef --- /dev/null +++ b/sysdeps/s390/s390-32/memchr.S @@ -0,0 +1,40 @@ +/* Search a character in a block of memory. For IBM S390 + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * R2 = address to memory area + * R3 = character to find + * R4 = number of bytes to search + */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(memchr) + lhi %r0,0xff + nr %r0,%r3 + lr %r1,%r2 + la %r2,0(%r4,%r1) +0: srst %r2,%r1 + jo 0b + brc 13,1f + slr %r2,%r2 +1: br %r14 +END(memchr) diff --git a/sysdeps/s390/s390-32/memcpy.S b/sysdeps/s390/s390-32/memcpy.S new file mode 100644 index 0000000..4bbec7c --- /dev/null +++ b/sysdeps/s390/s390-32/memcpy.S @@ -0,0 +1,41 @@ +/* Set a block of memory to some byte value. For IBM S390 + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * R2 = address to destination memory area + * R3 = address to source memory area + * R4 = number of bytes to copy + */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(memcpy) + ltr %r5,%r4 + jz .L1 + lr %r4,%r3 # %r4/%r5 = source ptr/len + lr %r3,%r5 # %r2/%r3 = dest ptr/len + lr %r0,%r2 # save source address +.L0: mvcle %r2,%r4,0 # thats it, MVCLE is your friend + jo .L0 + lr %r2,%r0 # return value is source address +.L1: + br %r14 +END(memset) diff --git a/sysdeps/s390/s390-32/memset.S b/sysdeps/s390/s390-32/memset.S new file mode 100644 index 0000000..047b14c --- /dev/null +++ b/sysdeps/s390/s390-32/memset.S @@ -0,0 +1,43 @@ +/* Set a block of memory to some byte value. For IBM S390 + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * R2 = address to memory area + * R3 = byte to fill memory with + * R4 = number of bytes to fill + */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(memset) + ltr %r4,%r4 + jz .L1 + lr %r0,%r2 # save source address + lr %r1,%r3 # move pad byte to R1 + lr %r3,%r4 + sr %r4,%r4 # no source for MVCLE, only a pad byte + sr %r5,%r5 +.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend + jo .L0 + lr %r2,%r0 # return value is source address +.L1: + br %r14 +END(memset) diff --git a/sysdeps/s390/s390-32/mul_1.S b/sysdeps/s390/s390-32/mul_1.S new file mode 100644 index 0000000..4800971 --- /dev/null +++ b/sysdeps/s390/s390-32/mul_1.S @@ -0,0 +1,55 @@ +/* __mpn_mul_1 -- Multiply a limb vector with a limb and store + the result in a second limb vector. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + This file is part of the GNU MP Library. + + The GNU MP Library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + The GNU MP Library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with the GNU MP Library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* + INPUT PARAMETERS + res_ptr %r2 + s1_ptr %r3 + size %r4 + s2_limb %r5 +*/ + +#include +#include "asm-syntax.h" + + .text +ENTRY(__mpn_mul_1) + st %r6,24(%r15) + slr %r6,%r6 # cy_limb = 0 +.L0: icm %r1,15,0(%r3) # get s1_ptr[i] + mr %r0,%r5 # umul_ppmm(prod_high,prod_low,s1_ptr[j],s2_limb) + jnm .L1 + alr %r0,%r5 +.L1: ltr %r5,%r5 + jnm .L2 + al %r0,0(%r3) +.L2: alr %r1,%r6 # prod_low += cy_limb + lr %r6,%r0 # cy_limb = prod_high + brc 12,.L3 + ahi %r6,1 # + (prod_low < cy_limb) +.L3: st %r1,0(%r2) + la %r2,4(0,%r2) + la %r3,4(0,%r3) + brct %r4,.L0 + lr %r2,%r6 # return cy_limb + l %r6,24(%r15) +.Lexit: br %r14 +END(__mpn_mul_1) diff --git a/sysdeps/s390/s390-32/s390-mcount.S b/sysdeps/s390/s390-32/s390-mcount.S new file mode 100644 index 0000000..6896291 --- /dev/null +++ b/sysdeps/s390/s390-32/s390-mcount.S @@ -0,0 +1,84 @@ +/* S/390-specific implemetation of profiling support. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com) + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* + * How profiling works on S/390: + * On the start of each function _mcount is called with the address of a + * data word in %r1 (initialized to 0, used for counting). The compiler + * with the option -p generates code of the form: + * + * STM 6,15,24(15) + * BRAS 13,.LTN0_0 + * .LT0_0: + * .LC12: .long _mcount + * .LC13: .long .LP0 + * .data + * .align 4 + * .LP0: .long 0 + * .text + * # function profiler + * st 14,4(15) + * l 14,.LC12-.LT0_0(13) + * l 1,.LC13-.LT0_0(13) + * basr 14,14 + * l 14,4(15) + * + * The _mcount implementation now has to call __mcount_internal with the + * address of .LP0 as first parameter and the return address as second + * parameter. &.LP0 was loaded to %r1 and the return address is in %r14. + * _mcount may not modify any register. + */ + + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount) + ASM_TYPE_DIRECTIVE(C_SYMBOL_NAME(_mcount), @function) + .align ALIGNARG(4) +C_LABEL(_mcount) + /* Save the caller-clobbered registers. */ + ahi %r15,-128 + stm %r14,%r5,96(%r15) + l %r2,132(%r15) # callers address = first parameter + la %r2,0(%r2) # clear bit 0 + la %r3,0(%r14) # callees address = second parameter + +#ifdef PIC + bras %r14,0f + .long _GLOBAL_OFFSET_TABLE_-. +0: al %r14,0(%r14) + l %r14,__mcount_internal@GOT(%r14) +#else + bras %r14,0f + .long __mcount_internal +0: l %r14,0(%r14) +#endif + basr %r14,%r14 + + /* + * Pop the saved registers. Please note that `mcount' has no + * return value. + */ + lm %r14,%r5,96(%r15) + ahi %r15,128 + br %r14 + ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) + +#undef mcount +weak_alias(_mcount, mcount) diff --git a/sysdeps/s390/s390-32/setjmp.S b/sysdeps/s390/s390-32/setjmp.S new file mode 100644 index 0000000..23d1039 --- /dev/null +++ b/sysdeps/s390/s390-32/setjmp.S @@ -0,0 +1,51 @@ +/* + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _ASM +#define _ASM +#endif + +#include +#include + +/* Save the current program position in ENV and return 0. */ +/* R2 = pointer to jmp_buf, R3 = savemask */ + +ENTRY(__sigsetjmp) + stm %r6,%r15,0(%r2) /* store registers in jmp_buf */ + std %f4,40(%r2) + std %f6,48(%r2) +#ifdef PIC + /* We cannot use the PLT, because it requires that %r12 be set, but + we can't save and restore our caller's value. Instead, we do an + indirect jump through the GOT. */ + basr %r1,0 +.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ + /* get address of __sigjmp_save from got */ + l %r1,__sigjmp_save@GOT12(0,%r1) + br %r1 +.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 +#else + basr %r1,0 +.L0: l %r1,.L1-.L0(0,%r1) /* load address of __sigjmp_save */ + br %r1 /* tail-call __sigjmp_save */ +.L1: .long __sigjmp_save +#endif +END (__sigsetjmp) diff --git a/sysdeps/s390/s390-32/strcpy.S b/sysdeps/s390/s390-32/strcpy.S new file mode 100644 index 0000000..cd8600c --- /dev/null +++ b/sysdeps/s390/s390-32/strcpy.S @@ -0,0 +1,36 @@ +/* strcpy - copy a string from source to destination. For IBM S390 + This file is part of the GNU C Library. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software ; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * R2 = address of destination + * R3 = address of source + */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(strcpy) + slr %r0,%r0 + lr %r1,%r2 +0: mvst %r1,%r3 + jo 0b + br %r14 +END(strcpy) diff --git a/sysdeps/s390/s390-32/strncpy.S b/sysdeps/s390/s390-32/strncpy.S new file mode 100644 index 0000000..1286526 --- /dev/null +++ b/sysdeps/s390/s390-32/strncpy.S @@ -0,0 +1,79 @@ +/* strncpy - copy at most n characters from a string from source to + destination. For IBM S390 + This file is part of the GNU C Library. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software ; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * R2 = address of destination (dst) + * R3 = address of source (src) + * R4 = max of bytes to copy + */ + +#include "sysdep.h" +#include "asm-syntax.h" + +ENTRY(strncpy) + .text + st %r2,24(%r15) # save dst pointer + slr %r2,%r3 # %r3 points to src, %r2+%r3 to dst + lhi %r1,3 + nr %r1,%r4 # last 2 bits of # bytes + srl %r4,2 + ltr %r4,%r4 # less than 4 bytes to copy ? + jz .L1 + bras %r5,.L0 # enter loop & load address of a 0 + .long 0 +.L0: icm %r0,8,0(%r3) # first byte + jz .L3 + icm %r0,4,1(%r3) # second byte + jz .L4 + icm %r0,2,2(%r3) # third byte + jz .L5 + icm %r0,1,3(%r3) # fourth byte + jz .L6 + st %r0,0(%r2,%r3) # store all four to dest. + la %r3,4(%r3) + brct %r4,.L0 +.L1: ltr %r1,%r1 + jz .Lexit +.L2: icm %r0,1,0(%r3) + stc %r0,0(%r2,%r3) + la %r3,1(%r3) + jz .L7 + brct %r1,.L2 + j .Lexit +.L3: icm %r0,4,0(%r5) +.L4: icm %r0,2,0(%r5) +.L5: icm %r0,1,0(%r5) +.L6: st %r0,0(%r2,%r3) + la %r3,4(%r3) + ahi %r4,-1 + j .L8 +.L7: ahi %r1,-1 +.L8: sll %r4,2 + alr %r4,%r1 + alr %r2,%r3 # start of dst area to be zeroed + lr %r3,%r4 + slr %r4,%r4 + slr %r5,%r5 +.L9: mvcle %r2,%r4,0 # pad dst with zeroes + jo .L9 +.Lexit: l %r2,24(%r15) # return dst pointer + br %r14 +END(strncpy) diff --git a/sysdeps/s390/s390-32/sub_n.S b/sysdeps/s390/s390-32/sub_n.S new file mode 100644 index 0000000..dd18243 --- /dev/null +++ b/sysdeps/s390/s390-32/sub_n.S @@ -0,0 +1,62 @@ +/* __mpn_sub_n -- Add two limb vectors of the same length > 0 and store + sum in a third limb vector. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + This file is part of the GNU MP Library. + + The GNU MP Library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + The GNU MP Library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with the GNU MP Library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* + INPUT PARAMETERS + res_ptr %r2 + s1_ptr %r3 + s2_ptr %r4 + size %r5 +*/ + +#include "sysdep.h" +#include "asm-syntax.h" + +ENTRY(__mpn_sub_n) + st %r6,24(%r15) # save register 6 + sr %r1,%r1 + lhi %r0,1 # cannot use ahi to add carry, use slr +.L0: l %r6,0(%r1,%r3) # .L0 -> no carry from last sub + sl %r6,0(%r1,%r4) + st %r6,0(%r1,%r2) + la %r1,4(0,%r1) + brc 4,.L3 +.L1: brct %r5,.L0 + slr %r2,%r2 # no last carry to return + j .Lexit +.L2: l %r6,0(%r1,%r3) # .L2 -> carry from last sub + sl %r6,0(%r1,%r4) + brc 4,.L4 + slr %r6,%r0 # no carry yet, add carry from last sub + st %r6,0(%r1,%r2) + la %r1,4(0,%r1) + brc 11,.L1 # new carry ? +.L3: brct %r5,.L2 + lr %r2,%r0 # return last carry + j .Lexit +.L4: slr %r6,%r0 # already a carry, add carry from last sub + st %r6,0(%r1,%r2) + la %r1,4(0,%r1) + brct %r5,.L2 + lr %r2,%r0 # return last carry +.Lexit: l %r6,24(%r15) # restore register 6 + br %r14 +END(__mpn_sub_n) diff --git a/sysdeps/s390/s390-32/sysdep.h b/sysdeps/s390/s390-32/sysdep.h new file mode 100644 index 0000000..a05b83c --- /dev/null +++ b/sysdeps/s390/s390-32/sysdep.h @@ -0,0 +1,121 @@ +/* Assembler macros for s390. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ASSEMBLER__ + +/* Syntactic details of assembler. */ + +#ifdef HAVE_ELF + +/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */ +#define ALIGNARG(log2) 1< +#include +#include +#include +#include +#include + +/* Jump to the position specified by ENV, causing the + setjmp call there to return VAL, or 1 if VAL is 0. */ +void +__longjmp (__jmp_buf env, int val) +{ + /* Restore registers and jump back. */ + asm volatile ("lgr %%r2,%0\n\t" /* Put val in grp 2. */ + "ld %%f7,104(%1)\n\t" + "ld %%f5,96(%1)\n\t" + "ld %%f3,88(%1)\n\t" + "ld %%f1,80(%1)\n\t" + "lmg %%r6,%%r15,0(%1)\n\t" + "br %%r14" + : : "r" (val == 0 ? 1 : val), + "a" (env) : "2" ); + + /* Avoid `volatile function does return' warnings. */ + for (;;); +} + diff --git a/sysdeps/s390/s390-64/add_n.S b/sysdeps/s390/s390-64/add_n.S new file mode 100644 index 0000000..734b773 --- /dev/null +++ b/sysdeps/s390/s390-64/add_n.S @@ -0,0 +1,63 @@ +/* Add two limb vectors of the same length > 0 and store sum in a third + limb vector. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + This file is part of the GNU MP Library. + + The GNU MP Library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + The GNU MP Library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with the GNU MP Library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* + INPUT PARAMETERS + res_ptr %r2 + s1_ptr %r3 + s2_ptr %r4 + size %r5 +*/ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(__mpn_add_n) + stg %r6,48(%r15) # save register 6 + slgr %r1,%r1 + lghi %r0,1 # cannot use ahi to add carry, use alr +.L0: lg %r6,0(%r1,%r3) # .L0 -> no carry from last add + alg %r6,0(%r1,%r4) + stg %r6,0(%r1,%r2) + la %r1,8(%r1) + brc 3,.L3 +.L1: brct %r5,.L0 + slgr %r2,%r2 # no last carry to return + j .Lexit +.L2: lg %r6,0(%r1,%r3) # .L2 -> carry from last add + alg %r6,0(%r1,%r4) + brc 3,.L4 + algr %r6,%r0 # no carry yet, add carry from last add + stg %r6,0(%r1,%r2) + la %r1,8(%r1) + brc 12,.L1 # new carry ? +.L3: brct %r5,.L2 + lgr %r2,%r0 # return last carry + j .Lexit +.L4: algr %r6,%r0 # already a carry, add carry from last add + stg %r6,0(%r1,%r2) + la %r1,8(%r1) + brct %r5,.L2 + lgr %r2,%r0 # return last carry +.Lexit: lg %r6,48(%r15) # restore register 6 + br %r14 +END(__mpn_add_n) diff --git a/sysdeps/s390/s390-64/atomicity.h b/sysdeps/s390/s390-64/atomicity.h new file mode 100644 index 0000000..039496e --- /dev/null +++ b/sysdeps/s390/s390-64/atomicity.h @@ -0,0 +1,76 @@ +/* Low-level functions for atomic operations. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _ATOMICITY_H +#define _ATOMICITY_H 1 + +#include + +static inline int +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, int val) +{ + int result; + __asm__ __volatile__( + " L %0,%2\n" + " LA 2,%1\n" + "0: LR 0,%0\n" + " AR 0,%3\n" + " CS %0,0,0(2)\n" + " JL 0b" + : "=&d" (result), "=m" (*mem) + : "1" (*mem), "d" (val) : "0", "1", "2" ); + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + __asm__ __volatile__( + " LA 2,%0\n" + "0: L 0,%1\n" + " LR 1,0\n" + " AR 1,%2\n" + " CS 0,1,0(2)\n" + " JL 0b" + : "=m" (*mem) : "0" (*mem), "d" (val) : "0", "1", "2" ); +} + +static inline int +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + int retval; + + __asm__ __volatile__( + " la 1,%1\n" + " lgr 0,%2\n" + " csg 0,%3,0(1)\n" + " ipm %0\n" + " srl %0,28\n" + "0:" + : "=&r" (retval), "+m" (*p) + : "d" (oldval) , "d" (newval) + : "memory", "0", "1", "cc"); + return !retval; +} + +#endif /* atomicity.h */ diff --git a/sysdeps/s390/s390-64/backtrace.c b/sysdeps/s390/s390-64/backtrace.c new file mode 100644 index 0000000..15ab214 --- /dev/null +++ b/sysdeps/s390/s390-64/backtrace.c @@ -0,0 +1,81 @@ +/* Return backtrace of current program state. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + + +/* This is a global variable set at program start time. It marks the + highest used stack address. */ +extern void *__libc_stack_end; + + +/* This is the stack layout we see for every non-leaf function. + size offset + %r15 -> +------------------+ + 8 | back chain | 0 + 8 | end of stack | 8 + 32 | scratch | 16 + 80 | save area r6-r15 | 48 + 16 | save area f4,f6 | 128 + 16 | empty | 144 + +------------------+ + r14 in the save area holds the return address. +*/ + +struct layout +{ + long back_chain; + long end_of_stack; + long scratch[4]; + long save_grps[10]; + long save_fp[2]; + long empty[2]; +}; + +int +__backtrace (array, size) + void **array; + int size; +{ + /* We assume that all the code is generated with frame pointers set. */ + struct layout *stack; + int cnt = 0; + + asm ("LGR %0,%%r15" : "=d" (stack) ); + /* We skip the call to this function, it makes no sense to record it. */ + stack = (struct layout *) stack->back_chain; + while (cnt < size) + { + if (stack == NULL || (void *) stack > __libc_stack_end) + /* This means the address is out of range. Note that for the + toplevel we see a frame pointer with value NULL which clearly is + out of range. */ + break; + + array[cnt++] = stack->save_grps[9]; + + stack = (struct layout *) stack->back_chain; + } + + return cnt; +} +weak_alias (__backtrace, backtrace) + diff --git a/sysdeps/s390/s390-64/bcopy.S b/sysdeps/s390/s390-64/bcopy.S new file mode 100644 index 0000000..5cb02b3 --- /dev/null +++ b/sysdeps/s390/s390-64/bcopy.S @@ -0,0 +1,61 @@ +/* bcopy -- copy a block from source to destination. 64 bit S/390 version. + This file is part of the GNU C Library. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software ; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = address of source + %r3 = address of destination + %r4 = number of bytes to copy. */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(__bcopy) + clgr %r2,%r3 # check against destructive overlap + jnl .L0 + lgr %r1,%r2 + algr %r1,%r4 + clgr %r1,%r3 + jh .L2 +.L0: + lgr %r5,%r4 # source length + lgr %r4,%r2 # source address + sgr %r1,%r1 # set pad byte to zero + lgr %r2,%r3 # set destination + lgr %r3,%r5 # destination length = source length +.L1: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend + jo .L1 + br %r14 +.L2: # destructive overlay, can not use mvcle + lgr %r1,%r2 # bcopy is called with source,dest + lgr %r2,%r3 # memmove with dest,source! Oh, well... + lgr %r3,%r1 +#ifdef PIC + jg memmove@PLT +#else + jg memmove +#endif + +END(__bcopy) + +#ifndef NO_WEAK_ALIAS +weak_alias (__bcopy, bcopy) +#endif + diff --git a/sysdeps/s390/s390-64/bits/byteswap.h b/sysdeps/s390/s390-64/bits/byteswap.h new file mode 100644 index 0000000..71b33f0 --- /dev/null +++ b/sysdeps/s390/s390-64/bits/byteswap.h @@ -0,0 +1,93 @@ +/* Macros to swap the order of bytes in integer values. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use directly; include instead." +#endif + +#define __bswap_constant_16(x) \ + ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) + +/* Swap bytes in 16 bit value. */ +#if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_16(x) \ + (__extension__ \ + ({ unsigned short int __v; \ + if (__builtin_constant_p (x)) \ + __v = __bswap_constant_16 (x); \ + else { \ + unsigned short int __tmp = (unsigned short int) (x); \ + __asm__ __volatile__ ( \ + "lrvh %0,%1" \ + : "=&d" (__v) : "m" (__tmp) ); \ + } \ + __v; })) +#else +/* This is better than nothing. */ +#define __bswap_16(x) __bswap_constant_16 (x) +#endif + +/* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) + +#if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_32(x) \ + (__extension__ \ + ({ unsigned int __v; \ + if (__builtin_constant_p (x)) \ + __v = __bswap_constant_32 (x); \ + else { \ + unsigned int __tmp = (unsigned int) (x); \ + __asm__ __volatile__ ( \ + "lrv %0,%1" \ + : "=&d" (__v) : "m" (__tmp)); \ + } \ + __v; })) +#else +# define __bswap_32(x) __bswap_constant_32 (x) +#endif + +/* Swap bytes in 64 bit value. */ +#define __bswap_constant_64(x) \ + ((((x)&0xff00000000000000) >> 56) | (((x)&0x00ff000000000000) >> 40) | \ + (((x)&0x0000ff0000000000) >> 24) | (((x)&0x000000ff00000000) >> 8) | \ + (((x)&0x00000000ff000000) << 8) | (((x)&0x0000000000ff0000) << 24) | \ + (((x)&0x000000000000ff00) << 40) | (((x)&0x00000000000000ff) << 56)) + +#if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_64(x) \ + (__extension__ \ + ({ unsigned long __w; \ + if (__builtin_constant_p (x)) \ + __w = __bswap_constant_64 (x); \ + else { \ + unsigned long __tmp = (unsigned long) (x); \ + __asm__ __volatile__ ( \ + "lrvg %0,%1" \ + : "=&d" (__w) : "m" (__tmp)); \ + } \ + __w; })) +#else +# define __bswap_64(x) __bswap_constant_64 (x) +#endif + + diff --git a/sysdeps/s390/s390-64/bits/huge_val.h b/sysdeps/s390/s390-64/bits/huge_val.h new file mode 100644 index 0000000..f6fd431 --- /dev/null +++ b/sysdeps/s390/s390-64/bits/huge_val.h @@ -0,0 +1,69 @@ +/* `HUGE_VAL' constants for 64 bit S/390 (where it is infinity). + Used by and functions for overflow. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#include + +/* IEEE positive infinity (-HUGE_VAL is negative infinity). */ + +#if __GNUC_PREREQ(2,96) +# define HUGE_VAL (__extension__ 0x1.0p2047) +#else +# define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } + +# define __huge_val_t union { unsigned char __c[8]; double __d; } +# ifdef __GNUC__ +# define HUGE_VAL (__extension__ \ + ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d) +# else /* Not GCC. */ +static __huge_val_t __huge_val = { __HUGE_VAL_bytes }; +# define HUGE_VAL (__huge_val.__d) +# endif /* GCC. */ +#endif /* GCC 2.95 */ + + +/* ISO C 99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ + +#ifdef __USE_ISOC99 + +# if __GNUC_PREREQ(2,96) +# define HUGE_VALF (__extension__ 0x1.0p255f) +# define HUGE_VALL (__extension__ 0x1.0p255f) +# else +# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 } +# define __huge_valf_t union { unsigned char __c[4]; float __f; } +# ifdef __GNUC__ +# define HUGE_VALF (__extension__ \ + ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f) +# else /* Not GCC. */ +static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; +# define HUGE_VALF (__huge_valf.__f) +# endif /* GCC. */ + +/* On 390 there is no 'long double' format. Make it the same as 'double' */ +# define HUGE_VALL HUGE_VAL + +# endif /* GCC 2.95 */ + +#endif /* __USE_ISOC99. */ diff --git a/sysdeps/s390/s390-64/bits/setjmp.h b/sysdeps/s390/s390-64/bits/setjmp.h new file mode 100644 index 0000000..d5c7d56 --- /dev/null +++ b/sysdeps/s390/s390-64/bits/setjmp.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Define the machine-dependent type `jmp_buf'. 64 bit S/390 version. */ + +#ifndef __S390_SETJMP_H__ +#define __S390_SETJMP_H__ + +#define __JB_GPR6 0 +#define __JB_GPR7 1 +#define __JB_GPR8 2 +#define __JB_GPR9 3 +#define __JB_GPR10 4 +#define __JB_GPR11 5 +#define __JB_GPR12 6 +#define __JB_GPR13 7 +#define __JB_GPR14 8 +#define __JB_GPR15 9 + +#ifndef _ASM + +typedef struct { + /* We save registers 6-15. */ + long int gregs[10]; + + /* We save fpu registers 4 and 6. */ + long fpregs[8]; +} __jmp_buf[1]; + +#endif + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((int) (address) < (jmpbuf)->gregs[__JB_GPR15]) + +#endif /* __S390_SETJMP_H__ */ + diff --git a/sysdeps/s390/s390-64/bits/string.h b/sysdeps/s390/s390-64/bits/string.h new file mode 100644 index 0000000..7acc2b1 --- /dev/null +++ b/sysdeps/s390/s390-64/bits/string.h @@ -0,0 +1,153 @@ +/* Optimized, inlined string functions. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _STRING_H +# error "Never use directly; include instead." +#endif + +/* The s390 processors can access unaligned multi-byte variables. */ +#define _STRING_ARCH_unaligned 1 + +/* We only provide optimizations if the user selects them and if + GNU CC is used. */ +#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \ + && defined __GNUC__ && __GNUC__ >= 2 + +#ifndef __STRING_INLINE +# ifdef __cplusplus +# define __STRING_INLINE inline +# else +# define __STRING_INLINE extern __inline +# endif +#endif + +#define _HAVE_STRING_ARCH_strlen 1 +#ifndef _FORCE_INLINES +__STRING_INLINE size_t +strlen (__const char *__str) +{ + size_t __len; + + __asm__ __volatile__ (" sgr 0,0\n" + " lgr %0,%1\n" + "0: srst 0,%0\n" + " jo 0b\n" + " lgr %0,0\n" + " sgr %0,%1" + : "=&a" (__len) : "a" (__str) + : "cc", "0" ); + return __len; +} +#endif + +/* Copy SRC to DEST. */ +#define _HAVE_STRING_ARCH_strcpy 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strcpy (char *__dest, __const char *__src) +{ + char *tmp = __dest; + + __asm__ __volatile__ (" sgr 0,0\n" + "0: mvst %0,%1\n" + " jo 0b" + : "+&a" (__dest), "+&a" (__src) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +#define _HAVE_STRING_ARCH_strncpy 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strncpy (char *__dest, __const char *__src, size_t __n) +{ + char *tmp = __dest; + + if (__n <= 0) + return tmp; + __asm__ __volatile (" slgr %0,%1\n" + "0: icm 0,1,0(%1)\n" + " stc 0,0(%0,%1)\n" + " jz 2f\n" + " la %1,1(%1)\n" + " brct %2,0b\n" + " j 3f\n" + "1: la %1,1(%1)\n" + " stc 0,0(%0,%1)\n" + "2: brct %2,1b\n" + "3:" + : "+&a" (__dest), "+&a" (__src), "+&d" (__n) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +/* Append SRC onto DEST. */ +#define _HAVE_STRING_ARCH_strcat 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strcat(char *__dest, const char *__src) +{ + char *tmp = __dest; + + __asm__ __volatile__ (" sgr 0,0\n" + "0: srst 0,%0\n" + " jo 0b\n" + " lgr %0,0\n" + " sgr 0,0\n" + "1: mvst %0,%1\n" + " jo 1b" + : "+&a" (__dest), "+&a" (__src) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +/* Append no more than N characters from SRC onto DEST. */ +#define _HAVE_STRING_ARCH_strncat 1 +#ifndef _FORCE_INLINES +__STRING_INLINE char * +strncat (char *__dest, __const char *__src, size_t __n) +{ + char *tmp = __dest; + + if (__n <= 0) + return tmp; + __asm__ __volatile__ (" sgr 0,0\n" + "0: srst 0,%0\n" + " jo 0b\n" + " lgr %0,0\n" + " slgr %0,%1\n" + "1: icm 0,1,0(%1)\n" + " stc 0,0(%0,%1)\n" + " jz 2f\n" + " la %1,1(%1)\n" + " brct %2,1b\n" + " la %0,0(%0,%1)\n" + " xc 0(1,%0),0(%0)\n" + "2:" + : "+&a" (__dest), "+&a" (__src), "+&d" (__n) : + : "cc", "memory", "0" ); + return tmp; +} +#endif + +#endif /* Use string inlines && GNU CC. */ diff --git a/sysdeps/s390/s390-64/bsd-_setjmp.S b/sysdeps/s390/s390-64/bsd-_setjmp.S new file mode 100644 index 0000000..210b24d --- /dev/null +++ b/sysdeps/s390/s390-64/bsd-_setjmp.S @@ -0,0 +1,35 @@ +/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This just does a tail-call to `__sigsetjmp (ARG, 0)'. + We cannot do it in C because it must be a tail-call, so frame-unwinding + in setjmp doesn't clobber the state restored by longjmp. */ + +#include + +ENTRY(_setjmp) + slgr %r3,%r3 /* Second argument of zero. */ +#ifdef PIC + jg __sigsetjmp@PLT /* Branch to PLT of __sigsetjmp. */ +#else + jg __sigsetjmp /* Branch to __sigsetjmp. */ +#endif +END (_setjmp) + diff --git a/sysdeps/s390/s390-64/bsd-setjmp.S b/sysdeps/s390/s390-64/bsd-setjmp.S new file mode 100644 index 0000000..4bded05 --- /dev/null +++ b/sysdeps/s390/s390-64/bsd-setjmp.S @@ -0,0 +1,34 @@ +/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This just does a tail-call to `__sigsetjmp (ARG, 1)'. + We cannot do it in C because it must be a tail-call, so frame-unwinding + in setjmp doesn't clobber the state restored by longjmp. */ + +#include + +ENTRY(setjmp) + lghi %r1,1 /* Second argument of one. */ +#ifdef PIC + jg __sigsetjmp@PLT /* Branch to PLT of __sigsetjmp. */ +#else + jg __sigsetjmp /* Branch to __sigsetjmp. */ +#endif +END (setjmp) diff --git a/sysdeps/s390/s390-64/bzero.S b/sysdeps/s390/s390-64/bzero.S new file mode 100644 index 0000000..7aad19b --- /dev/null +++ b/sysdeps/s390/s390-64/bzero.S @@ -0,0 +1,42 @@ +/* bzero -- set a block of memory to zero. 64 bit S/390 version. + This file is part of the GNU C Library. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = address of memory area + %r3 = number of bytes to fill. */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(__bzero) + ltgr %r3,%r3 + jz .L1 + sgr %r1,%r1 # set pad byte to zero + sgr %r4,%r4 # no source for MVCLE, only a pad byte + sgr %r5,%r5 +.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend + jo .L0 +.L1: br %r14 +END(__bzero) + +#ifndef NO_WEAK_ALIAS +weak_alias (__bzero, bzero) +#endif diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h new file mode 100644 index 0000000..fd1c752 --- /dev/null +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -0,0 +1,434 @@ +/* Machine-dependent ELF dynamic relocation inline functions. + 64 bit S/390 Version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef dl_machine_h +#define dl_machine_h + +#define ELF_MACHINE_NAME "s390x" + +#include +#include +#include + +/* This is an older, now obsolete value. */ +#define EM_S390_OLD 0xA390 + +/* Return nonzero iff E_MACHINE is compatible with the running host. */ +static inline int +elf_machine_matches_host (const Elf64_Ehdr *ehdr) +{ + return (ehdr->e_machine == EM_S390 || ehdr->e_machine == EM_S390_OLD) + && ehdr->e_ident[EI_CLASS] == ELFCLASS64; +} + +/* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT. This must be inlined in a function which + uses global data. */ + +static inline Elf64_Addr +elf_machine_dynamic (void) +{ + register Elf64_Addr *got; + + asm( " larl %0,_GLOBAL_OFFSET_TABLE_\n" + : "=&a" (got) : : "0" ); + + return *got; +} + +/* Return the run-time load address of the shared object. */ +static inline Elf64_Addr +elf_machine_load_address (void) +{ + Elf64_Addr addr; + + asm( " larl %0,_dl_start\n" + " larl 1,_GLOBAL_OFFSET_TABLE_\n" + " lghi 2,_dl_start@GOT\n" + " slg %0,0(2,1)" + : "=&d" (addr) : : "1", "2" ); + return addr; +} + +/* Set up the loaded object described by L so its unrelocated PLT + entries will jump to the on-demand fixup code in dl-runtime.c. */ + +static inline int __attribute__ ((unused)) +elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +{ + extern void _dl_runtime_resolve (Elf64_Word); + extern void _dl_runtime_profile (Elf64_Word); + + if (l->l_info[DT_JMPREL] && lazy) + { + /* The GOT entries for functions in the PLT have not yet been filled + in. Their initial contents will arrange when called to push an + offset into the .rela.plt section, push _GLOBAL_OFFSET_TABLE_[1], + and then jump to _GLOBAL_OFFSET_TABLE[2]. */ + Elf64_Addr *got; + got = (Elf64_Addr *) D_PTR (l, l_info[DT_PLTGOT]); + got[1] = (Elf64_Addr) l; /* Identify this shared object. */ + + /* The got[2] entry contains the address of a function which gets + called to get the address of a so far unresolved function and + jump to it. The profiling extension of the dynamic linker allows + to intercept the calls to collect information. In this case we + don't store the address in the GOT so that all future calls also + end in this function. */ + if (__builtin_expect (profile, 0)) + { + got[2] = (Elf64_Addr) &_dl_runtime_profile; + + if (_dl_name_match_p (_dl_profile, l)) + /* This is the object we are looking for. Say that we really + want profiling and the timers are started. */ + _dl_profile_map = l; + } + else + /* This function will get called to fix up the GOT entry indicated by + the offset on the stack, and then jump to the resolved address. */ + got[2] = (Elf64_Addr) &_dl_runtime_resolve; + } + + return lazy; +} + +/* This code is used in dl-runtime.c to call the `fixup' function + and then redirect to the address it returns. */ + +/* s390: + Arguments are in register. + r2 - r7 holds the original parameters for the function call, fixup + and trampoline code use r0-r5 and r14-15. For the correct function + call r2-r5 and r14-15 must be restored. + Arguments from the PLT are stored at 48(r15) and 56(r15) + and must be moved to r2 and r3 for the fixup call (see elf32-s390.c + in the binutils for the PLT code). + Fixup function address in r2. +*/ +#ifndef PROF +#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ + asm ( "\ + .text\n\ + .globl _dl_runtime_resolve\n\ + .type _dl_runtime_resolve, @function\n\ + .align 16\n\ +_dl_runtime_resolve:\n\ + # save registers\n\ + stmg 2,5,64(15)\n\ + stg 14,96(15)\n\ + lgr 0,15\n\ + aghi 15,-160\n\ + stg 0,0(15)\n\ + # load args saved by PLT\n\ + lmg 2,3,208(15)\n\ + brasl 14,fixup # call fixup + lgr 1,2 # function addr returned in r2\n\ + # restore registers\n\ + aghi 15,160\n\ + lg 14,96(15)\n\ + lmg 2,5,64(15)\n\ + br 1\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ +\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_profile, @function\n\ + .align 16\n\ +_dl_runtime_profile:\n\ + # save registers\n\ + stmg 2,5,64(15)\n\ + stg 14,96(15)\n\ + lgr 0,15\n\ + aghi 15,-160\n\ + stg 0,0(15)\n\ + # load args saved by PLT\n\ + lmg 2,3,208(15)\n\ + # load return address as third parameter\n\ + lgr 4,14\n\ + brasl 14,profile_fixup # call fixup\n\ + lgr 1,2 # function addr returned in r2\n\ + # restore registers\n\ + aghi 15,160\n\ + lg 14,96(15)\n\ + lmg 2,5,64(15)\n\ + br 1\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ +"); +#else +#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ + asm ( "\ + .text\n\ + .globl _dl_runtime_resolve\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_resolve, @function\n\ + .type _dl_runtime_profile, @function\n\ + .align 16\n\ +_dl_runtime_resolve:\n\ +_dl_runtime_profile:\n\ + # save registers\n\ + stmg 2,5,64(15)\n\ + stg 14,96(15)\n\ + lgr 0,15\n\ + aghi 15,-160\n\ + stg 0,0(15)\n\ + # load args saved by PLT\n\ + lmg 2,3,208(15)\n\ + # load return address as third parameter\n\ + lgr 4,14\n\ + brasl 14,profile_fixup # call fixup\n\ + lgr 1,2 # function addr returned in r2\n\ + # restore registers\n\ + aghi 15,160\n\ + lg 14,96(15)\n\ + lmg 2,5,64(15)\n\ + br 1\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ +"); +#endif + +/* Initial entry point code for the dynamic linker. + The C function `_dl_start' is the real entry point; + its return value is the user program's entry point. */ + +#define RTLD_START asm ("\n\ +.text\n\ +.align 4\n\ +.globl _start\n\ +.globl _dl_start_user\n\ +_start:\n\ + lgr %r2,%r15\n\ + # Alloc stack frame\n\ + aghi %r15,-160\n\ + # Set the back chain to zero\n\ + xc 0(8,%r15),0(%r15)\n\ + # Call _dl_start with %r2 pointing to arg on stack\n\ + brasl %r14,_dl_start # call _dl_start\n\ +_dl_start_user:\n\ + # Save the user entry point address in %r8.\n\ + lgr %r8,%r2\n\ + # Point %r12 at the GOT.\n\ + larl %r12,_GLOBAL_OFFSET_TABLE_\n\ + # Store the highest stack address\n\ + lghi %r1,__libc_stack_end@GOT + lg %r1,0(%r1,%r12)\n\ + stg %r15, 0(%r1)\n\ + # See if we were run as a command with the executable file\n\ + # name as an extra leading argument.\n\ + lghi %r1,_dl_skip_args@GOT + lg %r1,0(%r1,%r12)\n\ + lgf %r1,0(%r1) # load _dl_skip_args\n\ + # Get the original argument count.\n\ + lg %r0,160(%r15)\n\ + # Subtract _dl_skip_args from it.\n\ + sgr %r0,%r1\n\ + # Adjust the stack pointer to skip _dl_skip_args words.\n\ + sllg %r1,%r1,3\n\ + agr %r15,%r1\n\ + # Set the back chain to zero again\n\ + xc 0(8,%r15),0(%r15)\n\ + # Store back the modified argument count.\n\ + stg %r0,160(%r15)\n\ + # The special initializer gets called with the stack just\n\ + # as the application's entry point will see it; it can\n\ + # switch stacks if it moves these contents over.\n\ +" RTLD_START_SPECIAL_INIT "\n\ + # Call the function to run the initializers.\n\ + # Load the parameters:\n\ + # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ + lghi %r2,_dl_loaded@GOT + lg %r2,0(%r2,%r12)\n\ + lg %r2,0(%r2)\n\ + lg %r3,160(%r15)\n\ + la %r4,168(%r15)\n\ + lgr %r5,%r3\n\ + sllg %r5,%r5,3\n\ + la %r5,176(%r5,%r15)\n\ + brasl %r14,_dl_init@PLT\n + # Pass our finalizer function to the user in %r14, as per ELF ABI.\n\ + lghi %r14,_dl_fini@GOT + lg %r14,0(%r14,%r12)\n\ + # Free stack frame\n\ + aghi %r15,160\n\ + # Jump to the user's entry point (saved in %r8).\n\ + br %r8\n\ +"); + +#ifndef RTLD_START_SPECIAL_INIT +#define RTLD_START_SPECIAL_INIT /* nothing */ +#endif + +/* Nonzero iff TYPE should not be allowed to resolve to one of + the main executable's symbols, as for a COPY reloc. */ +#define elf_machine_lookup_noexec_p(type) ((type) == R_390_COPY) + +/* Nonzero iff TYPE describes relocation of a PLT entry, so + PLT entries should not be allowed to define the value. */ +#define elf_machine_lookup_noplt_p(type) ((type) == R_390_JMP_SLOT) + +/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ +#define ELF_MACHINE_JMP_SLOT R_390_JMP_SLOT + +/* The 64 bit S/390 never uses Elf64_Rel relocations. */ +#define ELF_MACHINE_NO_REL 1 + +/* We define an initialization functions. This is called very early in + _dl_sysdep_start. */ +#define DL_PLATFORM_INIT dl_platform_init () + +extern const char *_dl_platform; + +static inline void __attribute__ ((unused)) +dl_platform_init (void) +{ + if (_dl_platform != NULL && *_dl_platform == '\0') + /* Avoid an empty string which would disturb us. */ + _dl_platform = NULL; +} + +static inline Elf64_Addr +elf_machine_fixup_plt (struct link_map *map, lookup_t t, + const Elf64_Rela *reloc, + Elf64_Addr *reloc_addr, Elf64_Addr value) +{ + return *reloc_addr = value; +} + +/* Return the final value of a plt relocation. */ +static inline Elf64_Addr +elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, + Elf64_Addr value) +{ + return value; +} + +#endif /* !dl_machine_h */ + +#ifdef RESOLVE + +/* Perform the relocation specified by RELOC and SYM (which is fully resolved). + MAP is the object containing the reloc. */ + +static inline void +elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, + const Elf64_Sym *sym, const struct r_found_version *version, + Elf64_Addr *const reloc_addr) +{ + if (ELF64_R_TYPE (reloc->r_info) == R_390_RELATIVE) { +#ifndef RTLD_BOOTSTRAP + weak_extern (_dl_rtld_map); + if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +#endif + *reloc_addr = map->l_addr + reloc->r_addend; + } + else if (ELF64_R_TYPE (reloc->r_info) != R_390_NONE) + { + const Elf64_Sym *const refsym = sym; + Elf64_Addr value = RESOLVE (&sym, version, ELF64_R_TYPE (reloc->r_info)); + if (sym) + value += sym->st_value; + + switch (ELF64_R_TYPE (reloc->r_info)) + { + case R_390_GLOB_DAT: + case R_390_JMP_SLOT: + *reloc_addr = value + reloc->r_addend; + break; +#ifndef RTLD_BOOTSTRAP + case R_390_COPY: + if (sym == NULL) + /* This can happen in trace mode if an object could not be + found. */ + break; + if (__builtin_expect (sym->st_size > refsym->st_size, 0) + || (__builtin_expect (sym->st_size < refsym->st_size, 0) + && __builtin_expect (_dl_verbose, 0))) + { + const char *strtab; + + strtab = (const char *) D_PTR (map,l_info[DT_STRTAB]); + _dl_error_printf ("\ +%s: Symbol `%s' has different size in shared object, consider re-linking\n", + _dl_argv[0] ?: "", + strtab + refsym->st_name); + } + memcpy (reloc_addr, (void *) value, MIN (sym->st_size, + refsym->st_size)); + break; + case R_390_64: + *reloc_addr = value + reloc->r_addend; + break; + case R_390_32: + *(unsigned int *) reloc_addr = value + reloc->r_addend; + break; + case R_390_16: + *(unsigned short *) reloc_addr = value + reloc->r_addend; + break; + case R_390_8: + *(char *) reloc_addr = value + reloc->r_addend; + break; + case R_390_PC64: + *reloc_addr = value +reloc->r_addend - (Elf64_Addr) reloc_addr; + break; + case R_390_PC32DBL: + case R_390_PLT32DBL: + *(unsigned int *) reloc_addr = (unsigned int) + ((int) (value + reloc->r_addend - (Elf64_Addr) reloc_addr) >> 1); + break; + case R_390_PC32: + *(unsigned int *) reloc_addr = + value + reloc->r_addend - (Elf64_Addr) reloc_addr; + break; + case R_390_PC16DBL: + case R_390_PLT16DBL: + *(unsigned short *) reloc_addr = (unsigned short) + ((short) (value + reloc->r_addend - (Elf64_Addr) reloc_addr) >> 1); + break; + case R_390_PC16: + *(unsigned short *) reloc_addr = + value + reloc->r_addend - (Elf64_Addr) reloc_addr; + break; +#endif +#if !defined(RTLD_BOOTSTRAP) || defined(_NDEBUG) + default: + /* We add these checks in the version to relocate ld.so only + if we are still debugging. */ + _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0); + break; +#endif + } + } +} + +static inline void +elf_machine_lazy_rel (struct link_map *map, + Elf64_Addr l_addr, const Elf64_Rela *reloc) +{ + Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); + /* Check for unexpected PLT reloc type. */ + if (__builtin_expect (ELF64_R_TYPE (reloc->r_info), R_390_JMP_SLOT) + == R_390_JMP_SLOT) + *reloc_addr += l_addr; + else + _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1); +} + +#endif /* RESOLVE */ diff --git a/sysdeps/s390/s390-64/elf/bsd-_setjmp.S b/sysdeps/s390/s390-64/elf/bsd-_setjmp.S new file mode 100644 index 0000000..1417270 --- /dev/null +++ b/sysdeps/s390/s390-64/elf/bsd-_setjmp.S @@ -0,0 +1 @@ +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/sysdeps/s390/s390-64/elf/bsd-setjmp.S b/sysdeps/s390/s390-64/elf/bsd-setjmp.S new file mode 100644 index 0000000..1417270 --- /dev/null +++ b/sysdeps/s390/s390-64/elf/bsd-setjmp.S @@ -0,0 +1 @@ +/* We don't need any code here since the setjmp.S file contains it. */ diff --git a/sysdeps/s390/s390-64/elf/setjmp.S b/sysdeps/s390/s390-64/elf/setjmp.S new file mode 100644 index 0000000..ab19315 --- /dev/null +++ b/sysdeps/s390/s390-64/elf/setjmp.S @@ -0,0 +1,53 @@ +/* setjmp for 64 bit S/390, ELF version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#define _ASM +#define _SETJMP_H +#include + + /* We include the BSD entry points here as well but we make + them weak. */ +ENTRY (setjmp) + .weak C_SYMBOL_NAME (setjmp) + lghi %r3,1 /* Second argument of one. */ + j .Linternal_sigsetjmp /* Branch relativ to __sigsetjmp. */ +END (setjmp) + + /* Binary compatibility entry point. */ +ENTRY(_setjmp) + .weak C_SYMBOL_NAME (_setjmp) +ENTRY(__setjmp) + slgr %r3,%r3 /* Second argument of zero. */ + +ENTRY(__sigsetjmp) +.Linternal_sigsetjmp: + stmg %r6,%r15,0(%r2) /* Store registers in jmp_buf. */ + std %f1,80(%r2) + std %f3,88(%r2) + std %f5,96(%r2) + std %f7,104(%r2) +#ifdef PIC + jg __sigjmp_save@PLT /* Branch to PLT of __sigsetjmp. */ +#else + jg __sigjmp_save +#endif +END (__sigsetjmp) + diff --git a/sysdeps/s390/s390-64/elf/start.S b/sysdeps/s390/s390-64/elf/start.S new file mode 100644 index 0000000..d85c080 --- /dev/null +++ b/sysdeps/s390/s390-64/elf/start.S @@ -0,0 +1,84 @@ +/* Startup code compliant to the 64 bit S/390 ELF ABI. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + This is the canonical entry point, usually the first thing in the text + segment. Most registers' values are unspecified, except for: + + %r14 Contains a function pointer to be registered with `atexit'. + This is how the dynamic linker arranges to have DT_FINI + functions called for shared libraries that have been loaded + before this code runs. + + %r15 The stack contains the arguments and environment: + 0(%r15) argc + 8(%r15) argv[0] + ... + (8*argc)(%r15) NULL + (8*(argc+1))(%r15) envp[0] + ... + NULL +*/ + + .text + .globl _start +_start: + /* Load argc and argv from stack. */ + la %r4,8(%r15) # get argv + lg %r3,0(%r15) # get argc + + /* Align the stack to a double word boundary. */ + lghi %r0,-16 + ngr %r15,%r0 + + /* Setup a stack frame and a parameter area. */ + aghi %r15,-176 # make room on stack + xc 0(8,%r15),0(%r15) # clear back-chain + + /* Set up arguments for __libc_start_main: + main, argc, argv, envp, _init, _fini, rtld_fini, stack_end + Note that envp will be determined later in __libc_start_main. + */ + stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area + la %r7,160(%r15) + larl %r6,_fini # load pointer to _fini + larl %r5,_init # load pointer to _init + larl %r2,main # load pointer to main + + /* Ok, now branch to the libc main routine. */ + brasl %r14,__libc_start_main + + /* Crash if __libc_start_main returns. */ + .word 0 + + /* FIXME: FPU flags or what ?!? */ + + .section .rodata + .globl _fp_hw + .long 3 + .size _fp_hw, 4 + + /* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start diff --git a/sysdeps/s390/s390-64/ffs.c b/sysdeps/s390/s390-64/ffs.c new file mode 100644 index 0000000..64e0d89 --- /dev/null +++ b/sysdeps/s390/s390-64/ffs.c @@ -0,0 +1,68 @@ +/* ffs -- find first set bit in a word, counted from least significant end. + 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define ffsl __something_else +#include + +#undef ffs + +/* ffs: find first bit set. This is defined the same way as + the libc and compiler builtin ffs routines, therefore + differs in spirit from the above ffz (man ffs). */ + +int +__ffs (x) + int x; +{ + int r; + + if (x == 0) + return 0; + __asm__(" lr %%r1,%1\n" + " sr %0,%0\n" + " tml %%r1,0xFFFF\n" + " jnz 0f\n" + " ahi %0,16\n" + " srl %%r1,16\n" + "0: tml %%r1,0x00FF\n" + " jnz 1f\n" + " ahi %0,8\n" + " srl %%r1,8\n" + "1: tml %%r1,0x000F\n" + " jnz 2f\n" + " ahi %0,4\n" + " srl %%r1,4\n" + "2: tml %%r1,0x0003\n" + " jnz 3f\n" + " ahi %0,2\n" + " srl %%r1,2\n" + "3: tml %%r1,0x0001\n" + " jnz 4f\n" + " ahi %0,1\n" + "4:" + : "=&d" (r) : "d" (x) : "cc", "1" ); + return r+1; +} + +weak_alias (__ffs, ffs) +#undef ffsl +weak_alias (__ffs, ffsl) + diff --git a/sysdeps/s390/s390-64/initfini.c b/sysdeps/s390/s390-64/initfini.c new file mode 100644 index 0000000..3d14b0b --- /dev/null +++ b/sysdeps/s390/s390-64/initfini.c @@ -0,0 +1,136 @@ +/* Special .init and .fini section support for 64 bit S/390. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Library General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The Library General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + The GNU C Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file is compiled into assembly code which is then munged by a sed + script into two files: crti.s and crtn.s. + + * crti.s puts a function prologue at the beginning of the + .init and .fini sections and defines global symbols for + those addresses, so they can be called as functions. + + * crtn.s puts the corresponding function epilogues + in the .init and .fini sections. */ + +__asm__ (" + +#include \"defs.h\" + +/*@HEADER_ENDS*/ + +/*@TESTS_BEGIN*/ + +/*@TESTS_END*/ + +/*@_init_PROLOG_BEGINS*/ + + .section .init +#NO_APP + .align 4 +.globl _init + .type _init,@function +_init: +# leaf function 0 +# automatics 0 +# outgoing args 0 +# need frame pointer 0 +# call alloca 0 +# has varargs 0 +# incoming args (stack) 0 +# function length 36 + STMG 6,15,48(15) + LGR 1,15 + AGHI 15,-160 + STG 1,0(15) + LARL 12,_GLOBAL_OFFSET_TABLE_ + LGHI 1,__gmon_start__@GOT + LG 1,0(1,12) + LTGR 1,1 + JE .L22 + BASR 14,1 +.L22: +#APP + .align 4,0x07 + END_INIT + +/*@_init_PROLOG_ENDS*/ + +/*@_init_EPILOG_BEGINS*/ + .align 4 + .section .init +#NO_APP + .align 4 + LG 4,272(15) + LMG 6,15,208(15) + BR 4 +#APP + END_INIT + +/*@_init_EPILOG_ENDS*/ + +/*@_fini_PROLOG_BEGINS*/ + .section .fini +#NO_APP + .align 4 +.globl _fini + .type _fini,@function +_fini: +# leaf function 0 +# automatics 0 +# outgoing args 0 +# need frame pointer 0 +# call alloca 0 +# has varargs 0 +# incoming args (stack) 0 +# function length 30 + STMG 6,15,48(15) + LGR 1,15 + AGHI 15,-160 + STG 1,0(15) + LARL 12,_GLOBAL_OFFSET_TABLE_ +#APP + .align 4,0x07 + END_FINI + +/*@_fini_PROLOG_ENDS*/ + +/*@_fini_EPILOG_BEGINS*/ + .align 4 + .section .fini +#NO_APP + .align 4 + LG 4,272(15) + LMG 6,15,208(15) + BR 4 +#APP + END_FINI + +/*@_fini_EPILOG_ENDS*/ + +/*@TRAILER_BEGINS*/ +"); diff --git a/sysdeps/s390/s390-64/memchr.S b/sysdeps/s390/s390-64/memchr.S new file mode 100644 index 0000000..ecf5a5d --- /dev/null +++ b/sysdeps/s390/s390-64/memchr.S @@ -0,0 +1,40 @@ +/* Search a character in a block of memory. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = address to memory area + %r3 = character to find + %r4 = number of bytes to search. */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(memchr) + lghi %r0,0xff + ngr %r0,%r3 + lgr %r1,%r2 + la %r2,0(%r4,%r1) +0: srst %r2,%r1 + jo 0b + brc 13,1f + slgr %r2,%r2 +1: br %r14 +END(memchr) diff --git a/sysdeps/s390/s390-64/memcpy.S b/sysdeps/s390/s390-64/memcpy.S new file mode 100644 index 0000000..c59d3fb --- /dev/null +++ b/sysdeps/s390/s390-64/memcpy.S @@ -0,0 +1,41 @@ +/* Set a block of memory to some byte value. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = address to destination memory area + %r3 = address to source memory area + %r4 = number of bytes to copy. */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(memcpy) + ltgr %r5,%r4 + jz .L1 + lgr %r4,%r3 # %r4/%r5 = source ptr/len + lgr %r3,%r5 # %r2/%r3 = dest ptr/len + lgr %r0,%r2 # save source address +.L0: mvcle %r2,%r4,0 # thats it, MVCLE is your friend + jo .L0 + lgr %r2,%r0 # return value is source address +.L1: + br %r14 +END(memset) diff --git a/sysdeps/s390/s390-64/memset.S b/sysdeps/s390/s390-64/memset.S new file mode 100644 index 0000000..b71c036 --- /dev/null +++ b/sysdeps/s390/s390-64/memset.S @@ -0,0 +1,43 @@ +/* Set a block of memory to some byte value. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = address of memory area + %r3 = byte to fill memory with + %r4 = number of bytes to fill. */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(memset) + ltgr %r4,%r4 + jz .L1 + lgr %r0,%r2 # save source address + lgr %r1,%r3 # move pad byte to R1 + lgr %r3,%r4 + sgr %r4,%r4 # no source for MVCLE, only a pad byte + sgr %r5,%r5 +.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend + jo .L0 + lgr %r2,%r0 # return value is source address +.L1: + br %r14 +END(memset) diff --git a/sysdeps/s390/s390-64/s390x-mcount.S b/sysdeps/s390/s390-64/s390x-mcount.S new file mode 100644 index 0000000..831af9c --- /dev/null +++ b/sysdeps/s390/s390-64/s390x-mcount.S @@ -0,0 +1,72 @@ +/* 64 bit S/390-specific implemetation of profiling support. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* How profiling works on 64 bit S/390: + On the start of each function _mcount is called with the address of a + data word in %r1 (initialized to 0, used for counting). The compiler + with the option -p generates code of the form: + + STM 6,15,24(15) + BRAS 13,.LTN0_0 + .LT0_0: + .LC13: .long .LP0 + .data + .align 4 + .LP0: .long 0 + .text + # function profiler + stg 14,4(15) + lg 1,.LC13-.LT0_0(13) + brasl 14,_mcount + lg 14,4(15) + + The _mcount implementation now has to call __mcount_internal with the + address of .LP0 as first parameter and the return address as second + parameter. &.LP0 was loaded to %r1 and the return address is in %r14. + _mcount may not modify any register. */ + + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount) + ASM_TYPE_DIRECTIVE(C_SYMBOL_NAME(_mcount), @function) + .align ALIGNARG(4) +C_LABEL(_mcount) + /* Save the caller-clobbered registers. */ + aghi %r15,-224 + stmg %r14,%r5,160(%r15) + lg %r2,232(%r15) # callers address = first parameter + la %r2,0(%r2) # clear bit 0 + la %r3,0(%r14) # callees address = second parameter + +#ifdef PIC + brasl %r14,__mcount_internal@PLT +#else + brasl %r14,__mcount_internal +#endif + + /* Pop the saved registers. Please note that `mcount' has no + return value. */ + lmg %r14,%r5,160(%r15) + ahi %r15,224 + br %r14 + ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) + +#undef mcount +weak_alias(_mcount, mcount) diff --git a/sysdeps/s390/s390-64/setjmp.S b/sysdeps/s390/s390-64/setjmp.S new file mode 100644 index 0000000..32f2bd4 --- /dev/null +++ b/sysdeps/s390/s390-64/setjmp.S @@ -0,0 +1,43 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _ASM +#define _ASM +#endif + +#include +#include + +/* Save the current program position in ENV and return 0. */ +/* R2 = pointer to jmp_buf, R3 = savemask. */ + +ENTRY(__sigsetjmp) + stmg %r6,%r15,0(%r2) /* Store registers in jmp_buf. */ + std %f1,80(%r2) + std %f3,88(%r2) + std %f5,96(%r2) + std %f7,104(%r2) +#ifdef PIC + jg __sigjmp_save@PLT /* Tail-call __sigjmp_save. */ +#else + jg __sigjmp_save /* Tail-call __sigjmp_save. */ +#endif +END (__sigsetjmp) + + diff --git a/sysdeps/s390/s390-64/strcpy.S b/sysdeps/s390/s390-64/strcpy.S new file mode 100644 index 0000000..65a555e --- /dev/null +++ b/sysdeps/s390/s390-64/strcpy.S @@ -0,0 +1,35 @@ +/* strcpy - copy a string from source to destination. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation ; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY ; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = address of destination + %r3 = address of source. */ + +#include "sysdep.h" +#include "asm-syntax.h" + + .text +ENTRY(strcpy) + slgr %r0,%r0 + lgr %r1,%r2 +0: mvst %r1,%r3 + jo 0b + br %r14 +END(strcpy) diff --git a/sysdeps/s390/s390-64/strncpy.S b/sysdeps/s390/s390-64/strncpy.S new file mode 100644 index 0000000..5ea2cd5 --- /dev/null +++ b/sysdeps/s390/s390-64/strncpy.S @@ -0,0 +1,90 @@ +/* strncpy - copy at most n characters from a string from source to + destination. 64 bit S/390 version + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = address of destination (dst) + %r3 = address of source (src) + %r4 = max of bytes to copy. */ + +#include "sysdep.h" +#include "asm-syntax.h" + +ENTRY(strncpy) + .text + stg %r2,48(%r15) # save dst pointer + slgr %r2,%r3 # %r3 points to src, %r2+%r3 to dst + lghi %r1,7 + ngr %r1,%r4 # last 3 bits of # bytes + srlg %r4,%r4,3 + ltgr %r4,%r4 # less than 8 bytes to copy ? + jz .L1 + bras %r5,.L0 # enter loop & load address of a 0 + .long 0 +.L0: icmh %r0,8,0(%r3) # first byte + jz .L3 + icmh %r0,4,1(%r3) # second byte + jz .L4 + icmh %r0,2,2(%r3) # third byte + jz .L5 + icmh %r0,1,3(%r3) # fourth byte + jz .L6 + icm %r0,8,4(%r3) # fifth byte + jz .L7 + icm %r0,4,5(%r3) # sixth byte + jz .L8 + icm %r0,2,6(%r3) # seventh byte + jz .L9 + icm %r0,1,7(%r3) # eigth byte + jz .L10 + stg %r0,0(%r2,%r3) # store all eight to dest. + la %r3,8(%r3) + brct %r4,.L0 +.L1: ltgr %r1,%r1 + jz .Lexit +.L2: icm %r0,1,0(%r3) + stc %r0,0(%r2,%r3) + la %r3,1(%r3) + jz .L11 + brct %r1,.L2 + j .Lexit +.L3: icmh %r0,4,0(%r5) +.L4: icmh %r0,2,0(%r5) +.L5: icmh %r0,1,0(%r5) +.L6: icm %r0,8,0(%r5) +.L7: icm %r0,4,0(%r5) +.L8: icm %r0,2,0(%r5) +.L9: icm %r0,1,0(%r5) +.L10: stg %r0,0(%r2,%r3) + la %r3,8(%r3) + aghi %r4,-1 + j .L12 +.L11: aghi %r1,-1 +.L12: sllg %r4,%r4,3 + algr %r4,%r1 + algr %r2,%r3 # start of dst area to be zeroed + lgr %r3,%r4 + slgr %r4,%r4 + slgr %r5,%r5 +.L13: mvcle %r2,%r4,0 # pad dst with zeroes + jo .L13 +.Lexit: lg %r2,48(%r15) # return dst pointer + br %r14 +END(strncpy) diff --git a/sysdeps/s390/s390-64/sub_n.S b/sysdeps/s390/s390-64/sub_n.S new file mode 100644 index 0000000..183ebb7 --- /dev/null +++ b/sysdeps/s390/s390-64/sub_n.S @@ -0,0 +1,60 @@ +/* __mpn_sub_n -- Add two limb vectors of the same length > 0 and store + sum in a third limb vector. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + This file is part of the GNU MP Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* INPUT PARAMETERS + %r2 = res_ptr + %r3 = s1_ptr + %r4 = s2_ptr + %r5 = size. */ + +#include "sysdep.h" +#include "asm-syntax.h" + +ENTRY(__mpn_sub_n) + stg %r6,48(%r15) # save register 6 + sgr %r1,%r1 + lghi %r0,1 # cannot use ahi to add carry, use slr +.L0: lg %r6,0(%r1,%r3) # .L0 -> no carry from last sub + slg %r6,0(%r1,%r4) + stg %r6,0(%r1,%r2) + la %r1,8(%r1) + brc 4,.L3 +.L1: brct %r5,.L0 + slgr %r2,%r2 # no last carry to return + j .Lexit +.L2: lg %r6,0(%r1,%r3) # .L2 -> carry from last sub + slg %r6,0(%r1,%r4) + brc 4,.L4 + slgr %r6,%r0 # no carry yet, add carry from last sub + stg %r6,0(%r1,%r2) + la %r1,8(%r1) + brc 11,.L1 # new carry ? +.L3: brct %r5,.L2 + lgr %r2,%r0 # return last carry + j .Lexit +.L4: slgr %r6,%r0 # already a carry, add carry from last sub + stg %r6,0(%r1,%r2) + la %r1,8(%r1) + brct %r5,.L2 + lgr %r2,%r0 # return last carry +.Lexit: lg %r6,48(%r15) # restore register 6 + br %r14 +END(__mpn_sub_n) diff --git a/sysdeps/s390/s390-64/sysdep.h b/sysdeps/s390/s390-64/sysdep.h new file mode 100644 index 0000000..12f8c3a --- /dev/null +++ b/sysdeps/s390/s390-64/sysdep.h @@ -0,0 +1,112 @@ +/* Assembler macros for 64 bit S/390. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#ifdef __ASSEMBLER__ + +/* Syntactic details of assembler. */ + +#ifdef HAVE_ELF + +/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */ +#define ALIGNARG(log2) 1< - -/* - * How profiling works on S/390: - * On the start of each function _mcount is called with the address of a - * data word in %r1 (initialized to 0, used for counting). The compiler - * with the option -p generates code of the form: - * - * STM 6,15,24(15) - * BRAS 13,.LTN0_0 - * .LT0_0: - * .LC12: .long _mcount - * .LC13: .long .LP0 - * .data - * .align 4 - * .LP0: .long 0 - * .text - * # function profiler - * st 14,4(15) - * l 14,.LC12-.LT0_0(13) - * l 1,.LC13-.LT0_0(13) - * basr 14,14 - * l 14,4(15) - * - * The _mcount implementation now has to call __mcount_internal with the - * address of .LP0 as first parameter and the return address as second - * parameter. &.LP0 was loaded to %r1 and the return address is in %r14. - * _mcount may not modify any register. - */ - - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount) - ASM_TYPE_DIRECTIVE(C_SYMBOL_NAME(_mcount), @function) - .align ALIGNARG(4) -C_LABEL(_mcount) - /* Save the caller-clobbered registers. */ - ahi %r15,-128 - stm %r14,%r5,96(%r15) - l %r2,132(%r15) # callers address = first parameter - la %r2,0(%r2) # clear bit 0 - la %r3,0(%r14) # callees address = second parameter - -#ifdef PIC - bras %r14,0f - .long _GLOBAL_OFFSET_TABLE_-. -0: al %r14,0(%r14) - l %r14,__mcount_internal@GOT(%r14) -#else - bras %r14,0f - .long __mcount_internal -0: l %r14,0(%r14) -#endif - basr %r14,%r14 - - /* - * Pop the saved registers. Please note that `mcount' has no - * return value. - */ - lm %r14,%r5,96(%r15) - ahi %r15,128 - br %r14 - ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) - -#undef mcount -weak_alias(_mcount, mcount) diff --git a/sysdeps/s390/setjmp.S b/sysdeps/s390/setjmp.S deleted file mode 100644 index 5c92191..0000000 --- a/sysdeps/s390/setjmp.S +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _ASM -#define _ASM -#endif - -#include -#include - -/* Save the current program position in ENV and return 0. */ -/* R2 = pointer to jmp_buf, R3 = savemask */ - -ENTRY(__sigsetjmp) - stm %r6,%r15,0(%r2) /* store registers in jmp_buf */ -#ifdef PIC - /* We cannot use the PLT, because it requires that %r12 be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT. */ - basr %r1,0 -.L0: al %r1,.L1 - .L0(0,%r1) /* get address of global offset table */ - /* get address of __sigjmp_save from got */ - l %r1,__sigjmp_save@GOT12(0,%r1) - br %r1 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -#else - basr %r1,0 -.L0: l %r1,.L1-.L0(0,%r1) /* load address of __sigjmp_save */ - br %r1 /* tail-call __sigjmp_save */ -.L1: .long __sigjmp_save -#endif -END (__sigsetjmp) diff --git a/sysdeps/s390/strcpy.S b/sysdeps/s390/strcpy.S deleted file mode 100644 index fedefd8..0000000 --- a/sysdeps/s390/strcpy.S +++ /dev/null @@ -1,36 +0,0 @@ -/* strcpy - copy a string from source to destination. For IBM S390 - This file is part of the GNU C Library. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software ; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation ; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY ; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * R2 = address of destination - * R3 = address of source - */ - -#include "sysdep.h" -#include "asm-syntax.h" - - .text -ENTRY(strcpy) - slr %r0,%r0 - lr %r1,%r2 -0: mvst %r1,%r3 - jo 0b - br %r14 -END(strcpy) diff --git a/sysdeps/s390/strncpy.S b/sysdeps/s390/strncpy.S deleted file mode 100644 index 823eeb4..0000000 --- a/sysdeps/s390/strncpy.S +++ /dev/null @@ -1,79 +0,0 @@ -/* strncpy - copy at most n characters from a string from source to - destination. For IBM S390 - This file is part of the GNU C Library. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software ; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation ; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY ; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * R2 = address of destination (dst) - * R3 = address of source (src) - * R4 = max of bytes to copy - */ - -#include "sysdep.h" -#include "asm-syntax.h" - -ENTRY(strncpy) - .text - st %r2,24(%r15) # save dst pointer - slr %r2,%r3 # %r3 points to src, %r2+%r3 to dst - lhi %r1,3 - nr %r1,%r4 # last 2 bits of # bytes - srl %r4,2 - ltr %r4,%r4 # less than 4 bytes to copy ? - jz .L1 - bras %r5,.L0 # enter loop & load address of a 0 - .long 0 -.L0: icm %r0,8,0(%r3) # first byte - jz .L3 - icm %r0,4,1(%r3) # second byte - jz .L4 - icm %r0,2,2(%r3) # third byte - jz .L5 - icm %r0,1,3(%r3) # fourth byte - jz .L6 - st %r0,0(%r2,%r3) # store all four to dest. - la %r3,4(%r3) - brct %r4,.L0 -.L1: ltr %r1,%r1 - jz .Lexit -.L2: icm %r0,1,0(%r3) - stc %r0,0(%r2,%r3) - la %r3,1(%r3) - jz .L7 - brct %r1,.L2 - j .Lexit -.L3: icm %r0,4,0(%r5) -.L4: icm %r0,2,0(%r5) -.L5: icm %r0,1,0(%r5) -.L6: st %r0,0(%r2,%r3) - la %r3,4(%r3) - ahi %r4,-1 - j .L8 -.L7: ahi %r1,-1 -.L8: sll %r4,2 - alr %r4,%r1 - alr %r2,%r3 # start of dst area to be zeroed - lr %r3,%r4 - slr %r4,%r4 - slr %r5,%r5 -.L9: mvcle %r2,%r4,0 # pad dst with zeroes - jo .L9 -.Lexit: l %r2,24(%r15) # return dst pointer - br %r14 -END(strncpy) diff --git a/sysdeps/s390/sub_n.S b/sysdeps/s390/sub_n.S deleted file mode 100644 index 5eee0fb..0000000 --- a/sysdeps/s390/sub_n.S +++ /dev/null @@ -1,62 +0,0 @@ -/* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store - sum in a third limb vector. - Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - This file is part of the GNU MP Library. - - The GNU MP Library is free software; you can redistribute it and/or modify - it under the terms of the GNU Library General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - The GNU MP Library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public - License for more details. - - You should have received a copy of the GNU Library General Public License - along with the GNU MP Library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. */ - -/* - INPUT PARAMETERS - res_ptr %r2 - s1_ptr %r3 - s2_ptr %r4 - size %r5 -*/ - -#include "sysdep.h" -#include "asm-syntax.h" - -ENTRY(__mpn_sub_n) - st %r6,24(%r15) # save register 6 - sr %r1,%r1 - lhi %r0,1 # cannot use ahi to add carry, use slr -.L0: l %r6,0(%r1,%r3) # .L0 -> no carry from last sub - sl %r6,0(%r1,%r4) - st %r6,0(%r1,%r2) - la %r1,4(0,%r1) - brc 4,.L3 -.L1: brct %r5,.L0 - slr %r2,%r2 # no last carry to return - j .Lexit -.L2: l %r6,0(%r1,%r3) # .L2 -> carry from last sub - sl %r6,0(%r1,%r4) - brc 4,.L4 - slr %r6,%r0 # no carry yet, add carry from last sub - st %r6,0(%r1,%r2) - la %r1,4(0,%r1) - brc 11,.L1 # new carry ? -.L3: brct %r5,.L2 - lr %r2,%r0 # return last carry - j .Lexit -.L4: slr %r6,%r0 # already a carry, add carry from last sub - st %r6,0(%r1,%r2) - la %r1,4(0,%r1) - brct %r5,.L2 - lr %r2,%r0 # return last carry -.Lexit: l %r6,24(%r15) # restore register 6 - br %r14 -END(__mpn_sub_n) diff --git a/sysdeps/s390/sys/ucontext.h b/sysdeps/s390/sys/ucontext.h deleted file mode 100644 index c00bb5c..0000000 --- a/sysdeps/s390/sys/ucontext.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* System V/s390 ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include -#include - -/* Type for general register. */ -typedef int greg_t; - -/* Number of general registers. */ -#define NGREG 16 - -/* Number of each register is the `greg_t gregs[NREG]' array. */ -enum -{ - R_GPR0 = 0, -#define R_GPR0 R_GPR0 - R_GPR1 = 1, -#define R_GPR1 R_GPR1 - R_GPR2 = 2, -#define R_GPR2 R_GPR2 - R_GPR3 = 3, -#define R_GPR3 R_GPR3 - R_GPR4 = 4, -#define R_GPR4 R_GPR4 - R_GPR5 = 5, -#define R_GPR5 R_GPR5 - R_GPR6 = 6, -#define R_GPR6 R_GPR6 - R_GPR7 = 7, -#define R_GPR7 R_GPR7 - R_GPR8 = 8, -#define R_GPR8 R_GPR8 - R_GPR9 = 9, -#define R_GPR9 R_GPR9 - R_GPRA = 10, -#define R_GPRA R_GPRA - R_GPRB = 11, -#define R_GPRB R_GPRB - R_GPRC = 12, -#define R_GPRC R_GPRC - R_GPRD = 13, -#define R_GPRD R_GPRD - R_GPRE = 14, -#define R_GPRE R_GPRE - R_GPRF = 15 -#define R_GPRF R_GPRF -}; - -/* Structure to describe FPU registers. */ -typedef long long fpreg_t; - -/* Context to describe whole processor state. */ -typedef struct -{ - int version; - greg_t gregs[NGREG]; - fpreg_t fpregs[16]; -} mcontext_t; - -#define MCONTEXT_VERSION 1 - -/* Userlevel context. */ -typedef struct ucontext -{ - unsigned long int uc_flags; - struct ucontext *uc_links; - __sigset_t uc_sigmask; - stack_t uc_stack; - mcontext_t uc_mcontext; - long int uc_filler[170]; -} ucontext_t; - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/s390/sysdep.h b/sysdeps/s390/sysdep.h deleted file mode 100644 index 6915379..0000000 --- a/sysdeps/s390/sysdep.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Assembler macros for s390. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#ifdef __ASSEMBLER__ - -/* Syntactic details of assembler. */ - -#ifdef HAVE_ELF - -/* ELF uses byte-counts for .align, most others use log2 of count of bytes. */ -#define ALIGNARG(log2) 1< diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h deleted file mode 100644 index a6a2e13..0000000 --- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h +++ /dev/null @@ -1,179 +0,0 @@ -/* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _FCNTL_H -# error "Never use directly; include instead." -#endif - - -#include - -/* open/fcntl - O_SYNC is only implemented on blocks devices and on files - located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define O_FSYNC O_SYNC -#define O_ASYNC 020000 - -#ifdef __USE_GNU -# define O_DIRECT 040000 /* Direct disk access. */ -# define O_DIRECTORY 0200000 /* Must be a directory. */ -# define O_NOFOLLOW 0400000 /* Do not follow links. */ -#endif - -/* For now Linux has synchronisity options for data and read operations. - We define the symbols here but let them do the same as O_SYNC since - this is a superset. */ -#if defined __USE_POSIX199309 || defined __USE_UNIX98 -# define O_DSYNC O_SYNC /* Synchronize data. */ -# define O_RSYNC O_SYNC /* Synchronize read operations. */ -#endif - -#ifdef __USE_LARGEFILE64 -# define O_LARGEFILE 0100000 -#endif - -/* Values for the second argument to `fcntl'. */ -#define F_DUPFD 0 /* Duplicate file descriptor. */ -#define F_GETFD 1 /* Get file descriptor flags. */ -#define F_SETFD 2 /* Set file descriptor flags. */ -#define F_GETFL 3 /* Get file status flags. */ -#define F_SETFL 4 /* Set file status flags. */ -#ifndef __USE_FILE_OFFSET64 -#define F_GETLK 5 /* Get record locking info. */ -#define F_SETLK 6 /* Set record locking info (non-blocking). */ -#define F_SETLKW 7 /* Set record locking info (blocking). */ -#else -# define F_GETLK F_GETLK64 /* Get record locking info. */ -# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ -# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ -#endif -#define F_GETLK64 12 /* Get record locking info. */ -#define F_SETLK64 13 /* Set record locking info (non-blocking). */ -#define F_SETLKW64 14 /* Set record locking info (blocking). */ - -#if defined __USE_BSD || defined __USE_XOPEN2K -# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ -# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ -#endif - -#ifdef __USE_GNU -# define F_SETSIG 10 /* Set number of signal to be sent. */ -# define F_GETSIG 11 /* Get number of signal to be sent. */ -#endif - -#ifdef __USE_GNU -# define F_SETLEASE 1024 /* Set a lease. */ -# define F_GETLEASE 1025 /* Enquire what lease is active. */ -# define F_NOTIFY 1026 /* Request notfications on a directory. */ -#endif - -/* For F_[GET|SET]FL. */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ -#define F_RDLCK 0 /* Read lock. */ -#define F_WRLCK 1 /* Write lock. */ -#define F_UNLCK 2 /* Remove lock. */ - -/* for old implementation of bsd flock () */ -#define F_EXLCK 4 /* or 3 */ -#define F_SHLCK 8 /* or 4 */ - -#ifdef __USE_BSD -/* operations for bsd flock(), also used by the kernel implementation */ -# define LOCK_SH 1 /* shared lock */ -# define LOCK_EX 2 /* exclusive lock */ -# define LOCK_NB 4 /* or'd with one of the above to prevent - blocking */ -# define LOCK_UN 8 /* remove lock */ -#endif - -#ifdef __USE_GNU -# define LOCK_MAND 32 /* This is a mandatory flock: */ -# define LOCK_READ 64 /* ... which allows concurrent read operations. */ -# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ -# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ -#endif - -#ifdef __USE_GNU -/* Types of directory notifications that may be requested with F_NOTIFY. */ -# define DN_ACCESS 0x00000001 /* File accessed. */ -# define DN_MODIFY 0x00000002 /* File modified. */ -# define DN_CREATE 0x00000004 /* File created. */ -# define DN_DELETE 0x00000008 /* File removed. */ -# define DN_RENAME 0x00000010 /* File renamed. */ -# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ -# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ -#endif - -struct flock - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ -#ifndef __USE_FILE_OFFSET64 - __off_t l_start; /* Offset where the lock begins. */ - __off_t l_len; /* Size of the locked area; zero means until EOF. */ -#else - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ -#endif - __pid_t l_pid; /* Process holding the lock. */ - }; - -#ifdef __USE_LARGEFILE64 -struct flock64 - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ - __pid_t l_pid; /* Process holding the lock. */ - }; -#endif - -/* Define some more compatibility macros to be backward compatible with - BSD systems which did not managed to hide these kernel macros. */ -#ifdef __USE_BSD -# define FAPPEND O_APPEND -# define FFSYNC O_FSYNC -# define FASYNC O_ASYNC -# define FNONBLOCK O_NONBLOCK -# define FNDELAY O_NDELAY -#endif /* Use BSD. */ - -/* Advise to `posix_fadvise'. */ -#ifdef __USE_XOPEN2K -# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ -# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ -#endif diff --git a/sysdeps/unix/sysv/linux/s390/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h deleted file mode 100644 index 70069e9..0000000 --- a/sysdeps/unix/sysv/linux/s390/bits/mman.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Definitions for POSIX memory map interface. Linux/s390 version. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SYS_MMAN_H -# error "Never use directly; include instead." -#endif - -/* The following definitions basically come from the kernel headers. - But the kernel header is not namespace clean. */ - - -/* Protections are chosen from these bits, OR'd together. The - implementation does not necessarily support PROT_EXEC or PROT_WRITE - without PROT_READ. The only guarantees are that no writing will be - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ - -#define PROT_READ 0x1 /* Page can be read. */ -#define PROT_WRITE 0x2 /* Page can be written. */ -#define PROT_EXEC 0x4 /* Page can be executed. */ -#define PROT_NONE 0x0 /* Page can not be accessed. */ - -/* Sharing types (must choose one and only one of these). */ -#define MAP_SHARED 0x01 /* Share changes. */ -#define MAP_PRIVATE 0x02 /* Changes are private. */ -#ifdef __USE_MISC -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ -#endif - -/* Other flags. */ -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ -#ifdef __USE_MISC -# define MAP_FILE 0 -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ -# define MAP_ANON MAP_ANONYMOUS -#endif - -/* These are Linux-specific. */ -#ifdef __USE_MISC -# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ -# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ -# define MAP_LOCKED 0x2000 /* Lock the mapping. */ -# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ -#endif - -/* Flags to `msync'. */ -#define MS_ASYNC 1 /* Sync memory asynchronously. */ -#define MS_SYNC 4 /* Synchronous memory sync. */ -#define MS_INVALIDATE 2 /* Invalidate the caches. */ - -/* Flags for `mlockall'. */ -#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ -#define MCL_FUTURE 2 /* Lock all additions to address - space. */ - -/* Flags for `mremap'. */ -#ifdef __USE_GNU -# define MREMAP_MAYMOVE 1 -#endif - -/* Advice to `madvise'. */ -#ifdef __USE_BSD -# define MADV_NORMAL 0 /* No further special treatment. */ -# define MADV_RANDOM 1 /* Expect random page references. */ -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define MADV_WILLNEED 3 /* Will need these pages. */ -# define MADV_DONTNEED 4 /* Don't need these pages. */ -#endif - -/* The POSIX people had to invent similar names for the same things. */ -#ifdef __USE_XOPEN2K -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ -#endif diff --git a/sysdeps/unix/sysv/linux/s390/bits/resource.h b/sysdeps/unix/sysv/linux/s390/bits/resource.h deleted file mode 100644 index 8dd3972..0000000 --- a/sysdeps/unix/sysv/linux/s390/bits/resource.h +++ /dev/null @@ -1,205 +0,0 @@ -/* Bit values & structures for resource limits. Linux version. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SYS_RESOURCE_H -# error "Never use directly; include instead." -#endif - -#include - -/* Transmute defines to enumerations. The macro re-definitions are - necessary because some programs want to test for operating system - features with #ifdef RUSAGE_SELF. In ISO C the reflexive - definition is a no-op. */ - -/* Kinds of resource limit. */ -enum __rlimit_resource -{ - /* Per-process CPU limit, in seconds. */ - RLIMIT_CPU = 0, -#define RLIMIT_CPU RLIMIT_CPU - - /* Largest file that can be created, in bytes. */ - RLIMIT_FSIZE = 1, -#define RLIMIT_FSIZE RLIMIT_FSIZE - - /* Maximum size of data segment, in bytes. */ - RLIMIT_DATA = 2, -#define RLIMIT_DATA RLIMIT_DATA - - /* Maximum size of stack segment, in bytes. */ - RLIMIT_STACK = 3, -#define RLIMIT_STACK RLIMIT_STACK - - /* Largest core file that can be created, in bytes. */ - RLIMIT_CORE = 4, -#define RLIMIT_CORE RLIMIT_CORE - - /* Largest resident set size, in bytes. - This affects swapping; processes that are exceeding their - resident set size will be more likely to have physical memory - taken from them. */ - RLIMIT_RSS = 5, -#define RLIMIT_RSS RLIMIT_RSS - - /* Number of open files. */ - RLIMIT_NOFILE = 7, - RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ -#define RLIMIT_NOFILE RLIMIT_NOFILE -#define RLIMIT_OFILE RLIMIT_OFILE - - /* Address space limit. */ - RLIMIT_AS = 9, -#define RLIMIT_AS RLIMIT_AS - - /* Number of processes. */ - RLIMIT_NPROC = 6, -#define RLIMIT_NPROC RLIMIT_NPROC - - /* Locked-in-memory address space. */ - RLIMIT_MEMLOCK = 8, -#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK - - RLIMIT_NLIMITS = 10, - RLIM_NLIMITS = RLIMIT_NLIMITS -#define RLIMIT_NLIMITS RLIMIT_NLIMITS -#define RLIM_NLIMITS RLIM_NLIMITS -}; - -/* Value to indicate that there is no limit. */ -#ifndef __USE_FILE_OFFSET64 -# define RLIM_INFINITY ((unsigned long int) (~0UL)) -#else -# define RLIM_INFINITY 0xffffffffffffffffuLL -#endif - -#ifdef __USE_LARGEFILE64 -# define RLIM64_INFINITY 0xffffffffffffffffuLL -#endif - -/* We can represent all limits. */ -#define RLIM_SAVED_MAX RLIM_INFINITY -#define RLIM_SAVED_CUR RLIM_INFINITY - - -/* Type for resource quantity measurement. */ -#ifndef __USE_FILE_OFFSET64 -typedef __rlim_t rlim_t; -#else -typedef __rlim64_t rlim_t; -#endif -#ifdef __USE_LARGEFILE64 -typedef __rlim64_t rlim64_t; -#endif - -struct rlimit - { - /* The current (soft) limit. */ - rlim_t rlim_cur; - /* The hard limit. */ - rlim_t rlim_max; - }; - -#ifdef __USE_LARGEFILE64 -struct rlimit64 - { - /* The current (soft) limit. */ - rlim64_t rlim_cur; - /* The hard limit. */ - rlim64_t rlim_max; - }; -#endif - -/* Whose usage statistics do you want? */ -enum __rusage_who -{ - /* The calling process. */ - RUSAGE_SELF = 0, -#define RUSAGE_SELF RUSAGE_SELF - - /* All of its terminated child processes. */ - RUSAGE_CHILDREN = -1, -#define RUSAGE_CHILDREN RUSAGE_CHILDREN - - /* Both. */ - RUSAGE_BOTH = -2 -#define RUSAGE_BOTH RUSAGE_BOTH -}; - -#define __need_timeval -#include /* For `struct timeval'. */ - -/* Structure which says how much of each resource has been used. */ -struct rusage - { - /* Total amount of user time used. */ - struct timeval ru_utime; - /* Total amount of system time used. */ - struct timeval ru_stime; - /* Maximum resident set size (in kilobytes). */ - long int ru_maxrss; - /* Amount of sharing of text segment memory - with other processes (kilobyte-seconds). */ - long int ru_ixrss; - /* Amount of data segment memory used (kilobyte-seconds). */ - long int ru_idrss; - /* Amount of stack memory used (kilobyte-seconds). */ - long int ru_isrss; - /* Number of soft page faults (i.e. those serviced by reclaiming - a page from the list of pages awaiting reallocation. */ - long int ru_minflt; - /* Number of hard page faults (i.e. those that required I/O). */ - long int ru_majflt; - /* Number of times a process was swapped out of physical memory. */ - long int ru_nswap; - /* Number of input operations via the file system. Note: This - and `ru_oublock' do not include operations with the cache. */ - long int ru_inblock; - /* Number of output operations via the file system. */ - long int ru_oublock; - /* Number of IPC messages sent. */ - long int ru_msgsnd; - /* Number of IPC messages received. */ - long int ru_msgrcv; - /* Number of signals delivered. */ - long int ru_nsignals; - /* Number of voluntary context switches, i.e. because the process - gave up the process before it had to (usually to wait for some - resource to be available). */ - long int ru_nvcsw; - /* Number of involuntary context switches, i.e. a higher priority process - became runnable or the current process used up its time slice. */ - long int ru_nivcsw; - }; - -/* Priority limits. */ -#define PRIO_MIN -20 /* Minimum priority a process can have. */ -#define PRIO_MAX 20 /* Maximum priority a process can have. */ - -/* The type of the WHICH argument to `getpriority' and `setpriority', - indicating what flavor of entity the WHO argument specifies. */ -enum __priority_which -{ - PRIO_PROCESS = 0, /* WHO is a process ID. */ -#define PRIO_PROCESS PRIO_PROCESS - PRIO_PGRP = 1, /* WHO is a process group ID. */ -#define PRIO_PGRP PRIO_PGRP - PRIO_USER = 2 /* WHO is a user ID. */ -#define PRIO_USER PRIO_USER -}; diff --git a/sysdeps/unix/sysv/linux/s390/bits/stat.h b/sysdeps/unix/sysv/linux/s390/bits/stat.h deleted file mode 100644 index a40159b..0000000 --- a/sysdeps/unix/sysv/linux/s390/bits/stat.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SYS_STAT_H -# error "Never include directly; use instead." -#endif - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; -#ifndef __USE_FILE_OFFSET64 - unsigned long int __unused4; - unsigned long int __unused5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; - - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - __ino64_t st_ino; /* File serial number. */ - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ diff --git a/sysdeps/unix/sysv/linux/s390/chown.c b/sysdeps/unix/sysv/linux/s390/chown.c deleted file mode 100644 index 0e22192..0000000 --- a/sysdeps/unix/sysv/linux/s390/chown.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include -#include -#include -#include - -#include -#include "kernel-features.h" - -/* - In Linux 2.1.x the chown functions have been changed. A new function lchown - was introduced. The new chown now follows symlinks - the old chown and the - new lchown do not follow symlinks. - The new lchown function has the same number as the old chown had and the - new chown has a new number. When compiling with headers from Linux > 2.1.8x - it's impossible to run this libc with older kernels. In these cases libc - has therefore to route calls to chown to the old chown function. -*/ - -extern int __syscall_chown (const char *__file, - __kernel_uid_t __owner, __kernel_gid_t __group); - -/* Running under Linux > 2.1.80. */ - -#ifdef __NR_chown32 -extern int __syscall_chown32 (const char *__file, - __kernel_uid32_t owner, __kernel_gid32_t group); -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids; -# endif -#endif /* __NR_chown32 */ - -int -__real_chown (const char *file, uid_t owner, gid_t group) -{ - static int __libc_old_chown; - int result; - - if (!__libc_old_chown) - { - int saved_errno = errno; -#ifdef __NR_chown32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group); - if (result == 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -#endif /* __NR_chown32 */ - if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group); - - if (result >= 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_old_chown = 1; - } - - return __lchown (file, owner, group); -} - - -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -/* Compiling for compatibiity. */ -int -__chown_is_lchown (const char *file, uid_t owner, gid_t group) -{ - return __lchown (file, owner, group); -} -#endif - -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) -strong_alias (__chown_is_lchown, _chown_is_lchown) -compat_symbol (libc, __chown_is_lchown, __chown, GLIBC_2_0); -compat_symbol (libc, _chown_is_lchown, chown, GLIBC_2_0); - -strong_alias (__real_chown, _real_chown) -versioned_symbol (libc, __real_chown, __chown, GLIBC_2_1); -versioned_symbol (libc, _real_chown, chown, GLIBC_2_1); -#else -strong_alias (__real_chown, __chown) -weak_alias (__real_chown, chown) -#endif diff --git a/sysdeps/unix/sysv/linux/s390/clone.S b/sysdeps/unix/sysv/linux/s390/clone.S deleted file mode 100644 index bde800d..0000000 --- a/sysdeps/unix/sysv/linux/s390/clone.S +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* clone is even more special than fork as it mucks with stacks - and invokes a function in the right context after its all over. */ - -#include -#define _ERRNO_H 1 -#include - -/*int __clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg);*/ -/* sys_clone(void *child_stack, unsigned long flags) */ - - .text -ENTRY(__clone) - /* Sanity check arguments & move registers */ - ltr %r1,%r2 /* no NULL function pointers */ - lhi %r2,-EINVAL - jz SYSCALL_ERROR_LABEL - ltr %r3,%r3 /* no NULL stack pointers */ - jz SYSCALL_ERROR_LABEL - /* move child_stack and flags, then call SVC */ - lr %r2,%r3 - lr %r3,%r4 - svc SYS_ify(clone) - ltr %r2,%r2 /* check return code */ - jm SYSCALL_ERROR_LABEL - jz thread_start - br %r14 - -thread_start: - /* fn is in gpr 1, arg in gpr 5 */ - lr %r2,%r5 /* set first parameter to void *arg */ - sr %r11,%r11 /* terminate the stack frame */ - ahi %r15,-96 /* make room on the stack for the save area */ - basr %r14,%r1 /* jump to fn */ -#ifdef PIC - basr %r12,0 -.L0: lr %r1,%r12 - al %r12,.L1-.L0(%r12) - al %r1,.L2-.L0(%r1) - br %r1 /* branch to _exit -> thread termination */ -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -.L2: .long _exit@PLT - .L0 -#else - basr %r1,0 -.L0: al %r1,.L1-.L0(0,%r1) - br %r1 /* branch to _exit -> thread termination */ -.L1: .long _exit - .L0 -#endif -PSEUDO_END (__clone) diff --git a/sysdeps/unix/sysv/linux/s390/fchown.c b/sysdeps/unix/sysv/linux/s390/fchown.c deleted file mode 100644 index 3a69ecc..0000000 --- a/sysdeps/unix/sysv/linux/s390/fchown.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/fcntl.c b/sysdeps/unix/sysv/linux/s390/fcntl.c deleted file mode 100644 index ea951bc..0000000 --- a/sysdeps/unix/sysv/linux/s390/fcntl.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/fxstat.c b/sysdeps/unix/sysv/linux/s390/fxstat.c deleted file mode 100644 index 4f219f0..0000000 --- a/sysdeps/unix/sysv/linux/s390/fxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getdents64.c b/sysdeps/unix/sysv/linux/s390/getdents64.c deleted file mode 100644 index 0c75fb5..0000000 --- a/sysdeps/unix/sysv/linux/s390/getdents64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getegid.c b/sysdeps/unix/sysv/linux/s390/getegid.c deleted file mode 100644 index 37b4b4a..0000000 --- a/sysdeps/unix/sysv/linux/s390/getegid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/geteuid.c b/sysdeps/unix/sysv/linux/s390/geteuid.c deleted file mode 100644 index ebcb555..0000000 --- a/sysdeps/unix/sysv/linux/s390/geteuid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getgid.c b/sysdeps/unix/sysv/linux/s390/getgid.c deleted file mode 100644 index 0a4d606..0000000 --- a/sysdeps/unix/sysv/linux/s390/getgid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getgroups.c b/sysdeps/unix/sysv/linux/s390/getgroups.c deleted file mode 100644 index 20a7166..0000000 --- a/sysdeps/unix/sysv/linux/s390/getgroups.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getresgid.c b/sysdeps/unix/sysv/linux/s390/getresgid.c deleted file mode 100644 index b703a41..0000000 --- a/sysdeps/unix/sysv/linux/s390/getresgid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getresuid.c b/sysdeps/unix/sysv/linux/s390/getresuid.c deleted file mode 100644 index 0b14cef..0000000 --- a/sysdeps/unix/sysv/linux/s390/getresuid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getrlimit.c b/sysdeps/unix/sysv/linux/s390/getrlimit.c deleted file mode 100644 index fc06dbd..0000000 --- a/sysdeps/unix/sysv/linux/s390/getrlimit.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getrlimit64.c b/sysdeps/unix/sysv/linux/s390/getrlimit64.c deleted file mode 100644 index fef018f..0000000 --- a/sysdeps/unix/sysv/linux/s390/getrlimit64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/getuid.c b/sysdeps/unix/sysv/linux/s390/getuid.c deleted file mode 100644 index d682c79..0000000 --- a/sysdeps/unix/sysv/linux/s390/getuid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/lchown.c b/sysdeps/unix/sysv/linux/s390/lchown.c deleted file mode 100644 index 8ca77fc..0000000 --- a/sysdeps/unix/sysv/linux/s390/lchown.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -#include -#include -#include - -#include -#include "kernel-features.h" - -extern int __syscall_lchown (const char *__unbounded __file, - __kernel_uid_t __owner, __kernel_gid_t __group); - -# ifdef __NR_lchown32 -extern int __syscall_lchown32 (const char *__unbounded __file, - __kernel_uid32_t __owner, - __kernel_gid32_t __group); -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids; -# endif -# endif /* __NR_lchown32 */ - -int -__lchown (const char *file, uid_t owner, gid_t group) -{ -# if __ASSUME_32BITUIDS > 0 - return INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); -# else -# ifdef __NR_lchown32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); - if (result == 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_lchown32 */ - - if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (lchown, 3, CHECK_STRING (file), owner, group); -# endif -} - -weak_alias (__lchown, lchown) diff --git a/sysdeps/unix/sysv/linux/s390/lockf64.c b/sysdeps/unix/sysv/linux/s390/lockf64.c deleted file mode 100644 index a88f5a7..0000000 --- a/sysdeps/unix/sysv/linux/s390/lockf64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/lxstat.c b/sysdeps/unix/sysv/linux/s390/lxstat.c deleted file mode 100644 index 0efa0ae..0000000 --- a/sysdeps/unix/sysv/linux/s390/lxstat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/mmap.S b/sysdeps/unix/sysv/linux/s390/mmap.S deleted file mode 100644 index f9650e9..0000000 --- a/sysdeps/unix/sysv/linux/s390/mmap.S +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#define EINVAL 22 - - .text -ENTRY(__mmap) - /* Save registers and setup stack frame. */ - stm %r6,%r15,24(%r15) - lr %r1,%r15 - ahi %r15,-120 /* buy stack space */ - st %r1,0(%r15) /* store back chain */ - - /* Store parameters on stack, because old_mmap/mmap2 - * take only one parameter: a pointer to the parameter area - */ - 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'. */ - l %r1,216(%r15) /* Load offset. */ - -#ifdef __ASSUME_MMAP2_SYSCALL - /* I don't think it is worthwhile trying to use mmap2 whenever - * it is available. Only use it when we are sure the syscall - * exists. */ - tml %r1,0x0fff /* Offset page aligned ? */ - lhi %r2,-EINVAL - jnz 1f /* No -> EINVAL. */ - srl %r1,12 /* mmap2 takes the offset in pages. */ - st %r1,0x74(%r15) /* Store page offset. */ - la %r2,0x60(%r15) /* Load address of parameter list. */ - svc SYS_ify(mmap2) /* Do the system call trap. */ -#else - st %r1,0x74(%r15) /* Store offset unmodified. */ - la %r2,0x60(%r15) /* Load address of parameter list. */ - svc SYS_ify(mmap) /* Do the system call trap. */ -#endif - -1: l %r15,0(%r15) /* Load back chain. */ - lm %r6,%r15,24(%r15) /* Load registers. */ - - /* check gpr 2 for error */ - lhi %r0,-4096 - clr %r2,%r0 - jnl SYSCALL_ERROR_LABEL - - /* Successful; return the syscall's value. */ - br %r14 - -PSEUDO_END (__mmap) - -weak_alias (__mmap, mmap) diff --git a/sysdeps/unix/sysv/linux/s390/mmap64.S b/sysdeps/unix/sysv/linux/s390/mmap64.S deleted file mode 100644 index b42ff6f..0000000 --- a/sysdeps/unix/sysv/linux/s390/mmap64.S +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -#define EINVAL 22 -#define ENOSYS 38 - - .text -ENTRY(__mmap64) - /* Save registers and setup stack frame. */ - stm %r6,%r15,24(%r15) - lr %r1,%r15 - ahi %r15,-120 /* Buy stack space. */ - st %r1,0(%r15) /* Store back chain. */ - - /* Store parameters on stack, because mmap2 and old_mmap - * take only one parameter: a pointer to the parameter area. */ - 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'. */ - -#ifdef __NR_mmap2 - 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. */ - - la %r2,0x60(%r15) /* Load address of parameter list. */ - svc SYS_ify(mmap2) /* Do the system call trap. */ - -#ifndef __ASSUME_MMAP2_SYSCALL - chi %r0,-ENOSYS - je 1f -#endif - - l %r15,0(%r15) /* Load back chain. */ - lm %r6,%r15,24(%r15) /* Load registers. */ - - /* Check gpr 2 for error. */ - lhi %r0,-4096 - clr %r2,%r0 - jnl SYSCALL_ERROR_LABEL - - /* Successful; return the syscall's value. */ - br %r14 - -#endif - -#if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2 -1: lm %r0,%r1,216(%r15) /* Load 64 bit offset. */ - st %r1,0x74(%r15) /* Store lower word of offset. */ - ltr %r0,%r0 /* Offset > 2^32 ? */ - jnz 2f - alr %r1,%r3 /* Add length to offset. */ - brc 3,2f /* Carry -> EINVAL. */ - - la %r2,0x60(%r15) /* Load address of parameter list. */ - svc SYS_ify(mmap) /* Do the system call trap. */ - - l %r15,0(%r15) /* Load back chain. */ - lm %r6,%r15,24(%r15) /* Load registers. */ - - /* Check gpr 2 for error. */ - lhi %r0,-4096 - clr %r2,%r0 - jnl SYSCALL_ERROR_LABEL - - /* Successful; return the syscall's value. */ - br %r14 -#endif - -2: lhi %r2,-EINVAL - l %r15,0(%r15) /* Load back chain. */ - lm %r6,%r15,24(%r15) /* Load registers. */ - j SYSCALL_ERROR_LABEL - -PSEUDO_END (__mmap64) - -weak_alias (__mmap64, mmap64) diff --git a/sysdeps/unix/sysv/linux/s390/msgctl.c b/sysdeps/unix/sysv/linux/s390/msgctl.c deleted file mode 100644 index 9f9b843..0000000 --- a/sysdeps/unix/sysv/linux/s390/msgctl.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/s390/oldgetrlimit64.c deleted file mode 100644 index 4c27e95..0000000 --- a/sysdeps/unix/sysv/linux/s390/oldgetrlimit64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/readdir64.c b/sysdeps/unix/sysv/linux/s390/readdir64.c deleted file mode 100644 index 2ea26dd..0000000 --- a/sysdeps/unix/sysv/linux/s390/readdir64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/readdir64_r.c b/sysdeps/unix/sysv/linux/s390/readdir64_r.c deleted file mode 100644 index 9f54f89..0000000 --- a/sysdeps/unix/sysv/linux/s390/readdir64_r.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/register-dump.h b/sysdeps/unix/sysv/linux/s390/register-dump.h deleted file mode 100644 index 3c859aa..0000000 --- a/sysdeps/unix/sysv/linux/s390/register-dump.h +++ /dev/null @@ -1,130 +0,0 @@ -/* Dump registers. - Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -/* We will print the register dump in this format: - - GPR0: XXXXXXXX GPR1: XXXXXXXX GPR2: XXXXXXXX GPR3: XXXXXXXX - GPR4: XXXXXXXX GPR5: XXXXXXXX GPR6: XXXXXXXX GPR7: XXXXXXXX - GPR8: XXXXXXXX GPR9: XXXXXXXX GPRA: XXXXXXXX GPRB: XXXXXXXX - GPRC: XXXXXXXX GPRD: XXXXXXXX GPRE: XXXXXXXX GPRF: XXXXXXXX - - PSW.MASK: XXXXXXXX PSW.ADDR: XXXXXXXX - - ST(0) XXXX XXXXXXXXXXXXXXXX ST(1) XXXX XXXXXXXXXXXXXXXX - ST(2) XXXX XXXXXXXXXXXXXXXX ST(3) XXXX XXXXXXXXXXXXXXXX - ST(4) XXXX XXXXXXXXXXXXXXXX ST(5) XXXX XXXXXXXXXXXXXXXX - ST(6) XXXX XXXXXXXXXXXXXXXX ST(7) XXXX XXXXXXXXXXXXXXXX - - */ - -static void -hexvalue (unsigned long int value, char *buf, size_t len) -{ - char *cp = _itoa_word (value, buf + len, 16, 0); - while (cp > buf) - *--cp = '0'; -} - -static void -register_dump (int fd, struct sigcontext *ctx) -{ - char regs[19][8]; - struct iovec iov[40]; - size_t nr = 0; - -#define ADD_STRING(str) \ - iov[nr].iov_base = (char *) str; \ - iov[nr].iov_len = strlen (str); \ - ++nr -#define ADD_MEM(str, len) \ - iov[nr].iov_base = str; \ - iov[nr].iov_len = len; \ - ++nr - - /* Generate strings of register contents. */ - hexvalue (ctx->sregs->regs.gprs[0], regs[0], 8); - hexvalue (ctx->sregs->regs.gprs[1], regs[1], 8); - hexvalue (ctx->sregs->regs.gprs[2], regs[2], 8); - hexvalue (ctx->sregs->regs.gprs[3], regs[3], 8); - hexvalue (ctx->sregs->regs.gprs[4], regs[4], 8); - hexvalue (ctx->sregs->regs.gprs[5], regs[5], 8); - hexvalue (ctx->sregs->regs.gprs[6], regs[6], 8); - hexvalue (ctx->sregs->regs.gprs[7], regs[7], 8); - hexvalue (ctx->sregs->regs.gprs[8], regs[8], 8); - hexvalue (ctx->sregs->regs.gprs[9], regs[9], 8); - hexvalue (ctx->sregs->regs.gprs[10], regs[10], 8); - hexvalue (ctx->sregs->regs.gprs[11], regs[11], 8); - hexvalue (ctx->sregs->regs.gprs[12], regs[12], 8); - hexvalue (ctx->sregs->regs.gprs[13], regs[13], 8); - hexvalue (ctx->sregs->regs.gprs[14], regs[14], 8); - hexvalue (ctx->sregs->regs.gprs[15], regs[15], 8); - hexvalue (ctx->sregs->regs.psw.mask, regs[16], 8); - hexvalue (ctx->sregs->regs.psw.addr, regs[17], 8); - - /* Generate the output. */ - ADD_STRING ("Register dump:\n\n GPR0: "); - ADD_MEM (regs[0], 8); - ADD_STRING (" GPR1: "); - ADD_MEM (regs[1], 8); - ADD_STRING (" GPR2: "); - ADD_MEM (regs[2], 8); - ADD_STRING (" GPR3: "); - ADD_MEM (regs[3], 8); - ADD_STRING ("\n GPR4: "); - ADD_MEM (regs[4], 8); - ADD_STRING (" GPR5: "); - ADD_MEM (regs[5], 8); - ADD_STRING (" GPR6: "); - ADD_MEM (regs[6], 8); - ADD_STRING (" GPR7: "); - ADD_MEM (regs[7], 8); - ADD_STRING ("\n GPR8: "); - ADD_MEM (regs[8], 8); - ADD_STRING (" GPR9: "); - ADD_MEM (regs[9], 8); - ADD_STRING (" GPRA: "); - ADD_MEM (regs[10], 8); - ADD_STRING (" GPRB: "); - ADD_MEM (regs[11], 8); - ADD_STRING ("\n GPRC: "); - ADD_MEM (regs[12], 8); - ADD_STRING (" GPRD: "); - ADD_MEM (regs[13], 8); - ADD_STRING (" GPRE: "); - ADD_MEM (regs[14], 8); - ADD_STRING (" GPRF: "); - ADD_MEM (regs[15], 8); - ADD_STRING ("\n\n PSW.MASK: "); - ADD_MEM (regs[16], 8); - ADD_STRING (" PSW.ADDR: "); - ADD_MEM (regs[17], 8); - ADD_STRING (" TRAP: "); - ADD_MEM (regs[18], 4); - ADD_STRING ("\n"); - - /* Write the stuff out. */ - writev (fd, iov, nr); -} - - -#define REGISTER_DUMP register_dump (fd, &ctx) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Dist b/sysdeps/unix/sysv/linux/s390/s390-32/Dist new file mode 100644 index 0000000..d0740c1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Dist @@ -0,0 +1,9 @@ +clone.S +oldgetrlimit64.c +setresuid.c +setresgid.c +setfsuid.c +setfsgid.c +sys/elf.h +sys/procfs.h +sys/user.h diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile new file mode 100644 index 0000000..2115e40 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile @@ -0,0 +1,12 @@ +ifeq ($(subdir),misc) +sysdep_routines += setfsgid setfsuid setresgid setresuid +sysdep_headers += sys/elf.h +endif + +ifeq ($(subdir),csu) +CFLAGS-initfini.s += -DWEAK_GMON_START +endif + +ifeq ($(subdir),resource) +sysdep_routines += oldgetrlimit64 +endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions new file mode 100644 index 0000000..5a56361 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions @@ -0,0 +1,28 @@ +libc { + GLIBC_2.0 { + # Exception handling support functions from libgcc + __register_frame; __register_frame_table; __deregister_frame; + __register_frame_info; __deregister_frame_info; __frame_state_for; + __register_frame_info_table; + } + GLIBC_2.2 { + # functions used in other libraries + __xstat64; __fxstat64; __lxstat64; + + # a* + alphasort64; + + # New rlimit interface + getrlimit; setrlimit; getrlimit64; + + # r* + readdir64; readdir64_r; + + # s* + scandir64; + + # v* + versionsort64; + } +} + diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c b/sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c new file mode 100644 index 0000000..0b5ae47 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h new file mode 100644 index 0000000..0ae79d7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h @@ -0,0 +1,179 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + + +#include + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 + +#ifdef __USE_GNU +# define O_DIRECT 040000 /* Direct disk access. */ +# define O_DIRECTORY 0200000 /* Must be a directory. */ +# define O_NOFOLLOW 0400000 /* Do not follow links. */ +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0100000 +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +#define F_GETLK 5 /* Get record locking info. */ +#define F_SETLK 6 /* Set record locking info (non-blocking). */ +#define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#endif +#define F_GETLK64 12 /* Get record locking info. */ +#define F_SETLK64 13 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 14 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_XOPEN2K +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* for old implementation of bsd flock () */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* operations for bsd flock(), also used by the kernel implementation */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h new file mode 100644 index 0000000..d7fc58a --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h @@ -0,0 +1,93 @@ +/* Definitions for POSIX memory map interface. Linux/s390 version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x2000 /* Lock the mapping. */ +# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 1 /* Sync memory asynchronously. */ +#define MS_SYNC 4 /* Synchronous memory sync. */ +#define MS_INVALIDATE 2 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 2 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h new file mode 100644 index 0000000..b04764e --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h @@ -0,0 +1,205 @@ +/* Bit values & structures for resource limits. Linux version. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + RLIMIT_RSS = 5, +#define RLIMIT_RSS RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 7, + RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE RLIMIT_OFILE + + /* Address space limit. */ + RLIMIT_AS = 9, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + RLIMIT_NPROC = 6, +#define RLIMIT_NPROC RLIMIT_NPROC + + /* Locked-in-memory address space. */ + RLIMIT_MEMLOCK = 8, +#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK + + RLIMIT_NLIMITS = 10, + RLIM_NLIMITS = RLIMIT_NLIMITS +#define RLIMIT_NLIMITS RLIMIT_NLIMITS +#define RLIM_NLIMITS RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((unsigned long int) (~0UL)) +#else +# define RLIM_INFINITY 0xffffffffffffffffuLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffuLL +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1, +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + + /* Both. */ + RUSAGE_BOTH = -2 +#define RUSAGE_BOTH RUSAGE_BOTH +}; + +#define __need_timeval +#include /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long int ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long int ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long int ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long int ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long int ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long int ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long int ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long int ru_inblock; + /* Number of output operations via the file system. */ + long int ru_oublock; + /* Number of IPC messages sent. */ + long int ru_msgsnd; + /* Number of IPC messages received. */ + long int ru_msgrcv; + /* Number of signals delivered. */ + long int ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long int ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long int ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h new file mode 100644 index 0000000..a40159b --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h @@ -0,0 +1,134 @@ +/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_STAT_H +# error "Never include directly; use instead." +#endif + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ + + +struct stat + { + __dev_t st_dev; /* Device. */ + unsigned int __pad1; +#ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +#else + __ino_t __st_ino; /* 32bit file serial number. */ +#endif + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; +#ifndef __USE_FILE_OFFSET64 + __off_t st_size; /* Size of file, in bytes. */ +#else + __off64_t st_size; /* Size of file, in bytes. */ +#endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + +#ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +#else + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#endif + __time_t st_atime; /* Time of last access. */ + unsigned long int __unused1; + __time_t st_mtime; /* Time of last modification. */ + unsigned long int __unused2; + __time_t st_ctime; /* Time of last status change. */ + unsigned long int __unused3; +#ifndef __USE_FILE_OFFSET64 + unsigned long int __unused4; + unsigned long int __unused5; +#else + __ino64_t st_ino; /* File serial number. */ +#endif + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + unsigned int __pad1; + + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ + __time_t st_atime; /* Time of last access. */ + unsigned long int __unused1; + __time_t st_mtime; /* Time of last modification. */ + unsigned long int __unused2; + __time_t st_ctime; /* Time of last status change. */ + unsigned long int __unused3; + __ino64_t st_ino; /* File serial number. */ + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. Note that these macros always evaluate to zero. But + they do it by enforcing the correct use of the macros. */ +#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c new file mode 100644 index 0000000..682f2dd --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c @@ -0,0 +1,118 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include +#include +#include +#include + +#include +#include "kernel-features.h" + +/* + In Linux 2.1.x the chown functions have been changed. A new function lchown + was introduced. The new chown now follows symlinks - the old chown and the + new lchown do not follow symlinks. + The new lchown function has the same number as the old chown had and the + new chown has a new number. When compiling with headers from Linux > 2.1.8x + it's impossible to run this libc with older kernels. In these cases libc + has therefore to route calls to chown to the old chown function. +*/ + +extern int __syscall_chown (const char *__file, + __kernel_uid_t __owner, __kernel_gid_t __group); + +/* Running under Linux > 2.1.80. */ + +#ifdef __NR_chown32 +extern int __syscall_chown32 (const char *__file, + __kernel_uid32_t owner, __kernel_gid32_t group); +# if __ASSUME_32BITUIDS == 0 +/* This variable is shared with all files that need to check for 32bit + uids. */ +extern int __libc_missing_32bit_uids; +# endif +#endif /* __NR_chown32 */ + +int +__real_chown (const char *file, uid_t owner, gid_t group) +{ + static int __libc_old_chown; + int result; + + if (!__libc_old_chown) + { + int saved_errno = errno; +#ifdef __NR_chown32 + if (__libc_missing_32bit_uids <= 0) + { + int result; + int saved_errno = errno; + + result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group); + if (result == 0 || errno != ENOSYS) + return result; + + __set_errno (saved_errno); + __libc_missing_32bit_uids = 1; + } +#endif /* __NR_chown32 */ + if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) + || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) + { + __set_errno (EINVAL); + return -1; + } + + result = INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group); + + if (result >= 0 || errno != ENOSYS) + return result; + + __set_errno (saved_errno); + __libc_old_chown = 1; + } + + return __lchown (file, owner, group); +} + + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +/* Compiling for compatibiity. */ +int +__chown_is_lchown (const char *file, uid_t owner, gid_t group) +{ + return __lchown (file, owner, group); +} +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +strong_alias (__chown_is_lchown, _chown_is_lchown) +compat_symbol (libc, __chown_is_lchown, __chown, GLIBC_2_0); +compat_symbol (libc, _chown_is_lchown, chown, GLIBC_2_0); + +strong_alias (__real_chown, _real_chown) +versioned_symbol (libc, __real_chown, __chown, GLIBC_2_1); +versioned_symbol (libc, _real_chown, chown, GLIBC_2_1); +#else +strong_alias (__real_chown, __chown) +weak_alias (__real_chown, chown) +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S new file mode 100644 index 0000000..433246f --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S @@ -0,0 +1,66 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* clone is even more special than fork as it mucks with stacks + and invokes a function in the right context after its all over. */ + +#include +#define _ERRNO_H 1 +#include + +/*int __clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg);*/ +/* sys_clone(void *child_stack, unsigned long flags) */ + + .text +ENTRY(__clone) + /* Sanity check arguments & move registers */ + ltr %r1,%r2 /* no NULL function pointers */ + lhi %r2,-EINVAL + jz SYSCALL_ERROR_LABEL + ltr %r3,%r3 /* no NULL stack pointers */ + jz SYSCALL_ERROR_LABEL + /* move child_stack and flags, then call SVC */ + lr %r2,%r3 + lr %r3,%r4 + svc SYS_ify(clone) + ltr %r2,%r2 /* check return code */ + jm SYSCALL_ERROR_LABEL + jz thread_start + br %r14 + +thread_start: + /* fn is in gpr 1, arg in gpr 5 */ + lr %r2,%r5 /* set first parameter to void *arg */ + sr %r11,%r11 /* terminate the stack frame */ + ahi %r15,-96 /* make room on the stack for the save area */ + basr %r14,%r1 /* jump to fn */ +#ifdef PIC + basr %r12,0 +.L0: lr %r1,%r12 + al %r12,.L1-.L0(%r12) + al %r1,.L2-.L0(%r1) + br %r1 /* branch to _exit -> thread termination */ +.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 +.L2: .long _exit@PLT - .L0 +#else + basr %r1,0 +.L0: al %r1,.L1-.L0(0,%r1) + br %r1 /* branch to _exit -> thread termination */ +.L1: .long _exit - .L0 +#endif +PSEUDO_END (__clone) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c new file mode 100644 index 0000000..3a69ecc --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c b/sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c new file mode 100644 index 0000000..ea951bc --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c new file mode 100644 index 0000000..4f219f0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c b/sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c new file mode 100644 index 0000000..0c75fb5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getegid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getegid.c new file mode 100644 index 0000000..37b4b4a --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getegid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c new file mode 100644 index 0000000..ebcb555 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getgid.c new file mode 100644 index 0000000..0a4d606 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getgid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c b/sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c new file mode 100644 index 0000000..20a7166 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c new file mode 100644 index 0000000..b703a41 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c new file mode 100644 index 0000000..0b14cef --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c new file mode 100644 index 0000000..fc06dbd --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c new file mode 100644 index 0000000..fef018f --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getuid.c new file mode 100644 index 0000000..d682c79 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getuid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c new file mode 100644 index 0000000..acee703 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#include +#include +#include + +#include +#include "kernel-features.h" + +extern int __syscall_lchown (const char *__unbounded __file, + __kernel_uid_t __owner, __kernel_gid_t __group); + +# ifdef __NR_lchown32 +extern int __syscall_lchown32 (const char *__unbounded __file, + __kernel_uid32_t __owner, + __kernel_gid32_t __group); +# if __ASSUME_32BITUIDS == 0 +/* This variable is shared with all files that need to check for 32bit + uids. */ +extern int __libc_missing_32bit_uids; +# endif +# endif /* __NR_lchown32 */ + +int +__lchown (const char *file, uid_t owner, gid_t group) +{ +# if __ASSUME_32BITUIDS > 0 + return INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); +# else +# ifdef __NR_lchown32 + if (__libc_missing_32bit_uids <= 0) + { + int result; + int saved_errno = errno; + + result = INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); + if (result == 0 || errno != ENOSYS) + return result; + + __set_errno (saved_errno); + __libc_missing_32bit_uids = 1; + } +# endif /* __NR_lchown32 */ + + if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) + || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) + { + __set_errno (EINVAL); + return -1; + } + + return INLINE_SYSCALL (lchown, 3, CHECK_STRING (file), owner, group); +# endif +} + +weak_alias (__lchown, lchown) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c b/sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c new file mode 100644 index 0000000..a88f5a7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c new file mode 100644 index 0000000..0efa0ae --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S b/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S new file mode 100644 index 0000000..f101408 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S @@ -0,0 +1,72 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#define EINVAL 22 + + .text +ENTRY(__mmap) + /* Save registers and setup stack frame. */ + stm %r6,%r15,24(%r15) + lr %r1,%r15 + ahi %r15,-120 /* buy stack space */ + st %r1,0(%r15) /* store back chain */ + + /* Store parameters on stack, because old_mmap/mmap2 + * take only one parameter: a pointer to the parameter area + */ + 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'. */ + l %r1,216(%r15) /* Load offset. */ + +#ifdef __ASSUME_MMAP2_SYSCALL + /* I don't think it is worthwhile trying to use mmap2 whenever + * it is available. Only use it when we are sure the syscall + * exists. */ + tml %r1,0x0fff /* Offset page aligned ? */ + lhi %r2,-EINVAL + jnz 1f /* No -> EINVAL. */ + srl %r1,12 /* mmap2 takes the offset in pages. */ + st %r1,0x74(%r15) /* Store page offset. */ + la %r2,0x60(%r15) /* Load address of parameter list. */ + svc SYS_ify(mmap2) /* Do the system call trap. */ +#else + st %r1,0x74(%r15) /* Store offset unmodified. */ + la %r2,0x60(%r15) /* Load address of parameter list. */ + svc SYS_ify(mmap) /* Do the system call trap. */ +#endif + +1: l %r15,0(%r15) /* Load back chain. */ + lm %r6,%r15,24(%r15) /* Load registers. */ + + /* check gpr 2 for error */ + lhi %r0,-4096 + clr %r2,%r0 + jnl SYSCALL_ERROR_LABEL + + /* Successful; return the syscall's value. */ + br %r14 + +PSEUDO_END (__mmap) + +weak_alias (__mmap, mmap) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S b/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S new file mode 100644 index 0000000..f53fe4c --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S @@ -0,0 +1,101 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#define EINVAL 22 +#define ENOSYS 38 + + .text +ENTRY(__mmap64) + /* Save registers and setup stack frame. */ + stm %r6,%r15,24(%r15) + lr %r1,%r15 + ahi %r15,-120 /* Buy stack space. */ + st %r1,0(%r15) /* Store back chain. */ + + /* Store parameters on stack, because mmap2 and old_mmap + * take only one parameter: a pointer to the parameter area. */ + 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'. */ + +#ifdef __NR_mmap2 + 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. */ + + la %r2,0x60(%r15) /* Load address of parameter list. */ + svc SYS_ify(mmap2) /* Do the system call trap. */ + +#ifndef __ASSUME_MMAP2_SYSCALL + chi %r0,-ENOSYS + je 1f +#endif + + l %r15,0(%r15) /* Load back chain. */ + lm %r6,%r15,24(%r15) /* Load registers. */ + + /* Check gpr 2 for error. */ + lhi %r0,-4096 + clr %r2,%r0 + jnl SYSCALL_ERROR_LABEL + + /* Successful; return the syscall's value. */ + br %r14 + +#endif + +#if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2 +1: lm %r0,%r1,216(%r15) /* Load 64 bit offset. */ + st %r1,0x74(%r15) /* Store lower word of offset. */ + ltr %r0,%r0 /* Offset > 2^32 ? */ + jnz 2f + alr %r1,%r3 /* Add length to offset. */ + brc 3,2f /* Carry -> EINVAL. */ + + la %r2,0x60(%r15) /* Load address of parameter list. */ + svc SYS_ify(mmap) /* Do the system call trap. */ + + l %r15,0(%r15) /* Load back chain. */ + lm %r6,%r15,24(%r15) /* Load registers. */ + + /* Check gpr 2 for error. */ + lhi %r0,-4096 + clr %r2,%r0 + jnl SYSCALL_ERROR_LABEL + + /* Successful; return the syscall's value. */ + br %r14 +#endif + +2: lhi %r2,-EINVAL + l %r15,0(%r15) /* Load back chain. */ + lm %r6,%r15,24(%r15) /* Load registers. */ + j SYSCALL_ERROR_LABEL + +PSEUDO_END (__mmap64) + +weak_alias (__mmap64, mmap64) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c b/sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c new file mode 100644 index 0000000..9f9b843 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c new file mode 100644 index 0000000..4c27e95 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c new file mode 100644 index 0000000..2ea26dd --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c new file mode 100644 index 0000000..9f54f89 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h b/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h new file mode 100644 index 0000000..0bd9599 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h @@ -0,0 +1,130 @@ +/* Dump registers. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* We will print the register dump in this format: + + GPR0: XXXXXXXX GPR1: XXXXXXXX GPR2: XXXXXXXX GPR3: XXXXXXXX + GPR4: XXXXXXXX GPR5: XXXXXXXX GPR6: XXXXXXXX GPR7: XXXXXXXX + GPR8: XXXXXXXX GPR9: XXXXXXXX GPRA: XXXXXXXX GPRB: XXXXXXXX + GPRC: XXXXXXXX GPRD: XXXXXXXX GPRE: XXXXXXXX GPRF: XXXXXXXX + + PSW.MASK: XXXXXXXX PSW.ADDR: XXXXXXXX + + ST(0) XXXX XXXXXXXXXXXXXXXX ST(1) XXXX XXXXXXXXXXXXXXXX + ST(2) XXXX XXXXXXXXXXXXXXXX ST(3) XXXX XXXXXXXXXXXXXXXX + ST(4) XXXX XXXXXXXXXXXXXXXX ST(5) XXXX XXXXXXXXXXXXXXXX + ST(6) XXXX XXXXXXXXXXXXXXXX ST(7) XXXX XXXXXXXXXXXXXXXX + + */ + +static void +hexvalue (unsigned long int value, char *buf, size_t len) +{ + char *cp = _itoa_word (value, buf + len, 16, 0); + while (cp > buf) + *--cp = '0'; +} + +static void +register_dump (int fd, struct sigcontext *ctx) +{ + char regs[19][8]; + struct iovec iov[40]; + size_t nr = 0; + +#define ADD_STRING(str) \ + iov[nr].iov_base = (char *) str; \ + iov[nr].iov_len = strlen (str); \ + ++nr +#define ADD_MEM(str, len) \ + iov[nr].iov_base = str; \ + iov[nr].iov_len = len; \ + ++nr + + /* Generate strings of register contents. */ + hexvalue (ctx->sregs->regs.gprs[0], regs[0], 8); + hexvalue (ctx->sregs->regs.gprs[1], regs[1], 8); + hexvalue (ctx->sregs->regs.gprs[2], regs[2], 8); + hexvalue (ctx->sregs->regs.gprs[3], regs[3], 8); + hexvalue (ctx->sregs->regs.gprs[4], regs[4], 8); + hexvalue (ctx->sregs->regs.gprs[5], regs[5], 8); + hexvalue (ctx->sregs->regs.gprs[6], regs[6], 8); + hexvalue (ctx->sregs->regs.gprs[7], regs[7], 8); + hexvalue (ctx->sregs->regs.gprs[8], regs[8], 8); + hexvalue (ctx->sregs->regs.gprs[9], regs[9], 8); + hexvalue (ctx->sregs->regs.gprs[10], regs[10], 8); + hexvalue (ctx->sregs->regs.gprs[11], regs[11], 8); + hexvalue (ctx->sregs->regs.gprs[12], regs[12], 8); + hexvalue (ctx->sregs->regs.gprs[13], regs[13], 8); + hexvalue (ctx->sregs->regs.gprs[14], regs[14], 8); + hexvalue (ctx->sregs->regs.gprs[15], regs[15], 8); + hexvalue (ctx->sregs->regs.psw.mask, regs[16], 8); + hexvalue (ctx->sregs->regs.psw.addr, regs[17], 8); + + /* Generate the output. */ + ADD_STRING ("Register dump:\n\n GPR0: "); + ADD_MEM (regs[0], 8); + ADD_STRING (" GPR1: "); + ADD_MEM (regs[1], 8); + ADD_STRING (" GPR2: "); + ADD_MEM (regs[2], 8); + ADD_STRING (" GPR3: "); + ADD_MEM (regs[3], 8); + ADD_STRING ("\n GPR4: "); + ADD_MEM (regs[4], 8); + ADD_STRING (" GPR5: "); + ADD_MEM (regs[5], 8); + ADD_STRING (" GPR6: "); + ADD_MEM (regs[6], 8); + ADD_STRING (" GPR7: "); + ADD_MEM (regs[7], 8); + ADD_STRING ("\n GPR8: "); + ADD_MEM (regs[8], 8); + ADD_STRING (" GPR9: "); + ADD_MEM (regs[9], 8); + ADD_STRING (" GPRA: "); + ADD_MEM (regs[10], 8); + ADD_STRING (" GPRB: "); + ADD_MEM (regs[11], 8); + ADD_STRING ("\n GPRC: "); + ADD_MEM (regs[12], 8); + ADD_STRING (" GPRD: "); + ADD_MEM (regs[13], 8); + ADD_STRING (" GPRE: "); + ADD_MEM (regs[14], 8); + ADD_STRING (" GPRF: "); + ADD_MEM (regs[15], 8); + ADD_STRING ("\n\n PSW.MASK: "); + ADD_MEM (regs[16], 8); + ADD_STRING (" PSW.ADDR: "); + ADD_MEM (regs[17], 8); + ADD_STRING (" TRAP: "); + ADD_MEM (regs[18], 4); + ADD_STRING ("\n"); + + /* Write the stuff out. */ + writev (fd, iov, nr); +} + + +#define REGISTER_DUMP register_dump (fd, &ctx) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c b/sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c new file mode 100644 index 0000000..506fd88 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/semctl.c b/sysdeps/unix/sysv/linux/s390/s390-32/semctl.c new file mode 100644 index 0000000..e9b1a48 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/semctl.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setegid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setegid.c new file mode 100644 index 0000000..2e3a54c --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setegid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c new file mode 100644 index 0000000..18e41d0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c new file mode 100644 index 0000000..0886712 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c new file mode 100644 index 0000000..a9f22eb --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setgid.c new file mode 100644 index 0000000..377021d --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setgid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c b/sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c new file mode 100644 index 0000000..0e70862 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c @@ -0,0 +1,2 @@ +/* We also have to rewrite the kernel gid_t to the user land type. */ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setregid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setregid.c new file mode 100644 index 0000000..99c57ad --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setregid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c new file mode 100644 index 0000000..daca1a4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c new file mode 100644 index 0000000..3aeabe9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c new file mode 100644 index 0000000..8ad6122 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c b/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c new file mode 100644 index 0000000..bfaef74 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setuid.c new file mode 100644 index 0000000..c8fa23e --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setuid.c @@ -0,0 +1,2 @@ +#include + diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c b/sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c new file mode 100644 index 0000000..7eac638 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/socket.S b/sysdeps/unix/sysv/linux/s390/s390-32/socket.S new file mode 100644 index 0000000..9bed2f7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/socket.S @@ -0,0 +1,98 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* &%/$&!! preprocessor */ +#define P(a, b) P2(a, b) +#define P2(a, b) a##b + + .text +/* The socket-oriented system calls are handled unusally in Linux. + They are all gated through the single `socketcall' system call number. + `socketcall' takes two arguments: the first is the subcode, specifying + which socket function is being called; and the second is a pointer to + the arguments to the specific function. + + The .S files for the other calls just #define socket and #include this. */ + +#ifndef __socket +#ifndef NO_WEAK_ALIAS +#define __socket P(__,socket) +#else +#define __socket socket +#endif +#endif + +#ifndef NARGS /* the socket.o object is compiled directly ... */ +#define NARGS 3 +#endif + +.globl __socket +ENTRY(__socket) + + /* Save registers and setup stack. */ + stm %r6,%r15,24(%r15) /* save registers */ + lr %r1,%r15 + l %r0,4(0,%r15) /* load eos */ + ahi %r15,-120 /* buy stack space */ + st %r1,0(0,%r15) /* store back chain */ + st %r0,4(0,%r15) /* store eos */ + + /* Reorder arguments */ +#if (NARGS >= 6) + mvc 0x74(4,%r15),216(%r15) /* move between parameter lists */ +#endif +#if (NARGS >= 5) + st %r6,0x70(0,%r15) /* store into parameter list */ +#endif +#if (NARGS >= 4) + st %r5,0x6C(0,%r15) /* store into parameter list */ +#endif +#if (NARGS >= 3) + st %r4,0x68(0,%r15) /* store into parameter list */ +#endif +#if (NARGS >= 2) + st %r3,0x64(0,%r15) /* store into parameter list */ + st %r2,0x60(0,%r15) +#endif + /* load subcode for socket syscall */ + lhi %r2,P(SOCKOP_,socket) + la %r3,0x60(0,%r15) /* load address of parameter list */ + + /* Do the system call trap. */ + svc SYS_ify(socketcall) + + l %r15,0(0,%r15) /* load back chain */ + lm %r6,15,24(%r15) /* load registers */ + + /* gpr2 is < 0 if there was an error. */ + lhi %r0,-125 + clr %r2,%r0 + jnl SYSCALL_ERROR_LABEL + + /* Successful; return the syscall's value. */ + br %r14 + +PSEUDO_END (__socket) + +#ifndef NO_WEAK_ALIAS +weak_alias (__socket, socket) +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h b/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h new file mode 100644 index 0000000..968d085 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h @@ -0,0 +1,118 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +typedef greg_t elf_greg_t; +#define ELF_NGREG NGREG +typedef gregset_t elf_gregset_t; +typedef fpreg_t elf_fpreg_t; +typedef fpregset_t elf_fpregset_t; + +/* Signal info. */ +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with Linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + GDB doesn't really use excluded. */ + +struct elf_prstatus + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args. */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned short int pr_uid; + unsigned short int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + +/* The rest of this file provides the types for emulation of the + Solaris interfaces that should be implemented by + users of libthread_db. */ + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore have only one PID type. */ +typedef __pid_t lwpid_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h new file mode 100644 index 0000000..cb1869c --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h @@ -0,0 +1,76 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Contributed by Denis Joseph Barrow (djbarrow@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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 +/* Forward definition to avoid parse errors */ +struct ucontext; +typedef struct ucontext ucontext_t; +#include +#include + +/* We need the signal context definitions even if they are not used + included in . */ +#include + + +/* Type for a general-purpose register. */ +typedef unsigned long greg_t; + +/* And the whole bunch of them. We should have used `struct s390_regs', + but to avoid name space pollution and since the tradition says that + the register set is an array, we make gregset_t a simple array + that has the same size as s390_regs. */ +#define NGREG 36 +#define NUM_FPRS 16 +typedef greg_t gregset_t[NGREG]; + +typedef union +{ + double d; + float f; +} fpreg_t; + +/* Register set for the floating-point registers. */ +typedef struct { + unsigned int fpc; + fpreg_t fprs[NUM_FPRS]; +} fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + int version; + gregset_t gregs; + fpregset_t fpregs; + } mcontext_t; + +/* Userlevel context. */ +struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_links; + __sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long int uc_filler[170]; + }; + + +#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S new file mode 100644 index 0000000..5a0674a --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S @@ -0,0 +1,51 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Please consult the file sysdeps/unix/sysv/linux/s390/sysdep.h for + more information about the value -4095 used below.*/ + +ENTRY (syscall) + /* Save registers and setup stack. */ + stm %r6,%r15,24(%r15) /* save registers */ + lr %r1,%r15 + l %r0,4(0,%r15) /* load eos */ + ahi %r15,-96 /* buy stack space */ + st %r1,0(0,%r15) /* store back chain */ + st %r0,4(0,%r15) /* store eos */ + + lr %r1,%r2 /* move syscall number */ + lr %r2,%r3 /* first parameter */ + lr %r3,%r4 /* second parameter */ + lr %r4,%r5 /* third parameter */ + lr %r5,%r6 /* fourth parameter */ + l %r6,192(%r15) /* fifth parameter */ + basr %r7,0 +.L0: ex %r1,.L1-.L0(%r7) /* lsb of R1 is subsituted as SVC number */ + + l %r15,0(0,%r15) /* load back chain */ + lm %r6,15,24(%r15) /* load registers */ + + lhi %r0,-4095 + clr %r2,%r0 /* check R2 for error */ + jnl SYSCALL_ERROR_LABEL + br %r14 /* return to caller */ +.L1: .word 0x0A00 /* opcode for SVC 0 */ +PSEUDO_END (syscall) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list new file mode 100644 index 0000000..913f051 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list @@ -0,0 +1,4 @@ +# File name Caller Syscall name Args Strong name Weak names + +oldgetrlimit EXTRA getrlimit i:ip __old_getrlimit getrlimit@GLIBC_2.0 +oldsetrlimit EXTRA setrlimit i:ip __old_setrlimit setrlimit@GLIBC_2.0 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S new file mode 100644 index 0000000..15b822a --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S @@ -0,0 +1,104 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Because the Linux version is in fact m68k/ELF and the start.? file + for this system (sysdeps/m68k/elf/start.S) is also used by The Hurd + and therefore this files must not contain the definition of the + `errno' variable (I don't know why, ask Roland), we have to define + it somewhere else. + + ...and this place is here. */ + .bss + .globl errno + .type errno,@object + .size errno,4 +errno: + .space 4 +weak_alias (errno, _errno) + +/* The following code is only used in the shared library when we + compile the reentrant version. Otherwise each system call defines + each own version. */ + +/* The syscall stubs jump here when they detect an error. */ + +#undef CALL_MCOUNT +#define CALL_MCOUNT + + .text +ENTRY(__syscall_error) +#ifndef PIC +#ifndef _LIBC_REENTRANT + lcr %r2,%r2 + basr %r1,0 +.L0: l %r1,.L1-.L0(%r1) + st %r2,0(0,%r1) + lhi %r2,-1 + br %r14 +.L1: .long errno +#else + stm %r11,%r15,44(%r15) + lr %r0,%r15 + ahi %r15,-96 + st %r0,0(%r15) + lcr %r11,%r2 + basr %r13,0 +.L0: l %r1,.L1-.L0(%r13) + basr %r14,%r1 + st %r11,0(%r2) + lhi %r2,-1 + l %r15,0(%r15) + lm %r11,%r15,44(%r15) + br %r14 +.L1: .long __errno_location +#endif +#else +#ifndef _LIBC_REENTRANT + basr %r1,0 +.L0: al %r1,.L1-.L0(%r1) + l %r1,errno@GOT12(%r1) + lcr %r2,%r2 + st %r2,0(0,%r1) + lhi %r2,-1 + br %r14 +.L1: .long _GLOBAL_OFFSET_TABLE_-0b +#else + stm %r11,%r15,44(%r15) + lr %r0,%r15 + ahi %r15,-96 + st %r0,0(%r15) + lcr %r11,%r2 + basr %r13,0 +.L0: l %r12,.L1-.L0(%r13) + ar %r12,%r13 + l %r14,.L2-.L0(%r13) + bas %r14,0(%r14,%r13) + st %r11,0(0,%r2) + lhi %r2,-1 + l %r15,0(%r15) + lm %r11,%r15,44(%r15) + br %r14 +.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 +.L2: .long __errno_location@PLT - .L0 +#endif +#endif + +END (__syscall_error) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h new file mode 100644 index 0000000..507867b --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -0,0 +1,212 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _LINUX_S390_SYSDEP_H +#define _LINUX_S390_SYSDEP_H + +#include +#include + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +/* in newer 2.1 kernels __NR_syscall is missing so we define it here */ +#define __NR_syscall 0 + +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* ELF-like local names start with `.L'. */ +#undef L +#define L(name) .L##name + +#ifdef __ASSEMBLER__ + +/* Linux uses a negative return value to indicate syscall errors, unlike + most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be negative + even if the call succeeded. E.g., the `lseek' system call might return + a large offset. Therefore we must not anymore test for < 0, but test + for a real error by making sure the value in gpr2 is a real error + number. Linus said he will make sure the no syscall returns a value + in -1 .. -4095 as a valid result so we can savely test with -4095. */ + +#define SYSCALL_ERROR_LABEL 0f + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (args, syscall_name); \ + lhi %r4,-4095 ; \ + clr %r2,%r4 ; \ + jnl SYSCALL_ERROR_LABEL ; \ + L(pseudo_end): + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + SYSCALL_ERROR_HANDLER; \ + END (name) + +#ifndef _LIBC_REENTRANT +#ifndef PIC +#define SYSCALL_ERROR_HANDLER \ +0: lcr %r2,%r2 ; \ + basr %r1,0 ; \ +1: l %r1,2f-1b(%r1) \ + st %r2,0(%r1) \ + lhi %r2,-1 \ + br %r14 \ +2: .long errno +#else +#define SYSCALL_ERROR_HANDLER \ +0: basr %r1,0 ; \ +1: al %r1,2f-1b(%r1) ; \ + l %r1,errno@GOT12(%r1) ; \ + lcr %r2,%r2 ; \ + st %r2,0(%r1) ; \ + lhi %r2,-1 ; \ + br %r14 ; \ +2: .long _GLOBAL_OFFSET_TABLE_-1b +#endif /* PIC */ +#else +#define SYSCALL_ERROR_HANDLER \ +0: basr %r1,0 ; \ +1: al %r1,2f-1b(%r1) ; \ + br %r1 ; \ +2: .long __syscall_error@PLT-1b +#endif /* _LIBC_REENTRANT */ + +/* Linux takes system call arguments in registers: + + syscall number 1 call-clobbered + arg 1 2 call-clobbered + arg 2 3 call-clobbered + arg 3 4 call-clobbered + arg 4 5 call-clobbered + arg 5 6 call-saved + + (Of course a function with say 3 arguments does not have entries for + arguments 4 and 5.) + S390 does not need to do ANY stack operations to get its parameters + right. + */ + +#define DO_CALL(args, syscall) \ + svc SYS_ify (syscall) + +#define ret \ + br 14 + +#endif /* __ASSEMBLER__ */ + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + int err; \ + asm volatile ( \ + LOADARGS_##nr \ + "svc %b1\n\t" \ + "lr %0,%%r2\n\t" \ + : "=d" (err) \ + : "I" (__NR_##name) ASMFMT_##nr \ + : "memory", "cc", "2", "3", "4", "5", "6"); \ + if (err >= 0xfffff001) \ + { \ + __set_errno(-err); \ + err = 0xffffffff; \ + } \ + (int) err; }) + +#define DECLARGS_0() +#define DECLARGS_1(arg1) \ + unsigned int gpr2 = (unsigned int) (arg1); +#define DECLARGS_2(arg1, arg2) \ + DECLARGS_1(arg1) \ + unsigned int gpr3 = (unsigned int) (arg2); +#define DECLARGS_3(arg1, arg2, arg3) \ + DECLARGS_2(arg1, arg2) \ + unsigned int gpr4 = (unsigned int) (arg3); +#define DECLARGS_4(arg1, arg2, arg3, arg4) \ + DECLARGS_3(arg1, arg2, arg3) \ + unsigned int gpr5 = (unsigned int) (arg4); +#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ + DECLARGS_4(arg1, arg2, arg3, arg4) \ + unsigned int gpr6 = (unsigned int) (arg5); + +#define LOADARGS_0 +#define LOADARGS_1 "L 2,%2\n\t" +#define LOADARGS_2 LOADARGS_1 "L 3,%3\n\t" +#define LOADARGS_3 LOADARGS_2 "L 4,%4\n\t" +#define LOADARGS_4 LOADARGS_3 "L 5,%5\n\t" +#define LOADARGS_5 LOADARGS_4 "L 6,%6\n\t" + +#define ASMFMT_0 +#define ASMFMT_1 , "m" (gpr2) +#define ASMFMT_2 , "m" (gpr2), "m" (gpr3) +#define ASMFMT_3 , "m" (gpr2), "m" (gpr3), "m" (gpr4) +#define ASMFMT_4 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5) +#define ASMFMT_5 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5), "m" (gpr6) + +#if 0 +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + asm volatile ( \ + "svc %b1\n\t" \ + : "+d" (gpr2) \ + : "I" (__NR_##name) ASMFMT_##nr : "memory", "cc"); \ + if (gpr2 >= 0xfffff001) \ + { \ + __set_errno(-gpr2); \ + gpr2 = 0xffffffff; \ + } \ + (int) gpr2; }) + +#define DECLARGS_0() \ + register unsigned int gpr2 asm("2"); +#define DECLARGS_1(arg1) \ + register unsigned int gpr2 asm("2") = (unsigned int) (arg1); +#define DECLARGS_2(arg1, arg2) \ + DECLARGS_1(arg1) \ + register unsigned int gpr3 asm("3") = (unsigned int) (arg2); +#define DECLARGS_3(arg1, arg2, arg3) \ + DECLARGS_2(arg1, arg2) \ + register unsigned int gpr4 asm("4") = (unsigned int) (arg3); +#define DECLARGS_4(arg1, arg2, arg3, arg4) \ + DECLARGS_3(arg1, arg2, arg3) \ + register unsigned int gpr5 asm("5") = (unsigned int) (arg4); +#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ + DECLARGS_4(arg1, arg2, arg3, arg4) \ + register unsigned int gpr6 asm("6") = (unsigned int) (arg5); + +#define ASMFMT_0 +#define ASMFMT_1 +#define ASMFMT_2 , "d" (gpr3) +#define ASMFMT_3 , "d" (gpr3), "d" (gpr4) +#define ASMFMT_4 , "d" (gpr3), "d" (gpr4), "d" (gpr5) +#define ASMFMT_5 , "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) + +#endif /* 0 */ + +#endif /* _LINUX_S390_SYSDEP_H */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c b/sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c new file mode 100644 index 0000000..144b691 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c new file mode 100644 index 0000000..e9869f5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Dist b/sysdeps/unix/sysv/linux/s390/s390-64/Dist new file mode 100644 index 0000000..fe5ca68 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/Dist @@ -0,0 +1,4 @@ +clone.S +sys/elf.h +sys/procfs.h +sys/user.h diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Makefile b/sysdeps/unix/sysv/linux/s390/s390-64/Makefile new file mode 100644 index 0000000..0217d83 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/Makefile @@ -0,0 +1,8 @@ +ifeq ($(subdir),csu) +CFLAGS-initfini.s += -DWEAK_GMON_START +endif + +ifeq ($(subdir),misc) +sysdep_routines += setfsgid setfsuid setresgid setresuid +sysdep_headers += sys/elf.h +endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h new file mode 100644 index 0000000..73034d5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file specifies the native word size of the machine, which indicates + the ELF file class used for executables and shared objects on this + machine. */ + +#ifndef _LINK_H +# error "Never use directly; include instead." +#endif + +#include + +#define __ELF_NATIVE_CLASS __WORDSIZE + +/* 64 bit Linux for S/390 is exceptional as it has .hash section with + 64 bit entries. */ +typedef uint64_t Elf_Symndx; diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h new file mode 100644 index 0000000..d92df75 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h @@ -0,0 +1,174 @@ +/* O_*, F_*, FD_* bit values for Linux for 64 bit S/390. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + + +#include + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 +#define O_DIRECT 040000 + +#ifdef __USE_GNU +# define O_DIRECTORY 0200000 /* must be a directory */ +# define O_NOFOLLOW 0400000 /* don't follow links */ +#endif + +#ifdef __USE_LARGEFILE64 +/* Not necessary, files are always with 64bit off_t. */ +# define O_LARGEFILE 0 +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#define F_GETLK 5 /* Get record locking info. */ +#define F_SETLK 6 /* Set record locking info (non-blocking). */ +#define F_SETLKW 7 /* Set record locking info (blocking). */ + +/* Not necessary, we always have 64-bit offsets. */ +#define F_GETLK64 5 /* Get record locking info. */ +#define F_SETLK64 6 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 7 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_XOPEN2K +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* for old implementation of bsd flock () */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +/* We don't need to support __USE_FILE_OFFSET64. */ +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h new file mode 100644 index 0000000..4354cb6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h @@ -0,0 +1,78 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_IPC_H +# error "Never use directly; include instead." +#endif + +#include + +/* Mode bits for `msgget', `semget', and `shmget'. */ +#define IPC_CREAT 01000 /* Create key if key does not exist. */ +#define IPC_EXCL 02000 /* Fail if key exists. */ +#define IPC_NOWAIT 04000 /* Return error on wait. */ + +/* Control commands for `msgctl', `semctl', and `shmctl'. */ +#define IPC_RMID 0 /* Remove identifier. */ +#define IPC_SET 1 /* Set `ipc_perm' options. */ +#define IPC_STAT 2 /* Get `ipc_perm' options. */ +#ifdef __USE_GNU +#define IPC_INFO 3 /* See ipcs. */ +#endif + +/* Special key values. */ +#define IPC_PRIVATE ((__key_t) 0) /* Private key. */ + + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + __uid_t uid; /* Owner's user ID. */ + __gid_t gid; /* Owner's group ID. */ + __uid_t cuid; /* Creator's user ID. */ + __gid_t cgid; /* Creator's group ID. */ + __mode_t mode; /* Read/write permission. */ + unsigned short int __seq; /* Sequence number. */ + unsigned short int __pad1; + unsigned long int __unused1; + unsigned long int __unused2; + }; + + + +__BEGIN_DECLS + +/* The actual system call: all functions are multiplexed by this. */ +extern int __ipc __P ((int __call, int __first, int __second, int __third, + void *__ptr)); + +__END_DECLS + +/* The codes for the functions to use the multiplexer `__ipc'. */ +#define IPCOP_semop 1 +#define IPCOP_semget 2 +#define IPCOP_semctl 3 +#define IPCOP_msgsnd 11 +#define IPCOP_msgrcv 12 +#define IPCOP_msgget 13 +#define IPCOP_msgctl 14 +#define IPCOP_shmat 21 +#define IPCOP_shmdt 22 +#define IPCOP_shmget 23 +#define IPCOP_shmctl 24 diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h new file mode 100644 index 0000000..8379775 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h @@ -0,0 +1,94 @@ +/* Definitions for POSIX memory map interface. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x10 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ +# define MAP_GROWSUP 0x0200 /* Register stack-like segment */ +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x2000 /* Lock the mapping. */ +# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 0x1 /* Sync memory asynchronously. */ +#define MS_SYNC 0x4 /* Synchronous memory sync. */ +#define MS_INVALIDATE 0x2 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 0x1 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 0x2 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 4 /* Don't need these pages. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h new file mode 100644 index 0000000..0d43633 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h @@ -0,0 +1,68 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_MSG_H +#error "Never use directly; include instead." +#endif + +#include + +/* Define options for message queue functions. */ +#define MSG_NOERROR 010000 /* no error if message is too big */ +#define MSG_EXCEPT 020000 /* recv any msg except of specified type */ + + +/* Structure of record for one message inside the kernel. + The type `struct __msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgrcv command */ + __time_t msg_ctime; /* time of last change */ + unsigned long int __msg_cbytes; /* current number of bytes on queue */ + unsigned long int msg_qnum; /* number of messages currently on queue */ + unsigned long int msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + unsigned long int __unused1; + unsigned long int __unused2; +}; + +#ifdef __USE_MISC + +# define msg_cbytes __msg_cbytes + +/* ipcs ctl commands */ +# define MSG_STAT 11 +# define MSG_INFO 12 + +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ +struct msginfo + { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + unsigned short int msgseg; + }; + +#endif /* __USE_MISC */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h new file mode 100644 index 0000000..791c7b8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h @@ -0,0 +1,196 @@ +/* Bit values & structures for resource limits. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + RLIMIT_RSS = 5, +#define RLIMIT_RSS RLIMIT_RSS + + /* Number of processes. */ + RLIMIT_NPROC = 6, +#define RLIMIT_NPROC RLIMIT_NPROC + + /* Number of open files. */ + RLIMIT_NOFILE = 7, + RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE RLIMIT_OFILE + + /* Locked-in-memory address space. */ + RLIMIT_MEMLOCK = 8, +#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK + + /* Address space limit (?) */ + RLIMIT_AS = 9, +#define RLIMIT_AS RLIMIT_AS + + RLIM_NLIMITS = 10 +#define RLIMIT_NLIMITS RLIMIT_NLIMITS +#define RLIM_NLIMITS RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +# define RLIM_INFINITY ~0UL + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY ~0UL +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +typedef __rlim64_t rlim_t; +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1, +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + + /* Both. */ + RUSAGE_BOTH = -2 +#define RUSAGE_BOTH RUSAGE_BOTH +}; + +#define __need_timeval +#include /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long int ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long int ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long int ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long int ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long int ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long int ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long int ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long int ru_inblock; + /* Number of output operations via the file system. */ + long int ru_oublock; + /* Number of IPC messages sent. */ + long int ru_msgsnd; + /* Number of IPC messages received. */ + long int ru_msgrcv; + /* Number of signals delivered. */ + long int ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long int ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long int ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h new file mode 100644 index 0000000..0919256 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Flags for `semop'. */ +#define SEM_UNDO 0x1000 /* undo the operation on exit */ + +/* Commands for `semctl'. */ +#define GETPID 11 /* get sempid */ +#define GETVAL 12 /* get semval */ +#define GETALL 13 /* get all semval's */ +#define GETNCNT 14 /* get semncnt */ +#define GETZCNT 15 /* get semzcnt */ +#define SETVAL 16 /* set semval */ +#define SETALL 17 /* set all semval's */ + + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ + struct ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ + unsigned long int sem_nsems; /* number of semaphores in set */ + unsigned long int __unused1; + unsigned long int __unused2; +}; + +/* The user should define a union like the following to use it for arguments + for `semctl'. + + union semun + { + int val; <= value for SETVAL + struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET + unsigned short int *array; <= array for GETALL & SETALL + struct seminfo *__buf; <= buffer for IPC_INFO + }; + + Previous versions of this file used to define this union but this is + incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether + one must define the union or not. */ +#define _SEM_SEMUN_UNDEFINED 1 + +#ifdef __USE_MISC + +/* ipcs ctl cmds */ +# define SEM_STAT 18 +# define SEM_INFO 19 + +struct seminfo +{ + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +#endif /* __USE_MISC */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h new file mode 100644 index 0000000..3b39b64 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h @@ -0,0 +1,87 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Permission flag for shmget. */ +#define SHM_R 0400 /* or S_IRUGO from */ +#define SHM_W 0200 /* or S_IWUGO from */ + +/* Flags for `shmat'. */ +#define SHM_RDONLY 010000 /* attach read-only else read-write */ +#define SHM_RND 020000 /* round attach address to SHMLBA */ +#define SHM_REMAP 040000 /* take-over region on attach */ + +/* Commands for `shmctl'. */ +#define SHM_LOCK 11 /* lock segment (root only) */ +#define SHM_UNLOCK 12 /* unlock segment (root only) */ + + +/* Data structure describing a set of semaphores. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + unsigned long int shm_nattch; /* number of current attaches */ + unsigned long int __unused1; + unsigned long int __unused2; + }; + +#ifdef __USE_MISC + +/* ipcs ctl commands */ +# define SHM_STAT 13 +# define SHM_INFO 14 + +/* shm_mode upper byte flags */ +# define SHM_DEST 01000 /* segment will be destroyed on last detach */ +# define SHM_LOCKED 02000 /* segment will not be swapped */ + +struct shminfo + { + unsigned long int shmmax; + unsigned long int shmmin; + unsigned long int shmmni; + unsigned long int shmseg; + unsigned long int shmall; + unsigned long int __unused1; + unsigned long int __unused2; + unsigned long int __unused3; + unsigned long int __unused4; + }; + +struct shm_info + { + int used_ids; + unsigned long int shm_tot; /* total allocated shm */ + unsigned long int shm_rss; /* total resident shm */ + unsigned long int shm_swp; /* total swapped shm */ + unsigned long int swap_attempts; + unsigned long int swap_successes; + }; + +#endif /* __USE_MISC */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h new file mode 100644 index 0000000..5b96272 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h @@ -0,0 +1,72 @@ +/* Definitions for 64 bit S/390 sigaction. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SIGNAL_H +# error "Never include directly; use instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Signal handler. */ +#ifdef __USE_POSIX199309 + union + { + /* Used if SA_SIGINFO is not set. */ + __sighandler_t sa_handler; + /* Used if SA_SIGINFO is set. */ + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction +#else + __sighandler_t sa_handler; +#endif + + /* Special flags. */ + unsigned long int sa_flags; + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + }; + +/* Bits in `sa_flags'. */ +#define SA_NOCLDSTOP 0x00000001 /* Don't send SIGCHLD when children stop. */ +#define SA_SIGINFO 0x00000004 +#ifdef __USE_MISC +# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */ +# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ +# define SA_NODEFER 0x40000000 /* Don't automatically block the signal + when its handler is being executed. */ +# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */ +#endif +#ifdef __USE_MISC +# define SA_INTERRUPT 0x20000000 /* Historic no-op. */ + +/* Some aliases for the SA_ constants. */ +# define SA_NOMASK SA_NODEFER +# define SA_ONESHOT SA_RESETHAND +# define SA_STACK SA_ONSTACK +#endif + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h new file mode 100644 index 0000000..90e860c --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h @@ -0,0 +1,297 @@ +/* siginfo_t, sigevent and constants. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#if !defined _SIGNAL_H && !defined __need_siginfo_t \ + && !defined __need_sigevent_t +# error "Never include this file directly. Use instead" +#endif + +#if (!defined __have_sigval_t \ + && (defined _SIGNAL_H || defined __need_siginfo_t \ + || defined __need_sigevent_t)) +# define __have_sigval_t 1 + +/* Type for data associated with a signal. */ +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +#endif + +#if (!defined __have_siginfo_t \ + && (defined _SIGNAL_H || defined __need_siginfo_t)) +# define __have_siginfo_t 1 + +# define __SI_MAX_SIZE 128 +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) + +typedef struct siginfo + { + int si_signo; /* Signal number. */ + int si_errno; /* If non-zero, an errno value associated with + this signal, as defined in . */ + int si_code; /* Signal code. */ + + union + { + int _pad[__SI_PAD_SIZE]; + + /* kill(). */ + struct + { + __pid_t si_pid; /* Sending process ID. */ + __uid_t si_uid; /* Real user ID of sending process. */ + } _kill; + + /* POSIX.1b timers. */ + struct + { + unsigned int _timer1; + unsigned int _timer2; + } _timer; + + /* POSIX.1b signals. */ + struct + { + __pid_t si_pid; /* Sending process ID. */ + __uid_t si_uid; /* Real user ID of sending process. */ + sigval_t si_sigval; /* Signal value. */ + } _rt; + + /* SIGCHLD. */ + struct + { + __pid_t si_pid; /* Which child. */ + __uid_t si_uid; /* Real user ID of sending process. */ + int si_status; /* Exit value or signal. */ + __clock_t si_utime; + __clock_t si_stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ + struct + { + void *si_addr; /* Faulting insn/memory ref. */ + int si_trapno; + } _sigfault; + + /* SIGPOLL. */ + struct + { + long int si_band; /* Band event for SIGPOLL. */ + int si_fd; + } _sigpoll; + } _sifields; + } siginfo_t; + + +/* X/Open requires some more fields with fixed names. */ +# define si_pid _sifields._kill.si_pid +# define si_uid _sifields._kill.si_uid +# define si_timer1 _sifields._timer._timer1 +# define si_timer2 _sifields._timer._timer2 +# define si_status _sifields._sigchld.si_status +# define si_utime _sifields._sigchld.si_utime +# define si_stime _sifields._sigchld.si_stime +# define si_value _sifields._rt.si_sigval +# define si_int _sifields._rt.si_sigval.sival_int +# define si_ptr _sifields._rt.si_sigval.sival_ptr +# define si_addr _sifields._sigfault.si_addr +# define si_trapno _sifields._sigfault.si_trapno +# define si_band _sifields._sigpoll.si_band +# define si_fd _sifields._sigpoll.si_fd + +/* Values for `si_code'. Positive values are reserved for kernel-generated + signals. */ +enum +{ + SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */ +# define SI_ASYNCNL SI_ASYNCNL + SI_SIGIO, /* Sent by queued SIGIO. */ +# define SI_SIGIO SI_SIGIO + SI_ASYNCIO, /* Sent by AIO completion. */ +# define SI_ASYNCIO SI_ASYNCIO + SI_MESGQ, /* Sent by real time mesq state change. */ +# define SI_MESGQ SI_MESGQ + SI_TIMER, /* Sent by timer expiration. */ +# define SI_TIMER SI_TIMER + SI_QUEUE, /* Sent by sigqueue. */ +# define SI_QUEUE SI_QUEUE + SI_USER, /* Sent by kill, sigsend, raise. */ +# define SI_USER SI_USER + SI_KERNEL = 0x80 /* Send by kernel. */ +#define SI_KERNEL SI_KERNEL +}; + + +/* `si_code' values for SIGILL signal. */ +enum +{ + ILL_ILLOPC = 1, /* Illegal opcode. */ +# define ILL_ILLOPC ILL_ILLOPC + ILL_ILLOPN, /* Illegal operand. */ +# define ILL_ILLOPN ILL_ILLOPN + ILL_ILLADR, /* Illegal addressing mode. */ +# define ILL_ILLADR ILL_ILLADR + ILL_ILLTRP, /* Illegal trap. */ +# define ILL_ILLTRP ILL_ILLTRP + ILL_PRVOPC, /* Privileged opcode. */ +# define ILL_PRVOPC ILL_PRVOPC + ILL_PRVREG, /* Privileged register. */ +# define ILL_PRVREG ILL_PRVREG + ILL_COPROC, /* Coprocessor error. */ +# define ILL_COPROC ILL_COPROC + ILL_BADSTK /* Internal stack error. */ +# define ILL_BADSTK ILL_BADSTK +}; + +/* `si_code' values for SIGFPE signal. */ +enum +{ + FPE_INTDIV = 1, /* Integer divide by zero. */ +# define FPE_INTDIV FPE_INTDIV + FPE_INTOVF, /* Integer overflow. */ +# define FPE_INTOVF FPE_INTOVF + FPE_FLTDIV, /* Floating point divide by zero. */ +# define FPE_FLTDIV FPE_FLTDIV + FPE_FLTOVF, /* Floating point overflow. */ +# define FPE_FLTOVF FPE_FLTOVF + FPE_FLTUND, /* Floating point underflow. */ +# define FPE_FLTUND FPE_FLTUND + FPE_FLTRES, /* Floating point inexact result. */ +# define FPE_FLTRES FPE_FLTRES + FPE_FLTINV, /* Floating point invalid operation. */ +# define FPE_FLTINV FPE_FLTINV + FPE_FLTSUB /* Subscript out of range. */ +# define FPE_FLTSUB FPE_FLTSUB +}; + +/* `si_code' values for SIGSEGV signal. */ +enum +{ + SEGV_MAPERR = 1, /* Address not mapped to object. */ +# define SEGV_MAPERR SEGV_MAPERR + SEGV_ACCERR /* Invalid permissions for mapped object. */ +# define SEGV_ACCERR SEGV_ACCERR +}; + +/* `si_code' values for SIGBUS signal. */ +enum +{ + BUS_ADRALN = 1, /* Invalid address alignment. */ +# define BUS_ADRALN BUS_ADRALN + BUS_ADRERR, /* Non-existant physical address. */ +# define BUS_ADRERR BUS_ADRERR + BUS_OBJERR /* Object specific hardware error. */ +# define BUS_OBJERR BUS_OBJERR +}; + +/* `si_code' values for SIGTRAP signal. */ +enum +{ + TRAP_BRKPT = 1, /* Process breakpoint. */ +# define TRAP_BRKPT TRAP_BRKPT + TRAP_TRACE /* Process trace trap. */ +# define TRAP_TRACE TRAP_TRACE +}; + +/* `si_code' values for SIGCHLD signal. */ +enum +{ + CLD_EXITED = 1, /* Child has exited. */ +# define CLD_EXITED CLD_EXITED + CLD_KILLED, /* Child was killed. */ +# define CLD_KILLED CLD_KILLED + CLD_DUMPED, /* Child terminated abnormally. */ +# define CLD_DUMPED CLD_DUMPED + CLD_TRAPPED, /* Traced child has trapped. */ +# define CLD_TRAPPED CLD_TRAPPED + CLD_STOPPED, /* Child has stopped. */ +# define CLD_STOPPED CLD_STOPPED + CLD_CONTINUED /* Stopped child has continued. */ +# define CLD_CONTINUED CLD_CONTINUED +}; + +/* `si_code' values for SIGPOLL signal. */ +enum +{ + POLL_IN = 1, /* Data input available. */ +# define POLL_IN POLL_IN + POLL_OUT, /* Output buffers available. */ +# define POLL_OUT POLL_OUT + POLL_MSG, /* Input message available. */ +# define POLL_MSG POLL_MSG + POLL_ERR, /* I/O error. */ +# define POLL_ERR POLL_ERR + POLL_PRI, /* High priority input available. */ +# define POLL_PRI POLL_PRI + POLL_HUP /* Device disconnected. */ +# define POLL_HUP POLL_HUP +}; + +# undef __need_siginfo_t +#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ + + +#if (defined _SIGNAL_H || defined __need_sigevent_t) \ + && !defined __have_sigevent_t +# define __have_sigevent_t 1 + +/* Structure to transport application-defined values with signals. */ +# define __SIGEV_MAX_SIZE 64 +# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) + +/* Forward declaration of the `pthread_attr_t' type. */ +struct __pthread_attr_s; + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[__SIGEV_PAD_SIZE]; + + struct + { + void (*_function) (sigval_t); /* Function to start. */ + struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */ + } _sigev_thread; + } _sigev_un; + } sigevent_t; + +/* POSIX names to access some of the members. */ +# define sigev_notify_function _sigev_un._sigev_thread._function +# define sigev_notify_attributes _sigev_un._sigev_thread._attribute + +/* `sigev_notify' values. */ +enum +{ + SIGEV_SIGNAL = 0, /* Notify via signal. */ +# define SIGEV_SIGNAL SIGEV_SIGNAL + SIGEV_NONE, /* Other notification: meaningless. */ +# define SIGEV_NONE SIGEV_NONE + SIGEV_THREAD /* Deliver via thread creation. */ +# define SIGEV_THREAD SIGEV_THREAD +}; + +#endif /* have _SIGNAL_H. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h new file mode 100644 index 0000000..d4e108a --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h @@ -0,0 +1,59 @@ +/* sigstack, sigaltstack definitions. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SIGNAL_H +# error "Never include this file directly. Use instead" +#endif + +#ifndef _SIGSTACK_H +#define _SIGSTACK_H 1 + +/* Structure describing a signal stack (obsolete). */ +struct sigstack + { + __ptr_t ss_sp; /* Signal stack pointer. */ + int ss_onstack; /* Nonzero if executing on this stack. */ + }; + + +/* Possible values for `ss_flags.'. */ +enum +{ + SS_ONSTACK = 1, +#define SS_ONSTACK SS_ONSTACK + SS_DISABLE +#define SS_DISABLE SS_DISABLE +}; + +/* Minimum stack size for a signal handler. */ +#define MINSIGSTKSZ 2048 + +/* System default stack size. */ +#define SIGSTKSZ 8192 + + +/* Alternate, preferred interface. */ +typedef struct sigaltstack + { + __ptr_t ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; + +#endif /* bits/sigstack.h */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h new file mode 100644 index 0000000..2bdae97 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h @@ -0,0 +1,107 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_STAT_H +# error "Never include directly; use instead." +#endif + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_KERNEL 0 +#define _STAT_VER_LINUX 1 +#define _STAT_VER _STAT_VER_LINUX + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_LINUX 0 + +struct stat + { + __dev_t st_dev; /* Device. */ + __ino_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + int pad0; + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ + __time_t st_atime; /* Time of last access. */ + long int __reserved0; /* Reserved for atime.nanoseconds. */ + __time_t st_mtime; /* Time of last modification. */ + long int __reserved1; /* Reserved for mtime.nanoseconds. */ + __time_t st_ctime; /* Time of last status change. */ + long int __reserved2; /* Reserved for ctime.nanoseconds. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ + long int __unused[3]; + }; + +#ifdef __USE_LARGEFILE64 +/* Note stat64 is the same shape as stat. */ +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + int pad0; + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ + __time_t st_atime; /* Time of last access. */ + long int __reserved0; /* Reserved for atime.nanoseconds. */ + __time_t st_mtime; /* Time of last modification. */ + long int __reserved1; /* Reserved for mtime.nanoseconds. */ + __time_t st_ctime; /* Time of last status change. */ + long int __reserved2; /* Reserved for ctime.nanoseconds. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ + long int __unused[3]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. */ +#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h new file mode 100644 index 0000000..45c4dc8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h @@ -0,0 +1,115 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * Never include this file directly; use instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include + +#define __need_size_t +#include + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; +typedef unsigned long int __u_quad_t; +typedef long int __quad_t; +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; +typedef __quad_t *__qaddr_t; + +typedef __uint64_t __dev_t; /* Type of device numbers. */ +typedef __uint32_t __uid_t; /* Type of user identifications. */ +typedef __uint32_t __gid_t; /* Type of group identifications. */ +typedef __uint64_t __ino_t; /* Type of file serial numbers. */ +typedef __uint64_t __ino64_t; /* "" (LFS) */ +typedef __uint32_t __mode_t; /* Type of file attribute bitmasks. */ +typedef __uint64_t __nlink_t; /* Type of file link counts. */ +typedef __int64_t __off_t; /* Type of file sizes and offsets. */ +typedef __int64_t __off64_t; /* "" (LFS) */ +typedef __int64_t __loff_t; /* Type of file sizes and offsets. */ +typedef __int32_t __pid_t; /* Type of process identifications. */ +typedef __int64_t __ssize_t; /* Type of a byte count, or error. */ +typedef __uint64_t __rlim_t; /* Type of resource counts. */ +typedef __uint64_t __rlim64_t; /* "" (LFS) */ +typedef __int64_t __blkcnt_t; /* Type to count nr disk blocks. */ +typedef __int64_t __blkcnt64_t; /* "" (LFS) */ +typedef __uint64_t __fsblkcnt_t; /* Type to count file system blocks. */ +typedef __uint64_t __fsblkcnt64_t; /* "" (LFS) */ +typedef __uint64_t __fsfilcnt_t; /* Type to count file system inodes. */ +typedef __uint64_t __fsfilcnt64_t; /* "" (LFS) */ +typedef __uint32_t __id_t; /* General type for IDs. */ + +typedef struct + { + int __val[2]; + } __fsid_t; /* Type of file system IDs. */ + +/* Everythin' else. */ +typedef int __daddr_t; /* Type of a disk address. */ +typedef char *__caddr_t; /* Type of a core address. */ +typedef long int __time_t; +typedef unsigned int __useconds_t; +typedef long int __suseconds_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ +typedef long int __clock_t; +typedef int __key_t; /* Type of a SYSV IPC key. */ + +/* Clock ID used in clock and timer functions. */ +typedef int __clockid_t; + +/* Timer ID returned by `timer_create'. */ +typedef int __timer_t; + +/* Used in `struct shmid_ds'. */ +typedef int __ipc_pid_t; + +/* type to represent block size. */ +typedef long int __blksize_t; + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + +/* Used in XTI. */ +typedef int __t_scalar_t; +typedef unsigned int __t_uscalar_t; + +/* Duplicates info from stdint.h but this is used in unistd.h. */ +typedef long int __intptr_t; + +/* Duplicate info from sys/socket.h. */ +typedef unsigned int __socklen_t; + +/* Now add the thread types. */ +#if defined __USE_POSIX199506 || defined __USE_UNIX98 +# include +#endif + +#endif /* bits/types.h */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S new file mode 100644 index 0000000..c6b160a --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S @@ -0,0 +1,55 @@ +/* Wrapper around clone system call. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* clone is even more special than fork as it mucks with stacks + and invokes a function in the right context after its all over. */ + +#include +#define _ERRNO_H 1 +#include + + .text +ENTRY(__clone) + /* Sanity check arguments & move registers */ + ltgr %r1,%r2 /* no NULL function pointers */ + lghi %r2,-EINVAL + jz SYSCALL_ERROR_LABEL + ltgr %r3,%r3 /* no NULL stack pointers */ + jz SYSCALL_ERROR_LABEL + /* move child_stack and flags, then call SVC */ + lgr %r2,%r3 + lgr %r3,%r4 + svc SYS_ify(clone) + ltgr %r2,%r2 /* check return code */ + jm SYSCALL_ERROR_LABEL + jz thread_start + br %r14 + +thread_start: + /* fn is in gpr 1, arg in gpr 5 */ + lgr %r2,%r5 /* set first parameter to void *arg */ + sgr %r11,%r11 /* terminate the stack frame */ + aghi %r15,-96 /* make room on the stack for the save area */ + basr %r14,%r1 /* jump to fn */ +#ifdef PIC + larl %r12,_GLOBAL_OFFSET_TABLE_ +#endif + jg _exit@PLT /* branch to _exit -> thread termination */ +PSEUDO_END (__clone) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/fstatfs64.c b/sysdeps/unix/sysv/linux/s390/s390-64/fstatfs64.c new file mode 100644 index 0000000..2be4e59 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/fstatfs64.c @@ -0,0 +1 @@ +/* fstatfs64 is the same as fstatfs. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ftruncate64.c b/sysdeps/unix/sysv/linux/s390/s390-64/ftruncate64.c new file mode 100644 index 0000000..673a8b5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/ftruncate64.c @@ -0,0 +1 @@ +/* ftruncate64 is the same as ftruncate. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/fxstat.c b/sysdeps/unix/sysv/linux/s390/s390-64/fxstat.c new file mode 100644 index 0000000..96b7116 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/fxstat.c @@ -0,0 +1,42 @@ +/* fxstat using old-style Unix fstat system call. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Ho hum, since xstat == xstat64 we must get rid of the prototype or gcc + will complain since they don't strictly match. */ +#define __fxstat64 __fxstat64_disable + +#include +#include +#include + +#include +#include + +extern int __syscall_fstat (int, struct stat *); + +/* Get information about the file FD in BUF. */ +int +__fxstat (int vers, int fd, struct stat *buf) +{ + return INLINE_SYSCALL (fstat, 2, fd, buf); +} + +weak_alias (__fxstat, _fxstat); +#undef __fxstat64 +strong_alias (__fxstat, __fxstat64); diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/fxstat64.c b/sysdeps/unix/sysv/linux/s390/s390-64/fxstat64.c new file mode 100644 index 0000000..9eff9eb --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/fxstat64.c @@ -0,0 +1 @@ +/* fxstat64 is in fxstat.c */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getdents.c b/sysdeps/unix/sysv/linux/s390/s390-64/getdents.c new file mode 100644 index 0000000..491fa9d --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/getdents.c @@ -0,0 +1,4 @@ +#define __getdents64 __no___getdents64_decl +#include +#undef __getdents64 +weak_alias(__getdents, __getdents64); diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getdents64.c b/sysdeps/unix/sysv/linux/s390/s390-64/getdents64.c new file mode 100644 index 0000000..0df2c8f --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/getdents64.c @@ -0,0 +1 @@ +/* getdents64 is in getdents.c */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getrlimit64.c b/sysdeps/unix/sysv/linux/s390/s390-64/getrlimit64.c new file mode 100644 index 0000000..9feab0e --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/getrlimit64.c @@ -0,0 +1 @@ +/* getrlimit64 is the same as getrlimit. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/glob.c b/sysdeps/unix/sysv/linux/s390/s390-64/glob.c new file mode 100644 index 0000000..b6da989 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/glob.c @@ -0,0 +1,7 @@ +#define glob64 __no_glob64_decl +#define globfree64 __no_globfree64_decl +#include +#undef glob64 +#undef globfree64 +weak_alias (glob, glob64) +weak_alias (globfree, globfree64) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/glob64.c b/sysdeps/unix/sysv/linux/s390/s390-64/glob64.c new file mode 100644 index 0000000..33918ea --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/glob64.c @@ -0,0 +1 @@ +/* glob64 is in glob.c */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h new file mode 100644 index 0000000..10f17b2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h @@ -0,0 +1,46 @@ +/* Definition of `struct stat' used in the kernel. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +struct kernel_stat + { + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + unsigned int __pad1; + unsigned long int st_size; + unsigned long int st_atime; + unsigned long int st_mtime; + unsigned long int st_ctime; + unsigned int st_blksize; + int st_blocks; + unsigned long __unused1; + unsigned long __unused2; + }; + +extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf); + +#define XSTAT_IS_XSTAT64 1 +#define _HAVE___UNUSED1 +#define _HAVE___UNUSED2 + diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/lxstat.c b/sysdeps/unix/sysv/linux/s390/s390-64/lxstat.c new file mode 100644 index 0000000..1b80b11 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/lxstat.c @@ -0,0 +1,42 @@ +/* lxstat using old-style Unix fstat system call. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Ho hum, since xstat == xstat64 we must get rid of the prototype or gcc + will complain since they don't strictly match. */ +#define __lxstat64 __lxstat64_disable + +#include +#include +#include + +#include +#include + +extern int __syscall_lstat (const char *, struct stat *); + +/* Get information about the file FD in BUF. */ +int +__lxstat (int vers, const char *name, struct stat *buf) +{ + return INLINE_SYSCALL (lstat, 2, name, buf); +} + +weak_alias (__lxstat, _lxstat); +#undef __lxstat64 +strong_alias (__lxstat, __lxstat64); diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/lxstat64.c b/sysdeps/unix/sysv/linux/s390/s390-64/lxstat64.c new file mode 100644 index 0000000..bb5dbd0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/lxstat64.c @@ -0,0 +1 @@ +/* lxstat64 is in lxstat.c */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/mmap.S b/sysdeps/unix/sysv/linux/s390/s390-64/mmap.S new file mode 100644 index 0000000..72d73d4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/mmap.S @@ -0,0 +1,67 @@ +/* Wrapper around mmap system call. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#define EINVAL 22 + + .text + +ENTRY(__mmap) + /* Save registers and setup stack frame. */ + stmg %r6,%r15,48(%r15) + lgr %r1,%r15 + lg %r0,8(%r15) /* Load eos. */ + aghi %r15,-208 /* Buy stack space. */ + stg %r1,0(%r15) /* Store back chain. */ + stg %r0,8(%r15) /* Store eos. */ + + /* Store parameters on stack, because old_mmap + takes only one parameter: a pointer to the parameter area. */ + mvc 200(8,%r15),368(%r15) /* Move 'offset'. */ + lgfr %r6,%r6 + stg %r6,192(%r15) /* Store 'fd'. */ + lgfr %r5,%r5 + stg %r5,184(%r15) /* Store 'flags'. */ + lgfr %r4,%r4 + stg %r4,176(%r15) /* Store 'prot'. */ + stg %r3,168(%r15) /* Store 'length'. */ + stg %r2,160(%r15) /* Store 'start'. */ + + la %r2,160(%r15) /* Load address of parameter list. */ + /* Do the system call trap. */ + svc SYS_ify(mmap) + + lg %r15,0(%r15) /* Load back chain. */ + lmg %r6,%r15,48(%r15) /* Load registers. */ + + /* Check gpr 2 for error. */ + lghi %r0,-4096 + clgr %r2,%r0 + jnl SYSCALL_ERROR_LABEL + + /* Successful; return the syscall's value. */ + br %r14 + +PSEUDO_END (__mmap) + +weak_alias (__mmap, mmap) +weak_alias (__mmap, mmap64) + diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/mmap64.c b/sysdeps/unix/sysv/linux/s390/s390-64/mmap64.c new file mode 100644 index 0000000..0dbd384 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/mmap64.c @@ -0,0 +1 @@ +/* mmap64 is the same as mmap. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/pread64.c b/sysdeps/unix/sysv/linux/s390/s390-64/pread64.c new file mode 100644 index 0000000..b7f298d --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/pread64.c @@ -0,0 +1 @@ +/* Empty since the pread syscall is equivalent. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c b/sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c new file mode 100644 index 0000000..b1b25f6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/pwrite64.c @@ -0,0 +1 @@ +/* Empty since the pwrite syscall is equivalent. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/readdir.c b/sysdeps/unix/sysv/linux/s390/s390-64/readdir.c new file mode 100644 index 0000000..300ebb2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/readdir.c @@ -0,0 +1,7 @@ +#define readdir64 __no_readdir64_decl +#define __readdir64 __no___readdir64_decl +#include +#undef __readdir64 +strong_alias (__readdir, __readdir64) +#undef readdir64 +weak_alias (__readdir, readdir64) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/readdir64.c b/sysdeps/unix/sysv/linux/s390/s390-64/readdir64.c new file mode 100644 index 0000000..9796431 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/readdir64.c @@ -0,0 +1 @@ +/* readdir64 is in readdir.c */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/readdir64_r.c b/sysdeps/unix/sysv/linux/s390/s390-64/readdir64_r.c new file mode 100644 index 0000000..b8fe9a3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/readdir64_r.c @@ -0,0 +1 @@ +/* readdir64_r is in readdir_r.c */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/readdir_r.c b/sysdeps/unix/sysv/linux/s390/s390-64/readdir_r.c new file mode 100644 index 0000000..adb92db --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/readdir_r.c @@ -0,0 +1,4 @@ +#define readdir64_r __no_readdir64_r_decl +#include +#undef readdir64_r +weak_alias (__readdir_r, readdir64_r) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h b/sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h new file mode 100644 index 0000000..a9da7d8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h @@ -0,0 +1,133 @@ +/* Dump registers. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* We will print the register dump in this format: + + GPR0: XXXXXXXXXXXXXXXX GPR1: XXXXXXXXXXXXXXXX + GPR2: XXXXXXXXXXXXXXXX GPR3: XXXXXXXXXXXXXXXX + GPR4: XXXXXXXXXXXXXXXX GPR5: XXXXXXXXXXXXXXXX + GPR6: XXXXXXXXXXXXXXXX GPR7: XXXXXXXXXXXXXXXX + GPR8: XXXXXXXXXXXXXXXX GPR9: XXXXXXXXXXXXXXXX + GPRA: XXXXXXXXXXXXXXXX GPRB: XXXXXXXXXXXXXXXX + GPRC: XXXXXXXXXXXXXXXX GPRD: XXXXXXXXXXXXXXXX + GPRE: XXXXXXXXXXXXXXXX GPRF: XXXXXXXXXXXXXXXX + + PSW.MASK: XXXXXXXXXXXXXXXX PSW.ADDR: XXXXXXXXXXXXXXXX + + ST(0) XXXX XXXXXXXXXXXXXXXX ST(1) XXXX XXXXXXXXXXXXXXXX + ST(2) XXXX XXXXXXXXXXXXXXXX ST(3) XXXX XXXXXXXXXXXXXXXX + ST(4) XXXX XXXXXXXXXXXXXXXX ST(5) XXXX XXXXXXXXXXXXXXXX + ST(6) XXXX XXXXXXXXXXXXXXXX ST(7) XXXX XXXXXXXXXXXXXXXX + */ + +static void +hexvalue (unsigned long int value, char *buf, size_t len) +{ + char *cp = _itoa_word (value, buf + len, 16, 0); + while (cp > buf) + *--cp = '0'; +} + +static void +register_dump (int fd, struct sigcontext *ctx) +{ + char regs[19][16]; + struct iovec iov[40]; + size_t nr = 0; + +#define ADD_STRING(str) \ + iov[nr].iov_base = (char *) str; \ + iov[nr].iov_len = strlen (str); \ + ++nr +#define ADD_MEM(str, len) \ + iov[nr].iov_base = str; \ + iov[nr].iov_len = len; \ + ++nr + + /* Generate strings of register contents. */ + hexvalue (ctx->sregs->regs.gprs[0], regs[0], 16); + hexvalue (ctx->sregs->regs.gprs[1], regs[1], 16); + hexvalue (ctx->sregs->regs.gprs[2], regs[2], 16); + hexvalue (ctx->sregs->regs.gprs[3], regs[3], 16); + hexvalue (ctx->sregs->regs.gprs[4], regs[4], 16); + hexvalue (ctx->sregs->regs.gprs[5], regs[5], 16); + hexvalue (ctx->sregs->regs.gprs[6], regs[6], 16); + hexvalue (ctx->sregs->regs.gprs[7], regs[7], 16); + hexvalue (ctx->sregs->regs.gprs[8], regs[8], 16); + hexvalue (ctx->sregs->regs.gprs[9], regs[9], 16); + hexvalue (ctx->sregs->regs.gprs[10], regs[10], 16); + hexvalue (ctx->sregs->regs.gprs[11], regs[11], 16); + hexvalue (ctx->sregs->regs.gprs[12], regs[12], 16); + hexvalue (ctx->sregs->regs.gprs[13], regs[13], 16); + hexvalue (ctx->sregs->regs.gprs[14], regs[14], 16); + hexvalue (ctx->sregs->regs.gprs[15], regs[15], 16); + hexvalue (ctx->sregs->regs.psw.mask, regs[16], 16); + hexvalue (ctx->sregs->regs.psw.addr, regs[17], 16); + + /* Generate the output. */ + ADD_STRING ("Register dump:\n\n GPR0: "); + ADD_MEM (regs[0], 16); + ADD_STRING (" GPR1: "); + ADD_MEM (regs[1], 16); + ADD_STRING (" GPR2: "); + ADD_MEM (regs[2], 16); + ADD_STRING (" GPR3: "); + ADD_MEM (regs[3], 16); + ADD_STRING ("\n GPR4: "); + ADD_MEM (regs[4], 16); + ADD_STRING (" GPR5: "); + ADD_MEM (regs[5], 16); + ADD_STRING (" GPR6: "); + ADD_MEM (regs[6], 16); + ADD_STRING (" GPR7: "); + ADD_MEM (regs[7], 16); + ADD_STRING ("\n GPR8: "); + ADD_MEM (regs[8], 16); + ADD_STRING (" GPR9: "); + ADD_MEM (regs[9], 16); + ADD_STRING (" GPRA: "); + ADD_MEM (regs[10], 16); + ADD_STRING (" GPRB: "); + ADD_MEM (regs[11], 16); + ADD_STRING ("\n GPRC: "); + ADD_MEM (regs[12], 16); + ADD_STRING (" GPRD: "); + ADD_MEM (regs[13], 16); + ADD_STRING (" GPRE: "); + ADD_MEM (regs[14], 16); + ADD_STRING (" GPRF: "); + ADD_MEM (regs[15], 16); + ADD_STRING ("\n\n PSW.MASK: "); + ADD_MEM (regs[16], 16); + ADD_STRING (" PSW.ADDR: "); + ADD_MEM (regs[17], 16); + ADD_STRING (" TRAP: "); + ADD_MEM (regs[18], 4); + ADD_STRING ("\n"); + + /* Write the stuff out. */ + writev (fd, iov, nr); +} + + +#define REGISTER_DUMP register_dump (fd, &ctx) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setrlimit64.c b/sysdeps/unix/sysv/linux/s390/s390-64/setrlimit64.c new file mode 100644 index 0000000..8edcff0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/setrlimit64.c @@ -0,0 +1 @@ +/* setrlimit64 is the same as setrlimit. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c new file mode 100644 index 0000000..9e2ffa8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* 64 bit Linux for S/390 only has rt signals, thus we do not even want to try + falling back to the old style signals as the default Linux handler does. */ + +#include +#include +#include + +#include +#include + +extern int __syscall_rt_sigaction (int, const struct sigaction *, + struct sigaction *, size_t); + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. This is the definition. */ + + +/* If ACT is not NULL, change the action for SIG to *ACT. + If OACT is not NULL, put the old action for SIG in *OACT. */ +int +__libc_sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; +{ + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + return INLINE_SYSCALL (rt_sigaction, 4, sig, act, oact, _NSIG / 8); +} + +weak_alias (__libc_sigaction, __sigaction) +weak_alias (__libc_sigaction, sigaction) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigpending.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigpending.c new file mode 100644 index 0000000..cdaacd7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigpending.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* 64 bit Linux for S/390 only has rt signals, thus we do not even want to try + falling back to the old style signals as the default Linux handler does. */ + +#include +#include +#include + +#include +#include + +extern int __syscall_rt_sigpending (sigset_t *, size_t); + + +/* Change the set of blocked signals to SET, + wait until a signal arrives, and restore the set of blocked signals. */ +int +sigpending (set) + sigset_t *set; +{ + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + return INLINE_SYSCALL (rt_sigpending, 2, set, _NSIG / 8); +} diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c new file mode 100644 index 0000000..1a580b0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* 64 bit Linux for S/390 only has rt signals, thus we do not even want to try + falling back to the old style signals as the default Linux handler does. */ + +#include +#include +#include + +#include +#include + +extern int __syscall_rt_sigprocmask (int, const sigset_t *, + sigset_t *, size_t); + +/* Get and/or change the set of blocked signals. */ +int +__sigprocmask (how, set, oset) + int how; + const sigset_t *set; + sigset_t *oset; +{ + + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8); +} +weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c new file mode 100644 index 0000000..af7797e --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#include +#include + +extern int __syscall_rt_sigsuspend (const sigset_t *, size_t); + + +/* Change the set of blocked signals to SET, + wait until a signal arrives, and restore the set of blocked signals. */ +int +__sigsuspend (set) + const sigset_t *set; +{ + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + return INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8); +} +weak_alias (__sigsuspend, sigsuspend) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/socket.S b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S new file mode 100644 index 0000000..471c0b5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S @@ -0,0 +1,99 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* &%/$&!! preprocessor */ +#define P(a, b) P2(a, b) +#define P2(a, b) a##b + + .text +/* The socket-oriented system calls are handled unusally in Linux. + They are all gated through the single `socketcall' system call number. + `socketcall' takes two arguments: the first is the subcode, specifying + which socket function is being called; and the second is a pointer to + the arguments to the specific function. + + The .S files for the other calls just #define socket and #include this. */ + +#ifndef __socket +#ifndef NO_WEAK_ALIAS +#define __socket P(__,socket) +#else +#define __socket socket +#endif +#endif + +#ifndef NARGS /* The socket.o object is compiled directly ... */ +#define NARGS 3 +#endif + +.globl __socket +ENTRY(__socket) + + /* Save registers and setup stack. */ + stmg %r6,%r15,48(%r15) /* Save registers. */ + lgr %r1,%r15 + lg %r0,8(%r15) /* Load eos. */ + ahi %r15,-208 /* Buy stack space. */ + stg %r1,0(%r15) /* Store back chain. */ + stg %r0,8(%r15) /* Store eos. */ + + /* Reorder arguments. */ +#if (NARGS >= 6) + mvc 200(8,%r15),368(%r15) /* Move between parameter lists. */ +#endif +#if (NARGS >= 5) + stg %r6,192(%r15) /* Store into parameter list. */ +#endif +#if (NARGS >= 4) + stg %r5,184(%r15) /* Store into parameter list. */ +#endif +#if (NARGS >= 3) + stg %r4,176(%r15) /* Store into parameter list. */ +#endif +#if (NARGS >= 2) + stg %r3,168(%r15) /* Store into parameter list. */ + stg %r2,160(%r15) +#endif + /* Load subcode for socket syscall. */ + lghi %r2,P(SOCKOP_,socket) + la %r3,160(%r15) /* Load address of parameter list. */ + + /* Do the system call trap. */ + svc SYS_ify(socketcall) + + lg %r15,0(%r15) /* Load back chain. */ + lmg %r6,15,48(%r15) /* Load registers. */ + + /* gpr2 is < 0 if there was an error. */ + lghi %r0,-125 + clgr %r2,%r0 + jnl SYSCALL_ERROR_LABEL + + /* Successful; return the syscall's value. */ + br %r14 + +PSEUDO_END (__socket) + +#ifndef NO_WEAK_ALIAS +weak_alias (__socket, socket) +#endif + diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/statfs64.c b/sysdeps/unix/sysv/linux/s390/s390-64/statfs64.c new file mode 100644 index 0000000..06bc688 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/statfs64.c @@ -0,0 +1 @@ +/* statfs64 is the same as statfs. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h b/sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h new file mode 100644 index 0000000..3e91109 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h @@ -0,0 +1,118 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +typedef greg_t elf_greg_t; +#define ELF_NGREG NGREG +typedef gregset_t elf_gregset_t; +typedef fpreg_t elf_fpreg_t; +typedef fpregset_t elf_fpregset_t; + +/* Signal info. */ +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with Linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + GDB doesn't really use excluded. */ + +struct elf_prstatus + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args. */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned int pr_uid; + unsigned int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + +/* The rest of this file provides the types for emulation of the + Solaris interfaces that should be implemented by + users of libthread_db. */ + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore have only one PID type. */ +typedef __pid_t lwpid_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h new file mode 100644 index 0000000..773841c --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h @@ -0,0 +1,77 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Denis Joseph Barrow (djbarrow@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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 +/* Forward definition to avoid parse errors */ +struct ucontext; +typedef struct ucontext ucontext_t; +#include +#include + +/* We need the signal context definitions even if they are not used + included in . */ +#include + + +/* Type for a general-purpose register. */ +typedef unsigned long greg_t; + +/* And the whole bunch of them. We should have used `struct s390_regs', + but to avoid name space pollution and since the tradition says that + the register set is an array, we make gregset_t a simple array + that has the same size as s390_regs. */ +#define NGREG 27 +#define NUM_FPRS 16 +/* Must match kernels psw_t alignment */ +typedef greg_t gregset_t[NGREG] __attribute__ ((aligned(8))); + +typedef union +{ + double d; + float f; +} fpreg_t; + +/* Register set for the floating-point registers. */ +typedef struct { + unsigned int fpc; + fpreg_t fprs[NUM_FPRS]; +} fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + int version; + gregset_t gregs; + fpregset_t fpregs; + } mcontext_t; + +/* Userlevel context. */ +struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_links; + __sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long int uc_filler[170]; + }; + + +#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S new file mode 100644 index 0000000..b632ced --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S @@ -0,0 +1,52 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Please consult the file sysdeps/unix/sysv/linux/s390/sysdep.h for + more information about the value -4095 used below.*/ + +ENTRY (syscall) + /* Save registers and setup stack. */ + stmg %r6,%r15,48(%r15) /* Save registers. */ + lgr %r1,%r15 + lg %r0,8(%r15) /* Load eos. */ + aghi %r15,-160 /* Buy stack space. */ + stg %r1,0(%r15) /* Store back chain. */ + stg %r0,8(%r15) /* Store eos. */ + + lgr %r1,%r2 /* Move syscall number. */ + lgr %r2,%r3 /* First parameter. */ + lgr %r3,%r4 /* Second parameter. */ + lgr %r4,%r5 /* Third parameter. */ + lgr %r5,%r6 /* Fourth parameter. */ + lg %r6,320(%r15) /* Fifth parameter. */ + basr %r7,0 +.L0: ex %r1,.L1-.L0(%r7) /* Lsb of R1 is subsituted as SVC number. */ + + lg %r15,0(%r15) /* Load back chain. */ + lmg %r6,15,48(%r15) /* Load registers. */ + + lghi %r0,-4095 + clgr %r2,%r0 /* Check R2 for error. */ + jnl SYSCALL_ERROR_LABEL + br %r14 /* Return to caller. */ +.L1: .word 0x0A00 /* Opcode for SVC 0. */ +PSEUDO_END (syscall) + diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list new file mode 100644 index 0000000..0d72f06 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list @@ -0,0 +1,55 @@ +# File name Caller Syscall name # args Strong name Weak names + +llseek EXTRA lseek 3 __libc_lseek64 __lseek llseek __lseek64 lseek64 +pread - pread 4 __libc_pread __libc_pread64 __pread pread __pread64 pread64 +pwrite - pwrite 4 __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64 +fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64 +statfs - statfs i:sp __statfs statfs statfs64 +getpeername - getpeername i:ipp __getpeername getpeername +getpriority - getpriority i:ii __getpriority getpriority +ftruncate - ftruncate 2 __ftruncate ftruncate ftruncate64 __ftruncate64 +truncate - truncate 2 truncate truncate64 +getrlimit - getrlimit 2 __getrlimit getrlimit getrlimit64 +setrlimit - setrlimit 2 __setrlimit setrlimit setrlimit64 + +# semaphore and shm system calls +msgctl - msgctl i:iip __msgctl msgctl +msgget - msgget i:ii __msgget msgget +msgrcv - msgrcv i:ibnii __msgrcv msgrcv +msgsnd - msgsnd i:ibni __msgsnd msgsnd +shmat - shmat i:ipi __shmat shmat +shmctl - shmctl i:iip __shmctl shmctl +shmdt - shmdt i:s __shmdt shmdt +shmget - shmget i:iii __shmget shmget +semop - semop i:ipi __semop semop +semget - semget i:iii __semget semget +semctl - semctl i:iiii __semctl semctl + +# proper socket implementations: +accept - accept i:iBN __libc_accept __accept accept +bind - bind i:ipi __bind bind +connect - connect i:ipi __libc_connect __connect connect +getpeername - getpeername i:ipp __getpeername getpeername +getsockname - getsockname i:ipp __getsockname getsockname +getsockopt - getsockopt i:iiiBN __getsockopt getsockopt +listen - listen i:ii __listen listen +recv - recv i:ibni __libc_recv __recv recv +recvfrom - recvfrom i:ibniBN __libc_recvfrom __recvfrom recvfrom +recvmsg - recvmsg i:ipi __libc_recvmsg recvmsg +send - send i:ibni __libc_send __send send +sendmsg - sendmsg i:ipi __libc_sendmsg sendmsg +sendto - sendto i:ibnibn __libc_sendto __sendto sendto +setsockopt - setsockopt i:iiibn __setsockopt setsockopt +shutdown - shutdown i:ii __shutdown shutdown +socket - socket i:iii __socket socket +socketpair - socketpair i:iiif __socketpair socketpair + +getresuid - getresuid i:ppp getresuid +getresgid - getresgid i:ppp getresgid + +rt_sigaction EXTRA rt_sigaction i:ippi __syscall_rt_sigaction rt_sigaction +rt_sigpending EXTRA rt_sigpending i:pi __syscall_rt_sigpending rt_sigpending +rt_sigprocmask EXTRA rt_sigprocmask i:ippi __syscall_rt_sigprocmask rt_sigprocmask +rt_sigqueueinfo EXTRA rt_sigqueueinfo i:iip __syscall_rt_sigqueueinfo rt_sigqueueinfo +rt_sigsuspend EXTRA rt_sigsuspend i:pi __syscall_rt_sigsuspend rt_sigsuspend +rt_sigtimedwait EXTRA rt_sigtimedwait i:pppi __syscall_rt_sigtimedwait rt_sigtimedwait diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S new file mode 100644 index 0000000..7b216c8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S @@ -0,0 +1,90 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Because the Linux version is in fact m68k/ELF and the start.? file + for this system (sysdeps/m68k/elf/start.S) is also used by The Hurd + and therefore this files must not contain the definition of the + `errno' variable (I don't know why, ask Roland), we have to define + it somewhere else. + + ...and this place is here. */ + .bss + .globl errno + .type errno,@object + .size errno,4 +errno: + .space 4 +weak_alias (errno, _errno) + +/* The following code is only used in the shared library when we + compile the reentrant version. Otherwise each system call defines + each own version. */ + +/* The syscall stubs jump here when they detect an error. */ + +#undef CALL_MCOUNT +#define CALL_MCOUNT + + .text +ENTRY(__syscall_error) +#ifndef PIC +#ifndef _LIBC_REENTRANT + lcr %r2,%r2 + larl %r1,errno + st %r2,0(%r1) + lghi %r2,-1 + br %r14 +#else + stmg %r13,%r15,104(%r15) + lgr %r0,%r15 + aghi %r15,-160 + lcr %r13,%r2 + stg %r0,0(%r15) + brasl %r14,__errno_location + st %r13,0(%r2) + lmg %r13,%r15,264(%r15) + lghi %r2,-1 + br %r14 +#endif +#else +#ifndef _LIBC_REENTRANT + larl %r1,_GLOBAL_OFFSET_TABLE_ + lg %r1,errno@GOT(%r1) + lcr %r2,%r2 + st %r2,0(%r1) + lghi %r2,-1 + br %r14 +#else + stmg %r13,%r15,104(%r15) + lgr %r0,%r15 + aghi %r15,-160 + lcr %r13,%r2 + stg %r0,0(%r15) + brasl %r14,__errno_location@PLT + st %r13,0(%r2) + lmg %r13,%r15,264(%r15) + lghi %r2,-1 + br %r14 +#endif +#endif + +END (__syscall_error) + diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h new file mode 100644 index 0000000..d52e623 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -0,0 +1,164 @@ +/* Assembler macros for 64 bit S/390. + Copyright (C) 2001 Free Software Foundation, Inc. + 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _LINUX_S390_SYSDEP_H +#define _LINUX_S390_SYSEDP_H + +#include +#include + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +/* In newer 2.1 kernels __NR_syscall is missing so we define it here. */ +#define __NR_syscall 0 + +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* ELF-like local names start with `.L'. */ +#undef L +#define L(name) .L##name + +#ifdef __ASSEMBLER__ + +/* Linux uses a negative return value to indicate syscall errors, unlike + most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be negative + even if the call succeeded. E.g., the `lseek' system call might return + a large offset. Therefore we must not anymore test for < 0, but test + for a real error by making sure the value in gpr2 is a real error + number. Linus said he will make sure the no syscall returns a value + in -1 .. -4095 as a valid result so we can savely test with -4095. */ + +#define SYSCALL_ERROR_LABEL 0f + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (args, syscall_name); \ + lghi %r4,-4095 ; \ + clgr %r2,%r4 ; \ + jnl SYSCALL_ERROR_LABEL ; \ + L(pseudo_end): + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + SYSCALL_ERROR_HANDLER; \ + END (name) + +#ifndef _LIBC_REENTRANT +#ifndef PIC +#define SYSCALL_ERROR_HANDLER \ +0: lcr %r2,%r2 ; \ + larl %r1,errno ; \ + st %r2,0(%r1) ; \ + lghi %r2,-1 ; \ + br %r14 +#else +#define SYSCALL_ERROR_HANDLER \ +0: larl %r1,_GLOBAL_OFFSET_TABLE_ ; \ + lg %r1,errno@GOT(%r1) ; \ + lcr %r2,%r2 ; \ + st %r2,0(%r1) ; \ + lghi %r2,-1 ; \ + br %r14 +#endif /* PIC */ +#else +#define SYSCALL_ERROR_HANDLER \ +0: jg __syscall_error@PLT +#endif /* _LIBC_REENTRANT */ + +/* Linux takes system call arguments in registers: + + syscall number 1 call-clobbered + arg 1 2 call-clobbered + arg 2 3 call-clobbered + arg 3 4 call-clobbered + arg 4 5 call-clobbered + arg 5 6 call-saved + + (Of course a function with say 3 arguments does not have entries for + arguments 4 and 5.) + S390 does not need to do ANY stack operations to get its parameters + right. + */ + +#define DO_CALL(args, syscall) \ + svc SYS_ify (syscall) + +#define ret \ + br 14 + +#endif /* __ASSEMBLER__ */ + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + int err; \ + asm volatile ( \ + LOADARGS_##nr \ + "svc %b1\n\t" \ + "lgr %0,%%r2\n\t" \ + : "=d" (err) \ + : "I" (__NR_##name) ASMFMT_##nr \ + : "memory", "cc", "2", "3", "4", "5", "6"); \ + if (err >= 0xfffff001) \ + { \ + __set_errno(-err); \ + err = -1; \ + } \ + (int) err; }) + +#define DECLARGS_0() +#define DECLARGS_1(arg1) \ + unsigned long gpr2 = (unsigned long) (arg1); +#define DECLARGS_2(arg1, arg2) \ + DECLARGS_1(arg1) \ + unsigned long gpr3 = (unsigned long) (arg2); +#define DECLARGS_3(arg1, arg2, arg3) \ + DECLARGS_2(arg1, arg2) \ + unsigned long gpr4 = (unsigned long) (arg3); +#define DECLARGS_4(arg1, arg2, arg3, arg4) \ + DECLARGS_3(arg1, arg2, arg3) \ + unsigned long gpr5 = (unsigned long) (arg4); +#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ + DECLARGS_4(arg1, arg2, arg3, arg4) \ + unsigned long gpr6 = (unsigned long) (arg5); + +#define LOADARGS_0 +#define LOADARGS_1 "LG 2,%2\n\t" +#define LOADARGS_2 LOADARGS_1 "LG 3,%3\n\t" +#define LOADARGS_3 LOADARGS_2 "LG 4,%4\n\t" +#define LOADARGS_4 LOADARGS_3 "LG 5,%5\n\t" +#define LOADARGS_5 LOADARGS_4 "LG 6,%6\n\t" + +#define ASMFMT_0 +#define ASMFMT_1 , "m" (gpr2) +#define ASMFMT_2 , "m" (gpr2), "m" (gpr3) +#define ASMFMT_3 , "m" (gpr2), "m" (gpr3), "m" (gpr4) +#define ASMFMT_4 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5) +#define ASMFMT_5 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5), "m" (gpr6) + +#endif /* _LINUX_S390_SYSDEP_H */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/truncate64.c b/sysdeps/unix/sysv/linux/s390/s390-64/truncate64.c new file mode 100644 index 0000000..8999768 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/truncate64.c @@ -0,0 +1 @@ +/* truncate64 is the same as truncate. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/xstat.c b/sysdeps/unix/sysv/linux/s390/s390-64/xstat.c new file mode 100644 index 0000000..788f785 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/xstat.c @@ -0,0 +1,42 @@ +/* xstat using old-style Unix stat system call. 64 bit S/390 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Ho hum, since xstat == xstat64 we must get rid of the prototype or gcc + will complain since they don't strictly match. */ +#define __xstat64 __xstat64_disable + +#include +#include +#include + +#include +#include + +extern int __syscall_stat (const char *, struct stat *); + +/* Get information about the file NAME in BUF. */ +int +__xstat (int vers, const char *name, struct stat *buf) +{ + return INLINE_SYSCALL (stat, 2, name, buf); +} + +weak_alias (__xstat, _xstat); +#undef __xstat64 +strong_alias (__xstat, __xstat64); diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/xstat64.c b/sysdeps/unix/sysv/linux/s390/s390-64/xstat64.c new file mode 100644 index 0000000..e7acd3b --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/xstat64.c @@ -0,0 +1 @@ +/* xstat64 is in xstat.c */ diff --git a/sysdeps/unix/sysv/linux/s390/scandir64.c b/sysdeps/unix/sysv/linux/s390/scandir64.c deleted file mode 100644 index 506fd88..0000000 --- a/sysdeps/unix/sysv/linux/s390/scandir64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/semctl.c b/sysdeps/unix/sysv/linux/s390/semctl.c deleted file mode 100644 index e9b1a48..0000000 --- a/sysdeps/unix/sysv/linux/s390/semctl.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setegid.c b/sysdeps/unix/sysv/linux/s390/setegid.c deleted file mode 100644 index 2e3a54c..0000000 --- a/sysdeps/unix/sysv/linux/s390/setegid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/seteuid.c b/sysdeps/unix/sysv/linux/s390/seteuid.c deleted file mode 100644 index 18e41d0..0000000 --- a/sysdeps/unix/sysv/linux/s390/seteuid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setfsgid.c b/sysdeps/unix/sysv/linux/s390/setfsgid.c deleted file mode 100644 index 0886712..0000000 --- a/sysdeps/unix/sysv/linux/s390/setfsgid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setfsuid.c b/sysdeps/unix/sysv/linux/s390/setfsuid.c deleted file mode 100644 index a9f22eb..0000000 --- a/sysdeps/unix/sysv/linux/s390/setfsuid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setgid.c b/sysdeps/unix/sysv/linux/s390/setgid.c deleted file mode 100644 index 377021d..0000000 --- a/sysdeps/unix/sysv/linux/s390/setgid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setgroups.c b/sysdeps/unix/sysv/linux/s390/setgroups.c deleted file mode 100644 index 0e70862..0000000 --- a/sysdeps/unix/sysv/linux/s390/setgroups.c +++ /dev/null @@ -1,2 +0,0 @@ -/* We also have to rewrite the kernel gid_t to the user land type. */ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setregid.c b/sysdeps/unix/sysv/linux/s390/setregid.c deleted file mode 100644 index 99c57ad..0000000 --- a/sysdeps/unix/sysv/linux/s390/setregid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setresgid.c b/sysdeps/unix/sysv/linux/s390/setresgid.c deleted file mode 100644 index daca1a4..0000000 --- a/sysdeps/unix/sysv/linux/s390/setresgid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setresuid.c b/sysdeps/unix/sysv/linux/s390/setresuid.c deleted file mode 100644 index 3aeabe9..0000000 --- a/sysdeps/unix/sysv/linux/s390/setresuid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setreuid.c b/sysdeps/unix/sysv/linux/s390/setreuid.c deleted file mode 100644 index 8ad6122..0000000 --- a/sysdeps/unix/sysv/linux/s390/setreuid.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setrlimit.c b/sysdeps/unix/sysv/linux/s390/setrlimit.c deleted file mode 100644 index bfaef74..0000000 --- a/sysdeps/unix/sysv/linux/s390/setrlimit.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/setuid.c b/sysdeps/unix/sysv/linux/s390/setuid.c deleted file mode 100644 index c8fa23e..0000000 --- a/sysdeps/unix/sysv/linux/s390/setuid.c +++ /dev/null @@ -1,2 +0,0 @@ -#include - diff --git a/sysdeps/unix/sysv/linux/s390/shmctl.c b/sysdeps/unix/sysv/linux/s390/shmctl.c deleted file mode 100644 index 7eac638..0000000 --- a/sysdeps/unix/sysv/linux/s390/shmctl.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/socket.S b/sysdeps/unix/sysv/linux/s390/socket.S deleted file mode 100644 index 562b98f..0000000 --- a/sysdeps/unix/sysv/linux/s390/socket.S +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -/* &%/$&!! preprocessor */ -#define P(a, b) P2(a, b) -#define P2(a, b) a##b - - .text -/* The socket-oriented system calls are handled unusally in Linux. - They are all gated through the single `socketcall' system call number. - `socketcall' takes two arguments: the first is the subcode, specifying - which socket function is being called; and the second is a pointer to - the arguments to the specific function. - - The .S files for the other calls just #define socket and #include this. */ - -#ifndef __socket -#ifndef NO_WEAK_ALIAS -#define __socket P(__,socket) -#else -#define __socket socket -#endif -#endif - -#ifndef NARGS /* the socket.o object is compiled directly ... */ -#define NARGS 3 -#endif - -.globl __socket -ENTRY(__socket) - - /* Save registers and setup stack. */ - stm %r6,%r15,24(%r15) /* save registers */ - lr %r1,%r15 - l %r0,4(0,%r15) /* load eos */ - ahi %r15,-120 /* buy stack space */ - st %r1,0(0,%r15) /* store back chain */ - st %r0,4(0,%r15) /* store eos */ - - /* Reorder arguments */ -#if (NARGS >= 6) - mvc 0x74(4,%r15),216(%r15) /* move between parameter lists */ -#endif -#if (NARGS >= 5) - st %r6,0x70(0,%r15) /* store into parameter list */ -#endif -#if (NARGS >= 4) - st %r5,0x6C(0,%r15) /* store into parameter list */ -#endif -#if (NARGS >= 3) - st %r4,0x68(0,%r15) /* store into parameter list */ -#endif -#if (NARGS >= 2) - st %r3,0x64(0,%r15) /* store into parameter list */ - st %r2,0x60(0,%r15) -#endif - /* load subcode for socket syscall */ - lhi %r2,P(SOCKOP_,socket) - la %r3,0x60(0,%r15) /* load address of parameter list */ - - /* Do the system call trap. */ - svc SYS_ify(socketcall) - - l %r15,0(0,%r15) /* load back chain */ - lm %r6,15,24(%r15) /* load registers */ - - /* gpr2 is < 0 if there was an error. */ - lhi %r0,-125 - clr %r2,%r0 - jnl SYSCALL_ERROR_LABEL - - /* Successful; return the syscall's value. */ - br %r14 - -PSEUDO_END (__socket) - -#ifndef NO_WEAK_ALIAS -weak_alias (__socket, socket) -#endif diff --git a/sysdeps/unix/sysv/linux/s390/sys/procfs.h b/sysdeps/unix/sysv/linux/s390/sys/procfs.h deleted file mode 100644 index 8b60338..0000000 --- a/sysdeps/unix/sysv/linux/s390/sys/procfs.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SYS_PROCFS_H -#define _SYS_PROCFS_H 1 - -/* This is somewhat modelled after the file of the same name on SVR4 - systems. It provides a definition of the core file format for ELF - used on Linux. It doesn't have anything to do with the /proc file - system, even though Linux has one. - - Anyway, the whole purpose of this file is for GDB and GDB only. - Don't read too much into it. Don't use it for anything other than - GDB unless you know what you are doing. */ - -#include -#include -#include -#include -#include - -__BEGIN_DECLS - -typedef greg_t elf_greg_t; -#define ELF_NGREG NGREG -typedef gregset_t elf_gregset_t; -typedef fpreg_t elf_fpreg_t; -typedef fpregset_t elf_fpregset_t; - -/* Signal info. */ -struct elf_siginfo - { - int si_signo; /* Signal number. */ - int si_code; /* Extra code. */ - int si_errno; /* Errno. */ - }; - - -/* Definitions to generate Intel SVR4-like core files. These mostly - have the same names as the SVR4 types with "elf_" tacked on the - front to prevent clashes with Linux definitions, and the typedef - forms have been avoided. This is mostly like the SVR4 structure, - but more Linuxy, with things that Linux does not support and which - GDB doesn't really use excluded. */ - -struct elf_prstatus - { - struct elf_siginfo pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - unsigned long int pr_sigpend; /* Set of pending signals. */ - unsigned long int pr_sighold; /* Set of held signals. */ - __pid_t pr_pid; - __pid_t pr_ppid; - __pid_t pr_pgrp; - __pid_t pr_sid; - struct timeval pr_utime; /* User time. */ - struct timeval pr_stime; /* System time. */ - struct timeval pr_cutime; /* Cumulative user time. */ - struct timeval pr_cstime; /* Cumulative system time. */ - elf_gregset_t pr_reg; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - - -#define ELF_PRARGSZ (80) /* Number of chars for args. */ - -struct elf_prpsinfo - { - char pr_state; /* Numeric process state. */ - char pr_sname; /* Char for pr_state. */ - char pr_zomb; /* Zombie. */ - char pr_nice; /* Nice val. */ - unsigned long int pr_flag; /* Flags. */ - unsigned short int pr_uid; - unsigned short int pr_gid; - int pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ - }; - -/* The rest of this file provides the types for emulation of the - Solaris interfaces that should be implemented by - users of libthread_db. */ - -/* Addresses. */ -typedef void *psaddr_t; - -/* Register sets. Linux has different names. */ -typedef elf_gregset_t prgregset_t; -typedef elf_fpregset_t prfpregset_t; - -/* We don't have any differences between processes and threads, - therefore have only one PID type. */ -typedef __pid_t lwpid_t; - -/* Process status and info. In the end we do provide typedefs for them. */ -typedef struct elf_prstatus prstatus_t; -typedef struct elf_prpsinfo prpsinfo_t; - -__END_DECLS - -#endif /* sys/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h deleted file mode 100644 index b9ec806..0000000 --- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - Contributed by Denis Joseph Barrow (djbarrow@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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 -/* Forward definition to avoid parse errors */ -struct ucontext; -typedef struct ucontext ucontext_t; -#include -#include - -/* We need the signal context definitions even if they are not used - included in . */ -#include - - -/* Type for a general-purpose register. */ -typedef unsigned long greg_t; - -/* And the whole bunch of them. We should have used `struct s390_regs', - but to avoid name space pollution and since the tradition says that - the register set is an array, we make gregset_t a simple array - that has the same size as s390_regs. */ -#define NGREG 36 -#define NUM_FPRS 16 -typedef greg_t gregset_t[NGREG]; - -typedef union -{ - double d; - float f; -} fpreg_t; - -/* Register set for the floating-point registers. */ -typedef struct { - unsigned int fpc; - fpreg_t fprs[NUM_FPRS]; -} fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - int version; - gregset_t gregs; - fpregset_t fpregs; - } mcontext_t; - -/* Userlevel context. */ -struct ucontext - { - unsigned long int uc_flags; - struct ucontext *uc_links; - __sigset_t uc_sigmask; - stack_t uc_stack; - mcontext_t uc_mcontext; - long int uc_filler[170]; - }; - - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/s390/syscall.S b/sysdeps/unix/sysv/linux/s390/syscall.S deleted file mode 100644 index dbd8d68..0000000 --- a/sysdeps/unix/sysv/linux/s390/syscall.S +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -/* Please consult the file sysdeps/unix/sysv/linux/s390/sysdep.h for - more information about the value -4095 used below.*/ - -ENTRY (syscall) - /* Save registers and setup stack. */ - stm %r6,%r15,24(%r15) /* save registers */ - lr %r1,%r15 - l %r0,4(0,%r15) /* load eos */ - ahi %r15,-96 /* buy stack space */ - st %r1,0(0,%r15) /* store back chain */ - st %r0,4(0,%r15) /* store eos */ - - lr %r1,%r2 /* move syscall number */ - lr %r2,%r3 /* first parameter */ - lr %r3,%r4 /* second parameter */ - lr %r4,%r5 /* third parameter */ - lr %r5,%r6 /* fourth parameter */ - l %r6,192(%r15) /* fifth parameter */ - basr %r7,0 -.L0: ex %r1,.L1-.L0(%r7) /* lsb of R1 is subsituted as SVC number */ - - l %r15,0(0,%r15) /* load back chain */ - lm %r6,15,24(%r15) /* load registers */ - - lhi %r0,-4095 - clr %r2,%r0 /* check R2 for error */ - jnl SYSCALL_ERROR_LABEL - br %r14 /* return to caller */ -.L1: .word 0x0A00 /* opcode for SVC 0 */ -PSEUDO_END (syscall) diff --git a/sysdeps/unix/sysv/linux/s390/syscalls.list b/sysdeps/unix/sysv/linux/s390/syscalls.list deleted file mode 100644 index 913f051..0000000 --- a/sysdeps/unix/sysv/linux/s390/syscalls.list +++ /dev/null @@ -1,4 +0,0 @@ -# File name Caller Syscall name Args Strong name Weak names - -oldgetrlimit EXTRA getrlimit i:ip __old_getrlimit getrlimit@GLIBC_2.0 -oldsetrlimit EXTRA setrlimit i:ip __old_setrlimit setrlimit@GLIBC_2.0 diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.S b/sysdeps/unix/sysv/linux/s390/sysdep.S deleted file mode 100644 index 5515c0f..0000000 --- a/sysdeps/unix/sysv/linux/s390/sysdep.S +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include - -/* Because the Linux version is in fact m68k/ELF and the start.? file - for this system (sysdeps/m68k/elf/start.S) is also used by The Hurd - and therefore this files must not contain the definition of the - `errno' variable (I don't know why, ask Roland), we have to define - it somewhere else. - - ...and this place is here. */ - .bss - .globl errno - .type errno,@object - .size errno,4 -errno: - .space 4 -weak_alias (errno, _errno) - -/* The following code is only used in the shared library when we - compile the reentrant version. Otherwise each system call defines - each own version. */ - -/* The syscall stubs jump here when they detect an error. */ - -#undef CALL_MCOUNT -#define CALL_MCOUNT - - .text -ENTRY(__syscall_error) -#ifndef PIC -#ifndef _LIBC_REENTRANT - lcr %r2,%r2 - basr %r1,0 -.L0: l %r1,.L1-.L0(%r1) - st %r2,0(0,%r1) - lhi %r2,-1 - br %r14 -.L1: .long errno -#else - stm %r11,%r15,44(%r15) - lr %r0,%r15 - ahi %r15,-96 - st %r0,0(%r15) - lcr %r11,%r2 - basr %r13,0 -.L0: l %r1,.L1-.L0(%r13) - basr %r14,%r1 - st %r11,0(%r2) - lhi %r2,-1 - l %r15,0(%r15) - lm %r11,%r15,44(%r15) - br %r14 -.L1: .long __errno_location -#endif -#else -#ifndef _LIBC_REENTRANT - basr %r1,0 -.L0: al %r1,.L1-.L0(%r1) - l %r1,errno@GOT12(%r1) - lcr %r2,%r2 - st %r2,0(0,%r1) - lhi %r2,-1 - br %r14 -.L1: .long _GLOBAL_OFFSET_TABLE_-0b -#else - stm %r11,%r15,44(%r15) - lr %r0,%r15 - ahi %r15,-96 - st %r0,0(%r15) - lcr %r11,%r2 - basr %r13,0 -.L0: l %r12,.L1-.L0(%r13) - ar %r12,%r13 - l %r14,.L2-.L0(%r13) - bas %r14,0(%r14,%r13) - st %r11,0(0,%r2) - lhi %r2,-1 - l %r15,0(%r15) - lm %r11,%r15,44(%r15) - br %r14 -.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0 -.L2: .long __errno_location@PLT - .L0 -#endif -#endif - -END (__syscall_error) diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h deleted file mode 100644 index 099ce3d..0000000 --- a/sysdeps/unix/sysv/linux/s390/sysdep.h +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. - 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _LINUX_S390_SYSDEP_H -#define _LINUX_S390_SYSDEP_H - -#include -#include - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -/* in newer 2.1 kernels __NR_syscall is missing so we define it here */ -#define __NR_syscall 0 - -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -/* ELF-like local names start with `.L'. */ -#undef L -#define L(name) .L##name - -#ifdef __ASSEMBLER__ - -/* Linux uses a negative return value to indicate syscall errors, unlike - most Unices, which use the condition codes' carry flag. - - Since version 2.1 the return value of a system call might be negative - even if the call succeeded. E.g., the `lseek' system call might return - a large offset. Therefore we must not anymore test for < 0, but test - for a real error by making sure the value in gpr2 is a real error - number. Linus said he will make sure the no syscall returns a value - in -1 .. -4095 as a valid result so we can savely test with -4095. */ - -#define SYSCALL_ERROR_LABEL 0f - -#undef PSEUDO -#define PSEUDO(name, syscall_name, args) \ - .text; \ - ENTRY (name) \ - DO_CALL (args, syscall_name); \ - lhi %r4,-4095 ; \ - clr %r2,%r4 ; \ - jnl SYSCALL_ERROR_LABEL ; \ - L(pseudo_end): - -#undef PSEUDO_END -#define PSEUDO_END(name) \ - SYSCALL_ERROR_HANDLER; \ - END (name) - -#ifndef _LIBC_REENTRANT -#ifndef PIC -#define SYSCALL_ERROR_HANDLER \ -0: lcr %r2,%r2 ; \ - basr %r1,0 ; \ -1: l %r1,2f-1b(%r1) \ - st %r2,0(%r1) \ - lhi %r2,-1 \ - br %r14 \ -2: .long errno -#else -#define SYSCALL_ERROR_HANDLER \ -0: basr %r1,0 ; \ -1: al %r1,2f-1b(%r1) ; \ - l %r1,errno@GOT12(%r1) ; \ - lcr %r2,%r2 ; \ - st %r2,0(%r1) ; \ - lhi %r2,-1 ; \ - br %r14 ; \ -2: .long _GLOBAL_OFFSET_TABLE_-1b -#endif /* PIC */ -#else -#define SYSCALL_ERROR_HANDLER \ -0: basr %r1,0 ; \ -1: al %r1,2f-1b(%r1) ; \ - br %r1 ; \ -2: .long __syscall_error@PLT-1b -#endif /* _LIBC_REENTRANT */ - -/* Linux takes system call arguments in registers: - - syscall number 1 call-clobbered - arg 1 2 call-clobbered - arg 2 3 call-clobbered - arg 3 4 call-clobbered - arg 4 5 call-clobbered - arg 5 6 call-saved - - (Of course a function with say 3 arguments does not have entries for - arguments 4 and 5.) - S390 does not need to do ANY stack operations to get its parameters - right. - */ - -#define DO_CALL(args, syscall) \ - svc SYS_ify (syscall) - -#define ret \ - br 14 - -#endif /* __ASSEMBLER__ */ - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - int err; \ - asm volatile ( \ - LOADARGS_##nr \ - "svc %b1\n\t" \ - "lr %0,%%r2\n\t" \ - : "=d" (err) \ - : "I" (__NR_##name) ASMFMT_##nr \ - : "memory", "cc", "2", "3", "4", "5", "6"); \ - if (err >= 0xfffff001) \ - { \ - __set_errno(-err); \ - err = 0xffffffff; \ - } \ - (int) err; }) - -#define DECLARGS_0() -#define DECLARGS_1(arg1) \ - unsigned int gpr2 = (unsigned int) (arg1); -#define DECLARGS_2(arg1, arg2) \ - DECLARGS_1(arg1) \ - unsigned int gpr3 = (unsigned int) (arg2); -#define DECLARGS_3(arg1, arg2, arg3) \ - DECLARGS_2(arg1, arg2) \ - unsigned int gpr4 = (unsigned int) (arg3); -#define DECLARGS_4(arg1, arg2, arg3, arg4) \ - DECLARGS_3(arg1, arg2, arg3) \ - unsigned int gpr5 = (unsigned int) (arg4); -#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - DECLARGS_4(arg1, arg2, arg3, arg4) \ - unsigned int gpr6 = (unsigned int) (arg5); - -#define LOADARGS_0 -#define LOADARGS_1 "L 2,%2\n\t" -#define LOADARGS_2 LOADARGS_1 "L 3,%3\n\t" -#define LOADARGS_3 LOADARGS_2 "L 4,%4\n\t" -#define LOADARGS_4 LOADARGS_3 "L 5,%5\n\t" -#define LOADARGS_5 LOADARGS_4 "L 6,%6\n\t" - -#define ASMFMT_0 -#define ASMFMT_1 , "m" (gpr2) -#define ASMFMT_2 , "m" (gpr2), "m" (gpr3) -#define ASMFMT_3 , "m" (gpr2), "m" (gpr3), "m" (gpr4) -#define ASMFMT_4 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5) -#define ASMFMT_5 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5), "m" (gpr6) - -#if 0 -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - asm volatile ( \ - "svc %b1\n\t" \ - : "+d" (gpr2) \ - : "I" (__NR_##name) ASMFMT_##nr : "memory", "cc"); \ - if (gpr2 >= 0xfffff001) \ - { \ - __set_errno(-gpr2); \ - gpr2 = 0xffffffff; \ - } \ - (int) gpr2; }) - -#define DECLARGS_0() \ - register unsigned int gpr2 asm("2"); -#define DECLARGS_1(arg1) \ - register unsigned int gpr2 asm("2") = (unsigned int) (arg1); -#define DECLARGS_2(arg1, arg2) \ - DECLARGS_1(arg1) \ - register unsigned int gpr3 asm("3") = (unsigned int) (arg2); -#define DECLARGS_3(arg1, arg2, arg3) \ - DECLARGS_2(arg1, arg2) \ - register unsigned int gpr4 asm("4") = (unsigned int) (arg3); -#define DECLARGS_4(arg1, arg2, arg3, arg4) \ - DECLARGS_3(arg1, arg2, arg3) \ - register unsigned int gpr5 asm("5") = (unsigned int) (arg4); -#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - DECLARGS_4(arg1, arg2, arg3, arg4) \ - register unsigned int gpr6 asm("6") = (unsigned int) (arg5); - -#define ASMFMT_0 -#define ASMFMT_1 -#define ASMFMT_2 , "d" (gpr3) -#define ASMFMT_3 , "d" (gpr3), "d" (gpr4) -#define ASMFMT_4 , "d" (gpr3), "d" (gpr4), "d" (gpr5) -#define ASMFMT_5 , "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) - -#endif /* 0 */ - -#endif /* _LINUX_S390_SYSDEP_H */ diff --git a/sysdeps/unix/sysv/linux/s390/versionsort64.c b/sysdeps/unix/sysv/linux/s390/versionsort64.c deleted file mode 100644 index 144b691..0000000 --- a/sysdeps/unix/sysv/linux/s390/versionsort64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/xstat.c b/sysdeps/unix/sysv/linux/s390/xstat.c deleted file mode 100644 index e9869f5..0000000 --- a/sysdeps/unix/sysv/linux/s390/xstat.c +++ /dev/null @@ -1 +0,0 @@ -#include -- cgit v1.1