mirror of https://github.com/x64dbg/zydis
Improved decoding of PTR and AGEN operands
This commit is contained in:
parent
6794495f63
commit
58b15163f2
|
@ -304,6 +304,10 @@ typedef struct ZydisOperandInfo_
|
||||||
*/
|
*/
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @brief Signals, if the memory operand is only used for address generation.
|
||||||
|
*/
|
||||||
|
ZydisBool isAddressGenOnly;
|
||||||
/**
|
/**
|
||||||
* @brief The segment register.
|
* @brief The segment register.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -983,6 +983,11 @@ static void ZydisSetOperandSizeAndElementInfo(ZydisDecoderContext* context,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZYDIS_OPERAND_TYPE_POINTER:
|
case ZYDIS_OPERAND_TYPE_POINTER:
|
||||||
|
ZYDIS_ASSERT((info->details.imm[0].dataSize == 16) ||
|
||||||
|
(info->details.imm[0].dataSize == 32));
|
||||||
|
ZYDIS_ASSERT(info->details.imm[1].dataSize == 16);
|
||||||
|
operand->size = info->details.imm[0].dataSize + info->details.imm[1].dataSize;
|
||||||
|
break;
|
||||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||||
operand->size = definition->size[context->eoszIndex] * 8;
|
operand->size = definition->size[context->eoszIndex] * 8;
|
||||||
ZYDIS_ASSERT(operand->size);
|
ZYDIS_ASSERT(operand->size);
|
||||||
|
@ -1617,13 +1622,18 @@ static ZydisStatus ZydisDecodeOperands(ZydisDecoderContext* context, ZydisInstru
|
||||||
ZYDIS_CHECK(ZydisDecodeOperandMemory(context, info, &info->operands[i]));
|
ZYDIS_CHECK(ZydisDecodeOperandMemory(context, info, &info->operands[i]));
|
||||||
break;
|
break;
|
||||||
case ZYDIS_SEMANTIC_OPTYPE_PTR:
|
case ZYDIS_SEMANTIC_OPTYPE_PTR:
|
||||||
info->operands[i].type = ZYDIS_OPERAND_TYPE_MEMORY;
|
ZYDIS_ASSERT((info->details.imm[0].dataSize == 16) ||
|
||||||
info->operands[i].mem.disp.hasDisplacement = ZYDIS_TRUE;
|
(info->details.imm[0].dataSize == 32));
|
||||||
info->operands[i].mem.disp.value.sqword = info->details.disp.value.sqword;
|
ZYDIS_ASSERT(info->details.imm[1].dataSize == 16);
|
||||||
break; // TODO: implement
|
info->operands[i].type = ZYDIS_OPERAND_TYPE_POINTER;
|
||||||
|
info->operands[i].ptr.offset = info->details.imm[0].value.sdword;
|
||||||
|
info->operands[i].ptr.segment = info->details.imm[1].value.uword;
|
||||||
|
break;
|
||||||
case ZYDIS_SEMANTIC_OPTYPE_AGEN:
|
case ZYDIS_SEMANTIC_OPTYPE_AGEN:
|
||||||
|
info->operands[i].action = ZYDIS_OPERAND_ACTION_INVALID;
|
||||||
|
info->operands[i].mem.isAddressGenOnly = ZYDIS_TRUE;
|
||||||
ZYDIS_CHECK(ZydisDecodeOperandMemory(context, info, &info->operands[i]));
|
ZYDIS_CHECK(ZydisDecodeOperandMemory(context, info, &info->operands[i]));
|
||||||
break; // TODO: implement
|
break;
|
||||||
case ZYDIS_SEMANTIC_OPTYPE_MOFFS:
|
case ZYDIS_SEMANTIC_OPTYPE_MOFFS:
|
||||||
ZYDIS_ASSERT(info->details.disp.dataSize);
|
ZYDIS_ASSERT(info->details.disp.dataSize);
|
||||||
info->operands[i].type = ZYDIS_OPERAND_TYPE_MEMORY;
|
info->operands[i].type = ZYDIS_OPERAND_TYPE_MEMORY;
|
||||||
|
|
Loading…
Reference in New Issue