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>
This commit is contained in:
Warner Losh 2022-01-08 16:03:51 -07:00
parent 2bd010c4bf
commit fc9f9bdd3a
1 changed files with 12 additions and 3 deletions

View File

@ -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,