Invalidate the register cache when rtos_hartid==-1

This means I don't know what hart to look at, so I might as well
invalidate the register cache.  Without this, you might get stale
registers the first time you ask for them.
release
Palmer Dabbelt 2017-05-25 13:12:21 -07:00
parent faa6123e36
commit ab77c5d792
1 changed files with 4 additions and 1 deletions

View File

@ -1017,7 +1017,10 @@ void riscv_set_current_hartid(struct target *target, int hartid)
return;
/* Avoid invalidating the register cache all the time. */
if (r->registers_initialized && (!riscv_rtos_enabled(target) || (previous_hartid == hartid)) && target->reg_cache->reg_list[GDB_REGNO_XPR0].size == (long)riscv_xlen(target)) {
if (r->registers_initialized
&& (!riscv_rtos_enabled(target) || (previous_hartid == hartid))
&& target->reg_cache->reg_list[GDB_REGNO_XPR0].size == (long)riscv_xlen(target)
&& (!riscv_rtos_enabled(target) || (r->rtos_hartid != -1))) {
LOG_DEBUG("registers already initialized, skipping");
return;
} else