diff options
author | Tim Newsome <tim@sifive.com> | 2021-01-15 16:41:36 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 16:41:36 -0800 |
commit | ed37337b0d39383285b1d86fbefc9ce289470bb3 (patch) | |
tree | 86c1c6c2116ab9c9e06f146b65665fa341e934bd | |
parent | d7db23c6fcda69e22b23e64b65b10c637f8ddb9e (diff) | |
parent | fcdecd88aecb98507e5e97926cdbbb84c36ce3b0 (diff) | |
download | riscv-openocd-ed37337b0d39383285b1d86fbefc9ce289470bb3.zip riscv-openocd-ed37337b0d39383285b1d86fbefc9ce289470bb3.tar.gz riscv-openocd-ed37337b0d39383285b1d86fbefc9ce289470bb3.tar.bz2 |
Merge pull request #568 from riscv/zero
Don't write to zero.
-rw-r--r-- | src/target/riscv/riscv.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 9978931..9a56561 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -4165,6 +4165,11 @@ static int register_set(struct reg *reg, uint8_t *buf) riscv_current_hartid(target), str, reg->name, reg->valid); free(str); + /* Exit early for writing x0, which on the hardware would be ignored, and we + * don't want to update our cache. */ + if (reg->number == GDB_REGNO_ZERO) + return ERROR_OK; + memcpy(reg->value, buf, DIV_ROUND_UP(reg->size, 8)); reg->valid = gdb_regno_cacheable(reg->number, true); |