aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/opcode/riscv.h2
-rw-r--r--opcodes/riscv-dis.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/include/opcode/riscv.h b/include/opcode/riscv.h
index 9cc0016..f173a2e 100644
--- a/include/opcode/riscv.h
+++ b/include/opcode/riscv.h
@@ -40,6 +40,8 @@ static inline unsigned int riscv_insn_length (insn_t insn)
/* 80- ... 176-bit instructions. */
if ((insn & 0x7f) == 0x7f && (insn & 0x7000) != 0x7000)
return 10 + ((insn >> 11) & 0xe);
+ /* Maximum value returned by this function. */
+#define RISCV_MAX_INSN_LEN 22
/* Longer instructions not supported at the moment. */
return 2;
}
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 031c193..2c0aed1 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -1000,7 +1000,7 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED,
int
print_insn_riscv (bfd_vma memaddr, struct disassemble_info *info)
{
- bfd_byte packet[8];
+ bfd_byte packet[RISCV_MAX_INSN_LEN];
insn_t insn = 0;
bfd_vma dump_size;
int status;