Skip to content

Commit

Permalink
APX progress
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Sep 28, 2023
1 parent 47d51b6 commit 0f21bbf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@ static void ZydisSetOperandSizeAndElementInfo(const ZydisDecoderContext* context
#ifndef ZYDIS_DISABLE_AVX512
if (definition->size[context->eosz_index])
{
// TODO: fixme
// Operand size is hardcoded
operand->size = definition->size[context->eosz_index] * 8;
} else
Expand Down Expand Up @@ -3606,6 +3607,7 @@ static ZyanStatus ZydisNodeHandlerXOP(const ZydisDecodedInstruction* instruction
switch (instruction->encoding)
{
case ZYDIS_INSTRUCTION_ENCODING_LEGACY:
case ZYDIS_INSTRUCTION_ENCODING_REX2:
*index = 0;
break;
case ZYDIS_INSTRUCTION_ENCODING_XOP:
Expand Down Expand Up @@ -3817,6 +3819,12 @@ static ZyanStatus ZydisNodeHandlerOpcode(ZydisDecoderState* state,
}
case 0x8F:
{
if (instruction->attributes & ZYDIS_ATTRIB_HAS_REX2)
{
// 0x8F is just a normal opcode in this case
break;
}

ZyanU8 next_input;
ZYAN_CHECK(ZydisInputPeek(state, instruction, &next_input));
if ((next_input & 0x1F) >= 8)
Expand Down Expand Up @@ -3851,7 +3859,11 @@ static ZyanStatus ZydisNodeHandlerOpcode(ZydisDecoderState* state,
}
case 0xD5:
{
// TODO: Check if REX2 is already present
if (instruction->attributes & ZYDIS_ATTRIB_HAS_REX2)
{
return ZYDIS_STATUS_DECODING_ERROR;
}

if (state->decoder->machine_mode == ZYDIS_MACHINE_MODE_LONG_64)
{
ZyanU8 rex2;
Expand Down

0 comments on commit 0f21bbf

Please sign in to comment.