From e03dd199e05923abda2dbc86ebc97d92531ef294 Mon Sep 17 00:00:00 2001 From: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com> Date: Thu, 28 Nov 2019 00:24:25 +0100 Subject: [PATCH] Fixed write_memory_progbuf() on RV64. (#426) Abstract write size (aarsize) to shall always match the real size of the register. This is because abstract write of smaller size than the register need not be supported per spec (pg. 13 of RISC-V External Debug Support ver. 0.13.2). --- 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 417cb9f13..548c6d5cf 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -3232,7 +3232,7 @@ static int write_memory_progbuf(struct target *target, target_addr_t address, /* Write and execute command that moves value into S1 and * executes program buffer. */ uint32_t command = access_register_command(target, - GDB_REGNO_S1, size > 4 ? 64 : 32, + GDB_REGNO_S1, riscv_xlen(target), AC_ACCESS_REGISTER_POSTEXEC | AC_ACCESS_REGISTER_TRANSFER | AC_ACCESS_REGISTER_WRITE);