bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEF

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. Make a note about slight
differences with FreeBSD in case any of them turn out to be important
later.

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:22:16 -07:00
parent c0b93df352
commit 5e02ded157

View file

@ -51,18 +51,19 @@ static inline void target_cpu_loop(CPUARMState *env)
process_queued_cpu_work(cs); process_queued_cpu_work(cs);
switch (trapnr) { switch (trapnr) {
case EXCP_UDEF: case EXCP_UDEF:
{ case EXCP_NOCP:
/* See arm/arm/undefined.c undefinedinstruction(); */ case EXCP_INVSTATE:
info.si_addr = env->regs[15]; /*
* See arm/arm/undefined.c undefinedinstruction();
/* illegal instruction */ *
info.si_signo = TARGET_SIGILL; * A number of details aren't emulated (they likely don't matter):
info.si_errno = 0; * o Misaligned PC generates ILL_ILLADR (these can't come from qemu)
info.si_code = TARGET_ILL_ILLOPC; * o Thumb-2 instructions generate ILLADR
queue_signal(env, info.si_signo, &info); * o Both modes implement coprocessor instructions, which we don't
* do here. FreeBSD just implements them for the VFP coprocessor
/* TODO: What about instruction emulation? */ * and special kernel breakpoints, trace points, dtrace, etc.
} */
force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->regs[15]);
break; break;
case EXCP_SWI: case EXCP_SWI:
{ {