@samitouri / QOSamiQemu / commits / c0809cf012

target/arm: migrate gcs syndromes to registerfields

Tweak arg names to make it clear raddr is the data address register number. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20260422125250.1303100-14-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Alex Bennée committed Apr 22, 2026 at 13:52 UTC c0809cf012b48568b1faaf611f2146146f17eaef
1 file changed +33 -6
target/arm/syndrome.h
+33 -6
@@ -690,21 +690,48 @@ static inline uint32_t syn_pcalignment(void)
690 return res;
691 }
692
693 +/*
694 + * ISS encoding for a GCS exception
695 + *
696 + * Field validity depends on EXTYPE
697 + */
698 +FIELD(GCS_ISS, IT, 0, 5)
699 +FIELD(GCS_ISS, RN, 5, 5) /* only for non EXLOCK exceptions */
700 +FIELD(GCS_ISS, RADDR, 10, 5) /* only for GCSSTR/GCSSTTR traps */
701 +FIELD(GCS_ISS, EXTYPE, 20, 4)
702 +
703 static inline uint32_t syn_gcs_data_check(GCSInstructionType it, int rn)
704 {
695 - return ((EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL |
696 - (GCS_ET_DataCheck << 20) | (rn << 5) | it);
705 + uint32_t res = syn_set_ec(0, EC_GCS);
706 + res = FIELD_DP32(res, SYNDROME, IL, 1);
707 +
708 + res = FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_DataCheck);
709 + res = FIELD_DP32(res, GCS_ISS, RN, rn);
710 + res = FIELD_DP32(res, GCS_ISS, IT, it);
711 +
712 + return res;
713 }
714
715 static inline uint32_t syn_gcs_exlock(void)
716 {
701 - return (EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL | (GCS_ET_EXLOCK << 20);
717 + uint32_t res = syn_set_ec(0, EC_GCS);
718 + res = FIELD_DP32(res, SYNDROME, IL, 1);
719 +
720 + res = FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_EXLOCK);
721 +
722 + return res;
723 }
724
704 -static inline uint32_t syn_gcs_gcsstr(int ra, int rn)
725 +static inline uint32_t syn_gcs_gcsstr(int raddr, int rn)
726 {
706 - return ((EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL |
707 - (GCS_ET_GCSSTR_GCSSTTR << 20) | (ra << 10) | (rn << 5));
727 + uint32_t res = syn_set_ec(0, EC_GCS);
728 + res = FIELD_DP32(res, SYNDROME, IL, 1);
729 +
730 + res = FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_GCSSTR_GCSSTTR);
731 + res = FIELD_DP32(res, GCS_ISS, RADDR, raddr);
732 + res = FIELD_DP32(res, GCS_ISS, RN, rn);
733 +
734 + return res;
735 }
736
737 static inline uint32_t syn_serror(uint32_t extra)