aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2017-02-20 15:47:31 -0800
committerTim Newsome <tim@sifive.com>2017-02-20 15:47:31 -0800
commitaba0c0973d58ec42671b12c6226d11bd4356817f (patch)
treed92afbc77cc30b6dffb0f49b0cea6efe5f4c580f
parent3173314f28a621ccc60bcde21860d2900203c6ca (diff)
downloadriscv-openocd-aba0c0973d58ec42671b12c6226d11bd4356817f.zip
riscv-openocd-aba0c0973d58ec42671b12c6226d11bd4356817f.tar.gz
riscv-openocd-aba0c0973d58ec42671b12c6226d11bd4356817f.tar.bz2
Properly restore s0 and s1 on resume.
Now 33/39 of the gdbserver tests pass! Change-Id: I0cb38fbbcdc2c037ff0ec77229e79f24fa021663
-rw-r--r--src/target/riscv/riscv-013.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 2d34550..cc06fa7 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -954,14 +954,6 @@ static int execute_resume(struct target *target, bool step)
return ERROR_FAIL;
}
- // Restore GPRs
- if (register_write_direct(target, S0, reg_cache_get(target, S0)) != ERROR_OK) {
- return ERROR_FAIL;
- }
- if (register_write_direct(target, S1, reg_cache_get(target, S1)) != ERROR_OK) {
- return ERROR_FAIL;
- }
-
struct reg *mstatus_reg = &target->reg_cache->reg_list[REG_MSTATUS];
if (mstatus_reg->valid) {
uint64_t mstatus_user = buf_get_u64(mstatus_reg->value, 0, xlen(target));
@@ -985,6 +977,14 @@ static int execute_resume(struct target *target, bool step)
return ERROR_FAIL;
}
+ // Restore GPRs
+ if (register_write_direct(target, S0, reg_cache_get(target, S0)) != ERROR_OK) {
+ return ERROR_FAIL;
+ }
+ if (register_write_direct(target, S1, reg_cache_get(target, S1)) != ERROR_OK) {
+ return ERROR_FAIL;
+ }
+
program_t *program = program_new();
program_add32(program, fence_i());
program_add32(program, ebreak());