Set current_hartid from coreid

This avoids a bunch of RTOS special cases.
autoconf
Palmer Dabbelt 2017-06-20 17:12:53 -07:00
parent 4e2e730abe
commit 9f4cac5a38
3 changed files with 5 additions and 7 deletions

View File

@ -706,7 +706,7 @@ static int init_target(struct command_context *cmd_ctx,
LOG_DEBUG("init");
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->set_register = &riscv013_set_register;
generic_info->select_current_hart = &riscv013_select_current_hart;

View File

@ -872,11 +872,12 @@ struct target_type riscv_target =
/*** 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));
r->dtm_version = 1;
r->registers_initialized = false;
r->current_hartid = target->coreid;
for (size_t h = 0; h < RISCV_MAX_HARTS; ++h) {
r->xlen[h] = -1;
@ -1068,10 +1069,7 @@ void riscv_invalidate_register_cache(struct target *target)
int riscv_current_hartid(const struct target *target)
{
RISCV_INFO(r);
if (riscv_rtos_enabled(target))
return r->current_hartid;
else
return target->coreid;
return r->current_hartid;
}
void riscv_set_all_rtos_harts(struct target *target)

View File

@ -134,7 +134,7 @@ int riscv_openocd_deassert_reset(struct target *target);
/*** RISC-V Interface ***/
/* 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
* all the enabled harts, which when running in RTOS mode is all the harts on