Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoder: APX support #533

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading