From a334319f6530564d22e775935d9c91663623a1b4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 22 Dec 2004 20:10:10 +0000 Subject: (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. --- sysdeps/unix/sysv/linux/s390/s390-32/Dist | 7 ++++ sysdeps/unix/sysv/linux/s390/s390-32/chown.c | 4 +- sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c | 1 - sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c | 1 - sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S | 2 +- sysdeps/unix/sysv/linux/s390/s390-32/lchown.c | 4 +- sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c | 20 ++++----- sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S | 2 +- sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S | 2 +- sysdeps/unix/sysv/linux/s390/s390-32/syscall.S | 9 ++--- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 47 +++------------------- sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h | 35 ++++++++++++++++ 12 files changed, 66 insertions(+), 68 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/Dist delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h (limited to 'sysdeps/unix/sysv/linux/s390/s390-32') 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 0000000000..c0a7dc8c93 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Dist @@ -0,0 +1,7 @@ +clone.S +oldgetrlimit64.c +setresuid.c +setresgid.c +setfsuid.c +setfsgid.c +ucontext_i.h diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c index 5909ba8a43..0656b396f8 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2001,2002,2003,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2002, 2003, 2004 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 @@ -25,7 +25,7 @@ #include #include -#include +#include "kernel-features.h" /* In Linux 2.1.x the chown functions have been changed. A new function lchown diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c deleted file mode 100644 index dfed76aeb4..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c deleted file mode 100644 index 0f8b3135d8..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S index 3b38d19488..2578b3ddc0 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S @@ -72,4 +72,4 @@ ENTRY(__getcontext) br %r14 END(__getcontext) -weak_alias (__getcontext, getcontext) +weak_alias(__getcontext, getcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c index 1e64a0ef75..ccdb67b15c 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2003 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 @@ -24,7 +24,7 @@ #include #include -#include +#include "kernel-features.h" # ifdef __NR_lchown32 # if __ASSUME_32BITUIDS == 0 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c index 94760e0c2b..29c8640e92 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c @@ -37,6 +37,8 @@ +-----------------------+ n | overflow parameters | 96 +-----------------------+ + 8 | trampoline | 96+n + +-----------------------+ The registers are set up like this: %r2-%r6: parameters 1 to 5 %r7 : (*func) pointer @@ -53,16 +55,18 @@ void __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) { - extern void __makecontext_ret (void); unsigned long *sp; va_list ap; int i; - sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp - + ucp->uc_stack.ss_size) & -8L); + sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L); + + /* Setup the trampoline. */ + *--sp = 0x07f90000; + *--sp = 0x0de71828; /* Set the return address to trampoline. */ - ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret; + ucp->uc_mcontext.gregs[14] = (long) sp; /* Set register parameters. */ va_start (ap, argc); @@ -94,12 +98,4 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) ucp->uc_mcontext.gregs[15] = (long) sp; } -asm(".text\n" - ".type __makecontext_ret,@function\n" - "__makecontext_ret:\n" - " basr %r14,%r7\n" - " lr %r2,%r8\n" - " br %r9\n" - ".size __makecontext_ret, .-__makecontext_ret"); - weak_alias (__makecontext, makecontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S index cce8d29735..7ad360a3a0 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S @@ -69,4 +69,4 @@ ENTRY(__setcontext) br %r14 END(__setcontext) -weak_alias (__setcontext, setcontext) +weak_alias(__setcontext, setcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S index bf70f11cc7..d9abb62c0b 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S @@ -105,4 +105,4 @@ ENTRY(__swapcontext) /* Return. */ br %r14 END(__swapcontext) -weak_alias (__swapcontext, swapcontext) +weak_alias(__swapcontext, swapcontext) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S index b7e1736891..d1ce925ac3 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S +++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2006 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 C Library. @@ -48,14 +48,13 @@ ENTRY (syscall) lr %r4,%r5 /* third parameter */ lr %r5,%r6 /* fourth parameter */ l %r6,192(%r15) /* fifth parameter */ - l %r7,196(%r15) /* sixth parameter */ - basr %r8,0 -0: cl %r1,4f-0b(%r8) /* svc number < 256? */ + basr %r7,0 +0: cl %r1,4f-0b(%r7) /* svc number < 256? */ jl 2f 1: svc 0 j 3f -2: ex %r1,1b-0b(%r8) /* lsb of R1 is subsituted as SVC number */ +2: ex %r1,1b-0b(%r7) /* lsb of R1 is subsituted as SVC number */ 3: l %r15,0(%r15) /* load back chain */ cfi_adjust_cfa_offset (-96) lm %r6,15,24(%r15) /* load registers */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index b86072bd30..43b1b951d5 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -1,5 +1,4 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +/* Copyright (C) 2000,01,02,03,04 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -24,7 +23,6 @@ #include #include #include /* For RTLD_PRIVATE_ERRNO. */ -#include /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h @@ -113,8 +111,8 @@ 0: lcr %r0,%r2; \ basr %r1,0; \ 1: al %r1,2f-1b(%r1); \ - l %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1); \ - ear %r2,%a0; \ + l %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1) \ + ear %r2,%a0 \ st %r0,0(%r1,%r2); \ lhi %r2,-1; \ br %r14; \ @@ -149,28 +147,19 @@ arg 3 4 call-clobbered arg 4 5 call-clobbered arg 5 6 call-saved - arg 6 7 call-saved (Of course a function with say 3 arguments does not have entries for arguments 4 and 5.) - For system calls with 6 parameters a stack operation is required - to load the 6th parameter to register 7. Call saved register 7 is - moved to register 0 and back to avoid an additional stack frame. + S390 does not need to do ANY stack operations to get its parameters + right. */ #define DO_CALL(syscall, args) \ - .if args > 5; \ - lr %r0,%r7; \ - l %r7,96(%r15); \ - .endif; \ .if SYS_ify (syscall) < 256; \ svc SYS_ify (syscall); \ .else; \ lhi %r1,SYS_ify (syscall); \ svc 0; \ - .endif; \ - .if args > 5; \ - lr %r7,%r0; \ .endif #define ret \ @@ -264,9 +253,6 @@ #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ DECLARGS_4(arg1, arg2, arg3, arg4) \ register unsigned long gpr6 asm ("6") = (unsigned long)(arg5); -#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ - DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - register unsigned long gpr7 asm ("7") = (unsigned long)(arg6); #define ASMFMT_0 #define ASMFMT_1 , "0" (gpr2) @@ -274,28 +260,5 @@ #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) -#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) - - -/* Pointer mangling support. */ -#if defined NOT_IN_libc && defined IS_IN_rtld -/* We cannot use the thread descriptor because in ld.so we use setjmp - earlier than the descriptor is initialized. */ -#else -/* For the time being just use stack_guard rather than a separate - pointer_guard. */ -# ifdef __ASSEMBLER__ -# define PTR_MANGLE(reg, tmpreg) \ - ear tmpreg,%a0; \ - x reg,STACK_GUARD(tmpreg) -# define PTR_MANGLE2(reg, tmpreg) \ - x reg,STACK_GUARD(tmpreg) -# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) -# else -# define PTR_MANGLE(var) \ - (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif #endif /* _LINUX_S390_SYSDEP_H */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h new file mode 100644 index 0000000000..2e51f04e65 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger-Tang . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Constants shared between setcontext() and getcontext(). Don't + install this header file. */ + +#define SIG_BLOCK 0 +#define SIG_UNBLOCK 1 +#define SIG_SETMASK 2 + +#define SC_FLGS 0x000 +#define SC_LINK 0x004 +#define SC_STCK 0x008 +#define SC_PSW 0x018 +#define SC_GPRS 0x020 +#define SC_ACRS 0x060 +#define SC_FPC 0x0A0 +#define SC_FPRS 0x0A8 +#define SC_MASK 0x128 -- cgit v1.2.3