diff mbox series

[v2,13/30] linux-user/hexagon: Use force_sigsegv_code

Message ID 20210822035537.283193-14-richard.henderson@linaro.org
State New
Headers show
Series linux-user: Clean up siginfo_t handling | expand

Commit Message

Richard Henderson Aug. 22, 2021, 3:55 a.m. UTC
Use the new function instead of setting up a target_siginfo_t
and calling queue_signal.  Note that we were incorrectly using
QEMU_SI_KILL instead of QEMU_SI_FAULT for raising SIGSEGV.

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

---
 linux-user/hexagon/cpu_loop.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

-- 
2.25.1

Comments

Peter Maydell Aug. 24, 2021, 4:29 p.m. UTC | #1
On Sun, 22 Aug 2021 at 04:55, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> Use the new function instead of setting up a target_siginfo_t

> and calling queue_signal.  Note that we were incorrectly using

> QEMU_SI_KILL instead of QEMU_SI_FAULT for raising SIGSEGV.

>

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

> ---

>  linux-user/hexagon/cpu_loop.c | 22 ++++------------------

>  1 file changed, 4 insertions(+), 18 deletions(-)


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


thanks
-- PMM
diff mbox series

Patch

diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
index bc34f5d7c3..6095ca06ca 100644
--- a/linux-user/hexagon/cpu_loop.c
+++ b/linux-user/hexagon/cpu_loop.c
@@ -21,13 +21,13 @@ 
 #include "qemu/osdep.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
+#include "signal-common.h"
 #include "internal.h"
 
 void cpu_loop(CPUHexagonState *env)
 {
     CPUState *cs = env_cpu(env);
-    int trapnr, signum, sigcode;
-    target_ulong sigaddr;
+    int trapnr;
     target_ulong syscallnum;
     target_ulong ret;
 
@@ -37,10 +37,6 @@  void cpu_loop(CPUHexagonState *env)
         cpu_exec_end(cs);
         process_queued_cpu_work(cs);
 
-        signum = 0;
-        sigcode = 0;
-        sigaddr = 0;
-
         switch (trapnr) {
         case EXCP_INTERRUPT:
             /* just indicate that signals should be handled asap */
@@ -66,8 +62,8 @@  void cpu_loop(CPUHexagonState *env)
         case HEX_EXCP_FETCH_NO_UPAGE:
         case HEX_EXCP_PRIV_NO_UREAD:
         case HEX_EXCP_PRIV_NO_UWRITE:
-            signum = TARGET_SIGSEGV;
-            sigcode = TARGET_SEGV_MAPERR;
+            /* FIXME: need to store vaddr in hexagon_tlb_fill */
+            force_sigsegv_for_addr(0);
             break;
         case EXCP_ATOMIC:
             cpu_exec_step_atomic(cs);
@@ -78,16 +74,6 @@  void cpu_loop(CPUHexagonState *env)
             exit(EXIT_FAILURE);
         }
 
-        if (signum) {
-            target_siginfo_t info = {
-                .si_signo = signum,
-                .si_errno = 0,
-                .si_code = sigcode,
-                ._sifields._sigfault._addr = sigaddr
-            };
-            queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);
-        }
-
         process_pending_signals(env);
     }
 }