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 <tim@sifive.com>
This commit is contained in:
Tim Newsome 2021-01-29 10:58:34 -08:00 committed by GitHub
parent 6628394c2c
commit 8980c2038a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -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) {