From 8980c2038a3abfb431b73f111a196ef76cba6729 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 29 Jan 2021 10:58:34 -0800 Subject: Select current hart before accessing vector regs. (#574) I don't know how this worked before. Possibly caused by overzealous removal of `-rtos riscv`. Change-Id: I7259267b861ef45655f469ab39cc463d608fe149 Signed-off-by: Tim Newsome --- src/target/riscv/riscv-013.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/target') diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index ad0423c..272ae91 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1945,6 +1945,9 @@ static int riscv013_get_register_buf(struct target *target, { assert(regno >= GDB_REGNO_V0 && regno <= GDB_REGNO_V31); + if (riscv_select_current_hart(target) != ERROR_OK) + return ERROR_FAIL; + riscv_reg_t s0; if (register_read(target, &s0, GDB_REGNO_S0) != ERROR_OK) return ERROR_FAIL; @@ -2001,6 +2004,9 @@ static int riscv013_set_register_buf(struct target *target, { assert(regno >= GDB_REGNO_V0 && regno <= GDB_REGNO_V31); + if (riscv_select_current_hart(target) != ERROR_OK) + return ERROR_FAIL; + riscv_reg_t s0; if (register_read(target, &s0, GDB_REGNO_S0) != ERROR_OK) return ERROR_FAIL; @@ -4033,7 +4039,8 @@ static int riscv013_get_register(struct target *target, LOG_DEBUG("[%s] reading register %s", target_name(target), gdb_regno_name(rid)); - riscv_select_current_hart(target); + if (riscv_select_current_hart(target) != ERROR_OK) + return ERROR_FAIL; int result = ERROR_OK; if (rid == GDB_REGNO_PC) { -- cgit v1.1