linux-user/sh4: Deliver SIGILL on invalid instruction
On invalid instruction, deliver SIGILL rather than crashing the whole process unconditionally. Cc: qemu-stable@nongnu.org Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Yoshinori Sato <yoshinori.sato@nifty.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Helge Deller <deller@gmx.de>
Mikulas Patocka committed
Aug 5, 2026 at 18:23 UTC
bc4681990bb6b065e78e7564cb431e44dd148b88
1 file changed
+7
linux-user/sh4/cpu_loop.c
+7
@@ -64,6 +64,13 @@ void cpu_loop(CPUSH4State *env)
64
cpu_exec_step_atomic(cs);
65
arch_interrupt = false;
66
break;
67
+ case 0x180:
68
+ /* Illegal instruction */
69
+ /* fallthrough */
70
+ case 0x1a0:
71
+ /* Illegal instruction in delay slot */
72
+ force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc);
73
+ break;
74
default:
75
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
76
cpu_dump_state(cs, stderr, 0);