Skip to content

Commit

Permalink
Updated invalid instruction detection code for SIMD scalar three-same
Browse files Browse the repository at this point in the history
and SIMD scalar two-register miscellaneous instruction categories.
  • Loading branch information
ssunny7 committed Dec 19, 2016
1 parent fea0fdb commit d62aa74
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions instructionAPI/src/InstructionDecoder-aarch64.C
Expand Up @@ -480,13 +480,24 @@ namespace Dyninst {
int S = opcode & 0x1;

if(opcode != 0x1 && opcode != 0x5 && ((opcode >> 3) & 0x3) != 0x3) {
if(((opcode >> 2) & 0x2) == 0x2 && S == 0 && size != 0x3)
isValid = false;
else if(opcode == 0x16 && (size == 0 || size == 0x3))
isValid = false;
else if(opcode != 0x16 && size != 0x3)
isValid = false;
if(opcode == 0x16) {
if(size == 0 || size == 0x3)
isValid = false;
} else {
if(((opcode >> 2) & 0x2) == 0x2) {
if(S == 0 && size != 0x3)
isValid = false;
} else if(size != 0x3) {
isValid = false;
}
}
}
} else if(IS_INSN_SCALAR_2REG_MISC(insn)) {
int opcode = field<12, 16>(insn);

if(((opcode == 0x14 || opcode == 0x12) && size == 0x3) ||
(opcode >= 0x8 && opcode <= 0xB && size != 0x3))
isValid = false;
}
}

Expand Down Expand Up @@ -644,12 +655,15 @@ namespace Dyninst {
}
}
else {
switch (_szField) {
entryID op = insn_in_progress->getOperation().operationID;

switch (_szField) {
case 0x0:
reg = aarch64::s0;
if(op == aarch64_op_fcvtxn_advsimd)
isValid = false;
break;
case 0x1: {
entryID op = insn_in_progress->getOperation().operationID;
reg = (op == aarch64_op_fcvtxn_advsimd) ? aarch64::s0 : aarch64::d0;
}
break;
Expand Down

0 comments on commit d62aa74

Please sign in to comment.