Don't rely on the RTOS hartid for the register cache

This commit is contained in:
Palmer Dabbelt 2018-05-30 07:04:14 -07:00
parent 06bc6cccd4
commit 6d9e69499f
1 changed files with 1 additions and 2 deletions

View File

@ -1755,8 +1755,7 @@ int riscv_set_current_hartid(struct target *target, int hartid)
/* 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_ZERO].size == (unsigned)riscv_xlen(target)
&& (!riscv_rtos_enabled(target) || (r->rtos_hartid != -1))) {
&& target->reg_cache->reg_list[GDB_REGNO_ZERO].size == (unsigned)riscv_xlen(target)) {
return ERROR_OK;
} else
LOG_DEBUG("Initializing registers: xlen=%d", riscv_xlen(target));