diff mbox series

[PULL,27/59] linux-user/sparc: Clean up setup_frame

Message ID 20210518053131.87212-28-laurent@vivier.eu
State Accepted
Commit 757d260143488d1d0b4016020969ab28259b854b
Headers show
Series None | expand

Commit Message

Laurent Vivier May 18, 2021, 5:30 a.m. UTC
From: Richard Henderson <richard.henderson@linaro.org>


Clean up a goto label with a single use.  Remove #if 0.
Remove useless parentheses.  Fold constants into __put_user.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Message-Id: <20210426025334.1168495-21-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>

---
 linux-user/sparc/signal.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

-- 
2.31.1
diff mbox series

Patch

diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c
index 4a0578ebf37b..f0f614a3af7a 100644
--- a/linux-user/sparc/signal.c
+++ b/linux-user/sparc/signal.c
@@ -192,14 +192,13 @@  void setup_frame(int sig, struct target_sigaction *ka,
     size_t sf_size = sizeof(*sf) + sizeof(struct target_siginfo_fpu);
     int i;
 
-    /* 1. Make sure everything is clean */
-
     sf_addr = get_sigframe(ka, env, sf_size);
     trace_user_setup_frame(env, sf_addr);
 
     sf = lock_user(VERIFY_WRITE, sf_addr, sf_size, 0);
     if (!sf) {
-        goto sigsegv;
+        force_sigsegv(sig);
+        return;
     }
 
     /* 2. Save the current process state */
@@ -228,33 +227,21 @@  void setup_frame(int sig, struct target_sigaction *ka,
 
     /* 4. signal handler */
     env->pc = ka->_sa_handler;
-    env->npc = (env->pc + 4);
+    env->npc = env->pc + 4;
+
     /* 5. return to kernel instructions */
     if (ka->ka_restorer) {
         env->regwptr[WREG_O7] = ka->ka_restorer;
     } else {
-        uint32_t val32;
-
         env->regwptr[WREG_O7] = sf_addr +
                 offsetof(struct target_signal_frame, insns) - 2 * 4;
 
         /* mov __NR_sigreturn, %g1 */
-        val32 = 0x821020d8;
-        __put_user(val32, &sf->insns[0]);
-
+        __put_user(0x821020d8u, &sf->insns[0]);
         /* t 0x10 */
-        val32 = 0x91d02010;
-        __put_user(val32, &sf->insns[1]);
+        __put_user(0x91d02010u, &sf->insns[1]);
     }
     unlock_user(sf, sf_addr, sf_size);
-    return;
-#if 0
-sigill_and_return:
-    force_sig(TARGET_SIGILL);
-#endif
-sigsegv:
-    unlock_user(sf, sf_addr, sizeof(struct target_signal_frame));
-    force_sigsegv(sig);
 }
 
 void setup_rt_frame(int sig, struct target_sigaction *ka,