]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
mips: Remove rt_sigreturn usage on context function
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 15 Feb 2019 14:04:45 +0000 (12:04 -0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 17 Apr 2019 18:14:45 +0000 (15:14 -0300)
Similar to powerpc, mips also issues rt_sigreturn for setcontext
case the v0 value saved is not the one set by setcontext or
makecontext. As for powerpc, it is intention is no really supported
since setcontext is not async-signal-safe.

Checked the context tests on mips64-linux-gnu and mips-linux-gnu.

* sysdeps/unix/sysv/linux/mips/getcontext.S (__getcontext): Remove
the magic flag store.
* sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
Likewise.
* sysdeps/unix/sysv/linux/mips/swapcontext.S (__swapcontext):
Likewise.
* sysdeps/unix/sysv/linux/mips/setcontext.S (__setcontext):
Remove rt_sigreturn call.

ChangeLog
sysdeps/unix/sysv/linux/mips/getcontext.S
sysdeps/unix/sysv/linux/mips/makecontext.S
sysdeps/unix/sysv/linux/mips/setcontext.S
sysdeps/unix/sysv/linux/mips/swapcontext.S

index 41c1a7ec030d1716ee64782667cfd1605036d5d9..d2dea6d1ae64de1239ffedcecf18f3cf91acfd00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2019-04-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+       * sysdeps/unix/sysv/linux/mips/getcontext.S (__getcontext): Remove
+       the magic flag store.
+       * sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
+       Likewise.
+       * sysdeps/unix/sysv/linux/mips/swapcontext.S (__swapcontext):
+       Likewise.
+       * sysdeps/unix/sysv/linux/mips/setcontext.S (__setcontext):
+       Remove rt_sigreturn call.
+
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
        Remove rt_sigreturn call.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
index 4f7f89ee9a7668166f6f871d66261e8d205a0388..015bd5bff6719ee2c0be3eecd1e79af4fdd4ed5c 100644 (file)
@@ -78,11 +78,6 @@ NESTED (__getcontext, FRAMESZ, ra)
        .set    at
 #endif
 
-       /* Store a magic flag.  */
-       li      v1, 1
-       /* zero */
-       REG_S   v1, (MCONTEXT_GREGOFF + 0 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
-
        REG_S   s0, (MCONTEXT_GREGOFF + 16 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
        REG_S   s1, (MCONTEXT_GREGOFF + 17 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
        REG_S   s2, (MCONTEXT_GREGOFF + 18 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
index 4439fec3ffa8621dc2eb8dedd6c67d4d0c57421a..3f40f7c9f2b05de73b81254eb9a7dd3d2af35881 100644 (file)
@@ -93,11 +93,6 @@ NESTED (__makecontext, FRAMESZ, ra)
        REG_S   a7, A7OFF(sp)
 #endif
 
-       /* Store a magic flag.  */
-       li      v1, 1
-       /* zero */
-       REG_S   v1, (MCONTEXT_GREGOFF + 0 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
-
        /* Set up the stack.  */
        PTR_L   t0, STACK_SP(a0)
        PTR_L   t2, STACK_SIZE(a0)
index b6553bdb5e784c47a36c300e79de319c0119720e..98afe6cbac57e57c16af8712ec47082871008a62 100644 (file)
@@ -77,12 +77,6 @@ NESTED (__setcontext, FRAMESZ, ra)
        .set    at
 #endif
 
-       /* Check for the magic flag.  */
-       li      v0, 1
-       /* zero */
-       REG_L   v1, (MCONTEXT_GREGOFF + 0 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
-       bne     v0, v1, 98f
-
        REG_S   a0, A0OFF(sp)
 
 /* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */
@@ -154,38 +148,6 @@ NESTED (__setcontext, FRAMESZ, ra)
        move    v0, zero
        jr      t9
 
-98:
-       /* This is a context obtained from a signal handler.
-          Perform a full restore by pushing the context
-          passed onto a simulated signal frame on the stack
-          and call the signal return syscall as if a signal
-          handler exited normally.  */
-       PTR_ADDIU sp, -((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
-       cfi_adjust_cfa_offset ((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
-
-       /* Only ucontext is referred to from rt_sigreturn,
-          copy it.  */
-       PTR_ADDIU t1, sp, RT_SIGFRAME_UCONTEXT
-       li      t3, ((UCONTEXT_SIZE + SZREG - 1) / SZREG) - 1
-0:
-       REG_L   t2, (a0)
-       PTR_ADDIU a0, SZREG
-       REG_S   t2, (t1)
-       PTR_ADDIU t1, SZREG
-       .set    noreorder
-       bgtz    t3, 0b
-        addiu  t3, -1
-       .set    reorder
-
-/* rt_sigreturn () -- no arguments, sp points to struct rt_sigframe.  */
-       li      v0, SYS_ify (rt_sigreturn)
-       syscall
-
-       /* Restore the stack and fall through to the error
-          path.  Successful rt_sigreturn never returns to
-          its calling place.  */
-       PTR_ADDIU sp, ((RT_SIGFRAME_SIZE + ALSZ) & ALMASK)
-       cfi_adjust_cfa_offset (-((RT_SIGFRAME_SIZE + ALSZ) & ALMASK))
 99:
 #ifdef __PIC__
        PTR_LA  t9, JUMPTARGET (__syscall_error)
index 9c689613458ebc1925134df021d983380fa7c667..6612e757cdeb62b1434c7b52ec494847a09f352d 100644 (file)
@@ -87,11 +87,6 @@ NESTED (__swapcontext, FRAMESZ, ra)
        .set    at
 #endif
 
-       /* Store a magic flag.  */
-       li      v1, 1
-       /* zero */
-       REG_S   v1, (MCONTEXT_GREGOFF + 0 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
-
        REG_S   s0, (MCONTEXT_GREGOFF + 16 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
        REG_S   s1, (MCONTEXT_GREGOFF + 17 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)
        REG_S   s2, (MCONTEXT_GREGOFF + 18 * MCONTEXT_GREGSZ + MCONTEXT_GREGS)(a0)