summary refs log tree commit diff stats
path: root/linux-user/signal.c
diff options
context:
space:
mode:
authorGustavo Romero <gustavo.romero@linaro.org>2024-03-09 03:08:58 +0000
committerAlex Bennée <alex.bennee@linaro.org>2024-03-13 11:43:52 +0000
commit4d6d8a05a0a6d102ca94e59a43804d65309921e3 (patch)
treebea2c8624e52168039e92b6f316f7d3edae1b76a /linux-user/signal.c
parentb6617e937e9abe6ce449729e2fdebf11014f7e49 (diff)
downloadfocaccia-qemu-4d6d8a05a0a6d102ca94e59a43804d65309921e3.tar.gz
focaccia-qemu-4d6d8a05a0a6d102ca94e59a43804d65309921e3.zip
linux-user: Move tswap_siginfo out of target code
Move tswap_siginfo from target code to handle_pending_signal. This will
allow some cleanups and having the siginfo ready to be used in gdbstub.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240309030901.1726211-3-gustavo.romero@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r--linux-user/signal.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c
index b705625cbd..2db4d12ef6 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -409,8 +409,8 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
     tinfo->si_code = deposit32(si_code, 16, 16, si_type);
 }
 
-void tswap_siginfo(target_siginfo_t *tinfo,
-                   const target_siginfo_t *info)
+static void tswap_siginfo(target_siginfo_t *tinfo,
+                          const target_siginfo_t *info)
 {
     int si_type = extract32(info->si_code, 16, 16);
     int si_code = sextract32(info->si_code, 0, 16);
@@ -1178,6 +1178,12 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig,
     /* dequeue signal */
     k->pending = 0;
 
+    /*
+     * Writes out siginfo values byteswapped, accordingly to the target. It also
+     * cleans the si_type from si_code making it correct for the target.
+     */
+    tswap_siginfo(&k->info, &k->info);
+
     sig = gdb_handlesig(cpu, sig, NULL);
     if (!sig) {
         sa = NULL;