[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 09/10] target/arm: Suppress bp for exceptions with more priori
From: |
Richard Henderson |
Subject: |
[PATCH v4 09/10] target/arm: Suppress bp for exceptions with more priority |
Date: |
Wed, 3 Nov 2021 00:03:51 -0400 |
Both single-step and pc alignment faults have priority over
breakpoint exceptions.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/debug_helper.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
index 2983e36dd3..32f3caec23 100644
--- a/target/arm/debug_helper.c
+++ b/target/arm/debug_helper.c
@@ -220,6 +220,7 @@ bool arm_debug_check_breakpoint(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
+ target_ulong pc;
int n;
/*
@@ -231,6 +232,28 @@ bool arm_debug_check_breakpoint(CPUState *cs)
return false;
}
+ /*
+ * Single-step exceptions have priority over breakpoint exceptions.
+ * If single-step state is active-pending, suppress the bp.
+ */
+ if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) {
+ return false;
+ }
+
+ /*
+ * PC alignment faults have priority over breakpoint exceptions.
+ */
+ pc = is_a64(env) ? env->pc : env->regs[15];
+ if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) {
+ return false;
+ }
+
+ /*
+ * Instruction aborts have priority over breakpoint exceptions.
+ * TODO: We would need to look up the page for PC and verify that
+ * it is present and executable.
+ */
+
for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) {
if (bp_wp_matches(cpu, n, false)) {
return true;
--
2.25.1
- [PATCH v4 03/10] target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn, (continued)
- [PATCH v4 03/10] target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn, Richard Henderson, 2021/11/03
- [PATCH v4 04/10] target/arm: Split arm_pre_translate_insn, Richard Henderson, 2021/11/03
- [PATCH v4 05/10] target/arm: Advance pc for arch single-step exception, Richard Henderson, 2021/11/03
- [PATCH v4 08/10] target/arm: Assert thumb pc is aligned, Richard Henderson, 2021/11/03
- [PATCH v4 10/10] tests/tcg: Add arm and aarch64 pc alignment tests, Richard Henderson, 2021/11/03
- [PATCH v4 06/10] target/arm: Split compute_fsr_fsc out of arm_deliver_fault, Richard Henderson, 2021/11/03
- [PATCH v4 09/10] target/arm: Suppress bp for exceptions with more priority,
Richard Henderson <=
- [PATCH v4 07/10] target/arm: Take an exception if PC is misaligned, Richard Henderson, 2021/11/03
- Re: [PATCH v4 00/10] target/arm: Fix insn exception priorities, Peter Maydell, 2021/11/08