[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/30] bsd-user/arm/target_arch_cpu.h: Use force_sig_fault fo
|
From: |
Peter Maydell |
|
Subject: |
Re: [PATCH 07/30] bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEF |
|
Date: |
Thu, 13 Jan 2022 17:19:51 +0000 |
On Sun, 9 Jan 2022 at 16:27, Warner Losh <imp@bsdimp.com> wrote:
>
> Use force_sig_fault to implement unknown opcode. This just uninlines
> that function, so simplify things by using it. Fold in EXCP_NOCP and
> EXCP_INVSTATE, as is done in linux-user.
>
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
> bsd-user/arm/target_arch_cpu.h | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h
> index 905f13aa1b9..996a361e3fe 100644
> --- a/bsd-user/arm/target_arch_cpu.h
> +++ b/bsd-user/arm/target_arch_cpu.h
> @@ -51,18 +51,12 @@ static inline void target_cpu_loop(CPUARMState *env)
> process_queued_cpu_work(cs);
> switch (trapnr) {
> case EXCP_UDEF:
> - {
> - /* See arm/arm/undefined.c undefinedinstruction(); */
> - info.si_addr = env->regs[15];
> -
> - /* illegal instruction */
> - info.si_signo = TARGET_SIGILL;
> - info.si_errno = 0;
> - info.si_code = TARGET_ILL_ILLOPC;
> - queue_signal(env, info.si_signo, &info);
> -
> - /* TODO: What about instruction emulation? */
> - }
> + case EXCP_NOCP:
> + case EXCP_INVSTATE:
> + /*
> + * See arm/arm/undefined.c undefinedinstruction();
> + */
> + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->regs[15]);
> break;
Do you want to keep the TODO comment ?
Either way,
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
(Looks like FreeBSD sends SIGILL/ILL_ILLADR for UNDEF where the PC
is misaligned and we're not in Thumb mode, but that's a pretty oddball
corner case so not really worth emulating.)
thanks
-- PMM
- [PATCH 04/30] bsd-user/signal.c: implement cpu_loop_exit_sigbus, (continued)
- [PATCH 04/30] bsd-user/signal.c: implement cpu_loop_exit_sigbus, Warner Losh, 2022/01/09
- [PATCH 02/30] bsd-user/signal.c: implement force_sig_fault, Warner Losh, 2022/01/09
- [PATCH 03/30] bsd-user/signal.c: Implement cpu_loop_exit_sigsegv, Warner Losh, 2022/01/09
- [PATCH 07/30] bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEF, Warner Losh, 2022/01/09
- Re: [PATCH 07/30] bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEF,
Peter Maydell <=
- [PATCH 05/30] bsd-user/arm/arget_arch_cpu.h: Move EXCP_DEBUG and EXCP_BKPT together, Warner Losh, 2022/01/09
- [PATCH 06/30] bsd-user/arm/target_arch_cpu.h: Correct code pointer, Warner Losh, 2022/01/09