@samitouri / QOSamiQemu / commits / ab62f2f10c

target/arm: migrate debug syndromes to registerfields

Migrate syn_swstep, syn_watchpoint and syn_breakpoint to the registerfields API. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20260422125250.1303100-12-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Alex Bennée committed Apr 22, 2026 at 13:52 UTC ab62f2f10c6507f6f5ea2af175317b7fc555b931
1 file changed +48 -6
target/arm/syndrome.h
+48 -6
@@ -595,22 +595,64 @@ static inline uint32_t syn_data_abort_vncr(int ea, int wnr, int fsc)
595 return res;
596 }
597
598 +/*
599 + * ISS encoding for an exception from a Software Step exception.
600 + */
601 +FIELD(SOFTSTEP_ISS, IFSC, 0, 6)
602 +FIELD(SOFTSTEP_ISS, EX, 6, 1)
603 +FIELD(SOFTSTEP_ISS, ISV, 24, 1)
604 +
605 static inline uint32_t syn_swstep(int same_el, int isv, int ex)
606 {
600 - return (EC_SOFTWARESTEP << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT)
601 - | ARM_EL_IL | (isv << 24) | (ex << 6) | 0x22;
607 + uint32_t res = syn_set_ec(0, EC_SOFTWARESTEP + same_el);
608 + res = FIELD_DP32(res, SYNDROME, IL, 1);
609 +
610 + res = FIELD_DP32(res, SOFTSTEP_ISS, ISV, isv);
611 + res = FIELD_DP32(res, SOFTSTEP_ISS, EX, ex);
612 + res = FIELD_DP32(res, SOFTSTEP_ISS, IFSC, 0x22);
613 +
614 + return res;
615 }
616
617 +/*
618 + * ISS encoding for an exception from a Watchpoint exception
619 + */
620 +FIELD(WATCHPOINT_ISS, DFSC, 0, 6)
621 +FIELD(WATCHPOINT_ISS, WNR, 6, 1)
622 +FIELD(WATCHPOINT_ISS, CM, 8, 1)
623 +FIELD(WATCHPOINT_ISS, FnV, 10, 1)
624 +FIELD(WATCHPOINT_ISS, VNCR, 13, 1) /* FEAT_NV2 */
625 +FIELD(WATCHPOINT_ISS, FnP, 15, 1)
626 +FIELD(WATCHPOINT_ISS, WPF, 16, 1)
627 +/* bellow mandatory from FEAT_Debugv8p9 */
628 +FIELD(WATCHPOINT_ISS, WPTV, 17, 1) /* FEAT_Debugv8p2 - WPT valid */
629 +FIELD(WATCHPOINT_ISS, WPT, 18, 6) /* FEAT_Debugv8p2 - missing WP number */
630 +
631 static inline uint32_t syn_watchpoint(int same_el, int cm, int wnr)
632 {
606 - return (EC_WATCHPOINT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT)
607 - | ARM_EL_IL | (cm << 8) | (wnr << 6) | 0x22;
633 + uint32_t res = syn_set_ec(0, EC_WATCHPOINT + same_el);
634 + res = FIELD_DP32(res, SYNDROME, IL, 1);
635 +
636 + res = FIELD_DP32(res, WATCHPOINT_ISS, CM, cm);
637 + res = FIELD_DP32(res, WATCHPOINT_ISS, WNR, wnr);
638 + res = FIELD_DP32(res, WATCHPOINT_ISS, DFSC, 0x22);
639 +
640 + return res;
641 }
642
643 +/*
644 + * ISS encoding for an exception from a Breakpoint or a Vector Catch
645 + * debug exception.
646 + */
647 +FIELD(BREAKPOINT_ISS, IFSC, 0, 6)
648 +
649 static inline uint32_t syn_breakpoint(int same_el)
650 {
612 - return (EC_BREAKPOINT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT)
613 - | ARM_EL_IL | 0x22;
651 + uint32_t res = syn_set_ec(0, EC_BREAKPOINT + same_el);
652 + res = FIELD_DP32(res, SYNDROME, IL, 1);
653 + res = FIELD_DP32(res, BREAKPOINT_ISS, IFSC, 0x22);
654 +
655 + return res;
656 }
657
658 static inline uint32_t syn_wfx(int cv, int cond, int ti, bool is_16bit)