diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-10-04 10:06:10 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-11-02 07:00:52 -0400 |
commit | 12ed56407e60371d45ffa3b7f2fd00c4d7efa580 (patch) | |
tree | c326b99af2e21200b19fc92cc8fd35391fcfde8b /linux-user | |
parent | 644a9fece426d52cf8fb51e24e003dd4c590c5cc (diff) | |
download | qemu-12ed56407e60371d45ffa3b7f2fd00c4d7efa580.zip qemu-12ed56407e60371d45ffa3b7f2fd00c4d7efa580.tar.gz qemu-12ed56407e60371d45ffa3b7f2fd00c4d7efa580.tar.bz2 |
linux-user: Add cpu_loop_exit_sigbus
This is a new interface to be provided by the os emulator for
raising SIGBUS on fault. Use the new record_sigbus target hook.
Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/signal.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c index 9d60abc..df2c867 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -706,6 +706,20 @@ void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr, cpu_loop_exit_restore(cpu, ra); } +void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, + MMUAccessType access_type, uintptr_t ra) +{ + 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); +} + /* abort execution with signal */ static void QEMU_NORETURN dump_core_and_abort(int target_sig) { |