[PATCH] D12881: [mips][microMIPS] Fix an issue with disassembling lwm32 instruction

Zoran Jovanovic via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 08:01:19 PDT 2015


zoran.jovanovic created this revision.
zoran.jovanovic added a reviewer: dsanders.
zoran.jovanovic added a subscriber: llvm-commits.

The microMIPS disassembler crashes on the following input:
0x21,0x3b,0x59,0x84,



http://reviews.llvm.org/D12881

Files:
  lib/Target/Mips/Disassembler/MipsDisassembler.cpp
  test/MC/Disassembler/Mips/micromips.txt
  test/MC/Disassembler/Mips/micromips_le.txt

Index: test/MC/Disassembler/Mips/micromips_le.txt
===================================================================
--- test/MC/Disassembler/Mips/micromips_le.txt
+++ test/MC/Disassembler/Mips/micromips_le.txt
@@ -241,6 +241,8 @@
 
 0x44 0x20 0x08 0x50 # CHECK: lwm32 $16, $17, 8($4)
 
+0x3b 0x21 0x84 0x59 # CHECK: lwm32 $16, $17, $18, $19, $20, $21, $22, $23, $fp, -1660($27)
+
 0x44 0x20 0x08 0xd0 # CHECK: swm32 $16, $17, 8($4)
 
 0x04 0x22 0x08 0x90 # CHECK: swp $16, 8($4)
Index: test/MC/Disassembler/Mips/micromips.txt
===================================================================
--- test/MC/Disassembler/Mips/micromips.txt
+++ test/MC/Disassembler/Mips/micromips.txt
@@ -241,6 +241,8 @@
 
 0x20 0x44 0x50 0x08 # CHECK: lwm32 $16, $17, 8($4)
 
+0x21 0x3b 0x59 0x84 # CHECK: lwm32 $16, $17, $18, $19, $20, $21, $22, $23, $fp, -1660($27)
+
 0x20 0x44 0xd0 0x08 # CHECK: swm32 $16, $17, 8($4)
 
 0x22 0x04 0x90 0x08 # CHECK: swp $16, 8($4)
Index: lib/Target/Mips/Disassembler/MipsDisassembler.cpp
===================================================================
--- lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+++ lib/Target/Mips/Disassembler/MipsDisassembler.cpp
@@ -1915,7 +1915,7 @@
                                          uint64_t Address,
                                          const void *Decoder) {
   unsigned Regs[] = {Mips::S0, Mips::S1, Mips::S2, Mips::S3, Mips::S4, Mips::S5,
-                     Mips::S6, Mips::FP};
+                     Mips::S6, Mips::S7, Mips::FP};
   unsigned RegNum;
 
   unsigned RegLst = fieldFromInstruction(Insn, 21, 5);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12881.34803.patch
Type: text/x-patch
Size: 1589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150915/32527d7c/attachment.bin>


More information about the llvm-commits mailing list