Commit c0809cf012 for qemu.org
commit c0809cf012b48568b1faaf611f2146146f17eaef
Author: Alex Bennée <alex.bennee@linaro.org>
Date: Wed Apr 22 13:52:30 2026 +0100
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>
diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h
index 65d0de63a8..7ff8c30e2b 100644
--- a/target/arm/syndrome.h
+++ b/target/arm/syndrome.h
@@ -690,21 +690,48 @@ static inline uint32_t syn_pcalignment(void)
return res;
}
+/*
+ * ISS encoding for a GCS exception
+ *
+ * Field validity depends on EXTYPE
+ */
+FIELD(GCS_ISS, IT, 0, 5)
+FIELD(GCS_ISS, RN, 5, 5) /* only for non EXLOCK exceptions */
+FIELD(GCS_ISS, RADDR, 10, 5) /* only for GCSSTR/GCSSTTR traps */
+FIELD(GCS_ISS, EXTYPE, 20, 4)
+
static inline uint32_t syn_gcs_data_check(GCSInstructionType it, int rn)
{
- return ((EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL |
- (GCS_ET_DataCheck << 20) | (rn << 5) | it);
+ uint32_t res = syn_set_ec(0, EC_GCS);
+ res = FIELD_DP32(res, SYNDROME, IL, 1);
+
+ res = FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_DataCheck);
+ res = FIELD_DP32(res, GCS_ISS, RN, rn);
+ res = FIELD_DP32(res, GCS_ISS, IT, it);
+
+ return res;
}
static inline uint32_t syn_gcs_exlock(void)
{
- return (EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL | (GCS_ET_EXLOCK << 20);
+ uint32_t res = syn_set_ec(0, EC_GCS);
+ res = FIELD_DP32(res, SYNDROME, IL, 1);
+
+ res = FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_EXLOCK);
+
+ return res;
}
-static inline uint32_t syn_gcs_gcsstr(int ra, int rn)
+static inline uint32_t syn_gcs_gcsstr(int raddr, int rn)
{
- return ((EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL |
- (GCS_ET_GCSSTR_GCSSTTR << 20) | (ra << 10) | (rn << 5));
+ uint32_t res = syn_set_ec(0, EC_GCS);
+ res = FIELD_DP32(res, SYNDROME, IL, 1);
+
+ res = FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_GCSSTR_GCSSTTR);
+ res = FIELD_DP32(res, GCS_ISS, RADDR, raddr);
+ res = FIELD_DP32(res, GCS_ISS, RN, rn);
+
+ return res;
}
static inline uint32_t syn_serror(uint32_t extra)