@samitouri / QOSamiQemu / commits / d742196596

target/arm: migrate memory op syndromes to registerfields

Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20260422125250.1303100-15-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Alex Bennée committed Apr 22, 2026 at 13:52 UTC d742196596944cb77035f2707161075dd8f8e8a0
1 file changed +29 -4
target/arm/syndrome.h
+29 -4
@@ -742,14 +742,39 @@ static inline uint32_t syn_serror(uint32_t extra)
742 return res;
743 }
744
745 +/*
746 + * ISS encoding for an exception from the Memory Copy and Memory Set
747 + * instructions.
748 + */
749 +FIELD(MOP_ISS, SIZEREG, 0, 5)
750 +FIELD(MOP_ISS, SRCREG, 5, 5)
751 +FIELD(MOP_ISS, DESTREG, 10, 5)
752 +FIELD(MOP_ISS, FORMATOPT, 16, 2)
753 +FIELD(MOP_ISS, OPT_A, 16, 1)
754 +FIELD(MOP_ISS, WRONG_OPT, 17, 1)
755 +FIELD(MOP_ISS, EPILOGUE, 18, 1)
756 +FIELD(MOP_ISS, OPTIONS, 19, 4)
757 +FIELD(MOP_ISS, IS_SETG, 23, 1)
758 +FIELD(MOP_ISS, MEMINST, 24, 1)
759 +
760 static inline uint32_t syn_mop(bool is_set, bool is_setg, int options,
761 bool epilogue, bool wrong_option, bool option_a,
762 int destreg, int srcreg, int sizereg)
763 {
749 - return (EC_MOP << ARM_EL_EC_SHIFT) | ARM_EL_IL |
750 - (is_set << 24) | (is_setg << 23) | (options << 19) |
751 - (epilogue << 18) | (wrong_option << 17) | (option_a << 16) |
752 - (destreg << 10) | (srcreg << 5) | sizereg;
764 + uint32_t res = syn_set_ec(0, EC_MOP);
765 + res = FIELD_DP32(res, SYNDROME, IL, 1);
766 +
767 + res = FIELD_DP32(res, MOP_ISS, MEMINST, is_set);
768 + res = FIELD_DP32(res, MOP_ISS, IS_SETG, is_setg);
769 + res = FIELD_DP32(res, MOP_ISS, OPTIONS, options);
770 + res = FIELD_DP32(res, MOP_ISS, EPILOGUE, epilogue);
771 + res = FIELD_DP32(res, MOP_ISS, WRONG_OPT, wrong_option);
772 + res = FIELD_DP32(res, MOP_ISS, OPT_A, option_a);
773 + res = FIELD_DP32(res, MOP_ISS, DESTREG, destreg);
774 + res = FIELD_DP32(res, MOP_ISS, SRCREG, srcreg);
775 + res = FIELD_DP32(res, MOP_ISS, SIZEREG, sizereg);
776 +
777 + return res;
778 }
779
780