aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-04-13 22:11:07 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-04-13 22:11:07 -0700
commitd652e6ea1627e525e7c9ca63c217ea6e1277f821 (patch)
tree341b8424f734c4f0f0704340ccb6243011606e1c
parent22d102e3c13971b5324e7c14d2be646232b53644 (diff)
downloadriscv-openocd-d652e6ea1627e525e7c9ca63c217ea6e1277f821.zip
riscv-openocd-d652e6ea1627e525e7c9ca63c217ea6e1277f821.tar.gz
riscv-openocd-d652e6ea1627e525e7c9ca63c217ea6e1277f821.tar.bz2
off by one
-rw-r--r--src/target/riscv/riscv-013.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 8997c6a..625e26c 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -1517,14 +1517,14 @@ void riscv013_debug_buffer_leave(struct target *target, struct riscv_program *pr
void riscv013_write_debug_buffer(struct target *target, int index, riscv_insn_t data)
{
- if (index > riscv013_progbuf_size(target))
+ if (index >= riscv013_progbuf_size(target))
return dmi_write(target, DMI_DATA0 + index - riscv013_progbuf_size(target), data);
return dmi_write(target, DMI_PROGBUF0 + index, data);
}
riscv_insn_t riscv013_read_debug_buffer(struct target *target, int index)
{
- if (index > riscv013_progbuf_size(target))
+ if (index >= riscv013_progbuf_size(target))
return dmi_read(target, DMI_DATA0 + index - riscv013_progbuf_size(target));
return dmi_read(target, DMI_PROGBUF0 + index);
}