Skip to content

Commit

Permalink
Add ZYDIS_ATTRIB_HAS_EEVEX
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Oct 29, 2024
1 parent 7e0ec6f commit c105172
Show file tree
Hide file tree
Showing 5 changed files with 6,114 additions and 6,095 deletions.
3 changes: 3 additions & 0 deletions include/Zydis/Internal/SharedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,9 @@ typedef struct ZydisInstructionDefinitionEVEX_
ZyanU8 mask_override ZYAN_BITFIELD(ZYDIS_MASK_OVERRIDE_REQUIRED_BITS);
ZyanU8 broadcast ZYAN_BITFIELD(ZYDIS_EVEX_STATIC_BROADCAST_REQUIRED_BITS);
#endif
ZyanU8 is_eevex ZYAN_BITFIELD( 1);
/*ZyanU8 accepts_zu ZYAN_BITFIELD( 1);
ZyanU8 accepts_nf ZYAN_BITFIELD( 1);*/
} ZydisInstructionDefinitionEVEX;
#endif

Expand Down
4 changes: 4 additions & 0 deletions include/Zydis/SharedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,10 @@ typedef ZyanU64 ZydisInstructionAttributes;
* The instruction uses the APX source condition code.
*/
#define ZYDIS_ATTRIB_HAS_SCC (1ULL << 47)
/**
* The instruction has the `EEVEX` (extended `EVEX`) prefix.
*/
#define ZYDIS_ATTRIB_HAS_EEVEX (1ULL << 48) // TODO: rebase

// TODO: PPX Hint

Expand Down
11 changes: 11 additions & 0 deletions src/Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -5188,6 +5188,17 @@ static ZyanStatus ZydisDecodeInstruction(ZydisDecoderState* state,
ZydisGetInstructionDefinition(instruction->encoding, node->value, &definition);
}

if (instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX)
{
const ZydisInstructionDefinitionEVEX* evex_definition =
(const ZydisInstructionDefinitionEVEX*)definition;

if (evex_definition->is_eevex)
{
instruction->attributes |= ZYDIS_ATTRIB_HAS_EEVEX;
}
}

instruction->mnemonic = definition->mnemonic;

#ifndef ZYDIS_MINIMAL_MODE
Expand Down
Loading

0 comments on commit c105172

Please sign in to comment.