From 83a87b2ccc9e6e2f0bcf20bc56bb4f6759392aa6 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 22 Jul 2021 11:43:51 -0700 Subject: Fix clobbering s2 in read_memory_progbuf(increment=0) Fixes #632. Change-Id: Ic884823faf67749f1ac8fbd91fe67ff9ebdd8fd0 Signed-off-by: Tim Newsome --- src/target/riscv/riscv-013.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 4b9bd93..8766795 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -3457,7 +3457,7 @@ static int read_memory_progbuf(struct target *target, target_addr_t address, return ERROR_FAIL; if (register_read(target, &s1, GDB_REGNO_S1) != ERROR_OK) return ERROR_FAIL; - if (increment == 0 && register_read(target, &s2, GDB_REGNO_S1) != ERROR_OK) + if (increment == 0 && register_read(target, &s2, GDB_REGNO_S2) != ERROR_OK) return ERROR_FAIL; /* Write the program (load, increment) */ -- cgit v1.1