29e444
#Contains the following patches from upstream:
29e444
#
29e444
#commit c3e94a953347ecf361ab400111dbb1a62505c7fe
29e444
#Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
29e444
#Date:   Tue Mar 5 08:15:33 2013 +0100
29e444
#
29e444
#	S/390: Fix rt_sigprocmask syscall invocation in get/set/swapcontext.
29e444
#
29e444
#****commit e21d7aa71c0700b6611bd55881b862ac73c5cd5b
29e444
#Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
29e444
#Date:   Thu Feb 21 09:47:55 2013 +0100
29e444
#
29e444
#	S/390: Fix _dl_runtime_profile for 32 bit.
29e444
#
29e444
#****commit f78b5caa6ece23ce86f6cabac8edf3ecd6850473
29e444
#Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
29e444
#Date:   Mon Feb 18 10:29:40 2013 +0100
29e444
#
29e444
#	S/390: Fix _dl_runtime_profile
29e444
#
29e444
#
29e444
#****commit bc101e2652728d8a6e8ece7c637e095618546a95
29e444
#Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
29e444
#Date:   Wed Jan 23 10:00:24 2013 +0100
29e444
#
29e444
#	S/390: Fix setjmp/longjmp FPR save/restore
29e444
#
29e444
#****commit 5c95f7b66be2e59cf26f3c29cfab7657880bd76d
29e444
#Author: Heiko Carstens <heiko.carstens@de.ibm.com>
29e444
#Date:   Tue Apr 23 08:53:44 2013 +0200
29e444
#
29e444
#	S/390: Change struct statfs[64] member types to unsigned values
29e444
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/s390/bits/setjmp.h glibc-2.17-c758a686/sysdeps/s390/bits/setjmp.h
12745e
--- glibc-2.17-c758a686/sysdeps/s390/bits/setjmp.h	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/s390/bits/setjmp.h	2013-08-23 12:33:20.597299428 -0400
29e444
@@ -34,7 +34,7 @@ typedef struct __s390_jmp_buf
29e444
   long int __gregs[10];
29e444
 
29e444
 # if __WORDSIZE == 64
29e444
-  /* We save fpu registers 1, 3, 5 and 7.  */
29e444
+  /* We save fpu registers f8 - f15.  */
29e444
   long __fpregs[8];
29e444
 # else
29e444
   /* We save fpu registers 4 and 6.  */
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/s390/s390-32/dl-trampoline.S glibc-2.17-c758a686/sysdeps/s390/s390-32/dl-trampoline.S
12745e
--- glibc-2.17-c758a686/sysdeps/s390/s390-32/dl-trampoline.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/s390/s390-32/dl-trampoline.S	2013-08-23 12:33:20.593298453 -0400
29e444
@@ -95,16 +95,16 @@ _dl_runtime_profile:
29e444
 	lr     %r1,%r2			# function addr returned in r2
29e444
 	icm    %r0,15,20(%r12)		# load & test framesize
29e444
 	jnm    2f
29e444
+
29e444
 	lm     %r2,%r6,32(%r12)
29e444
 	ld     %f0,56(%r12)
29e444
 	ld     %f2,64(%r12)
29e444
-	basr   %r14,%r1			# call resolved function
29e444
-1:	lr     %r15,%r12		# remove stack frame
29e444
+	lr     %r15,%r12		# remove stack frame
29e444
 	cfi_def_cfa_register (15)
29e444
 	l      %r14,16(%r15)		# restore registers
29e444
 	l      %r12,12(%r15)
29e444
-	l      %r6,8(%r15)
29e444
-	br     %r14
29e444
+	br     %r1			# tail-call to the resolved function
29e444
+
29e444
 	cfi_def_cfa_register (12)
29e444
 2:	jz     4f			# framesize == 0 ?
29e444
 	ahi    %r0,7			# align framesize to 8
29e444
@@ -131,7 +131,13 @@ _dl_runtime_profile:
29e444
 	la     %r4,32(%r12)		# pointer to struct La_s390_32_regs
29e444
 	la     %r5,72(%r12)		# pointer to struct La_s390_32_retval
29e444
 	basr   %r14,%r1			# call _dl_call_pltexit
29e444
-	j      1b
29e444
+
29e444
+	lr     %r15,%r12		# remove stack frame
29e444
+	cfi_def_cfa_register (15)
29e444
+	l      %r14,16(%r15)		# restore registers
29e444
+	l      %r12,12(%r15)
29e444
+	br     %r14
29e444
+
29e444
 6:	.long  _dl_profile_fixup - 0b
29e444
 7:	.long  _dl_call_pltexit - 5b
29e444
 	cfi_endproc
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/s390/s390-64/dl-trampoline.S glibc-2.17-c758a686/sysdeps/s390/s390-64/dl-trampoline.S
12745e
--- glibc-2.17-c758a686/sysdeps/s390/s390-64/dl-trampoline.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/s390/s390-64/dl-trampoline.S	2013-08-23 12:46:11.478239405 -0400
29e444
@@ -1,4 +1,4 @@
29e444
-/* PLT trampolines.  s390 version.
29e444
+/* PLT trampolines.  s390x version.
29e444
    Copyright (C) 2005 Free Software Foundation, Inc.
29e444
    This file is part of the GNU C Library.
29e444
 
29e444
@@ -20,8 +20,8 @@
29e444
  * with the following linkage:
29e444
  *   r2 - r6 : parameter registers
29e444
  *   f0, f2, f4, f6 : floating point parameter registers
29e444
- *   24(r15), 28(r15) : PLT arguments PLT1, PLT2
29e444
- *   96(r15) : additional stack parameters
29e444
+ *   48(r15), 56(r15) : PLT arguments PLT1, PLT2
29e444
+ *   160(r15) : additional stack parameters
29e444
  * The normal clobber rules for function calls apply:
29e444
  *   r0 - r5 : call clobbered
29e444
  *   r6 - r13 :	 call saved
29e444
@@ -39,21 +39,21 @@
29e444
 	cfi_startproc
29e444
 	.align 16
29e444
 _dl_runtime_resolve:
29e444
-	stmg   2,5,64(15)	# save registers
29e444
-	stg    14,96(15)
29e444
+	stmg   %r2,%r5,64(15)	# save call-clobbered argument registers
29e444
+	stg    %r14,96(15)
29e444
 	cfi_offset (r14, -64)
29e444
-	lgr    0,15		# create stack frame
29e444
-	aghi   15,-160
29e444
+	lgr    %r0,%r15
29e444
+	aghi   %r15,-160	# create stack frame
29e444
 	cfi_adjust_cfa_offset (160)
29e444
-	stg    0,0(15)
29e444
-	lmg    2,3,208(15)	# load args saved by PLT
29e444
-	brasl  14,_dl_fixup	# call fixup
29e444
-	lgr    1,2		# function addr returned in r2
29e444
-	aghi   15,160		# remove stack frame
29e444
+	stg    %r0,0(%r15)      # write backchain
29e444
+	lmg    %r2,%r3,208(%r15)# load args saved by PLT
29e444
+	brasl  %r14,_dl_fixup	# call fixup
29e444
+	lgr    %r1,%r2		# function addr returned in r2
29e444
+	aghi   %r15,160		# remove stack frame
29e444
 	cfi_adjust_cfa_offset (-160)
29e444
-	lg     14,96(15)	# restore registers
29e444
-	lmg    2,5,64(15)
29e444
-	br     1
29e444
+	lg     %r14,96(15)	# restore registers
29e444
+	lmg    %r2,%r5,64(15)
29e444
+	br     %r1
29e444
 	cfi_endproc
29e444
 	.size _dl_runtime_resolve, .-_dl_runtime_resolve
29e444
 
29e444
@@ -64,13 +64,12 @@ _dl_runtime_resolve:
29e444
 	cfi_startproc
29e444
 	.align 16
29e444
 _dl_runtime_profile:
29e444
-	stmg   %r2,%r6,64(%r15)		# save registers
29e444
-	std    %f0,104(%r15)
29e444
-	std    %f2,112(%r15)
29e444
+	stmg   %r2,%r6,64(%r15)		# save call-clobbered arg regs
29e444
+	std    %f0,104(%r15)		# + r6 needed as arg for
29e444
+	std    %f2,112(%r15)		#  _dl_profile_fixup
29e444
 	std    %f4,120(%r15)
29e444
 	std    %f6,128(%r15)
29e444
-	stg    %r6,16(%r15)
29e444
-	stg    %r12,24(%r15)
29e444
+	stg    %r12,24(%r15)		# r12 is used as backup of r15
29e444
 	stg    %r14,32(%r15)
29e444
 	cfi_offset (r6, -96)
29e444
 	cfi_offset (f0, -56)
29e444
@@ -79,10 +78,10 @@ _dl_runtime_profile:
29e444
 	cfi_offset (f6, -32)
29e444
 	cfi_offset (r12, -136)
29e444
 	cfi_offset (r14, -128)
29e444
-	lgr    %r12,%r15		# create stack frame
29e444
+	lgr    %r12,%r15		# backup stack pointer
29e444
 	cfi_def_cfa_register (12)
29e444
-	aghi   %r15,-160
29e444
-	stg    %r12,0(%r15)
29e444
+	aghi   %r15,-160		# create stack frame
29e444
+	stg    %r12,0(%r15)		# save backchain
29e444
 	lmg    %r2,%r3,48(%r12)		# load arguments saved by PLT
29e444
 	lgr    %r4,%r14			# return address as third parameter
29e444
 	la     %r5,64(%r12)		# pointer to struct La_s390_32_regs
29e444
@@ -92,18 +91,19 @@ _dl_runtime_profile:
29e444
 	lg     %r0,40(%r12)		# load framesize
29e444
 	ltgr   %r0,%r0
29e444
 	jnm    1f
29e444
-	lmg    %r2,%r6,64(%r12)
29e444
-	ld     %f0,104(%r12)
29e444
-	ld     %f2,112(%r12)
29e444
+
29e444
+	lmg    %r2,%r6,64(%r12)		# framesize < 0 means no pltexit call
29e444
+	ld     %f0,104(%r12)		# so we can do a tail call without
29e444
+	ld     %f2,112(%r12)		# copying the arg overflow area
29e444
 	ld     %f4,120(%r12)
29e444
 	ld     %f6,128(%r12)
29e444
-	basr   %r14,%r1			# call resolved function
29e444
-0:	lgr    %r15,%r12		# remove stack frame
29e444
+
29e444
+	lgr    %r15,%r12		# remove stack frame
29e444
 	cfi_def_cfa_register (15)
29e444
 	lg     %r14,32(%r15)		# restore registers
29e444
 	lg     %r12,24(%r15)
29e444
-	lg     %r6,16(%r15)
29e444
-	br     %r14
29e444
+	br     %r1			# tail-call to resolved function
29e444
+
29e444
 	cfi_def_cfa_register (12)
29e444
 1:	jz     4f			# framesize == 0 ?
29e444
 	aghi   %r0,7			# align framesize to 8
29e444
@@ -118,7 +118,7 @@ _dl_runtime_profile:
29e444
 	la     %r3,8(%r3)
29e444
 	brctg  %r0,3b
29e444
 4:	lmg    %r2,%r6,64(%r12)		# load register parameters
29e444
-	ld     %f0,104(%r12)
29e444
+	ld     %f0,104(%r12)            # restore call-clobbered arg regs
29e444
 	ld     %f2,112(%r12)
29e444
 	ld     %f4,120(%r12)
29e444
 	ld     %f6,128(%r12)
29e444
@@ -129,7 +129,13 @@ _dl_runtime_profile:
29e444
 	la     %r4,32(%r12)		# pointer to struct La_s390_32_regs
29e444
 	la     %r5,72(%r12)		# pointer to struct La_s390_32_retval
29e444
 	brasl  %r14,_dl_call_pltexit
29e444
-	j      0b
29e444
+
29e444
+	lgr    %r15,%r12		# remove stack frame
29e444
+	cfi_def_cfa_register (15)
29e444
+	lg     %r14,32(%r15)		# restore registers
29e444
+	lg     %r12,24(%r15)
29e444
+	br     %r14
29e444
+
29e444
 	cfi_endproc
29e444
 	.size _dl_runtime_profile, .-_dl_runtime_profile
29e444
 #endif
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/s390/s390-64/__longjmp.c glibc-2.17-c758a686/sysdeps/s390/s390-64/__longjmp.c
12745e
--- glibc-2.17-c758a686/sysdeps/s390/s390-64/__longjmp.c	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/s390/s390-64/__longjmp.c	2013-08-23 12:33:20.597299428 -0400
29e444
@@ -42,10 +42,14 @@ __longjmp (__jmp_buf env, int val)
29e444
   register void *r1 __asm ("%r1") = (void *) env;
29e444
 #endif
29e444
   /* Restore registers and jump back.  */
29e444
-  asm volatile ("ld   %%f7,104(%1)\n\t"
29e444
-		"ld   %%f5,96(%1)\n\t"
29e444
-		"ld   %%f3,88(%1)\n\t"
29e444
-		"ld   %%f1,80(%1)\n\t"
29e444
+  asm volatile ("ld    %%f8,80(%1)\n\t"
29e444
+		"ld    %%f9,88(%1)\n\t"
29e444
+		"ld    %%f10,96(%1)\n\t"
29e444
+		"ld    %%f11,104(%1)\n\t"
29e444
+		"ld    %%f12,112(%1)\n\t"
29e444
+		"ld    %%f13,120(%1)\n\t"
29e444
+		"ld    %%f14,128(%1)\n\t"
29e444
+		"ld    %%f15,136(%1)\n\t"
29e444
 #ifdef PTR_DEMANGLE
29e444
 		"lmg  %%r6,%%r13,0(%1)\n\t"
29e444
 		"lmg  %%r4,%%r5,64(%1)\n\t"
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/s390/s390-64/setjmp.S glibc-2.17-c758a686/sysdeps/s390/s390-64/setjmp.S
12745e
--- glibc-2.17-c758a686/sysdeps/s390/s390-64/setjmp.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/s390/s390-64/setjmp.S	2013-08-23 12:33:20.598300448 -0400
29e444
@@ -55,10 +55,14 @@ ENTRY(__sigsetjmp)
29e444
 #else
29e444
         stmg   %r6,%r15,0(%r2)      /* Store registers in jmp_buf.  */
29e444
 #endif
29e444
-	std    %f1,80(%r2)
29e444
-	std    %f3,88(%r2)
29e444
-	std    %f5,96(%r2)
29e444
-	std    %f7,104(%r2)
29e444
+	std    %f8,80(%r2)
29e444
+	std    %f9,88(%r2)
29e444
+	std    %f10,96(%r2)
29e444
+	std    %f11,104(%r2)
29e444
+	std    %f12,112(%r2)
29e444
+	std    %f13,120(%r2)
29e444
+	std    %f14,128(%r2)
29e444
+	std    %f15,136(%r2)
29e444
 #if defined NOT_IN_libc && defined IS_IN_rtld
29e444
 	/* In ld.so we never save the signal mask.  */
29e444
 	lghi   %r2,0
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/bits/statfs.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/bits/statfs.h
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/bits/statfs.h	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/bits/statfs.h	2013-08-23 12:33:20.601180842 -0400
29e444
@@ -23,8 +23,8 @@
29e444
 
29e444
 struct statfs
29e444
   {
29e444
-    int f_type;
29e444
-    int f_bsize;
29e444
+    unsigned int f_type;
29e444
+    unsigned int f_bsize;
29e444
 #ifndef __USE_FILE_OFFSET64
29e444
     __fsblkcnt_t f_blocks;
29e444
     __fsblkcnt_t f_bfree;
29e444
@@ -39,27 +39,27 @@ struct statfs
29e444
     __fsfilcnt64_t f_ffree;
29e444
 #endif
29e444
     __fsid_t f_fsid;
29e444
-    int f_namelen;
29e444
-    int f_frsize;
29e444
-    int f_flags;
29e444
-    int f_spare[4];
29e444
+    unsigned int f_namelen;
29e444
+    unsigned int f_frsize;
29e444
+    unsigned int f_flags;
29e444
+    unsigned int f_spare[4];
29e444
   };
29e444
 
29e444
 #ifdef __USE_LARGEFILE64
29e444
 struct statfs64
29e444
   {
29e444
-    int f_type;
29e444
-    int f_bsize;
29e444
+    unsigned int f_type;
29e444
+    unsigned int f_bsize;
29e444
     __fsblkcnt64_t f_blocks;
29e444
     __fsblkcnt64_t f_bfree;
29e444
     __fsblkcnt64_t f_bavail;
29e444
     __fsfilcnt64_t f_files;
29e444
     __fsfilcnt64_t f_ffree;
29e444
     __fsid_t f_fsid;
29e444
-    int f_namelen;
29e444
-    int f_frsize;
29e444
-    int f_flags;
29e444
-    int f_spare[4];
29e444
+    unsigned int f_namelen;
29e444
+    unsigned int f_frsize;
29e444
+    unsigned int f_flags;
29e444
+    unsigned int f_spare[4];
29e444
   };
29e444
 #endif
29e444
 
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S	2013-08-23 12:33:20.588297827 -0400
29e444
@@ -31,41 +31,42 @@
29e444
   other than the PRESERVED state.  */
29e444
 
29e444
 ENTRY(__getcontext)
29e444
-	lr      %r5,%r2
29e444
+	lr      %r1,%r2
29e444
 
29e444
 	/* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
 	slr	%r3,%r3
29e444
-	la	%r4,SC_MASK(%r5)
29e444
+	la	%r4,SC_MASK(%r1)
29e444
+	lhi	%r5,_NSIG8
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Store fpu context.  */
29e444
-	stfpc   SC_FPC(%r5)
29e444
-	std     %f0,SC_FPRS(%r5)
29e444
-	std     %f1,SC_FPRS+8(%r5)
29e444
-	std     %f2,SC_FPRS+16(%r5)
29e444
-	std     %f3,SC_FPRS+24(%r5)
29e444
-	std     %f4,SC_FPRS+32(%r5)
29e444
-	std     %f5,SC_FPRS+40(%r5)
29e444
-	std     %f6,SC_FPRS+48(%r5)
29e444
-	std     %f7,SC_FPRS+56(%r5)
29e444
-	std     %f8,SC_FPRS+64(%r5)
29e444
-	std     %f9,SC_FPRS+72(%r5)
29e444
-	std     %f10,SC_FPRS+80(%r5)
29e444
-	std     %f11,SC_FPRS+88(%r5)
29e444
-	std     %f12,SC_FPRS+96(%r5)
29e444
-	std     %f13,SC_FPRS+104(%r5)
29e444
-	std     %f14,SC_FPRS+112(%r5)
29e444
-	std     %f15,SC_FPRS+120(%r5)
29e444
+	stfpc   SC_FPC(%r1)
29e444
+	std     %f0,SC_FPRS(%r1)
29e444
+	std     %f1,SC_FPRS+8(%r1)
29e444
+	std     %f2,SC_FPRS+16(%r1)
29e444
+	std     %f3,SC_FPRS+24(%r1)
29e444
+	std     %f4,SC_FPRS+32(%r1)
29e444
+	std     %f5,SC_FPRS+40(%r1)
29e444
+	std     %f6,SC_FPRS+48(%r1)
29e444
+	std     %f7,SC_FPRS+56(%r1)
29e444
+	std     %f8,SC_FPRS+64(%r1)
29e444
+	std     %f9,SC_FPRS+72(%r1)
29e444
+	std     %f10,SC_FPRS+80(%r1)
29e444
+	std     %f11,SC_FPRS+88(%r1)
29e444
+	std     %f12,SC_FPRS+96(%r1)
29e444
+	std     %f13,SC_FPRS+104(%r1)
29e444
+	std     %f14,SC_FPRS+112(%r1)
29e444
+	std     %f15,SC_FPRS+120(%r1)
29e444
 
29e444
 	/* Set __getcontext return value to 0.  */
29e444
 	slr     %r2,%r2
29e444
 
29e444
 	/* Store access registers.  */
29e444
-	stam    %a0,%a15,SC_ACRS(%r5)
29e444
+	stam    %a0,%a15,SC_ACRS(%r1)
29e444
 
29e444
 	/* Store general purpose registers.  */
29e444
-	stm     %r0,%r15,SC_GPRS(%r5)
29e444
+	stm     %r0,%r15,SC_GPRS(%r1)
29e444
 
29e444
 	/* Return.  */
29e444
 	br	%r14
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S	2013-08-23 12:33:20.588297827 -0400
29e444
@@ -31,38 +31,39 @@
29e444
   other than the PRESERVED state.  */
29e444
 
29e444
 ENTRY(__setcontext)
29e444
-	lr	%r5,%r2
29e444
+	lr	%r1,%r2
29e444
 
29e444
 	/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
-	la	%r3,SC_MASK(%r5)
29e444
+	la	%r3,SC_MASK(%r1)
29e444
 	slr	%r4,%r4
29e444
+	lhi	%r5,_NSIG8
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Load fpu context.  */
29e444
-	lfpc	SC_FPC(%r5)
29e444
-	ld	%f0,SC_FPRS(%r5)
29e444
-	ld      %f1,SC_FPRS+8(%r5)
29e444
-	ld      %f2,SC_FPRS+16(%r5)
29e444
-	ld      %f3,SC_FPRS+24(%r5)
29e444
-	ld      %f4,SC_FPRS+32(%r5)
29e444
-	ld      %f5,SC_FPRS+40(%r5)
29e444
-	ld      %f6,SC_FPRS+48(%r5)
29e444
-	ld      %f7,SC_FPRS+56(%r5)
29e444
-	ld      %f8,SC_FPRS+64(%r5)
29e444
-	ld      %f9,SC_FPRS+72(%r5)
29e444
-	ld      %f10,SC_FPRS+80(%r5)
29e444
-	ld      %f11,SC_FPRS+88(%r5)
29e444
-	ld      %f12,SC_FPRS+96(%r5)
29e444
-	ld      %f13,SC_FPRS+104(%r5)
29e444
-	ld      %f14,SC_FPRS+112(%r5)
29e444
-	ld      %f15,SC_FPRS+120(%r5)
29e444
+	lfpc	SC_FPC(%r1)
29e444
+	ld	%f0,SC_FPRS(%r1)
29e444
+	ld      %f1,SC_FPRS+8(%r1)
29e444
+	ld      %f2,SC_FPRS+16(%r1)
29e444
+	ld      %f3,SC_FPRS+24(%r1)
29e444
+	ld      %f4,SC_FPRS+32(%r1)
29e444
+	ld      %f5,SC_FPRS+40(%r1)
29e444
+	ld      %f6,SC_FPRS+48(%r1)
29e444
+	ld      %f7,SC_FPRS+56(%r1)
29e444
+	ld      %f8,SC_FPRS+64(%r1)
29e444
+	ld      %f9,SC_FPRS+72(%r1)
29e444
+	ld      %f10,SC_FPRS+80(%r1)
29e444
+	ld      %f11,SC_FPRS+88(%r1)
29e444
+	ld      %f12,SC_FPRS+96(%r1)
29e444
+	ld      %f13,SC_FPRS+104(%r1)
29e444
+	ld      %f14,SC_FPRS+112(%r1)
29e444
+	ld      %f15,SC_FPRS+120(%r1)
29e444
  
29e444
 	/* Don't touch %a0, used for thread purposes.  */
29e444
-	lam	%a1,%a15,SC_ACRS+4(%r5)
29e444
+	lam	%a1,%a15,SC_ACRS+4(%r1)
29e444
 
29e444
 	/* Load general purpose registers.  */
29e444
-	lm	%r0,%r15,SC_GPRS(%r5)
29e444
+	lm	%r0,%r15,SC_GPRS(%r1)
29e444
 
29e444
 	/* Return.  */
29e444
 	br	%r14
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S	2013-08-23 12:33:20.589298155 -0400
29e444
@@ -34,12 +34,13 @@
29e444
 
29e444
 ENTRY(__swapcontext)
29e444
 	lr	%r1,%r2
29e444
-	lr      %r5,%r3
29e444
+	lr      %r0,%r3
29e444
 
29e444
 	/* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
 	slr	%r3,%r3
29e444
 	la	%r4,SC_MASK(%r1)
29e444
+	lhi	%r5,_NSIG8
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Store fpu context.  */
29e444
@@ -72,11 +73,14 @@ ENTRY(__swapcontext)
29e444
 	
29e444
 	/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
+	lr	%r5,%r0
29e444
 	la	%r3,SC_MASK(%r5)
29e444
 	slr	%r4,%r4
29e444
+	lhi	%r5,_NSIG8
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Load fpu context.  */
29e444
+	lr	%r5,%r0
29e444
 	lfpc	SC_FPC(%r5)
29e444
 	ld	%f0,SC_FPRS(%r5)
29e444
 	ld      %f1,SC_FPRS+8(%r5)
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S	2013-08-23 12:33:20.590298812 -0400
29e444
@@ -31,41 +31,42 @@
29e444
   other than the PRESERVED state.  */
29e444
 
29e444
 ENTRY(__getcontext)
29e444
-	lgr     %r5,%r2
29e444
+	lgr     %r1,%r2
29e444
 
29e444
 	/* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
 	slgr	%r3,%r3
29e444
-	la	%r4,SC_MASK(%r5)
29e444
+	la	%r4,SC_MASK(%r1)
29e444
+	lghi	%r5,_NSIG8
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Store fpu context.  */
29e444
-	stfpc   SC_FPC(%r5)
29e444
-	std     %f0,SC_FPRS(%r5)
29e444
-	std     %f1,SC_FPRS+8(%r5)
29e444
-	std     %f2,SC_FPRS+16(%r5)
29e444
-	std     %f3,SC_FPRS+24(%r5)
29e444
-	std     %f4,SC_FPRS+32(%r5)
29e444
-	std     %f5,SC_FPRS+40(%r5)
29e444
-	std     %f6,SC_FPRS+48(%r5)
29e444
-	std     %f7,SC_FPRS+56(%r5)
29e444
-	std     %f8,SC_FPRS+64(%r5)
29e444
-	std     %f9,SC_FPRS+72(%r5)
29e444
-	std     %f10,SC_FPRS+80(%r5)
29e444
-	std     %f11,SC_FPRS+88(%r5)
29e444
-	std     %f12,SC_FPRS+96(%r5)
29e444
-	std     %f13,SC_FPRS+104(%r5)
29e444
-	std     %f14,SC_FPRS+112(%r5)
29e444
-	std     %f15,SC_FPRS+120(%r5)
29e444
+	stfpc   SC_FPC(%r1)
29e444
+	std     %f0,SC_FPRS(%r1)
29e444
+	std     %f1,SC_FPRS+8(%r1)
29e444
+	std     %f2,SC_FPRS+16(%r1)
29e444
+	std     %f3,SC_FPRS+24(%r1)
29e444
+	std     %f4,SC_FPRS+32(%r1)
29e444
+	std     %f5,SC_FPRS+40(%r1)
29e444
+	std     %f6,SC_FPRS+48(%r1)
29e444
+	std     %f7,SC_FPRS+56(%r1)
29e444
+	std     %f8,SC_FPRS+64(%r1)
29e444
+	std     %f9,SC_FPRS+72(%r1)
29e444
+	std     %f10,SC_FPRS+80(%r1)
29e444
+	std     %f11,SC_FPRS+88(%r1)
29e444
+	std     %f12,SC_FPRS+96(%r1)
29e444
+	std     %f13,SC_FPRS+104(%r1)
29e444
+	std     %f14,SC_FPRS+112(%r1)
29e444
+	std     %f15,SC_FPRS+120(%r1)
29e444
 
29e444
 	/* Set __getcontext return value to 0.  */
29e444
 	slgr    %r2,%r2
29e444
 
29e444
 	/* Store access registers.  */
29e444
-	stam    %a0,%a15,SC_ACRS(%r5)
29e444
+	stam    %a0,%a15,SC_ACRS(%r1)
29e444
 
29e444
 	/* Store general purpose registers.  */
29e444
-	stmg    %r0,%r15,SC_GPRS(%r5)
29e444
+	stmg    %r0,%r15,SC_GPRS(%r1)
29e444
 
29e444
 	/* Return.  */
29e444
 	br	%r14
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S	2013-08-23 12:33:20.591298098 -0400
29e444
@@ -31,38 +31,39 @@
29e444
   other than the PRESERVED state.  */
29e444
 
29e444
 ENTRY(__setcontext)
29e444
-	lgr	%r5,%r2
29e444
+	lgr	%r1,%r2
29e444
 
29e444
 	/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
-	la	%r3,SC_MASK(%r5)
29e444
+	la	%r3,SC_MASK(%r1)
29e444
 	slgr	%r4,%r4
29e444
+	lghi	%r5,_NSIG8
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Load fpu context.  */
29e444
-	lfpc	SC_FPC(%r5)
29e444
-	ld	%f0,SC_FPRS(%r5)
29e444
-	ld      %f1,SC_FPRS+8(%r5)
29e444
-	ld      %f2,SC_FPRS+16(%r5)
29e444
-	ld      %f3,SC_FPRS+24(%r5)
29e444
-	ld      %f4,SC_FPRS+32(%r5)
29e444
-	ld      %f5,SC_FPRS+40(%r5)
29e444
-	ld      %f6,SC_FPRS+48(%r5)
29e444
-	ld      %f7,SC_FPRS+56(%r5)
29e444
-	ld      %f8,SC_FPRS+64(%r5)
29e444
-	ld      %f9,SC_FPRS+72(%r5)
29e444
-	ld      %f10,SC_FPRS+80(%r5)
29e444
-	ld      %f11,SC_FPRS+88(%r5)
29e444
-	ld      %f12,SC_FPRS+96(%r5)
29e444
-	ld      %f13,SC_FPRS+104(%r5)
29e444
-	ld      %f14,SC_FPRS+112(%r5)
29e444
-	ld      %f15,SC_FPRS+120(%r5)
29e444
+	lfpc	SC_FPC(%r1)
29e444
+	ld	%f0,SC_FPRS(%r1)
29e444
+	ld      %f1,SC_FPRS+8(%r1)
29e444
+	ld      %f2,SC_FPRS+16(%r1)
29e444
+	ld      %f3,SC_FPRS+24(%r1)
29e444
+	ld      %f4,SC_FPRS+32(%r1)
29e444
+	ld      %f5,SC_FPRS+40(%r1)
29e444
+	ld      %f6,SC_FPRS+48(%r1)
29e444
+	ld      %f7,SC_FPRS+56(%r1)
29e444
+	ld      %f8,SC_FPRS+64(%r1)
29e444
+	ld      %f9,SC_FPRS+72(%r1)
29e444
+	ld      %f10,SC_FPRS+80(%r1)
29e444
+	ld      %f11,SC_FPRS+88(%r1)
29e444
+	ld      %f12,SC_FPRS+96(%r1)
29e444
+	ld      %f13,SC_FPRS+104(%r1)
29e444
+	ld      %f14,SC_FPRS+112(%r1)
29e444
+	ld      %f15,SC_FPRS+120(%r1)
29e444
 
29e444
 	/* Don't touch %a0 and %a1, used for thread purposes.  */
29e444
-	lam     %a2,%a15,SC_ACRS+8(%r5)
29e444
+	lam     %a2,%a15,SC_ACRS+8(%r1)
29e444
  
29e444
 	/* Load general purpose registers.  */
29e444
-	lmg	%r0,%r15,SC_GPRS(%r5)
29e444
+	lmg	%r0,%r15,SC_GPRS(%r1)
29e444
 
29e444
 	/* Return.  */
29e444
 	br	%r14
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S	2013-08-23 12:33:20.591298098 -0400
29e444
@@ -34,12 +34,13 @@
29e444
 
29e444
 ENTRY(__swapcontext)
29e444
 	lgr	%r1,%r2
29e444
-	lgr      %r5,%r3
29e444
+	lgr     %r0,%r3
29e444
 
29e444
 	/* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
 	slgr	%r3,%r3
29e444
 	la	%r4,SC_MASK(%r1)
29e444
+	lghi	%r5,_NSIG8
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Store fpu context.  */
29e444
@@ -72,11 +73,14 @@ ENTRY(__swapcontext)
29e444
 
29e444
 	/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL).  */
29e444
 	la      %r2,SIG_BLOCK
29e444
+	lgr	%r5,%r0
29e444
 	la	%r3,SC_MASK(%r5)
29e444
+	lghi	%r5,_NSIG8
29e444
 	slgr	%r4,%r4
29e444
 	svc	SYS_ify(rt_sigprocmask)
29e444
 
29e444
 	/* Load fpu context.  */
29e444
+	lgr	%r5,%r0
29e444
 	lfpc	SC_FPC(%r5)
29e444
 	ld	%f0,SC_FPRS(%r5)
29e444
 	ld      %f1,SC_FPRS+8(%r5)
12745e
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/ucontext_i.sym glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
12745e
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/ucontext_i.sym	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/s390/ucontext_i.sym	2013-08-23 12:33:20.591298098 -0400
29e444
@@ -8,6 +8,8 @@ SIG_BLOCK
29e444
 SIG_UNBLOCK
29e444
 SIG_SETMASK
29e444
 
29e444
+_NSIG8          (_NSIG / 8)
29e444
+
29e444
 #define ucontext(member)	offsetof (ucontext_t, member)
29e444
 #define mcontext(member)	ucontext (uc_mcontext.member)
29e444