Refactor examine, to avoid some assertions
Now that we're supporting non-RTOS multi-hart mode there's some more assertions that you're running on the right hart. Those assertions aren't sane very early in examine, so I avoid them.
This commit is contained in:
parent
788908fcf0
commit
a277416a39
|
@ -1123,17 +1123,23 @@ static int examine(struct target *target)
|
||||||
|
|
||||||
/* Before doing anything else we must first enumerate the harts. */
|
/* Before doing anything else we must first enumerate the harts. */
|
||||||
RISCV_INFO(r);
|
RISCV_INFO(r);
|
||||||
if (riscv_rtos_enabled(target)) {
|
int original_coreid = target->coreid;
|
||||||
for (int i = 0; i < RISCV_MAX_HARTS; ++i) {
|
for (int i = 0; i < RISCV_MAX_HARTS; ++i) {
|
||||||
riscv_set_current_hartid(target, i);
|
/* Fake being a non-RTOS targeted to this core so we can see if
|
||||||
uint32_t s = dmi_read(target, DMI_DMSTATUS);
|
* it exists. This avoids the assertion in
|
||||||
if (get_field(s, DMI_DMSTATUS_ANYNONEXISTENT))
|
* riscv_set_current_hartid() that ensures non-RTOS targets
|
||||||
break;
|
* don't touch the harts they're not assigned to. */
|
||||||
r->hart_count = i + 1;
|
target->coreid = i;
|
||||||
|
r->hart_count = i + 1;
|
||||||
|
riscv_set_current_hartid(target, i);
|
||||||
|
|
||||||
|
uint32_t s = dmi_read(target, DMI_DMSTATUS);
|
||||||
|
if (get_field(s, DMI_DMSTATUS_ANYNONEXISTENT)) {
|
||||||
|
r->hart_count--;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
r->hart_count = 1;
|
|
||||||
}
|
}
|
||||||
|
target->coreid = original_coreid;
|
||||||
|
|
||||||
LOG_DEBUG("Enumerated %d harts", r->hart_count);
|
LOG_DEBUG("Enumerated %d harts", r->hart_count);
|
||||||
|
|
||||||
|
@ -1233,6 +1239,7 @@ static int examine(struct target *target)
|
||||||
|
|
||||||
/* Resumes all the harts, so the debugger can later pause them. */
|
/* Resumes all the harts, so the debugger can later pause them. */
|
||||||
riscv_resume_all_harts(target);
|
riscv_resume_all_harts(target);
|
||||||
|
target->state = TARGET_RUNNING;
|
||||||
target_set_examined(target);
|
target_set_examined(target);
|
||||||
|
|
||||||
if (target->rtos) {
|
if (target->rtos) {
|
||||||
|
|
Loading…
Reference in New Issue