aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@bsdimp.com>2022-01-08 16:06:33 -0700
committerWarner Losh <imp@bsdimp.com>2022-01-28 15:52:39 -0700
commitcfdee273c4e41d0b485bc82966a82d6ab6f37a1d (patch)
tree3bf8542da3e9e42f05e36a82b9058d16aa548a60
parentfc9f9bdd3a6111d0bb419282657f89eea7d8de88 (diff)
downloadqemu-cfdee273c4e41d0b485bc82966a82d6ab6f37a1d.zip
qemu-cfdee273c4e41d0b485bc82966a82d6ab6f37a1d.tar.gz
qemu-cfdee273c4e41d0b485bc82966a82d6ab6f37a1d.tar.bz2
bsd-user/signal.c: implement cpu_loop_exit_sigbus
First attempt at implementing cpu_loop_exit_sigbus, mostly copied from linux-user version of this function. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Kyle Evans <kevans@freebsd.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--bsd-user/signal.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/bsd-user/signal.c b/bsd-user/signal.c
index 12de0e2..844dfa1 100644
--- a/bsd-user/signal.c
+++ b/bsd-user/signal.c
@@ -80,7 +80,13 @@ void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr,
void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr,
MMUAccessType access_type, uintptr_t ra)
{
- qemu_log_mask(LOG_UNIMP, "No signal support for SIGBUS\n");
- /* unreachable */
- abort();
+ const struct TCGCPUOps *tcg_ops = CPU_GET_CLASS(cpu)->tcg_ops;
+
+ if (tcg_ops->record_sigbus) {
+ tcg_ops->record_sigbus(cpu, addr, access_type, ra);
+ }
+
+ force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, addr);
+ cpu->exception_index = EXCP_INTERRUPT;
+ cpu_loop_exit_restore(cpu, ra);
}