diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index e1f807d38..e7efb9c79 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1430,9 +1430,9 @@ static int read_memory(struct target *target, target_addr_t address, switch (riscv_xlen(target)) { case 64: - riscv013_write_debug_buffer(target, d_addr + 1, (cur_addr - size) >> 32); + riscv013_write_debug_buffer(target, d_addr + 1, cur_addr >> 32); case 32: - riscv013_write_debug_buffer(target, d_addr, (cur_addr - size)); + riscv013_write_debug_buffer(target, d_addr, cur_addr); break; default: LOG_ERROR("unknown XLEN %d", riscv_xlen(target));