32 #ifndef ZYDIS_SHAREDTYPES_H
33 #define ZYDIS_SHAREDTYPES_H
35 #include <Zycore/Types.h>
49 #define ZYDIS_MAX_INSTRUCTION_LENGTH 15
50 #define ZYDIS_MAX_OPERAND_COUNT 10
51 #define ZYDIS_MAX_OPERAND_COUNT_VISIBLE 5
506 #define ZYDIS_ATTRIB_HAS_MODRM (1ULL << 0)
510 #define ZYDIS_ATTRIB_HAS_SIB (1ULL << 1)
514 #define ZYDIS_ATTRIB_HAS_REX (1ULL << 2)
518 #define ZYDIS_ATTRIB_HAS_XOP (1ULL << 3)
522 #define ZYDIS_ATTRIB_HAS_VEX (1ULL << 4)
526 #define ZYDIS_ATTRIB_HAS_EVEX (1ULL << 5)
530 #define ZYDIS_ATTRIB_HAS_MVEX (1ULL << 6)
534 #define ZYDIS_ATTRIB_IS_RELATIVE (1ULL << 7)
540 #define ZYDIS_ATTRIB_IS_PRIVILEGED (1ULL << 8)
544 #define ZYDIS_ATTRIB_CPUFLAG_ACCESS (1ULL << 9)
548 #define ZYDIS_ATTRIB_CPU_STATE_CR (1ULL << 10)
552 #define ZYDIS_ATTRIB_CPU_STATE_CW (1ULL << 11)
556 #define ZYDIS_ATTRIB_FPU_STATE_CR (1ULL << 12)
560 #define ZYDIS_ATTRIB_FPU_STATE_CW (1ULL << 13)
564 #define ZYDIS_ATTRIB_XMM_STATE_CR (1ULL << 14)
568 #define ZYDIS_ATTRIB_XMM_STATE_CW (1ULL << 15)
572 #define ZYDIS_ATTRIB_ACCEPTS_LOCK (1ULL << 16)
576 #define ZYDIS_ATTRIB_ACCEPTS_REP (1ULL << 17)
580 #define ZYDIS_ATTRIB_ACCEPTS_REPE (1ULL << 18)
584 #define ZYDIS_ATTRIB_ACCEPTS_REPZ ZYDIS_ATTRIB_ACCEPTS_REPE
588 #define ZYDIS_ATTRIB_ACCEPTS_REPNE (1ULL << 19)
592 #define ZYDIS_ATTRIB_ACCEPTS_REPNZ ZYDIS_ATTRIB_ACCEPTS_REPNE
596 #define ZYDIS_ATTRIB_ACCEPTS_BND (1ULL << 20)
600 #define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE (1ULL << 21)
604 #define ZYDIS_ATTRIB_ACCEPTS_XRELEASE (1ULL << 22)
609 #define ZYDIS_ATTRIB_ACCEPTS_HLE_WITHOUT_LOCK (1ULL << 23)
613 #define ZYDIS_ATTRIB_ACCEPTS_BRANCH_HINTS (1ULL << 24)
617 #define ZYDIS_ATTRIB_ACCEPTS_NOTRACK (1ULL << 25)
622 #define ZYDIS_ATTRIB_ACCEPTS_SEGMENT (1ULL << 26)
626 #define ZYDIS_ATTRIB_HAS_LOCK (1ULL << 27)
630 #define ZYDIS_ATTRIB_HAS_REP (1ULL << 28)
634 #define ZYDIS_ATTRIB_HAS_REPE (1ULL << 29)
638 #define ZYDIS_ATTRIB_HAS_REPZ ZYDIS_ATTRIB_HAS_REPE
642 #define ZYDIS_ATTRIB_HAS_REPNE (1ULL << 30)
646 #define ZYDIS_ATTRIB_HAS_REPNZ ZYDIS_ATTRIB_HAS_REPNE
650 #define ZYDIS_ATTRIB_HAS_BND (1ULL << 31)
654 #define ZYDIS_ATTRIB_HAS_XACQUIRE (1ULL << 32)
658 #define ZYDIS_ATTRIB_HAS_XRELEASE (1ULL << 33)
662 #define ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN (1ULL << 34)
666 #define ZYDIS_ATTRIB_HAS_BRANCH_TAKEN (1ULL << 35)
670 #define ZYDIS_ATTRIB_HAS_NOTRACK (1ULL << 36)
674 #define ZYDIS_ATTRIB_HAS_SEGMENT_CS (1ULL << 37)
678 #define ZYDIS_ATTRIB_HAS_SEGMENT_SS (1ULL << 38)
682 #define ZYDIS_ATTRIB_HAS_SEGMENT_DS (1ULL << 39)
686 #define ZYDIS_ATTRIB_HAS_SEGMENT_ES (1ULL << 40)
690 #define ZYDIS_ATTRIB_HAS_SEGMENT_FS (1ULL << 41)
694 #define ZYDIS_ATTRIB_HAS_SEGMENT_GS (1ULL << 42)
698 #define ZYDIS_ATTRIB_HAS_SEGMENT (ZYDIS_ATTRIB_HAS_SEGMENT_CS | \
699 ZYDIS_ATTRIB_HAS_SEGMENT_SS | \
700 ZYDIS_ATTRIB_HAS_SEGMENT_DS | \
701 ZYDIS_ATTRIB_HAS_SEGMENT_ES | \
702 ZYDIS_ATTRIB_HAS_SEGMENT_FS | \
703 ZYDIS_ATTRIB_HAS_SEGMENT_GS)
707 #define ZYDIS_ATTRIB_HAS_OPERANDSIZE (1ULL << 43)
711 #define ZYDIS_ATTRIB_HAS_ADDRESSSIZE (1ULL << 44)
717 #define ZYDIS_ATTRIB_HAS_EVEX_B (1ULL << 45)
ZydisElementType_
Defines the ZydisElementType enum.
Definition: SharedTypes.h:134
@ ZYDIS_ELEMENT_TYPE_LONGBCD
Binary coded decimal value.
Definition: SharedTypes.h:171
@ ZYDIS_ELEMENT_TYPE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:184
@ ZYDIS_ELEMENT_TYPE_UINT
Unsigned integer value.
Definition: SharedTypes.h:143
@ ZYDIS_ELEMENT_TYPE_FLOAT64
64-bit floating point value (double).
Definition: SharedTypes.h:159
@ ZYDIS_ELEMENT_TYPE_INT
Signed integer value.
Definition: SharedTypes.h:147
@ ZYDIS_ELEMENT_TYPE_INVALID
Definition: SharedTypes.h:135
@ ZYDIS_ELEMENT_TYPE_STRUCT
A struct type.
Definition: SharedTypes.h:139
@ ZYDIS_ELEMENT_TYPE_FLOAT16
16-bit floating point value (half).
Definition: SharedTypes.h:151
@ ZYDIS_ELEMENT_TYPE_BFLOAT16
16-bit brain floating point value.
Definition: SharedTypes.h:167
@ ZYDIS_ELEMENT_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:180
@ ZYDIS_ELEMENT_TYPE_FLOAT32
32-bit floating point value (single).
Definition: SharedTypes.h:155
@ ZYDIS_ELEMENT_TYPE_FLOAT80
80-bit floating point value (extended).
Definition: SharedTypes.h:163
@ ZYDIS_ELEMENT_TYPE_CC
A condition code (e.g.
Definition: SharedTypes.h:175
enum ZydisOperandEncoding_ ZydisOperandEncoding
Defines the ZydisOperandEncoding enum.
ZydisOperandVisibility_
Defines the ZydisOperandVisibility enum.
Definition: SharedTypes.h:303
@ ZYDIS_OPERAND_VISIBILITY_IMPLICIT
The operand is part of the opcode, but listed as an operand.
Definition: SharedTypes.h:312
@ ZYDIS_OPERAND_VISIBILITY_EXPLICIT
The operand is explicitly encoded in the instruction.
Definition: SharedTypes.h:308
@ ZYDIS_OPERAND_VISIBILITY_INVALID
Definition: SharedTypes.h:304
@ ZYDIS_OPERAND_VISIBILITY_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:325
@ ZYDIS_OPERAND_VISIBILITY_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:321
@ ZYDIS_OPERAND_VISIBILITY_HIDDEN
The operand is part of the opcode, and not typically listed as an operand.
Definition: SharedTypes.h:316
ZydisMachineMode_
Defines the ZydisMachineMode enum.
Definition: SharedTypes.h:67
@ ZYDIS_MACHINE_MODE_LONG_COMPAT_16
16 bit protected mode.
Definition: SharedTypes.h:79
@ ZYDIS_MACHINE_MODE_LONG_COMPAT_32
32 bit protected mode.
Definition: SharedTypes.h:75
@ ZYDIS_MACHINE_MODE_REAL_16
16 bit real mode.
Definition: SharedTypes.h:91
@ ZYDIS_MACHINE_MODE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:100
@ ZYDIS_MACHINE_MODE_LEGACY_16
16 bit protected mode.
Definition: SharedTypes.h:87
@ ZYDIS_MACHINE_MODE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:96
@ ZYDIS_MACHINE_MODE_LEGACY_32
32 bit protected mode.
Definition: SharedTypes.h:83
@ ZYDIS_MACHINE_MODE_LONG_64
64 bit mode.
Definition: SharedTypes.h:71
enum ZydisOperandAction_ ZydisOperandAction
Defines the ZydisOperandAction enum.
enum ZydisInstructionEncoding_ ZydisInstructionEncoding
Defines the ZydisInstructionEncoding enum.
enum ZydisOperandType_ ZydisOperandType
Defines the ZydisOperandType enum.
enum ZydisOperandVisibility_ ZydisOperandVisibility
Defines the ZydisOperandVisibility enum.
ZyanU8 ZydisOperandActions
Defines the ZydisOperandActions data-type.
Definition: SharedTypes.h:406
enum ZydisStackWidth_ ZydisStackWidth
Defines the ZydisStackWidth enum.
enum ZydisOpcodeMap_ ZydisOpcodeMap
Defines the ZydisOpcodeMap enum.
ZydisOperandEncoding_
Defines the ZydisOperandEncoding enum.
Definition: SharedTypes.h:248
@ ZYDIS_OPERAND_ENCODING_MODRM_RM
Definition: SharedTypes.h:251
@ ZYDIS_OPERAND_ENCODING_DISP16_32_64
Definition: SharedTypes.h:260
@ ZYDIS_OPERAND_ENCODING_DISP16
Definition: SharedTypes.h:257
@ ZYDIS_OPERAND_ENCODING_DISP64
Definition: SharedTypes.h:259
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_64
Definition: SharedTypes.h:281
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_64
Definition: SharedTypes.h:274
@ ZYDIS_OPERAND_ENCODING_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:288
@ ZYDIS_OPERAND_ENCODING_DISP16_32_32
Definition: SharedTypes.h:262
@ ZYDIS_OPERAND_ENCODING_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:292
@ ZYDIS_OPERAND_ENCODING_SIMM32
Definition: SharedTypes.h:272
@ ZYDIS_OPERAND_ENCODING_UIMM64
Definition: SharedTypes.h:266
@ ZYDIS_OPERAND_ENCODING_JIMM8
Definition: SharedTypes.h:277
@ ZYDIS_OPERAND_ENCODING_NDSNDD
Definition: SharedTypes.h:253
@ ZYDIS_OPERAND_ENCODING_DISP32_32_64
Definition: SharedTypes.h:261
@ ZYDIS_OPERAND_ENCODING_JIMM16
Definition: SharedTypes.h:278
@ ZYDIS_OPERAND_ENCODING_JIMM32_32_64
Definition: SharedTypes.h:282
@ ZYDIS_OPERAND_ENCODING_IS4
Definition: SharedTypes.h:254
@ ZYDIS_OPERAND_ENCODING_SIMM64
Definition: SharedTypes.h:273
@ ZYDIS_OPERAND_ENCODING_UIMM32
Definition: SharedTypes.h:265
@ ZYDIS_OPERAND_ENCODING_MASK
Definition: SharedTypes.h:255
@ ZYDIS_OPERAND_ENCODING_SIMM16
Definition: SharedTypes.h:271
@ ZYDIS_OPERAND_ENCODING_UIMM32_32_64
Definition: SharedTypes.h:268
@ ZYDIS_OPERAND_ENCODING_UIMM16
Definition: SharedTypes.h:264
@ ZYDIS_OPERAND_ENCODING_UIMM8
Definition: SharedTypes.h:263
@ ZYDIS_OPERAND_ENCODING_DISP32
Definition: SharedTypes.h:258
@ ZYDIS_OPERAND_ENCODING_MODRM_REG
Definition: SharedTypes.h:250
@ ZYDIS_OPERAND_ENCODING_SIMM32_32_64
Definition: SharedTypes.h:275
@ ZYDIS_OPERAND_ENCODING_JIMM64
Definition: SharedTypes.h:280
@ ZYDIS_OPERAND_ENCODING_JIMM32
Definition: SharedTypes.h:279
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_64
Definition: SharedTypes.h:267
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_32
Definition: SharedTypes.h:283
@ ZYDIS_OPERAND_ENCODING_OPCODE
Definition: SharedTypes.h:252
@ ZYDIS_OPERAND_ENCODING_DISP8
Definition: SharedTypes.h:256
@ ZYDIS_OPERAND_ENCODING_NONE
Definition: SharedTypes.h:249
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_32
Definition: SharedTypes.h:276
@ ZYDIS_OPERAND_ENCODING_SIMM8
Definition: SharedTypes.h:270
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_32
Definition: SharedTypes.h:269
ZydisInstructionEncoding_
Defines the ZydisInstructionEncoding enum.
Definition: SharedTypes.h:416
@ ZYDIS_INSTRUCTION_ENCODING_VEX
The instruction uses the VEX-encoding.
Definition: SharedTypes.h:432
@ ZYDIS_INSTRUCTION_ENCODING_3DNOW
The instruction uses the AMD 3DNow-encoding.
Definition: SharedTypes.h:424
@ ZYDIS_INSTRUCTION_ENCODING_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:449
@ ZYDIS_INSTRUCTION_ENCODING_MVEX
The instruction uses the MVEX-encoding.
Definition: SharedTypes.h:440
@ ZYDIS_INSTRUCTION_ENCODING_LEGACY
The instruction uses the legacy encoding.
Definition: SharedTypes.h:420
@ ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:445
@ ZYDIS_INSTRUCTION_ENCODING_EVEX
The instruction uses the EVEX-encoding.
Definition: SharedTypes.h:436
@ ZYDIS_INSTRUCTION_ENCODING_XOP
The instruction uses the AMD XOP-encoding.
Definition: SharedTypes.h:428
ZydisStackWidth_
Defines the ZydisStackWidth enum.
Definition: SharedTypes.h:111
@ ZYDIS_STACK_WIDTH_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:123
@ ZYDIS_STACK_WIDTH_16
Definition: SharedTypes.h:112
@ ZYDIS_STACK_WIDTH_32
Definition: SharedTypes.h:113
@ ZYDIS_STACK_WIDTH_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:119
@ ZYDIS_STACK_WIDTH_64
Definition: SharedTypes.h:114
ZYAN_STATIC_ASSERT(ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_TYPE_MAX_VALUE - ZYDIS_OPERAND_TYPE_REGISTER)==2)
ZydisOperandAction_
Defines the ZydisOperandAction enum.
Definition: SharedTypes.h:337
@ ZYDIS_OPERAND_ACTION_CONDWRITE
The operand is conditionally written by the instruction (may write).
Definition: SharedTypes.h:357
@ ZYDIS_OPERAND_ACTION_READWRITE
The operand is read (must read) and written by the instruction (must write).
Definition: SharedTypes.h:366
@ ZYDIS_OPERAND_ACTION_CONDREAD_WRITE
The operand is written (must write) and conditionally read by the instruction (may read).
Definition: SharedTypes.h:383
@ ZYDIS_OPERAND_ACTION_CONDREAD
The operand is conditionally read by the instruction.
Definition: SharedTypes.h:353
@ ZYDIS_OPERAND_ACTION_WRITE
The operand is written by the instruction (must write).
Definition: SharedTypes.h:349
@ ZYDIS_OPERAND_ACTION_MASK_READ
Mask combining all reading access flags.
Definition: SharedTypes.h:389
@ ZYDIS_OPERAND_ACTION_REQUIRED_BITS
The minimum number of bits required to represent all values of this bitset.
Definition: SharedTypes.h:400
@ ZYDIS_OPERAND_ACTION_CONDREAD_CONDWRITE
The operand is conditionally read (may read) and conditionally written by the instruction (may write)...
Definition: SharedTypes.h:371
@ ZYDIS_OPERAND_ACTION_READ
The operand is read by the instruction.
Definition: SharedTypes.h:345
@ ZYDIS_OPERAND_ACTION_READ_CONDWRITE
The operand is read (must read) and conditionally written by the instruction (may write).
Definition: SharedTypes.h:377
@ ZYDIS_OPERAND_ACTION_MASK_WRITE
Mask combining all writing access flags.
Definition: SharedTypes.h:393
ZydisOpcodeMap_
Defines the ZydisOpcodeMap enum.
Definition: SharedTypes.h:461
@ ZYDIS_OPCODE_MAP_XOP9
Definition: SharedTypes.h:472
@ ZYDIS_OPCODE_MAP_MAP7
Definition: SharedTypes.h:469
@ ZYDIS_OPCODE_MAP_0F38
Definition: SharedTypes.h:464
@ ZYDIS_OPCODE_MAP_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:482
@ ZYDIS_OPCODE_MAP_0F
Definition: SharedTypes.h:463
@ ZYDIS_OPCODE_MAP_MAP4
Definition: SharedTypes.h:466
@ ZYDIS_OPCODE_MAP_DEFAULT
Definition: SharedTypes.h:462
@ ZYDIS_OPCODE_MAP_XOP8
Definition: SharedTypes.h:471
@ ZYDIS_OPCODE_MAP_XOPA
Definition: SharedTypes.h:473
@ ZYDIS_OPCODE_MAP_MAP6
Definition: SharedTypes.h:468
@ ZYDIS_OPCODE_MAP_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:478
@ ZYDIS_OPCODE_MAP_MAP5
Definition: SharedTypes.h:467
@ ZYDIS_OPCODE_MAP_0F3A
Definition: SharedTypes.h:465
@ ZYDIS_OPCODE_MAP_0F0F
Definition: SharedTypes.h:470
enum ZydisElementType_ ZydisElementType
Defines the ZydisElementType enum.
ZyanU16 ZydisElementSize
Defines the ZydisElementSize datatype.
Definition: SharedTypes.h:194
enum ZydisMachineMode_ ZydisMachineMode
Defines the ZydisMachineMode enum.
ZydisOperandType_
Defines the ZydisOperandType enum.
Definition: SharedTypes.h:204
@ ZYDIS_OPERAND_TYPE_IMMEDIATE
The operand is an immediate operand.
Definition: SharedTypes.h:224
@ ZYDIS_OPERAND_TYPE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:233
@ ZYDIS_OPERAND_TYPE_UNUSED
The operand is not used.
Definition: SharedTypes.h:208
@ ZYDIS_OPERAND_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:229
@ ZYDIS_OPERAND_TYPE_REGISTER
The operand is a register operand.
Definition: SharedTypes.h:212
@ ZYDIS_OPERAND_TYPE_MEMORY
The operand is a memory operand.
Definition: SharedTypes.h:216
@ ZYDIS_OPERAND_TYPE_POINTER
The operand is a pointer operand with a segment:offset lvalue.
Definition: SharedTypes.h:220
ZyanU64 ZydisInstructionAttributes
Defines the ZydisInstructionAttributes data-type.
Definition: SharedTypes.h:501