diff options
author | Owen Anderson <resistor@mac.com> | 2011-08-11 20:21:46 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2011-08-11 20:21:46 +0000 |
commit | 26d2f0ac919f6ae868fe901fd4ad64af6f92da4d (patch) | |
tree | de83d75d66ddbd00de03a252656ce9cdf46d80b8 /lib/Target/ARM/Disassembler/ARMDisassembler.cpp | |
parent | ade7d00f5afce5f79ca5c1eb1a854b777c8e0194 (diff) |
Continue to tighten decoding by performing more operand validation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
-rw-r--r-- | lib/Target/ARM/Disassembler/ARMDisassembler.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp index d5994220a0..8cfb21793e 100644 --- a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp @@ -133,6 +133,8 @@ static bool DecodeAddrMode3Offset(llvm::MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder); static bool DecodeMemBarrierOption(llvm::MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder); +static bool DecodeMSRMask(llvm::MCInst &Inst, unsigned Insn, + uint64_t Address, const void *Decoder); static bool DecodeThumbAddSpecialReg(llvm::MCInst &Inst, uint16_t Insn, @@ -759,6 +761,8 @@ static bool DecodeSORegRegOperand(llvm::MCInst &Inst, unsigned Val, static bool DecodeRegListOperand(llvm::MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder) { + // Empty register lists are not allowed. + if (CountPopulation_32(Val) == 0) return false; for (unsigned i = 0; i < 16; ++i) { if (Val & (1 << i)) { if (!DecodeGPRRegisterClass(Inst, i, Address, Decoder)) return false; @@ -2467,3 +2471,9 @@ static bool DecodeMemBarrierOption(llvm::MCInst &Inst, unsigned Val, return true; } +static bool DecodeMSRMask(llvm::MCInst &Inst, unsigned Val, + uint64_t Address, const void *Decoder) { + if (!Val) return false; + Inst.addOperand(MCOperand::CreateImm(Val)); + return true; +} |