target/arm: report register in WFIT syndromes

Pass the register number (rd) to the wfit helper and report it in the
syndrome ISS.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-id: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
This commit is contained in:
Alex Bennée authored and Peter Maydell committed 2026-04-27 11:46:34 +01:00
1 parent fb5ffe0194
commit 4575da5ecb
4 files changed
+16 -6

No files matched your search

+10 -1
View File
@@ -670,7 +670,14 @@ FIELD(WFX_ISS, RN, 5, 5)
FIELD(WFX_ISS, COND, 20, 4)
FIELD(WFX_ISS, CV, 24, 1)
static inline uint32_t syn_wfx(int cv, int cond, int ti, bool is_16bit)
typedef enum {
WFI = 0b00,
WFE = 0b01,
WFIT = 0b10,
WFET = 0xb11
} wfx_ti;
static inline uint32_t syn_wfx(int cv, int cond, int rn, bool rv, wfx_ti ti, bool is_16bit)
{
uint32_t res = syn_set_ec(0, EC_WFX_TRAP);
res = FIELD_DP32(res, SYNDROME, IL, !is_16bit);
@@ -678,6 +685,8 @@ static inline uint32_t syn_wfx(int cv, int cond, int ti, bool is_16bit)
res = FIELD_DP32(res, WFX_ISS, CV, cv);
res = FIELD_DP32(res, WFX_ISS, COND, cond);
res = FIELD_DP32(res, WFX_ISS, TI, ti);
res = FIELD_DP32(res, WFX_ISS, RN, rn);
res = FIELD_DP32(res, WFX_ISS, RV, rv);
return res;
}
+1 -1
View File
@@ -55,7 +55,7 @@ DEF_HELPER_2(exception_pc_alignment, noreturn, env, vaddr)
DEF_HELPER_1(setend, void, env)
DEF_HELPER_2(wfi, void, env, i32)
DEF_HELPER_1(wfe, void, env)
DEF_HELPER_2(wfit, void, env, i64)
DEF_HELPER_2(wfit, void, env, i32)
DEF_HELPER_1(yield, void, env)
DEF_HELPER_1(pre_hvc, void, env)
DEF_HELPER_2(pre_smc, void, env, i32)
+4 -3
View File
@@ -398,7 +398,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
env->regs[15] -= insn_len;
}
raise_exception(env, excp, syn_wfx(1, 0xe, 0, insn_len == 2),
raise_exception(env, excp, syn_wfx(1, 0xe, 0, false, WFI, insn_len == 2),
target_el);
}
@@ -408,7 +408,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
#endif
}
void HELPER(wfit)(CPUARMState *env, uint64_t timeout)
void HELPER(wfit)(CPUARMState *env, uint32_t rd)
{
#ifdef CONFIG_USER_ONLY
/*
@@ -427,6 +427,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout)
int target_el = check_wfx_trap(env, false, &excp);
/* The WFIT should time out when CNTVCT_EL0 >= the specified value. */
uint64_t cntval = gt_get_countervalue(env);
uint64_t timeout = env->xregs[rd];
/*
* We want the value that we would get if we read CNTVCT_EL0 from
* the current exception level, so the direct_access offset, not
@@ -447,7 +448,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout)
if (target_el) {
env->pc -= 4;
raise_exception(env, excp, syn_wfx(1, 0xe, 2, false), target_el);
raise_exception(env, excp, syn_wfx(1, 0xe, rd, true, WFIT, false), target_el);
}
if (uadd64_overflow(timeout, offset, &nexttick)) {
+1 -1
View File
@@ -2065,7 +2065,7 @@ static bool trans_WFIT(DisasContext *s, arg_WFIT *a)
}
gen_a64_update_pc(s, 4);
gen_helper_wfit(tcg_env, cpu_reg(s, a->rd));
gen_helper_wfit(tcg_env, tcg_constant_i32(a->rd));
/* Go back to the main loop to check for interrupts */
s->base.is_jmp = DISAS_EXIT;
return true;