diff options
author | Tim Newsome <tim@sifive.com> | 2017-10-17 11:58:51 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2017-10-17 11:58:51 -0700 |
commit | a0623b2fa83eeeef91b83f193c98a1354d5963f9 (patch) | |
tree | a728e5de4f359150c15faaf788dd5f681c6ceb88 /src | |
parent | 65be0776d8301daddee9c517e7a7a2c154313dd2 (diff) | |
download | riscv-openocd-a0623b2fa83eeeef91b83f193c98a1354d5963f9.zip riscv-openocd-a0623b2fa83eeeef91b83f193c98a1354d5963f9.tar.gz riscv-openocd-a0623b2fa83eeeef91b83f193c98a1354d5963f9.tar.bz2 |
Don't crash when encountering RV64.
Change-Id: Ie915ce830c3499919e4918ad443a5e225cf8c4d9
Diffstat (limited to 'src')
-rw-r--r-- | src/target/riscv/riscv-013.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 1510290..8e7a2f0 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -700,7 +700,8 @@ static int register_read_abstract(struct target *target, uint64_t *value, return result; } - *value = read_abstract_arg(target, 0); + if (value) + *value = read_abstract_arg(target, 0); return ERROR_OK; } @@ -1078,11 +1079,7 @@ static int examine(struct target *target) * program buffer. */ r->debug_buffer_size[i] = info->progsize; - /* Guess this is a 32-bit system, we're probing it. */ - // >>> r->xlen[i] = 32; - - uint64_t value; - int result = register_read_abstract(target, &value, GDB_REGNO_S0, 64); + int result = register_read_abstract(target, NULL, GDB_REGNO_S0, 64); if (result == ERROR_OK) { r->xlen[i] = 64; } else { @@ -1371,7 +1368,6 @@ static int read_memory(struct target *target, target_addr_t address, dmi_write(target, DMI_ABSTRACTAUTO, 0); if (register_read_direct(target, &next_addr, GDB_REGNO_S0) != ERROR_OK) return ERROR_FAIL; - next_addr -= size; dmi_write(target, DMI_ABSTRACTAUTO, 1 << DMI_ABSTRACTAUTO_AUTOEXECDATA_OFFSET); break; |