@samitouri / QOSamiQemu / commits / a0c02e40b5

target/arm: migrate PAC trap syndromes to registerfields

syn_pactrap is fairly simple as the ISS is all RES0. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20260422125250.1303100-7-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Alex Bennée committed Apr 22, 2026 at 13:52 UTC a0c02e40b53453bd5f8a115cfb6ae23da6199cc6
1 file changed +20 -3
target/arm/syndrome.h
+20 -3
@@ -398,15 +398,32 @@ static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit)
398 return res;
399 }
400
401 +/*
402 + * ISS encoding for a PAC Fail exceptions
403 + */
404 +FIELD(PACFAIL_ISS, BnA, 0, 1) /* B key or A key */
405 +FIELD(PACFAIL_ISS, DnI, 1, 1) /* Data or Instruction */
406 +
407 static inline uint32_t syn_pacfail(bool data, int keynumber)
408 {
403 - int error_code = (data << 1) | keynumber;
404 - return (EC_PACFAIL << ARM_EL_EC_SHIFT) | ARM_EL_IL | error_code;
409 + uint32_t res = syn_set_ec(0, EC_PACFAIL);
410 + res = FIELD_DP32(res, SYNDROME, IL, 1);
411 +
412 + res = FIELD_DP32(res, PACFAIL_ISS, DnI, data);
413 + res = FIELD_DP32(res, PACFAIL_ISS, BnA, keynumber);
414 +
415 + return res;
416 }
417
418 +/*
419 + * ISS encoding for an exception from a trapped Pointer
420 + * Authentication instruction is RES0
421 + */
422 static inline uint32_t syn_pactrap(void)
423 {
409 - return (EC_PACTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL;
424 + uint32_t res = syn_set_ec(0, EC_PACTRAP);
425 + res = FIELD_DP32(res, SYNDROME, IL, 1);
426 + return res;
427 }
428
429 static inline uint32_t syn_btitrap(int btype)