diff options
author | Jan Matyas <jan.matyas@codasip.com> | 2024-02-05 12:46:23 +0100 |
---|---|---|
committer | Jan Matyas <jan.matyas@codasip.com> | 2024-02-06 14:34:22 +0100 |
commit | d0615e4a12f5be543ea29e89dcfab5bdb9d9c011 (patch) | |
tree | 69daa055da9375c3379e022b9007ec80cee77a9f | |
parent | 87331a82a29a5aeb222543b6876e0208be70ea41 (diff) | |
download | riscv-openocd-d0615e4a12f5be543ea29e89dcfab5bdb9d9c011.zip riscv-openocd-d0615e4a12f5be543ea29e89dcfab5bdb9d9c011.tar.gz riscv-openocd-d0615e4a12f5be543ea29e89dcfab5bdb9d9c011.tar.bz2 |
riscv/program: Removed dead code for restoring register values
Function riscv_program_exec() contains code for restoring
of register values after progbuf execution. This code is
not used anymore by current OpenOCD, and hence removed.
Related discussion can be found under:
https://github.com/riscv/riscv-openocd/issues/982
Change-Id: I4c79bec081522b6fc0d16367cef51ed19a131962
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
-rw-r--r-- | src/target/riscv/program.c | 16 | ||||
-rw-r--r-- | src/target/riscv/program.h | 7 |
2 files changed, 0 insertions, 23 deletions
diff --git a/src/target/riscv/program.c b/src/target/riscv/program.c index 22962fa..c4ffb3f 100644 --- a/src/target/riscv/program.c +++ b/src/target/riscv/program.c @@ -20,9 +20,6 @@ int riscv_program_init(struct riscv_program *p, struct target *target) memset(p, 0, sizeof(*p)); p->target = target; p->instruction_count = 0; - p->target_xlen = riscv_xlen(target); - for (size_t i = 0; i < RISCV_REGISTER_COUNT; ++i) - p->writes_xreg[i] = 0; for (size_t i = 0; i < RISCV_MAX_PROGBUF_SIZE; ++i) p->progbuf[i] = -1; @@ -48,15 +45,6 @@ int riscv_program_exec(struct riscv_program *p, struct target *t) keep_alive(); p->execution_result = RISCV_PROGBUF_EXEC_RESULT_UNKNOWN; - riscv_reg_t saved_registers[GDB_REGNO_XPR31 + 1]; - for (size_t i = GDB_REGNO_ZERO + 1; i <= GDB_REGNO_XPR31; ++i) { - if (p->writes_xreg[i]) { - LOG_TARGET_DEBUG(t, "Saving register %d as used by program", (int)i); - int result = riscv_get_register(t, &saved_registers[i], i); - if (result != ERROR_OK) - return result; - } - } if (riscv_program_ebreak(p) != ERROR_OK) { LOG_TARGET_ERROR(t, "Unable to insert ebreak into program buffer"); @@ -80,10 +68,6 @@ int riscv_program_exec(struct riscv_program *p, struct target *t) } p->execution_result = RISCV_PROGBUF_EXEC_RESULT_SUCCESS; - for (size_t i = GDB_REGNO_ZERO; i <= GDB_REGNO_XPR31; ++i) - if (p->writes_xreg[i]) - riscv_set_register(t, i, saved_registers[i]); - return ERROR_OK; } diff --git a/src/target/riscv/program.h b/src/target/riscv/program.h index 1735f23..361191a 100644 --- a/src/target/riscv/program.h +++ b/src/target/riscv/program.h @@ -28,13 +28,6 @@ struct riscv_program { /* Number of 32-bit instructions in the program. */ size_t instruction_count; - /* Side effects of executing this program. These must be accounted for - * in order to maintain correct executing of the target system. */ - bool writes_xreg[RISCV_REGISTER_COUNT]; - - /* XLEN on the target. */ - int target_xlen; - /* execution result of the program */ /* TODO: remove this field. We should make it a parameter to riscv_program_exec */ riscv_progbuf_exec_result_t execution_result; |