Skip to content

Commit

Permalink
Encoder: APX support
Browse files Browse the repository at this point in the history
  • Loading branch information
mappzor committed Nov 5, 2024
1 parent 544de93 commit 0d322f9
Show file tree
Hide file tree
Showing 72 changed files with 13,586 additions and 10,355 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
*.c eof=lf encoding=utf-8
*.py eof=lf encoding=utf-8
*.md eof=lf encoding=utf-8

*.json eof=lf encoding=utf-8
9 changes: 9 additions & 0 deletions include/Zydis/DecoderTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,15 @@ typedef ZyanU8 ZydisDefaultFlagsValue;
*/
#define ZYDIS_DFV_OF (1u << 3)

/**
* All default flags clear.
*/
#define ZYDIS_DFV_NONE 0
/**
* All default flags set.
*/
#define ZYDIS_DFV_ALL (ZYDIS_DFV_CF | ZYDIS_DFV_ZF | ZYDIS_DFV_SF | ZYDIS_DFV_OF)

/**
* @}
*/
Expand Down
8 changes: 8 additions & 0 deletions include/Zydis/Encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ typedef struct ZydisEncoderRequest_
* Specify `ZYAN_TRUE` for instructions with forced zeroing mask.
*/
ZyanBool zeroing_mask;
/**
* Supress status flags update for certain `APX` instructions.
*/
ZyanBool no_flags;
/**
* The APX default flags value (DFV).
*/
ZydisDefaultFlagsValue default_flags;
} evex;
/**
* Extended info for `MVEX` instructions.
Expand Down
27 changes: 27 additions & 0 deletions include/Zydis/Internal/EncoderData.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <Zycore/Defines.h>
#include <Zydis/Mnemonic.h>
#include <Zydis/SharedTypes.h>
#include <Zydis/DecoderTypes.h>

/**
* Used in encoder's table to represent standard ISA sizes in form of bit flags.
Expand Down Expand Up @@ -179,6 +180,22 @@ typedef struct ZydisEncodableInstruction_
* True if `REX.W` is required for this definition.
*/
ZyanU8 rex_w ZYAN_BITFIELD(1);
/**
* True if `REX2` prefix is required for this definition.
*/
ZyanU8 rex2 ZYAN_BITFIELD(1);
/**
* True if `EEVEX.ND` is required for this definition.
*/
ZyanU8 evex_nd ZYAN_BITFIELD(1);
/**
* True if `EEVEX.NF` is required for this definition.
*/
ZyanU8 evex_nf ZYAN_BITFIELD(1);
/**
* True if `APX` definition scales memory operand with operand size attribute.
*/
ZyanU8 apx_osz ZYAN_BITFIELD(1);
/**
* The vector length.
*/
Expand Down Expand Up @@ -250,4 +267,14 @@ ZyanU8 ZydisGetEncodableInstructions(ZydisMnemonic mnemonic,
*/
const ZydisEncoderRelInfo *ZydisGetRelInfo(ZydisMnemonic mnemonic);

/**
* Fetches information about APX conditional instructions.
*
* @param mnemonic Instruction mnemonic.
* @param scc Receives `scc` if applicable.
*
* @return True if mnemonic represents an APX conditional instruction, false otherwise.
*/
ZyanBool ZydisGetCcInfo(ZydisMnemonic mnemonic, ZydisSourceConditionCode *scc);

#endif /* ZYDIS_INTERNAL_ENCODERDATA_H */
Loading

0 comments on commit 0d322f9

Please sign in to comment.