Set current_hartid from coreid
This avoids a bunch of RTOS special cases.
This commit is contained in:
parent
4e2e730abe
commit
9f4cac5a38
|
@ -706,7 +706,7 @@ static int init_target(struct command_context *cmd_ctx,
|
||||||
LOG_DEBUG("init");
|
LOG_DEBUG("init");
|
||||||
riscv_info_t *generic_info = (riscv_info_t *) target->arch_info;
|
riscv_info_t *generic_info = (riscv_info_t *) target->arch_info;
|
||||||
|
|
||||||
riscv_info_init(generic_info);
|
riscv_info_init(target, generic_info);
|
||||||
generic_info->get_register = &riscv013_get_register;
|
generic_info->get_register = &riscv013_get_register;
|
||||||
generic_info->set_register = &riscv013_set_register;
|
generic_info->set_register = &riscv013_set_register;
|
||||||
generic_info->select_current_hart = &riscv013_select_current_hart;
|
generic_info->select_current_hart = &riscv013_select_current_hart;
|
||||||
|
|
|
@ -872,11 +872,12 @@ struct target_type riscv_target =
|
||||||
|
|
||||||
/*** RISC-V Interface ***/
|
/*** RISC-V Interface ***/
|
||||||
|
|
||||||
void riscv_info_init(riscv_info_t *r)
|
void riscv_info_init(struct target *target, riscv_info_t *r)
|
||||||
{
|
{
|
||||||
memset(r, 0, sizeof(*r));
|
memset(r, 0, sizeof(*r));
|
||||||
r->dtm_version = 1;
|
r->dtm_version = 1;
|
||||||
r->registers_initialized = false;
|
r->registers_initialized = false;
|
||||||
|
r->current_hartid = target->coreid;
|
||||||
|
|
||||||
for (size_t h = 0; h < RISCV_MAX_HARTS; ++h) {
|
for (size_t h = 0; h < RISCV_MAX_HARTS; ++h) {
|
||||||
r->xlen[h] = -1;
|
r->xlen[h] = -1;
|
||||||
|
@ -1068,10 +1069,7 @@ void riscv_invalidate_register_cache(struct target *target)
|
||||||
int riscv_current_hartid(const struct target *target)
|
int riscv_current_hartid(const struct target *target)
|
||||||
{
|
{
|
||||||
RISCV_INFO(r);
|
RISCV_INFO(r);
|
||||||
if (riscv_rtos_enabled(target))
|
|
||||||
return r->current_hartid;
|
return r->current_hartid;
|
||||||
else
|
|
||||||
return target->coreid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void riscv_set_all_rtos_harts(struct target *target)
|
void riscv_set_all_rtos_harts(struct target *target)
|
||||||
|
|
|
@ -134,7 +134,7 @@ int riscv_openocd_deassert_reset(struct target *target);
|
||||||
/*** RISC-V Interface ***/
|
/*** RISC-V Interface ***/
|
||||||
|
|
||||||
/* Initializes the shared RISC-V structure. */
|
/* Initializes the shared RISC-V structure. */
|
||||||
void riscv_info_init(riscv_info_t *r);
|
void riscv_info_init(struct target *target, riscv_info_t *r);
|
||||||
|
|
||||||
/* Run control, possibly for multiple harts. The _all_harts versions resume
|
/* Run control, possibly for multiple harts. The _all_harts versions resume
|
||||||
* all the enabled harts, which when running in RTOS mode is all the harts on
|
* all the enabled harts, which when running in RTOS mode is all the harts on
|
||||||
|
|
Loading…
Reference in New Issue