summaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-01-06 16:42:23 +0000
committerAndrew Burgess <aburgess@redhat.com>2023-02-13 12:05:32 +0000
commit77be7257442b1ca19deba8ec0e424f0faf53321f (patch)
tree4d70af2c5d233796f906dfdd10a4d8435b26f785 /opcodes
parent97c195191578e9a68bfbb810eea373f5f3efcb7d (diff)
downloadbinutils-gdb-77be7257442b1ca19deba8ec0e424f0faf53321f.tar.gz
opcodes/mips: disassemble unknown micromips instructions as two shorts
Before commit: commit 2438b771ee07be19d5b01ea55e077dd8b7cef445 Date: Wed Nov 2 15:53:43 2022 +0000 opcodes/mips: use .word/.short for undefined instructions unknown 32-bit microMIPS instructions were disassembled as a raw 32-bit number with no '.word' directive. The above commit changed this and added a '.word' directive before the 32-bit number. It was pointed out on the mailing list, that for microMIPS it would be better to display such 32-bit instructions using a '.short' directive followed by two 16-bit values. This commit updates the mips disassembler to do this, and adds a new test that validates this output.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/mips-dis.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index 6a513cd8946..859d4e3806f 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -2600,12 +2600,15 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info)
}
}
- if (length == 2)
- infprintf (is, dis_style_assembler_directive, ".short");
- else
- infprintf (is, dis_style_assembler_directive, ".word");
+ infprintf (is, dis_style_assembler_directive, ".short");
infprintf (is, dis_style_text, "\t");
- infprintf (is, dis_style_immediate, "0x%x", insn);
+ if (length != 2)
+ {
+ infprintf (is, dis_style_immediate, "0x%x", (insn >> 16) & 0xffff);
+ infprintf (is, dis_style_text, ", ");
+ }
+ infprintf (is, dis_style_immediate, "0x%x", (insn & 0xffff));
+
info->insn_type = dis_noninsn;
return length;