diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 584014dd0..4a6bbdb49 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1267,7 +1267,7 @@ static int read_memory(struct target *target, uint32_t address, case 64: riscv_program_write_ram(&program, r_addr + 4, (((riscv_addr_t)(address)) - size) >> 32); case 32: - riscv_program_write_ram(&program, r_addr, (riscv_addr_t)(address - size)); + riscv_program_write_ram(&program, r_addr, (riscv_addr_t)(address) - size); break; default: LOG_ERROR("unknown XLEN %d", riscv_xlen(target));