Invalidate the register cache on step, resume, reset
I thought OpenOCD did this, but it looks like that doesn't happen when runningi in RTOS mode. With this I can get to the end of most of the RTOS tests, but they SIGINT instead of exiting.
This commit is contained in:
parent
a1e07e58f4
commit
faa6123e36
|
@ -914,6 +914,7 @@ int riscv_resume_all_harts(struct target *target)
|
||||||
riscv_resume_one_hart(target, riscv_current_hartid(target));
|
riscv_resume_one_hart(target, riscv_current_hartid(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
riscv_invalidate_register_cache(target);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,6 +942,7 @@ int riscv_reset_all_harts(struct target *target)
|
||||||
riscv_reset_one_hart(target, riscv_current_hartid(target));
|
riscv_reset_one_hart(target, riscv_current_hartid(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
riscv_invalidate_register_cache(target);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,8 +975,10 @@ int riscv_step_rtos_hart(struct target *target)
|
||||||
LOG_DEBUG("stepping hart %d", hartid);
|
LOG_DEBUG("stepping hart %d", hartid);
|
||||||
|
|
||||||
assert(riscv_is_halted(target));
|
assert(riscv_is_halted(target));
|
||||||
|
riscv_invalidate_register_cache(target);
|
||||||
r->on_step(target);
|
r->on_step(target);
|
||||||
r->step_current_hart(target);
|
r->step_current_hart(target);
|
||||||
|
riscv_invalidate_register_cache(target);
|
||||||
r->on_halt(target);
|
r->on_halt(target);
|
||||||
assert(riscv_is_halted(target));
|
assert(riscv_is_halted(target));
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1019,6 +1023,13 @@ void riscv_set_current_hartid(struct target *target, int hartid)
|
||||||
} else
|
} else
|
||||||
LOG_DEBUG("Initializing registers: xlen=%d", riscv_xlen(target));
|
LOG_DEBUG("Initializing registers: xlen=%d", riscv_xlen(target));
|
||||||
|
|
||||||
|
riscv_invalidate_register_cache(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
void riscv_invalidate_register_cache(struct target *target)
|
||||||
|
{
|
||||||
|
RISCV_INFO(r);
|
||||||
|
|
||||||
/* Update the register list's widths. */
|
/* Update the register list's widths. */
|
||||||
register_cache_invalidate(target->reg_cache);
|
register_cache_invalidate(target->reg_cache);
|
||||||
for (size_t i = 0; i < GDB_REGNO_COUNT; ++i) {
|
for (size_t i = 0; i < GDB_REGNO_COUNT; ++i) {
|
||||||
|
|
|
@ -211,4 +211,7 @@ void riscv_fill_dmi_write_u64(struct target *target, char *buf, int a, uint64_t
|
||||||
void riscv_fill_dmi_read_u64(struct target *target, char *buf, int a);
|
void riscv_fill_dmi_read_u64(struct target *target, char *buf, int a);
|
||||||
int riscv_dmi_write_u64_bits(struct target *target);
|
int riscv_dmi_write_u64_bits(struct target *target);
|
||||||
|
|
||||||
|
/* Invalidates the register cache. */
|
||||||
|
void riscv_invalidate_register_cache(struct target *target);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue