On 2026-09-18 2:42, Yonggang Luo wrote:
Name guest trap numbers SH4_EXCP_* in cpu.h. TCG loop codes such as
EXCP_INTERRUPT start at 0x10000. Translate illegal and FPU-disable
through gen_helper_raise_excp. Drop unused raise_* TCG helpers and
the one-line raise_exception wrapper. Keep leftover sleep, trapa,
and exclusive helpers. Exit unaligned and tlb_fill through
cpu_loop_exit_excp. Log reset, manual reset, TLB multiple, and
user break.
Signed-off-by: Yonggang Luo <[email protected]>
---
target/sh4/cpu.h | 24 +++++++++++++
target/sh4/helper.c | 82 +++++++++++++++++++++---------------------
target/sh4/helper.h | 4 ---
target/sh4/op_helper.c | 43 +++-------------------
target/sh4/translate.c | 17 ++++++---
5 files changed, 84 insertions(+), 86 deletions(-)
+/*
+ * Guest trap numbers in cs->exception_index. TCG loop codes such as
+ * EXCP_INTERRUPT start at 0x10000 in cpu-common.h and do not overlap these.
Again this is the definition of outer loop QEMU exceptions versus
per-target inner loop ones. No need to mention it each time.
+ */
+enum {
+ SH4_EXCP_RESET = 0x000,
+ SH4_EXCP_MANUAL_RESET = 0x020,
+ SH4_EXCP_TLB_MISS = 0x040,
+ SH4_EXCP_DTLB_MISS_WRITE = 0x060,
+ SH4_EXCP_INITIAL_PAGE_WRITE = 0x080,
+ SH4_EXCP_TLB_VIOLATION = 0x0a0,
+ SH4_EXCP_DTLB_VIOLATION_WRITE = 0x0c0,
+ SH4_EXCP_ADDR_ERROR = 0x0e0,
+ SH4_EXCP_DATA_WRITE = 0x100,
+ SH4_EXCP_FPU = 0x120,
+ SH4_EXCP_TLB_MULTIPLE = 0x140,
+ SH4_EXCP_TRAPA = 0x160,
+ SH4_EXCP_ILLEGAL_INSTRUCTION = 0x180,
+ SH4_EXCP_SLOT_ILLEGAL_INSTRUCTION = 0x1a0,
+ SH4_EXCP_USER_BREAK = 0x1e0,
+ SH4_EXCP_FPU_DISABLE = 0x800,
+ SH4_EXCP_SLOT_FPU_DISABLE = 0x820,
+};
LGTM as a separate patch adding definitions.