opcodes/mips: disassemble unknown micromips instructions as two shorts

Before commit:

  commit 2438b771ee
  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.
This commit is contained in:
Andrew Burgess
2023-01-06 16:42:23 +00:00
parent 97c1951915
commit 77be725744
6 changed files with 41 additions and 5 deletions

View File

@@ -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;