From 98df29b8d1589a158099ee7366cbf9e559ade40c Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Thu, 13 Apr 2017 17:22:59 -0700 Subject: [PATCH] Check for step --- src/target/riscv/riscv-013.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 92b6ae858..8298f63da 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1584,6 +1584,10 @@ static void riscv013_step_or_resume_current_hart(struct target *target, bool ste uint32_t dmstatus = dmi_read(target, DMI_DMSTATUS); if (get_field(dmstatus, DMI_DMSTATUS_ALLRESUMEACK) == 0) continue; + if (step && get_field(dmstatus, DMI_DMSTATUS_ALLHALTED) == 0) + continue; + if (!step && get_field(dmstatus, DMI_DMSTATUS_ALLRUNNING) == 0) + continue; dmcontrol = set_field(dmcontrol, DMI_DMCONTROL_RESUMEREQ, 0); dmi_write(target, DMI_DMCONTROL, dmcontrol);