externals: Update zydis to 4.0.0

Merge commit '6fa8d51479'
This commit is contained in:
Alexandre Bouvier 2022-11-20 21:52:58 +01:00
commit cbeed6396f
394 changed files with 61415 additions and 39455 deletions

View file

@ -40,109 +40,6 @@
extern "C" {
#endif
/* ============================================================================================== */
/* Macros */
/* ============================================================================================== */
/* ---------------------------------------------------------------------------------------------- */
/* Constants */
/* ---------------------------------------------------------------------------------------------- */
#define ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT 9
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
/* Enums and types */
/* ============================================================================================== */
/**
* Defines the `ZydisInstructionSegment` struct.
*/
typedef enum ZydisInstructionSegment_
{
ZYDIS_INSTR_SEGMENT_NONE,
/**
* The legacy prefixes (including ignored `REX` prefixes).
*/
ZYDIS_INSTR_SEGMENT_PREFIXES,
/**
* The effective `REX` prefix byte.
*/
ZYDIS_INSTR_SEGMENT_REX,
/**
* The `XOP` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_XOP,
/**
* The `VEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_VEX,
/**
* The `EVEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_EVEX,
/**
* The `MVEX` prefix bytes.
*/
ZYDIS_INSTR_SEGMENT_MVEX,
/**
* The opcode bytes.
*/
ZYDIS_INSTR_SEGMENT_OPCODE,
/**
* The `ModRM` byte.
*/
ZYDIS_INSTR_SEGMENT_MODRM,
/**
* The `SIB` byte.
*/
ZYDIS_INSTR_SEGMENT_SIB,
/**
* The displacement bytes.
*/
ZYDIS_INSTR_SEGMENT_DISPLACEMENT,
/**
* The immediate bytes.
*/
ZYDIS_INSTR_SEGMENT_IMMEDIATE,
/**
* Maximum value of this enum.
*/
ZYDIS_INSTR_SEGMENT_MAX_VALUE = ZYDIS_INSTR_SEGMENT_IMMEDIATE,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_INSTR_SEGMENT_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_INSTR_SEGMENT_MAX_VALUE)
} ZydisInstructionSegment;
/**
* Defines the `ZydisInstructionSegments` struct.
*/
typedef struct ZydisInstructionSegments_
{
/**
* The number of logical instruction segments.
*/
ZyanU8 count;
struct
{
/**
* The type of the segment.
*/
ZydisInstructionSegment type;
/**
* The offset of the segment relative to the start of the instruction (in bytes).
*/
ZyanU8 offset;
/**
* The size of the segment, in bytes.
*/
ZyanU8 size;
} segments[ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT];
} ZydisInstructionSegments;
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
@ -199,67 +96,6 @@ ZYDIS_EXPORT ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction
const ZydisDecodedOperand* operand, ZyanU64 runtime_address,
const ZydisRegisterContext* register_context, ZyanU64* result_address);
/* ---------------------------------------------------------------------------------------------- */
/* Accessed CPU flags */
/* ---------------------------------------------------------------------------------------------- */
/**
* Returns a mask of accessed CPU-flags matching the given `action`.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param action The CPU-flag action.
* @param flags Receives the flag mask.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
ZydisCPUFlagAction action, ZydisCPUFlags* flags);
/**
* Returns a mask of accessed CPU-flags that are read (tested) by the current instruction.
*
* DEPRECATED. This function will be removed in the next major release. Please refer to the
* `cpu_flags_read` or `fpu_flags_read` fields of the `ZydisDecodedInstruction` instead.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param flags Receives the flag mask.
*
* @return A zyan status code.
*/
ZYDIS_DEPRECATED_EXPORT ZyanStatus ZydisGetAccessedFlagsRead(
const ZydisDecodedInstruction* instruction, ZydisCPUFlags* flags);
/**
* Returns a mask of accessed CPU-flags that are written (modified, undefined) by the current
* instruction.
*
* DEPRECATED. This function will be removed in the next major release. Please refer to the
* `cpu_flags_written` or `fpu_flags_written` fields of the `ZydisDecodedInstruction` instead.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param flags Receives the flag mask.
*
* @return A zyan status code.
*/
ZYDIS_DEPRECATED_EXPORT ZyanStatus ZydisGetAccessedFlagsWritten(
const ZydisDecodedInstruction* instruction, ZydisCPUFlags* flags);
/* ---------------------------------------------------------------------------------------------- */
/* Instruction segments */
/* ---------------------------------------------------------------------------------------------- */
/**
* Returns offsets and sizes of all logical instruction segments (e.g. `OPCODE`,
* `MODRM`, ...).
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param segments Receives the instruction segments information.
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instruction,
ZydisInstructionSegments* segments);
/* ---------------------------------------------------------------------------------------------- */
/**