target/arm: migrate check_hcr_el2_trap to use syndrome helper
It shares the same COPROC_ISS encoding as the other CP traps although not all the fields are used. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20260422125250.1303100-16-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Alex Bennée committed
Apr 22, 2026 at 13:52 UTC
ff1ec40a8e6df31298af4524303a6c4400f27689
2 files changed
+17
-4
target/arm/syndrome.h
+16
@@ -251,6 +251,22 @@ FIELD(COPROC_ISS, OP2, 17, 3)
251
FIELD(COPROC_ISS, COND, 20, 4)
252
FIELD(COPROC_ISS, CV, 24, 1)
253
254
+static inline uint32_t syn_cp10_rt_trap(int cv, int cond, int opc1,
255
+ int crn, int rt, int isread)
256
+{
257
+ uint32_t res = syn_set_ec(0, EC_FPIDTRAP);
258
+ res = FIELD_DP32(res, SYNDROME, IL, 1);
259
+
260
+ res = FIELD_DP32(res, COPROC_ISS, CV, cv);
261
+ res = FIELD_DP32(res, COPROC_ISS, COND, cond);
262
+ res = FIELD_DP32(res, COPROC_ISS, OP1, opc1);
263
+ res = FIELD_DP32(res, COPROC_ISS, CRN, crn);
264
+ res = FIELD_DP32(res, COPROC_ISS, RT, rt);
265
+ res = FIELD_DP32(res, COPROC_ISS, ISREAD, isread);
266
+
267
+ return res;
268
+}
269
+
270
static inline uint32_t syn_cp14_rt_trap(int cv, int cond, int opc1, int opc2,
271
int crn, int crm, int rt, int isread,
272
bool is_16bit)
target/arm/tcg/vfp_helper.c
+1
-4
@@ -1359,10 +1359,7 @@ void HELPER(check_hcr_el2_trap)(CPUARMState *env, uint32_t rt, uint32_t reg)
1359
g_assert_not_reached();
1360
}
1361
1362
- syndrome = ((EC_FPIDTRAP << ARM_EL_EC_SHIFT)
1363
- | ARM_EL_IL
1364
- | (1 << 24) | (0xe << 20) | (7 << 14)
1365
- | (reg << 10) | (rt << 5) | 1);
1362
+ syndrome = syn_cp10_rt_trap(1, 0xe, 7, reg, rt, 1);
1363
1364
raise_exception(env, EXCP_HYP_TRAP, syndrome, 2);
1365
}