aboutsummaryrefslogtreecommitdiff
path: root/riscv/debug_module.cc
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/debug_module.cc')
-rw-r--r--riscv/debug_module.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/riscv/debug_module.cc b/riscv/debug_module.cc
index 5490d0e..920166c 100644
--- a/riscv/debug_module.cc
+++ b/riscv/debug_module.cc
@@ -661,6 +661,17 @@ bool debug_module_t::perform_abstract_command()
return true;
}
+ if (regno == 0x1000 + S0 && write) {
+ /*
+ * The exception handler starts out be restoring dscratch to s0,
+ * which was saved before executing the abstract memory region. Since
+ * we just wrote s0, also make sure to write that same value to
+ * dscratch in case an exception occurs in a program buffer that
+ * might be executed later.
+ */
+ write32(debug_abstract, i++, csrw(S0, CSR_DSCRATCH0));
+ }
+
} else if (regno >= 0x1020 && regno < 0x1040) {
unsigned fprnum = regno - 0x1020;