From 5a48975118f1be31135d6dc5c7293b6e92639557 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 6 Oct 2022 11:19:11 -0700 Subject: [PATCH] target/riscv: Error when hart becomes unavailable during resume Change-Id: I731e6178b2b08b65206614b0dc2a0d993c149cc3 Signed-off-by: Tim Newsome --- src/target/riscv/riscv-013.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index a205424d3..5e5434761 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -4856,6 +4856,8 @@ static int riscv013_step_or_resume_current_hart(struct target *target, usleep(10); if (dmstatus_read(target, &dmstatus, true) != ERROR_OK) return ERROR_FAIL; + if (get_field(dmstatus, DM_DMSTATUS_ALLUNAVAIL)) + return ERROR_FAIL; if (get_field(dmstatus, DM_DMSTATUS_ALLRESUMEACK) == 0) continue; if (step && get_field(dmstatus, DM_DMSTATUS_ALLHALTED) == 0)