mirror of https://github.com/x64dbg/zydis
Various bugfixes
- Fixed decoding of XOP/VEX instructions with 256-bit vector length - Fixed decoding of instructions with hardcoded displacement values (e.g. MOFFS) - Fixed decoding of instructions that make use of the "ANY" mandatory-prefix filter
This commit is contained in:
parent
1d023c2997
commit
6794495f63
|
@ -268,6 +268,7 @@ static ZydisStatus ZydisDecodeXOP(ZydisDecoderContext* context, ZydisInstruction
|
||||||
context->cache.X = 0x01 & ~info->details.xop.X;
|
context->cache.X = 0x01 & ~info->details.xop.X;
|
||||||
context->cache.B = 0x01 & ~info->details.xop.B;
|
context->cache.B = 0x01 & ~info->details.xop.B;
|
||||||
context->cache.L = info->details.xop.L;
|
context->cache.L = info->details.xop.L;
|
||||||
|
context->cache.LL = info->details.xop.L;
|
||||||
context->cache.v_vvvv = (0x0F & ~info->details.xop.vvvv);
|
context->cache.v_vvvv = (0x0F & ~info->details.xop.vvvv);
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
|
@ -334,6 +335,7 @@ static ZydisStatus ZydisDecodeVEX(ZydisDecoderContext* context, ZydisInstruction
|
||||||
context->cache.X = 0x01 & ~info->details.vex.X;
|
context->cache.X = 0x01 & ~info->details.vex.X;
|
||||||
context->cache.B = 0x01 & ~info->details.vex.B;
|
context->cache.B = 0x01 & ~info->details.vex.B;
|
||||||
context->cache.L = info->details.vex.L;
|
context->cache.L = info->details.vex.L;
|
||||||
|
context->cache.LL = info->details.vex.L;
|
||||||
context->cache.v_vvvv = (0x0F & ~info->details.vex.vvvv);
|
context->cache.v_vvvv = (0x0F & ~info->details.vex.vvvv);
|
||||||
|
|
||||||
return ZYDIS_STATUS_SUCCESS;
|
return ZYDIS_STATUS_SUCCESS;
|
||||||
|
@ -874,7 +876,7 @@ static ZydisStatus ZydisDecodeOptionalInstructionParts(ZydisDecoderContext* cont
|
||||||
if (optionalParts->flags & ZYDIS_INSTRPART_FLAG_HAS_DISP)
|
if (optionalParts->flags & ZYDIS_INSTRPART_FLAG_HAS_DISP)
|
||||||
{
|
{
|
||||||
ZYDIS_CHECK(ZydisReadDisplacement(
|
ZYDIS_CHECK(ZydisReadDisplacement(
|
||||||
context, info, optionalParts->disp.size[context->eoszIndex]));
|
context, info, optionalParts->disp.size[context->easzIndex]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionalParts->flags & ZYDIS_INSTRPART_FLAG_HAS_IMM0)
|
if (optionalParts->flags & ZYDIS_INSTRPART_FLAG_HAS_IMM0)
|
||||||
|
@ -2940,6 +2942,7 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context, ZydisIns
|
||||||
|
|
||||||
// Iterate through the instruction table
|
// Iterate through the instruction table
|
||||||
const ZydisInstructionTreeNode* node = ZydisInstructionTreeGetRootNode();
|
const ZydisInstructionTreeNode* node = ZydisInstructionTreeGetRootNode();
|
||||||
|
const ZydisInstructionTreeNode* temp = NULL;
|
||||||
ZydisInstructionTreeNodeType nodeType;
|
ZydisInstructionTreeNodeType nodeType;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -2949,6 +2952,17 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context, ZydisIns
|
||||||
switch (nodeType)
|
switch (nodeType)
|
||||||
{
|
{
|
||||||
case ZYDIS_NODETYPE_INVALID:
|
case ZYDIS_NODETYPE_INVALID:
|
||||||
|
if (temp)
|
||||||
|
{
|
||||||
|
node = temp;
|
||||||
|
temp = NULL;
|
||||||
|
nodeType = ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX;
|
||||||
|
if (context->mandatoryCandidate == 0x66)
|
||||||
|
{
|
||||||
|
info->attributes |= ZYDIS_ATTRIB_HAS_OPERANDSIZE;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
return ZYDIS_STATUS_DECODING_ERROR;
|
return ZYDIS_STATUS_DECODING_ERROR;
|
||||||
case ZYDIS_NODETYPE_FILTER_XOP:
|
case ZYDIS_NODETYPE_FILTER_XOP:
|
||||||
status = ZydisNodeHandlerXOP(info, &index);
|
status = ZydisNodeHandlerXOP(info, &index);
|
||||||
|
@ -2982,6 +2996,7 @@ static ZydisStatus ZydisDecodeInstruction(ZydisDecoderContext* context, ZydisIns
|
||||||
break;
|
break;
|
||||||
case ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX:
|
case ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX:
|
||||||
status = ZydisNodeHandlerMandatoryPrefix(context, info, &index);
|
status = ZydisNodeHandlerMandatoryPrefix(context, info, &index);
|
||||||
|
temp = ZydisInstructionTreeGetChildNode(node, 0);
|
||||||
// TODO: Return to this point, if index == 0 contains a value and the previous path
|
// TODO: Return to this point, if index == 0 contains a value and the previous path
|
||||||
// TODO: was not successfull
|
// TODO: was not successfull
|
||||||
// TODO: Restore consumed prefix
|
// TODO: Restore consumed prefix
|
||||||
|
|
Loading…
Reference in New Issue