Invalidate the register cache when touching another hart

The 0.13 code now caches registers interally, so when reading registers
on a diferent hart we need to invalidate the cache.
This commit is contained in:
Palmer Dabbelt 2018-05-30 17:36:22 -07:00
parent 6d9e69499f
commit d2cd725dd3
1 changed files with 8 additions and 0 deletions

View File

@ -1840,7 +1840,15 @@ int riscv_get_register_on_hart(struct target *target, riscv_reg_t *value,
int hartid, enum gdb_regno regid)
{
RISCV_INFO(r);
if (hartid != riscv_current_hartid(target))
riscv_invalidate_register_cache(target);
int result = r->get_register(target, value, hartid, regid);
if (hartid != riscv_current_hartid(target))
riscv_invalidate_register_cache(target);
LOG_DEBUG("[%d] %s: %" PRIx64, hartid, gdb_regno_name(regid), *value);
return result;
}