[nios2] Fix setcontext/swapcontext signal mask setting

Message ID 55B32BF6.3070404@codesourcery.com
State Committed
Headers

Commit Message

Chung-Lin Tang July 25, 2015, 6:25 a.m. UTC
  It appears that I got the order of arguments to rt_sigprocmask wrong for
setting the signal mask. Discovered only after the tst-setcontext2 testcase
was added.

Tested and committed, will probably backport to 2.21 later.

Chung-Lin

2015-07-25  Chung-Lin Tang  <cltang@codesourcery.com>

        * sysdeps/unix/sysv/linux/nios2/setcontext.S (__setcontext):
        Fix order of arguments to the rt_sigprocmask syscall.
        * sysdeps/unix/sysv/linux/nios2/swapcontext.S (__swapcontext):
        Likewise.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/nios2/setcontext.S b/sysdeps/unix/sysv/linux/nios2/setcontext.S
index f40b733..8d899d9 100644
--- a/sysdeps/unix/sysv/linux/nios2/setcontext.S
+++ b/sysdeps/unix/sysv/linux/nios2/setcontext.S
@@ -29,10 +29,10 @@  ENTRY(__setcontext)
 	mov	r10, r4
 
 	/* Restore signal mask.  */
-	/* rt_sigprocmask (SIG_SETMASK, NULL, &ucp->uc_sigmask, _NSIG8) */
+	/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */
 	movi	r7, _NSIG8
-	addi	r6, r4, UCONTEXT_SIGMASK
-	mov	r5, zero
+	addi	r5, r4, UCONTEXT_SIGMASK
+	mov	r6, zero
 	movi	r4, SIG_SETMASK
 	movi	r2, SYS_ify (rt_sigprocmask)
 	trap
diff --git a/sysdeps/unix/sysv/linux/nios2/swapcontext.S b/sysdeps/unix/sysv/linux/nios2/swapcontext.S
index c2c321d..cfbcf8d 100644
--- a/sysdeps/unix/sysv/linux/nios2/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/nios2/swapcontext.S
@@ -68,10 +68,10 @@  ENTRY(__swapcontext)
 	bne	r5, r6, .Lsigreturn
 
 	/* Restore signal mask.  */
-	/* rt_sigprocmask (SIG_SETMASK, NULL, &ucp->uc_sigmask, _NSIG8) */
+	/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */
 	movi	r7, _NSIG8
-	addi	r6, r10, UCONTEXT_SIGMASK
-	mov	r5, zero
+	addi	r5, r10, UCONTEXT_SIGMASK
+	mov	r6, zero
 	movi	r4, SIG_SETMASK
 	movi	r2, SYS_ify (rt_sigprocmask)
 	trap