aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/s390/s390-64
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/unix/sysv/linux/s390/s390-64
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'sysdeps/unix/sysv/linux/s390/s390-64')
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/Dist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c19
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c47
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/socket.S1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscall.S9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h44
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h36
12 files changed, 67 insertions, 104 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Dist b/sysdeps/unix/sysv/linux/s390/s390-64/Dist
deleted file mode 100644
index bfd4edc372..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-clone.S
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
index 5a0d7eca5d..8889b5359e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/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-64/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
index cdff9a4f21..b08f1b4047 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
@@ -37,8 +37,6 @@
+-----------------------+
n | overflow parameters | 160
+-----------------------+
- 8 | trampoline | 160+n
- +-----------------------+
The registers are set up like this:
%r2-%r6: parameters 1 to 5
%r7 : (*func) pointer
@@ -55,17 +53,16 @@
void
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
{
+ extern void __makecontext_ret (void);
unsigned long *sp;
va_list ap;
int i;
- sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
-
- /* Setup the trampoline. */
- *--sp = 0x0de7b904002807f9;
+ sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
+ + ucp->uc_stack.ss_size) & -8L);
/* Set the return address to trampoline. */
- ucp->uc_mcontext.gregs[14] = (long) sp;
+ ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
/* Set register parameters. */
va_start (ap, argc);
@@ -97,4 +94,12 @@ __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"
+ " lgr %r2,%r8\n"
+ " br %r9\n"
+ ".size __makecontext_ret, .-__makecontext_ret");
+
weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
index 268f36e713..7beca847c2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/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-64/sigaction.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
index 480ebd424c..eff4f17853 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005 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
@@ -44,6 +44,10 @@ __libc_sigaction (sig, act, oact)
}
libc_hidden_def (__libc_sigaction)
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
#ifndef LIBC_SIGACTION
weak_alias (__libc_sigaction, __sigaction)
libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
deleted file mode 100644
index 452f8354d0..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 2001, 2002, 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
- 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. */
-
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-/* 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. */
- if (SINGLE_THREAD_P)
- return INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
- int oldtype = LIBC_CANCEL_ASYNC ();
-
- int result = INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
- LIBC_CANCEL_RESET (oldtype);
-
- return result;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/socket.S b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
index c98a97449b..d4c3a1c4e1 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
@@ -128,6 +128,7 @@ L(socket_cancel):
j 4b
#endif
+ SYSCALL_ERROR_HANDLER
END (__socket)
#ifndef NO_WEAK_ALIAS
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
index ef2a862c55..cb96fd3b6a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/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-64/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
index 4caeaeaf50..31b55d73f2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -48,13 +48,14 @@ ENTRY (syscall)
lgr %r4,%r5 /* Third parameter. */
lgr %r5,%r6 /* Fourth parameter. */
lg %r6,320(%r15) /* Fifth parameter. */
+ lg %r7,328(%r15) /* Sixth parameter. */
- basr %r7,0
-0: clg %r1,4f-0b(%r7) /* svc number < 256? */
+ basr %r8,0
+0: clg %r1,4f-0b(%r8) /* svc number < 256? */
jl 2f
1: svc 0
j 3f
-2: ex %r1,1b-0b(%r7) /* lsb of R1 is subsituted as SVC number */
+2: ex %r1,1b-0b(%r8) /* lsb of R1 is subsituted as SVC number */
3: lg %r15,0(%r15) /* load back chain */
cfi_adjust_cfa_offset (-160)
lmg %r6,15,48(%r15) /* Load registers. */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 477f8a9f09..791ab9ba52 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-getpeername - getpeername i:ipp __getpeername getpeername
vfork - vfork 0 __vfork vfork
# semaphore and shm system calls
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 154bc06803..9ddec8e041 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -1,5 +1,6 @@
/* Assembler macros for 64 bit S/390.
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -24,6 +25,7 @@
#include <sysdeps/s390/s390-64/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
+#include <tls.h>
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
@@ -149,19 +151,28 @@
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.)
- S390 does not need to do ANY stack operations to get its parameters
- right.
+ 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.
*/
#define DO_CALL(syscall, args) \
+ .if args > 5; \
+ lgr %r0,%r7; \
+ lg %r7,160(%r15); \
+ .endif; \
.if SYS_ify (syscall) < 256; \
svc SYS_ify (syscall); \
.else; \
lghi %r1,SYS_ify (syscall); \
svc 0; \
+ .endif; \
+ .if args > 5; \
+ lgr %r7,%r0; \
.endif
#define ret \
@@ -255,6 +266,9 @@
#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)
@@ -262,5 +276,29 @@
#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; \
+ sllg tmpreg,tmpreg,32; \
+ ear tmpreg,%a1; \
+ xg reg,STACK_GUARD(tmpreg)
+# define PTR_MANGLE2(reg, tmpreg) \
+ xg 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-64/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
deleted file mode 100644
index 6d223a08a6..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
- 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 0x008
-#define SC_STCK 0x010
-#define SC_PSW 0x028
-#define SC_GPRS 0x038
-#define SC_ACRS 0x0B8
-#define SC_FPC 0x0F8
-#define SC_FPRS 0x100
-#define SC_MASK 0x180
-