diff options
author | Palmer Dabbelt <palmer@dabbelt.com> | 2017-06-20 17:12:53 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2017-06-20 17:19:05 -0700 |
commit | 9f4cac5a3812be137913995e2d1d4be4b34e0744 (patch) | |
tree | 6115a04cfaef739e09ef0974d89bc0c878c5b6a6 | |
parent | 4e2e730abef0789143a3e10db30eb2771e311731 (diff) | |
download | riscv-openocd-9f4cac5a3812be137913995e2d1d4be4b34e0744.zip riscv-openocd-9f4cac5a3812be137913995e2d1d4be4b34e0744.tar.gz riscv-openocd-9f4cac5a3812be137913995e2d1d4be4b34e0744.tar.bz2 |
Set current_hartid from coreid
This avoids a bunch of RTOS special cases.
-rw-r--r-- | src/target/riscv/riscv-013.c | 2 | ||||
-rw-r--r-- | src/target/riscv/riscv.c | 8 | ||||
-rw-r--r-- | src/target/riscv/riscv.h | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 60846de..2fab9a1 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -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; diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 7a40467..ad5eddb 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -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) diff --git a/src/target/riscv/riscv.h b/src/target/riscv/riscv.h index e23d49d..53fb086 100644 --- a/src/target/riscv/riscv.h +++ b/src/target/riscv/riscv.h @@ -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 |