Skip to content

Commit

Permalink
Fix EVEX.U filters
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Oct 30, 2024
1 parent fa5240c commit fbf7c5c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 555 deletions.
2 changes: 1 addition & 1 deletion include/Zydis/Internal/SharedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ typedef struct ZydisInstructionDefinitionEVEX_
ZyanU8 broadcast ZYAN_BITFIELD(ZYDIS_EVEX_STATIC_BROADCAST_REQUIRED_BITS);
#endif
ZyanU8 is_eevex ZYAN_BITFIELD( 1);
ZyanU8 has_apx_nf ZYAN_BITFIELD(1);
ZyanU8 has_apx_nf ZYAN_BITFIELD( 1);
ZyanU8 has_apx_zu ZYAN_BITFIELD( 1);
} ZydisInstructionDefinitionEVEX;
#endif
Expand Down
5 changes: 2 additions & 3 deletions src/Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,13 @@ static ZyanStatus ZydisDecodeEVEX(const ZydisDecoder* decoder, ZydisDecoderConte
instruction->raw.evex.mmm = (data[1] >> 0) & 0x07;

const ZyanBool is_apx = ZYDIS_DECODER_MODE_ACTIVE(decoder, ZYDIS_DECODER_MODE_APX);
if (!is_apx && (data[1] & 0x08))
if (!is_apx && (data[1] & 0x08)) // TODO: This condition might have to as well consider AVX 10.2 besides APX
{
// Invalid according to the intel documentation
return ZYDIS_STATUS_MALFORMED_EVEX;
}

if ((instruction->raw.evex.mmm == 0x00) ||
(instruction->raw.evex.mmm == 0x07))
if (instruction->raw.evex.mmm == 0x00)
{
// Invalid according to the intel documentation
return ZYDIS_STATUS_INVALID_MAP;
Expand Down
Loading

0 comments on commit fbf7c5c

Please sign in to comment.