about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S')
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S19
1 files changed, 13 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
index ec92898964..ac74b6bc08 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
@@ -33,6 +33,9 @@
   other than the PRESERVED state.  */
 
 ENTRY(__swapcontext)
+	/* While not part of the ABI a system call never clobbers r0
+	   or r1.  So keeping the values here while calling
+	   rt_sigprocmask is ok.  */
 	lgr	%r1,%r2
 	lgr     %r0,%r3
 
@@ -62,21 +65,25 @@ ENTRY(__swapcontext)
 	std     %f14,SC_FPRS+112(%r1)
 	std     %f15,SC_FPRS+120(%r1)
 
-	/* Set __swapcontext return value to 0.  */
-	slgr     %r2,%r2
-
 	/* Store access registers.  */
 	stam    %a0,%a15,SC_ACRS(%r1)
 
+	/* Set __swapcontext return value to 0.  */
+	slgr	%r2,%r2
+
 	/* Store general purpose registers.  */
 	stmg    %r0,%r15,SC_GPRS(%r1)
 
-	/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL).  */
-	la      %r2,SIG_BLOCK
+	/* Copy uc_flags into the new ucontext_t.  */
 	lgr	%r5,%r0
+	lg	%r2,SC_FLGS(%r5)
+	stg	%r2,SC_FLGS(%r1)
+
+	/* rt_sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL, sigsetsize).  */
+	la      %r2,SIG_BLOCK
 	la	%r3,SC_MASK(%r5)
-	lghi	%r5,_NSIG8
 	slgr	%r4,%r4
+	lghi	%r5,_NSIG8
 	svc	SYS_ify(rt_sigprocmask)
 
 	/* Load fpu context.  */