Correct previous hart caching logic

race
Palmer Dabbelt 2017-05-01 08:31:18 -07:00
parent 1ec607c726
commit ba3a56937b
1 changed files with 2 additions and 1 deletions

View File

@ -890,9 +890,10 @@ bool riscv_rtos_enabled(const struct target *target)
void riscv_set_current_hartid(struct target *target, int hartid) void riscv_set_current_hartid(struct target *target, int hartid)
{ {
RISCV_INFO(r); RISCV_INFO(r);
int previous_hartid = riscv_current_hartid(target);
r->current_hartid = hartid; r->current_hartid = hartid;
assert(riscv_rtos_enabled(target) || target->coreid == hartid); assert(riscv_rtos_enabled(target) || target->coreid == hartid);
int previous_hartid = riscv_current_hartid(target); LOG_DEBUG("setting hartid to %d, was %d", hartid, previous_hartid);
if (riscv_rtos_enabled(target)) if (riscv_rtos_enabled(target))
r->select_current_hart(target); r->select_current_hart(target);