Message ID | 20220109161923.85683-4-imp@bsdimp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | bsd-user: upstream our signal implementation | expand |
On Sun, 9 Jan 2022 at 16:23, Warner Losh <imp@bsdimp.com> wrote: > > 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> thanks -- PMM
On 1/10/22 3:18 AM, Warner Losh wrote: > 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> > --- > bsd-user/signal.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/bsd-user/signal.c b/bsd-user/signal.c index 1206d0d728c..12de0e2dea4 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,