diff options
author | Warner Losh <imp@bsdimp.com> | 2022-01-08 16:03:51 -0700 |
---|---|---|
committer | Warner Losh <imp@bsdimp.com> | 2022-01-28 15:52:39 -0700 |
commit | fc9f9bdd3a6111d0bb419282657f89eea7d8de88 (patch) | |
tree | bd904f2a286db9c12efb93d088e2a08886750311 /bsd-user | |
parent | 2bd010c4bfdaecee33f3ba4a785ccaaf84df25c1 (diff) |
bsd-user/signal.c: Implement cpu_loop_exit_sigsegv
First attempt at implementing cpu_loop_exit_sigsegv, 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>
Diffstat (limited to 'bsd-user')
-rw-r--r-- | bsd-user/signal.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/bsd-user/signal.c b/bsd-user/signal.c index 1206d0d728..12de0e2dea 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu.h" #include "signal-common.h" +#include "hw/core/tcg-cpu-ops.h" /* * Stubbed out routines until we merge signal support from bsd-user @@ -63,9 +64,17 @@ void process_pending_signals(CPUArchState *cpu_env) void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr, MMUAccessType access_type, bool maperr, uintptr_t ra) { - qemu_log_mask(LOG_UNIMP, "No signal support for SIGSEGV\n"); - /* unreachable */ - abort(); + const struct TCGCPUOps *tcg_ops = CPU_GET_CLASS(cpu)->tcg_ops; + + if (tcg_ops->record_sigsegv) { + tcg_ops->record_sigsegv(cpu, addr, access_type, maperr, ra); + } + + force_sig_fault(TARGET_SIGSEGV, + maperr ? TARGET_SEGV_MAPERR : TARGET_SEGV_ACCERR, + addr); + cpu->exception_index = EXCP_INTERRUPT; + cpu_loop_exit_restore(cpu, ra); } void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, |