Message ID | 20210918184527.408540-19-richard.henderson@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | linux-user: Streamline handling of SIGSEGV | expand |
On 9/18/21 20:45, Richard Henderson wrote: > Now that all of the linux-user hosts have been converted > to host-signal.h, drop the compatibility code. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > include/exec/exec-all.h | 12 ------------ > linux-user/signal.c | 13 ------------- > 2 files changed, 25 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> On Sep 18, 2021, at 12:45 PM, Richard Henderson <richard.henderson@linaro.org> wrote: > > Now that all of the linux-user hosts have been converted > to host-signal.h, drop the compatibility code. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > include/exec/exec-all.h | 12 ------------ > linux-user/signal.c | 13 ------------- > 2 files changed, 25 deletions(-) Reviewed by: Warner Losh <imp@bsdimp.com> > diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h > index 5f94d799aa..5dd663c153 100644 > --- a/include/exec/exec-all.h > +++ b/include/exec/exec-all.h > @@ -685,18 +685,6 @@ MMUAccessType adjust_signal_pc(uintptr_t *pc, bool is_write); > bool handle_sigsegv_accerr_write(CPUState *cpu, sigset_t *old_set, > uintptr_t host_pc, abi_ptr guest_addr); > > -/** > - * cpu_signal_handler > - * @signum: host signal number > - * @pinfo: host siginfo_t > - * @puc: host ucontext_t > - * > - * To be called from the SIGBUS and SIGSEGV signal handler to inform the > - * virtual cpu of exceptions. Returns true if the signal was handled by > - * the virtual CPU. > - */ > -int cpu_signal_handler(int signum, void *pinfo, void *puc); > - > #else > static inline void mmap_lock(void) {} > static inline void mmap_unlock(void) {} > diff --git a/linux-user/signal.c b/linux-user/signal.c > index 6f953f10d4..e6531fdfa0 100644 > --- a/linux-user/signal.c > +++ b/linux-user/signal.c > @@ -773,16 +773,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) > ucontext_t *uc = puc; > struct emulated_sigtable *k; > int guest_sig; > - > -#ifdef HOST_SIGNAL_PLACEHOLDER > - /* the CPU emulator uses some host signals to detect exceptions, > - we forward to it some signals */ > - if ((host_sig == SIGSEGV || host_sig == SIGBUS) > - && info->si_code > 0) { > - if (cpu_signal_handler(host_sig, info, puc)) > - return; > - } > -#else > uintptr_t pc = 0; > bool sync_sig = false; > > @@ -842,7 +832,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) > > sync_sig = true; > } > -#endif > > /* get target signal number */ > guest_sig = host_to_target_signal(host_sig); > @@ -857,7 +846,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) > k->pending = guest_sig; > ts->signal_pending = 1; > > -#ifndef HOST_SIGNAL_PLACEHOLDER > /* > * For synchronous signals, unwind the cpu state to the faulting > * insn and then exit back to the main loop so that the signal > @@ -867,7 +855,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) > cpu->exception_index = EXCP_INTERRUPT; > cpu_loop_exit_restore(cpu, pc); > } > -#endif > > rewind_if_in_safe_syscall(puc); > > -- > 2.25.1 > >
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 5f94d799aa..5dd663c153 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -685,18 +685,6 @@ MMUAccessType adjust_signal_pc(uintptr_t *pc, bool is_write); bool handle_sigsegv_accerr_write(CPUState *cpu, sigset_t *old_set, uintptr_t host_pc, abi_ptr guest_addr); -/** - * cpu_signal_handler - * @signum: host signal number - * @pinfo: host siginfo_t - * @puc: host ucontext_t - * - * To be called from the SIGBUS and SIGSEGV signal handler to inform the - * virtual cpu of exceptions. Returns true if the signal was handled by - * the virtual CPU. - */ -int cpu_signal_handler(int signum, void *pinfo, void *puc); - #else static inline void mmap_lock(void) {} static inline void mmap_unlock(void) {} diff --git a/linux-user/signal.c b/linux-user/signal.c index 6f953f10d4..e6531fdfa0 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -773,16 +773,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) ucontext_t *uc = puc; struct emulated_sigtable *k; int guest_sig; - -#ifdef HOST_SIGNAL_PLACEHOLDER - /* the CPU emulator uses some host signals to detect exceptions, - we forward to it some signals */ - if ((host_sig == SIGSEGV || host_sig == SIGBUS) - && info->si_code > 0) { - if (cpu_signal_handler(host_sig, info, puc)) - return; - } -#else uintptr_t pc = 0; bool sync_sig = false; @@ -842,7 +832,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) sync_sig = true; } -#endif /* get target signal number */ guest_sig = host_to_target_signal(host_sig); @@ -857,7 +846,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) k->pending = guest_sig; ts->signal_pending = 1; -#ifndef HOST_SIGNAL_PLACEHOLDER /* * For synchronous signals, unwind the cpu state to the faulting * insn and then exit back to the main loop so that the signal @@ -867,7 +855,6 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) cpu->exception_index = EXCP_INTERRUPT; cpu_loop_exit_restore(cpu, pc); } -#endif rewind_if_in_safe_syscall(puc);
Now that all of the linux-user hosts have been converted to host-signal.h, drop the compatibility code. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- include/exec/exec-all.h | 12 ------------ linux-user/signal.c | 13 ------------- 2 files changed, 25 deletions(-)