aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog6
-rw-r--r--opcodes/riscv-dis.c24
2 files changed, 29 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index ca3206d..a32af60 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2021-09-20 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * riscv-dis.c (riscv_disassemble_insn): Print a .%dbyte opcode
+ before an unknown instruction, '%d' is replaced with the
+ instruction length.
+
2021-09-02 Nick Clifton <nickc@redhat.com>
PR 28292
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 57198c7..2e28ba7 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -570,7 +570,29 @@ riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info)
/* We did not find a match, so just print the instruction bits. */
info->insn_type = dis_noninsn;
- (*info->fprintf_func) (info->stream, "0x%llx", (unsigned long long)word);
+ switch (insnlen)
+ {
+ case 2:
+ case 4:
+ case 8:
+ (*info->fprintf_func) (info->stream, ".%dbyte\t0x%llx",
+ insnlen, (unsigned long long) word);
+ break;
+ default:
+ {
+ int i;
+ (*info->fprintf_func) (info->stream, ".byte\t");
+ for (i = 0; i < insnlen; ++i)
+ {
+ if (i > 0)
+ (*info->fprintf_func) (info->stream, ", ");
+ (*info->fprintf_func) (info->stream, "0x%02x",
+ (unsigned int) (word & 0xff));
+ word >>= 8;
+ }
+ }
+ break;
+ }
return insnlen;
}