Fix for incorrect operand size in 64bit CALL / JMP when x66 prefix in use (#777)

This commit is contained in:
el2ro 2017-04-15 05:34:50 +03:00 committed by Nguyen Anh Quynh
parent 468b4b0b54
commit 8084cd96d9
1 changed files with 10 additions and 0 deletions

View File

@ -1251,6 +1251,15 @@ static int getID(struct InternalInstruction *insn)
if (getIDWithAttrMask(&instructionID, insn, attrMask)) if (getIDWithAttrMask(&instructionID, insn, attrMask))
return -1; return -1;
/* Fixing CALL and JMP instruction when in 64bit mode and x66 prefix is used */
if (insn->mode == MODE_64BIT && insn->isPrefix66 &&
(insn->opcode == 0xE8 || insn->opcode == 0xE9))
{
attrMask ^= ATTR_OPSIZE;
if (getIDWithAttrMask(&instructionID, insn, attrMask))
return -1;
}
/* /*
* JCXZ/JECXZ need special handling for 16-bit mode because the meaning * JCXZ/JECXZ need special handling for 16-bit mode because the meaning
* of the AdSize prefix is inverted w.r.t. 32-bit mode. * of the AdSize prefix is inverted w.r.t. 32-bit mode.
@ -2377,3 +2386,4 @@ int decodeInstruction(struct InternalInstruction *insn,
} }
#endif #endif