Properly restore s0 and s1 on resume.

Now 33/39 of the gdbserver tests pass!

Change-Id: I0cb38fbbcdc2c037ff0ec77229e79f24fa021663
This commit is contained in:
Tim Newsome 2017-02-20 15:47:31 -08:00
parent 3173314f28
commit aba0c0973d
1 changed files with 8 additions and 8 deletions

View File

@ -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());