When single-step finishes on a hart backed by a Debug Module ROM,
restart execution at the ROM entry instead of forcing the legacy
EXCP_DEBUG stop path.
This lets the park loop observe step completion through the
normal ROM flow and keeps single-step behavior aligned with the
Debug Module run-control model.
Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
---
target/riscv/op_helper.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c
index e7878d7aa4..945688eca8 100644
--- a/target/riscv/op_helper.c
+++ b/target/riscv/op_helper.c
@@ -481,6 +481,10 @@ void helper_sdext_step(CPURISCVState *env)
}
riscv_cpu_enter_debug_mode(env, env->pc, DCSR_CAUSE_STEP);
+ if (env->dm_rom_present) {
+ env->pc = env->dm_halt_addr;
+ cpu_loop_exit(cs);
+ }
cs->exception_index = EXCP_DEBUG;
cpu_loop_exit_restore(cs, GETPC());
#endif
--
2.53.0