diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-04-06 20:49:02 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-04-06 20:49:02 +0000 |
commit | 4d81c9a6ba076e86671eebb9a0c533a45f357d2d (patch) | |
tree | 9a6a0128fa1544b2e482f62c22f9be9e0f9662e3 /lib | |
parent | a040d47c74341327997a50e88bb8ad4ceda6989f (diff) | |
download | external_llvm-4d81c9a6ba076e86671eebb9a0c533a45f357d2d.zip external_llvm-4d81c9a6ba076e86671eebb9a0c533a45f357d2d.tar.gz external_llvm-4d81c9a6ba076e86671eebb9a0c533a45f357d2d.tar.bz2 |
A8.6.92 MCR (Encoding A1): if coproc == '101x' then SEE "Advanced SIMD and VFP"
Since these "Advanced SIMD and VFP" instructions have more specfic encoding bits
specified, if coproc == 10 or 11, we should reject the insn as invalid.
rdar://problem/9239922
rdar://problem/9239596
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp b/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp index 5ac0819..8d4f8d8 100644 --- a/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp +++ b/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp @@ -686,8 +686,21 @@ static bool DisassembleCoprocessor(MCInst &MI, unsigned Opcode, uint32_t insn, assert(NumOps >= 4 && "Num of operands >= 4 for coprocessor instr"); unsigned &OpIdx = NumOpsAdded; + // A8.6.92 + // if coproc == '101x' then SEE "Advanced SIMD and VFP" + // But since the special instructions have more explicit encoding bits + // specified, if coproc == 10 or 11, we should reject it as invalid. + unsigned coproc = GetCoprocessor(insn); + if ((Opcode == ARM::MCR || Opcode == ARM::MCRR || + Opcode == ARM::MRC || Opcode == ARM::MRRC) && + (coproc == 10 || coproc == 11)) { + DEBUG(errs() << "Encoding error: coproc == 10 or 11 for MCR[R]/MR[R]C\n"); + return false; + } + bool OneCopOpc = (Opcode == ARM::MCRR || Opcode == ARM::MCRR2 || Opcode == ARM::MRRC || Opcode == ARM::MRRC2); + // CDP/CDP2 has no GPR operand; the opc1 operand is also wider (Inst{23-20}). bool NoGPR = (Opcode == ARM::CDP || Opcode == ARM::CDP2); bool LdStCop = LdStCopOpcode(Opcode); @@ -700,7 +713,7 @@ static bool DisassembleCoprocessor(MCInst &MI, unsigned Opcode, uint32_t insn, decodeRd(insn)))); ++OpIdx; } - MI.addOperand(MCOperand::CreateImm(GetCoprocessor(insn))); + MI.addOperand(MCOperand::CreateImm(coproc)); ++OpIdx; if (LdStCop) { |