aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2023-08-23 12:01:49 -0700
committerGitHub <noreply@github.com>2023-08-23 12:01:49 -0700
commit7aedb159511bb32d96015631c6c2e48d5b6c2b32 (patch)
tree468bd0b9f41c2d8cecdca060f6f5d690c5c37deb /src/target
parent5cb60e3f7d1b2eca5e376a6a829bdd3659c35f54 (diff)
parent0ae47ae4723431e78c2164d069e530b049fdbbbb (diff)
downloadriscv-openocd-7aedb159511bb32d96015631c6c2e48d5b6c2b32.zip
riscv-openocd-7aedb159511bb32d96015631c6c2e48d5b6c2b32.tar.gz
riscv-openocd-7aedb159511bb32d96015631c6c2e48d5b6c2b32.tar.bz2
Merge pull request #905 from aap-sc/aap-sc/crash_when_on_vector_tgt_running
fix crash when we try to read vector register on a running target
Diffstat (limited to 'src/target')
-rw-r--r--src/target/riscv/riscv-013.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 6f5c142..f85c91d 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -2369,9 +2369,6 @@ static int riscv013_get_register_buf(struct target *target,
if (dm013_select_target(target) != ERROR_OK)
return ERROR_FAIL;
- if (riscv_save_register(target, GDB_REGNO_S0) != ERROR_OK)
- return ERROR_FAIL;
-
riscv_reg_t mstatus, vtype, vl;
unsigned int debug_vl, debug_vsew;
@@ -2379,6 +2376,9 @@ static int riscv013_get_register_buf(struct target *target,
&debug_vl, &debug_vsew) != ERROR_OK)
return ERROR_FAIL;
+ if (riscv_save_register(target, GDB_REGNO_S0) != ERROR_OK)
+ return ERROR_FAIL;
+
unsigned int vnum = regno - GDB_REGNO_V0;
int result = ERROR_OK;
@@ -2424,9 +2424,6 @@ static int riscv013_set_register_buf(struct target *target,
if (dm013_select_target(target) != ERROR_OK)
return ERROR_FAIL;
- if (riscv_save_register(target, GDB_REGNO_S0) != ERROR_OK)
- return ERROR_FAIL;
-
riscv_reg_t mstatus, vtype, vl;
unsigned int debug_vl, debug_vsew;
@@ -2434,6 +2431,9 @@ static int riscv013_set_register_buf(struct target *target,
&debug_vl, &debug_vsew) != ERROR_OK)
return ERROR_FAIL;
+ if (riscv_save_register(target, GDB_REGNO_S0) != ERROR_OK)
+ return ERROR_FAIL;
+
unsigned int vnum = regno - GDB_REGNO_V0;
struct riscv_program program;