Zydis  v3.2.0
DecoderTypes.h
Go to the documentation of this file.
1 /***************************************************************************************************
2 
3  Zyan Disassembler Library (Zydis)
4 
5  Original Author : Florian Bernd
6 
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24 
25 ***************************************************************************************************/
26 
32 #ifndef ZYDIS_INSTRUCTIONINFO_H
33 #define ZYDIS_INSTRUCTIONINFO_H
34 
35 #include <Zycore/Types.h>
36 #include <Zydis/MetaInfo.h>
37 #include <Zydis/Mnemonic.h>
38 #include <Zydis/Register.h>
39 #include <Zydis/SharedTypes.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /* ============================================================================================== */
46 /* Decoded operand */
47 /* ============================================================================================== */
48 
49 /* ---------------------------------------------------------------------------------------------- */
50 /* Operand attributes */
51 /* ---------------------------------------------------------------------------------------------- */
52 
56 typedef ZyanU8 ZydisOperandAttributes;
57 
66 #define ZYDIS_OATTRIB_IS_MULTISOURCE4 0x01 // (1 << 0)
67 
68 /* ---------------------------------------------------------------------------------------------- */
69 /* Memory type */
70 /* ---------------------------------------------------------------------------------------------- */
71 
76 {
77  ZYDIS_MEMOP_TYPE_INVALID,
92 
102 
103 /* ---------------------------------------------------------------------------------------------- */
104 /* Decoded operand */
105 /* ---------------------------------------------------------------------------------------------- */
106 
110 typedef struct ZydisDecodedOperand_
111 {
115  ZyanU8 id;
135  ZyanU16 size;
147  ZyanU16 element_count;
148  /*
149  * Additional operand attributes.
150  */
151  ZydisOperandAttributes attributes;
156  {
160  ZydisRegister value;
161  // TODO: AVX512_4VNNIW MULTISOURCE registers
162  } reg;
167  {
175  ZydisRegister segment;
179  ZydisRegister base;
183  ZydisRegister index;
187  ZyanU8 scale;
192  {
200  ZyanI64 value;
201  } disp;
202  } mem;
207  {
208  ZyanU16 segment;
209  ZyanU32 offset;
210  } ptr;
215  {
219  ZyanBool is_signed;
224  ZyanBool is_relative;
229  {
230  ZyanU64 u;
231  ZyanI64 s;
232  } value;
233  } imm;
235 
236 /* ---------------------------------------------------------------------------------------------- */
237 
238 /* ============================================================================================== */
239 /* Decoded instruction */
240 /* ============================================================================================== */
241 
242 /* ---------------------------------------------------------------------------------------------- */
243 /* Instruction attributes */
244 /* ---------------------------------------------------------------------------------------------- */
245 
250 
254 #define ZYDIS_ATTRIB_HAS_MODRM 0x0000000000000001 // (1 << 0)
258 #define ZYDIS_ATTRIB_HAS_SIB 0x0000000000000002 // (1 << 1)
262 #define ZYDIS_ATTRIB_HAS_REX 0x0000000000000004 // (1 << 2)
266 #define ZYDIS_ATTRIB_HAS_XOP 0x0000000000000008 // (1 << 3)
270 #define ZYDIS_ATTRIB_HAS_VEX 0x0000000000000010 // (1 << 4)
274 #define ZYDIS_ATTRIB_HAS_EVEX 0x0000000000000020 // (1 << 5)
278 #define ZYDIS_ATTRIB_HAS_MVEX 0x0000000000000040 // (1 << 6)
282 #define ZYDIS_ATTRIB_IS_RELATIVE 0x0000000000000080 // (1 << 7)
288 #define ZYDIS_ATTRIB_IS_PRIVILEGED 0x0000000000000100 // (1 << 8)
289 
293 #define ZYDIS_ATTRIB_CPUFLAG_ACCESS 0x0000001000000000 // (1 << 36) // TODO: rebase
294 
298 #define ZYDIS_ATTRIB_CPU_STATE_CR 0x0000002000000000 // (1 << 37) // TODO: rebase
302 #define ZYDIS_ATTRIB_CPU_STATE_CW 0x0000004000000000 // (1 << 38) // TODO: rebase
306 #define ZYDIS_ATTRIB_FPU_STATE_CR 0x0000008000000000 // (1 << 39) // TODO: rebase
310 #define ZYDIS_ATTRIB_FPU_STATE_CW 0x0000010000000000 // (1 << 40) // TODO: rebase
314 #define ZYDIS_ATTRIB_XMM_STATE_CR 0x0000020000000000 // (1 << 41) // TODO: rebase
318 #define ZYDIS_ATTRIB_XMM_STATE_CW 0x0000040000000000 // (1 << 42) // TODO: rebase
319 
323 #define ZYDIS_ATTRIB_ACCEPTS_LOCK 0x0000000000000200 // (1 << 9)
327 #define ZYDIS_ATTRIB_ACCEPTS_REP 0x0000000000000400 // (1 << 10)
331 #define ZYDIS_ATTRIB_ACCEPTS_REPE 0x0000000000000800 // (1 << 11)
335 #define ZYDIS_ATTRIB_ACCEPTS_REPZ 0x0000000000000800 // (1 << 11)
339 #define ZYDIS_ATTRIB_ACCEPTS_REPNE 0x0000000000001000 // (1 << 12)
343 #define ZYDIS_ATTRIB_ACCEPTS_REPNZ 0x0000000000001000 // (1 << 12)
347 #define ZYDIS_ATTRIB_ACCEPTS_BND 0x0000000000002000 // (1 << 13)
351 #define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE 0x0000000000004000 // (1 << 14)
355 #define ZYDIS_ATTRIB_ACCEPTS_XRELEASE 0x0000000000008000 // (1 << 15)
360 #define ZYDIS_ATTRIB_ACCEPTS_HLE_WITHOUT_LOCK 0x0000000000010000 // (1 << 16)
364 #define ZYDIS_ATTRIB_ACCEPTS_BRANCH_HINTS 0x0000000000020000 // (1 << 17)
369 #define ZYDIS_ATTRIB_ACCEPTS_SEGMENT 0x0000000000040000 // (1 << 18)
373 #define ZYDIS_ATTRIB_HAS_LOCK 0x0000000000080000 // (1 << 19)
377 #define ZYDIS_ATTRIB_HAS_REP 0x0000000000100000 // (1 << 20)
381 #define ZYDIS_ATTRIB_HAS_REPE 0x0000000000200000 // (1 << 21)
385 #define ZYDIS_ATTRIB_HAS_REPZ 0x0000000000200000 // (1 << 21)
389 #define ZYDIS_ATTRIB_HAS_REPNE 0x0000000000400000 // (1 << 22)
393 #define ZYDIS_ATTRIB_HAS_REPNZ 0x0000000000400000 // (1 << 22)
397 #define ZYDIS_ATTRIB_HAS_BND 0x0000000000800000 // (1 << 23)
401 #define ZYDIS_ATTRIB_HAS_XACQUIRE 0x0000000001000000 // (1 << 24)
405 #define ZYDIS_ATTRIB_HAS_XRELEASE 0x0000000002000000 // (1 << 25)
409 #define ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN 0x0000000004000000 // (1 << 26)
413 #define ZYDIS_ATTRIB_HAS_BRANCH_TAKEN 0x0000000008000000 // (1 << 27)
417 #define ZYDIS_ATTRIB_HAS_SEGMENT 0x00000003F0000000
421 #define ZYDIS_ATTRIB_HAS_SEGMENT_CS 0x0000000010000000 // (1 << 28)
425 #define ZYDIS_ATTRIB_HAS_SEGMENT_SS 0x0000000020000000 // (1 << 29)
429 #define ZYDIS_ATTRIB_HAS_SEGMENT_DS 0x0000000040000000 // (1 << 30)
433 #define ZYDIS_ATTRIB_HAS_SEGMENT_ES 0x0000000080000000 // (1 << 31)
437 #define ZYDIS_ATTRIB_HAS_SEGMENT_FS 0x0000000100000000 // (1 << 32)
441 #define ZYDIS_ATTRIB_HAS_SEGMENT_GS 0x0000000200000000 // (1 << 33)
445 #define ZYDIS_ATTRIB_HAS_OPERANDSIZE 0x0000000400000000 // (1 << 34) // TODO: rename
449 #define ZYDIS_ATTRIB_HAS_ADDRESSSIZE 0x0000000800000000 // (1 << 35) // TODO: rename
453 #define ZYDIS_ATTRIB_ACCEPTS_NOTRACK 0x0000080000000000 // (1 << 43) // TODO: rebase
457 #define ZYDIS_ATTRIB_HAS_NOTRACK 0x0000100000000000 // (1 << 44) // TODO: rebase
458 
459 /* ---------------------------------------------------------------------------------------------- */
460 /* R/E/FLAGS info */
461 /* ---------------------------------------------------------------------------------------------- */
462 
466 typedef ZyanU32 ZydisCPUFlags;
467 
471 typedef ZyanU8 ZydisCPUFlag;
472 
476 #define ZYDIS_CPUFLAG_CF 0
480 #define ZYDIS_CPUFLAG_PF 2
484 #define ZYDIS_CPUFLAG_AF 4
488 #define ZYDIS_CPUFLAG_ZF 6
492 #define ZYDIS_CPUFLAG_SF 7
496 #define ZYDIS_CPUFLAG_TF 8
500 #define ZYDIS_CPUFLAG_IF 9
504 #define ZYDIS_CPUFLAG_DF 10
508 #define ZYDIS_CPUFLAG_OF 11
512 #define ZYDIS_CPUFLAG_IOPL 12
516 #define ZYDIS_CPUFLAG_NT 14
520 #define ZYDIS_CPUFLAG_RF 16
524 #define ZYDIS_CPUFLAG_VM 17
528 #define ZYDIS_CPUFLAG_AC 18
532 #define ZYDIS_CPUFLAG_VIF 19
536 #define ZYDIS_CPUFLAG_VIP 20
540 #define ZYDIS_CPUFLAG_ID 21
541 
543 
551 #define ZYDIS_CPUFLAG_C0 22
559 #define ZYDIS_CPUFLAG_C1 23
567 #define ZYDIS_CPUFLAG_C2 24
575 #define ZYDIS_CPUFLAG_C3 25
576 
580 #define ZYDIS_CPUFLAG_MAX_VALUE ZYDIS_CPUFLAG_C3
581 
583 
587 typedef ZyanU8 ZydisFPUFlags;
588 
592 #define ZYDIS_FPUFLAG_C0 0x00 // (1 << 0)
596 #define ZYDIS_FPUFLAG_C1 0x01 // (1 << 1)
600 #define ZYDIS_FPUFLAG_C2 0x02 // (1 << 2)
604 #define ZYDIS_FPUFLAG_C3 0x04 // (1 << 3)
605 
612 {
641 
651 
652 /* ---------------------------------------------------------------------------------------------- */
653 /* Branch types */
654 /* ---------------------------------------------------------------------------------------------- */
655 
659 typedef enum ZydisBranchType_
660 {
677 
687 
688 /* ---------------------------------------------------------------------------------------------- */
689 /* SSE/AVX exception-class */
690 /* ---------------------------------------------------------------------------------------------- */
691 
696 {
697  ZYDIS_EXCEPTION_CLASS_NONE,
698  // TODO: FP Exceptions
699  ZYDIS_EXCEPTION_CLASS_SSE1,
700  ZYDIS_EXCEPTION_CLASS_SSE2,
701  ZYDIS_EXCEPTION_CLASS_SSE3,
702  ZYDIS_EXCEPTION_CLASS_SSE4,
703  ZYDIS_EXCEPTION_CLASS_SSE5,
704  ZYDIS_EXCEPTION_CLASS_SSE7,
705  ZYDIS_EXCEPTION_CLASS_AVX1,
706  ZYDIS_EXCEPTION_CLASS_AVX2,
707  ZYDIS_EXCEPTION_CLASS_AVX3,
708  ZYDIS_EXCEPTION_CLASS_AVX4,
709  ZYDIS_EXCEPTION_CLASS_AVX5,
710  ZYDIS_EXCEPTION_CLASS_AVX6,
711  ZYDIS_EXCEPTION_CLASS_AVX7,
712  ZYDIS_EXCEPTION_CLASS_AVX8,
713  ZYDIS_EXCEPTION_CLASS_AVX11,
714  ZYDIS_EXCEPTION_CLASS_AVX12,
715  ZYDIS_EXCEPTION_CLASS_E1,
716  ZYDIS_EXCEPTION_CLASS_E1NF,
717  ZYDIS_EXCEPTION_CLASS_E2,
718  ZYDIS_EXCEPTION_CLASS_E2NF,
719  ZYDIS_EXCEPTION_CLASS_E3,
720  ZYDIS_EXCEPTION_CLASS_E3NF,
721  ZYDIS_EXCEPTION_CLASS_E4,
722  ZYDIS_EXCEPTION_CLASS_E4NF,
723  ZYDIS_EXCEPTION_CLASS_E5,
724  ZYDIS_EXCEPTION_CLASS_E5NF,
725  ZYDIS_EXCEPTION_CLASS_E6,
726  ZYDIS_EXCEPTION_CLASS_E6NF,
727  ZYDIS_EXCEPTION_CLASS_E7NM,
728  ZYDIS_EXCEPTION_CLASS_E7NM128,
729  ZYDIS_EXCEPTION_CLASS_E9NF,
730  ZYDIS_EXCEPTION_CLASS_E10,
731  ZYDIS_EXCEPTION_CLASS_E10NF,
732  ZYDIS_EXCEPTION_CLASS_E11,
733  ZYDIS_EXCEPTION_CLASS_E11NF,
734  ZYDIS_EXCEPTION_CLASS_E12,
735  ZYDIS_EXCEPTION_CLASS_E12NP,
736  ZYDIS_EXCEPTION_CLASS_K20,
737  ZYDIS_EXCEPTION_CLASS_K21,
738  ZYDIS_EXCEPTION_CLASS_AMXE1,
739  ZYDIS_EXCEPTION_CLASS_AMXE2,
740  ZYDIS_EXCEPTION_CLASS_AMXE3,
741  ZYDIS_EXCEPTION_CLASS_AMXE4,
742  ZYDIS_EXCEPTION_CLASS_AMXE5,
743  ZYDIS_EXCEPTION_CLASS_AMXE6,
744 
748  ZYDIS_EXCEPTION_CLASS_MAX_VALUE = ZYDIS_EXCEPTION_CLASS_AMXE6,
754 
755 /* ---------------------------------------------------------------------------------------------- */
756 /* AVX mask mode */
757 /* ---------------------------------------------------------------------------------------------- */
758 
762 typedef enum ZydisMaskMode_
763 {
764  ZYDIS_MASK_MODE_INVALID,
785 
795 
796 /* ---------------------------------------------------------------------------------------------- */
797 /* AVX broadcast-mode */
798 /* ---------------------------------------------------------------------------------------------- */
799 
804 {
805  ZYDIS_BROADCAST_MODE_INVALID,
806  ZYDIS_BROADCAST_MODE_1_TO_2,
807  ZYDIS_BROADCAST_MODE_1_TO_4,
808  ZYDIS_BROADCAST_MODE_1_TO_8,
809  ZYDIS_BROADCAST_MODE_1_TO_16,
810  ZYDIS_BROADCAST_MODE_1_TO_32,
811  ZYDIS_BROADCAST_MODE_1_TO_64,
812  ZYDIS_BROADCAST_MODE_2_TO_4,
813  ZYDIS_BROADCAST_MODE_2_TO_8,
814  ZYDIS_BROADCAST_MODE_2_TO_16,
815  ZYDIS_BROADCAST_MODE_4_TO_8,
816  ZYDIS_BROADCAST_MODE_4_TO_16,
817  ZYDIS_BROADCAST_MODE_8_TO_16,
818 
822  ZYDIS_BROADCAST_MODE_MAX_VALUE = ZYDIS_BROADCAST_MODE_8_TO_16,
828 
829 /* ---------------------------------------------------------------------------------------------- */
830 /* AVX rounding-mode */
831 /* ---------------------------------------------------------------------------------------------- */
832 
836 typedef enum ZydisRoundingMode_
837 {
838  ZYDIS_ROUNDING_MODE_INVALID,
855 
865 
866 /* ---------------------------------------------------------------------------------------------- */
867 /* KNC swizzle-mode */
868 /* ---------------------------------------------------------------------------------------------- */
869 
873 typedef enum ZydisSwizzleMode_
874 {
875  ZYDIS_SWIZZLE_MODE_INVALID,
876  ZYDIS_SWIZZLE_MODE_DCBA,
877  ZYDIS_SWIZZLE_MODE_CDAB,
878  ZYDIS_SWIZZLE_MODE_BADC,
879  ZYDIS_SWIZZLE_MODE_DACB,
880  ZYDIS_SWIZZLE_MODE_AAAA,
881  ZYDIS_SWIZZLE_MODE_BBBB,
882  ZYDIS_SWIZZLE_MODE_CCCC,
883  ZYDIS_SWIZZLE_MODE_DDDD,
884 
888  ZYDIS_SWIZZLE_MODE_MAX_VALUE = ZYDIS_SWIZZLE_MODE_DDDD,
894 
895 /* ---------------------------------------------------------------------------------------------- */
896 /* KNC conversion-mode */
897 /* ---------------------------------------------------------------------------------------------- */
898 
903 {
904  ZYDIS_CONVERSION_MODE_INVALID,
905  ZYDIS_CONVERSION_MODE_FLOAT16,
906  ZYDIS_CONVERSION_MODE_SINT8,
907  ZYDIS_CONVERSION_MODE_UINT8,
908  ZYDIS_CONVERSION_MODE_SINT16,
909  ZYDIS_CONVERSION_MODE_UINT16,
910 
914  ZYDIS_CONVERSION_MODE_MAX_VALUE = ZYDIS_CONVERSION_MODE_UINT16,
920 
921 /* ---------------------------------------------------------------------------------------------- */
922 /* Legacy prefix type */
923 /* ---------------------------------------------------------------------------------------------- */
924 
928 typedef enum ZydisPrefixType_
929 {
948 
958 
959 // TODO: Check effective for 66/67 prefixes (currently defaults to EFFECTIVE)
960 
961 /* ---------------------------------------------------------------------------------------------- */
962 /* Decoded instruction */
963 /* ---------------------------------------------------------------------------------------------- */
964 
969 {
977  ZydisMnemonic mnemonic;
981  ZyanU8 length;
993  ZyanU8 opcode;
997  ZyanU8 stack_width;
1017  ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
1030  {
1038  } accessed_flags[ZYDIS_CPUFLAG_MAX_VALUE + 1];
1069  {
1073  ZyanU16 vector_length;
1078  {
1086  ZydisRegister reg;
1087  } mask;
1092  {
1099  ZyanBool is_static;
1104  } broadcast;
1109  {
1114  } rounding;
1119  {
1124  } swizzle;
1129  {
1134  } conversion;
1139  ZyanBool has_sae;
1144  // TODO: publish EVEX tuple-type and MVEX functionality
1145  } avx;
1150  {
1154  ZydisInstructionCategory category;
1158  ZydisISASet isa_set;
1162  ZydisISAExt isa_ext;
1171  } meta;
1177  {
1186  {
1194  ZyanU8 value;
1195  } prefixes[ZYDIS_MAX_INSTRUCTION_LENGTH];
1200  {
1204  ZyanU8 W;
1208  ZyanU8 R;
1212  ZyanU8 X;
1216  ZyanU8 B;
1228  ZyanU8 offset;
1229  } rex;
1234  {
1238  ZyanU8 R;
1242  ZyanU8 X;
1246  ZyanU8 B;
1250  ZyanU8 m_mmmm;
1254  ZyanU8 W;
1259  ZyanU8 vvvv;
1263  ZyanU8 L;
1267  ZyanU8 pp;
1272  ZyanU8 offset;
1273  } xop;
1278  {
1282  ZyanU8 R;
1286  ZyanU8 X;
1290  ZyanU8 B;
1294  ZyanU8 m_mmmm;
1298  ZyanU8 W;
1303  ZyanU8 vvvv;
1307  ZyanU8 L;
1311  ZyanU8 pp;
1316  ZyanU8 offset;
1320  ZyanU8 size;
1321  } vex;
1326  {
1330  ZyanU8 R;
1334  ZyanU8 X;
1338  ZyanU8 B;
1342  ZyanU8 R2;
1346  ZyanU8 mmm;
1350  ZyanU8 W;
1355  ZyanU8 vvvv;
1359  ZyanU8 pp;
1363  ZyanU8 z;
1367  ZyanU8 L2;
1371  ZyanU8 L;
1375  ZyanU8 b;
1379  ZyanU8 V2;
1383  ZyanU8 aaa;
1388  ZyanU8 offset;
1389  } evex;
1394  {
1398  ZyanU8 R;
1402  ZyanU8 X;
1406  ZyanU8 B;
1410  ZyanU8 R2;
1414  ZyanU8 mmmm;
1418  ZyanU8 W;
1423  ZyanU8 vvvv;
1427  ZyanU8 pp;
1431  ZyanU8 E;
1435  ZyanU8 SSS;
1439  ZyanU8 V2;
1443  ZyanU8 kkk;
1448  ZyanU8 offset;
1449  } mvex;
1454  {
1458  ZyanU8 mod;
1462  ZyanU8 reg;
1466  ZyanU8 rm;
1471  ZyanU8 offset;
1472  } modrm;
1477  {
1481  ZyanU8 scale;
1485  ZyanU8 index;
1489  ZyanU8 base;
1494  ZyanU8 offset;
1495  } sib;
1500  {
1504  ZyanI64 value;
1508  ZyanU8 size;
1509  // TODO: publish cd8 scale
1514  ZyanU8 offset;
1515  } disp;
1520  {
1524  ZyanBool is_signed;
1529  ZyanBool is_relative;
1534  {
1535  ZyanU64 u;
1536  ZyanI64 s;
1537  } value;
1541  ZyanU8 size;
1546  ZyanU8 offset;
1547  } imm[2];
1548  } raw;
1550 
1551 /* ---------------------------------------------------------------------------------------------- */
1552 
1553 /* ============================================================================================== */
1554 
1555 #ifdef __cplusplus
1556 }
1557 #endif
1558 
1559 #endif /* ZYDIS_INSTRUCTIONINFO_H */
ZyanU8 ZydisFPUFlags
Defines the ZydisFPUFlags data-type.
Definition: DecoderTypes.h:587
ZyanU32 ZydisCPUFlags
Defines the ZydisCPUFlags data-type.
Definition: DecoderTypes.h:466
ZyanU8 ZydisCPUFlag
Defines the ZydisCPUFlag data-type.
Definition: DecoderTypes.h:471
enum ZydisConversionMode_ ZydisConversionMode
Defines the ZydisConversionMode enum.
enum ZydisMaskMode_ ZydisMaskMode
Defines the ZydisMaskMode enum.
enum ZydisRoundingMode_ ZydisRoundingMode
Defines the ZydisRoundingMode enum.
ZydisExceptionClass_
Defines the ZydisExceptionClass enum.
Definition: DecoderTypes.h:696
@ ZYDIS_EXCEPTION_CLASS_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:748
@ ZYDIS_EXCEPTION_CLASS_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:752
ZydisBranchType_
Defines the ZydisBranchType enum.
Definition: DecoderTypes.h:660
@ ZYDIS_BRANCH_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:681
@ ZYDIS_BRANCH_TYPE_FAR
The instruction is a far (inter-segment) branch instruction.
Definition: DecoderTypes.h:676
@ ZYDIS_BRANCH_TYPE_NONE
The instruction is not a branch instruction.
Definition: DecoderTypes.h:664
@ ZYDIS_BRANCH_TYPE_NEAR
The instruction is a near (16-bit or 32-bit) branch instruction.
Definition: DecoderTypes.h:672
@ ZYDIS_BRANCH_TYPE_SHORT
The instruction is a short (8-bit) branch instruction.
Definition: DecoderTypes.h:668
@ ZYDIS_BRANCH_TYPE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:685
ZydisBroadcastMode_
Defines the ZydisBroadcastMode enum.
Definition: DecoderTypes.h:804
@ ZYDIS_BROADCAST_MODE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:826
@ ZYDIS_BROADCAST_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:822
enum ZydisExceptionClass_ ZydisExceptionClass
Defines the ZydisExceptionClass enum.
ZydisPrefixType_
Defines the ZydisPrefixType enum.
Definition: DecoderTypes.h:929
@ ZYDIS_PREFIX_TYPE_IGNORED
The prefix is ignored by the instruction.
Definition: DecoderTypes.h:936
@ ZYDIS_PREFIX_TYPE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:956
@ ZYDIS_PREFIX_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:952
@ ZYDIS_PREFIX_TYPE_MANDATORY
The prefix is used as a mandatory prefix.
Definition: DecoderTypes.h:947
@ ZYDIS_PREFIX_TYPE_EFFECTIVE
The prefix is effectively used by the instruction.
Definition: DecoderTypes.h:940
ZydisCPUFlagAction_
Defines the ZydisCPUFlagAction enum.
Definition: DecoderTypes.h:612
@ ZYDIS_CPUFLAG_ACTION_SET_0
The CPU flag is set to 0 (write).
Definition: DecoderTypes.h:632
@ ZYDIS_CPUFLAG_ACTION_NONE
The CPU flag is not touched by the instruction.
Definition: DecoderTypes.h:616
@ ZYDIS_CPUFLAG_ACTION_UNDEFINED
The CPU flag is undefined (write).
Definition: DecoderTypes.h:640
@ ZYDIS_CPUFLAG_ACTION_MODIFIED
The CPU flag is modified (write).
Definition: DecoderTypes.h:628
@ ZYDIS_CPUFLAG_ACTION_SET_1
The CPU flag is set to 1 (write).
Definition: DecoderTypes.h:636
@ ZYDIS_CPUFLAG_ACTION_TESTED
The CPU flag is tested (read).
Definition: DecoderTypes.h:620
@ ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED
The CPU flag is tested and modified afterwards (read-write).
Definition: DecoderTypes.h:624
@ ZYDIS_CPUFLAG_ACTION_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:645
@ ZYDIS_CPUFLAG_ACTION_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:649
ZydisMemoryOperandType_
Defines the ZydisMemoryOperandType enum.
Definition: DecoderTypes.h:76
@ ZYDIS_MEMOP_TYPE_AGEN
The memory operand is only used for address-generation.
Definition: DecoderTypes.h:86
@ ZYDIS_MEMOP_TYPE_MEM
Normal memory operand.
Definition: DecoderTypes.h:81
@ ZYDIS_MEMOP_TYPE_MIB
A memory operand using SIB addressing form, where the index register is not used in address calculati...
Definition: DecoderTypes.h:91
@ ZYDIS_MEMOP_TYPE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:100
@ ZYDIS_MEMOP_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:96
ZydisRoundingMode_
Defines the ZydisRoundingMode enum.
Definition: DecoderTypes.h:837
@ ZYDIS_ROUNDING_MODE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:863
@ ZYDIS_ROUNDING_MODE_RN
Round to nearest.
Definition: DecoderTypes.h:842
@ ZYDIS_ROUNDING_MODE_RZ
Round towards zero.
Definition: DecoderTypes.h:854
@ ZYDIS_ROUNDING_MODE_RD
Round down.
Definition: DecoderTypes.h:846
@ ZYDIS_ROUNDING_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:859
@ ZYDIS_ROUNDING_MODE_RU
Round up.
Definition: DecoderTypes.h:850
enum ZydisSwizzleMode_ ZydisSwizzleMode
Defines the ZydisSwizzleMode enum.
enum ZydisMemoryOperandType_ ZydisMemoryOperandType
Defines the ZydisMemoryOperandType enum.
ZyanU64 ZydisInstructionAttributes
Defines the ZydisInstructionAttributes data-type.
Definition: DecoderTypes.h:249
ZydisConversionMode_
Defines the ZydisConversionMode enum.
Definition: DecoderTypes.h:903
@ ZYDIS_CONVERSION_MODE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:918
@ ZYDIS_CONVERSION_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:914
ZyanU8 ZydisOperandAttributes
Defines the ZydisOperandAttributes data-type.
Definition: DecoderTypes.h:56
struct ZydisDecodedOperand_ ZydisDecodedOperand
Defines the ZydisDecodedOperand struct.
enum ZydisBroadcastMode_ ZydisBroadcastMode
Defines the ZydisBroadcastMode enum.
enum ZydisPrefixType_ ZydisPrefixType
Defines the ZydisPrefixType enum.
#define ZYDIS_CPUFLAG_MAX_VALUE
DEPRECATED.
Definition: DecoderTypes.h:580
struct ZydisDecodedInstruction_ ZydisDecodedInstruction
Information about a decoded instruction.
ZydisMaskMode_
Defines the ZydisMaskMode enum.
Definition: DecoderTypes.h:763
@ ZYDIS_MASK_MODE_DISABLED
Masking is disabled for the current instruction (K0 register is used).
Definition: DecoderTypes.h:768
@ ZYDIS_MASK_MODE_CONTROL
The embedded mask register is used as a control-mask (element selector).
Definition: DecoderTypes.h:780
@ ZYDIS_MASK_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:789
@ ZYDIS_MASK_MODE_MERGING
The embedded mask register is used as a merge-mask.
Definition: DecoderTypes.h:772
@ ZYDIS_MASK_MODE_CONTROL_ZEROING
The embedded mask register is used as a zeroing control-mask (element selector).
Definition: DecoderTypes.h:784
@ ZYDIS_MASK_MODE_ZEROING
The embedded mask register is used as a zero-mask.
Definition: DecoderTypes.h:776
@ ZYDIS_MASK_MODE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:793
enum ZydisBranchType_ ZydisBranchType
Defines the ZydisBranchType enum.
ZydisSwizzleMode_
Defines the ZydisSwizzleMode enum.
Definition: DecoderTypes.h:874
@ ZYDIS_SWIZZLE_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:888
@ ZYDIS_SWIZZLE_MODE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: DecoderTypes.h:892
enum ZydisCPUFlagAction_ ZydisCPUFlagAction
Defines the ZydisCPUFlagAction enum.
Mnemonic constant definitions and helper functions.
Utility functions and constants for registers.
Defines decoder/encoder-shared macros and types.
enum ZydisOperandEncoding_ ZydisOperandEncoding
Defines the ZydisOperandEncoding 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:397
enum ZydisOpcodeMap_ ZydisOpcodeMap
Defines the ZydisOpcodeMap enum.
enum ZydisElementType_ ZydisElementType
Defines the ZydisElementType enum.
ZyanU16 ZydisElementSize
Defines the ZydisElementSize datatype.
Definition: SharedTypes.h:189
enum ZydisMachineMode_ ZydisMachineMode
Defines the ZydisMachineMode enum.
Information about accessed CPU flags.
Definition: DecoderTypes.h:1030
ZydisCPUFlagAction action
The CPU-flag action.
Definition: DecoderTypes.h:1037
Contains info about the AVX broadcast.
Definition: DecoderTypes.h:1092
ZydisBroadcastMode mode
The AVX broadcast-mode.
Definition: DecoderTypes.h:1103
ZyanBool is_static
Signals, if the broadcast is a static broadcast.
Definition: DecoderTypes.h:1099
Contains info about the AVX data-conversion (KNC only).
Definition: DecoderTypes.h:1129
ZydisConversionMode mode
The AVX data-conversion mode.
Definition: DecoderTypes.h:1133
Info about the embedded writemask-register (AVX-512 and KNC only).
Definition: DecoderTypes.h:1078
ZydisRegister reg
The mask register.
Definition: DecoderTypes.h:1086
ZydisMaskMode mode
The masking mode.
Definition: DecoderTypes.h:1082
Contains info about the AVX rounding.
Definition: DecoderTypes.h:1109
ZydisRoundingMode mode
The AVX rounding-mode.
Definition: DecoderTypes.h:1113
Contains info about the AVX register-swizzle (KNC only).
Definition: DecoderTypes.h:1119
ZydisSwizzleMode mode
The AVX register-swizzle mode.
Definition: DecoderTypes.h:1123
Extended info for AVX instructions.
Definition: DecoderTypes.h:1069
ZyanBool has_eviction_hint
Signals, if the instruction has a memory-eviction-hint (KNC only).
Definition: DecoderTypes.h:1143
ZyanU16 vector_length
The AVX vector-length.
Definition: DecoderTypes.h:1073
ZyanBool has_sae
Signals, if the SAE (suppress-all-exceptions) functionality is enabled for the instruction.
Definition: DecoderTypes.h:1139
Meta info.
Definition: DecoderTypes.h:1150
ZydisBranchType branch_type
The branch type.
Definition: DecoderTypes.h:1166
ZydisISASet isa_set
The ISA-set.
Definition: DecoderTypes.h:1158
ZydisISAExt isa_ext
The ISA-set extension.
Definition: DecoderTypes.h:1162
ZydisExceptionClass exception_class
The exception class.
Definition: DecoderTypes.h:1170
ZydisInstructionCategory category
The instruction category.
Definition: DecoderTypes.h:1154
Detailed info about the ModRM byte.
Definition: DecoderTypes.h:1454
ZyanU8 rm
Register specifier or opcode-extension.
Definition: DecoderTypes.h:1466
ZyanU8 mod
The addressing mode.
Definition: DecoderTypes.h:1458
ZyanU8 offset
The offset of the ModRM byte, relative to the beginning of the instruction, in bytes.
Definition: DecoderTypes.h:1471
ZyanU8 reg
Register specifier or opcode-extension.
Definition: DecoderTypes.h:1462
Detailed info about displacement-bytes.
Definition: DecoderTypes.h:1500
ZyanU8 size
The physical displacement size, in bits.
Definition: DecoderTypes.h:1508
ZyanI64 value
The displacement value.
Definition: DecoderTypes.h:1504
ZyanU8 offset
The offset of the displacement data, relative to the beginning of the instruction,...
Definition: DecoderTypes.h:1514
Detailed info about the EVEX prefix.
Definition: DecoderTypes.h:1326
ZyanU8 R2
High-16 register specifier modifier (inverted).
Definition: DecoderTypes.h:1342
ZyanU8 L2
Vector-length specifier or rounding-control (most significant bit).
Definition: DecoderTypes.h:1367
ZyanU8 X
Extension of the SIB.index/vidx field (inverted).
Definition: DecoderTypes.h:1334
ZyanU8 L
Vector-length specifier or rounding-control (least significant bit).
Definition: DecoderTypes.h:1371
ZyanU8 aaa
Embedded opmask register specifier.
Definition: DecoderTypes.h:1383
ZyanU8 offset
The offset of the first evex byte, relative to the beginning of the instruction, in bytes.
Definition: DecoderTypes.h:1388
ZyanU8 R
Extension of the ModRM.reg field (inverted).
Definition: DecoderTypes.h:1330
ZyanU8 pp
Compressed legacy prefix.
Definition: DecoderTypes.h:1359
ZyanU8 W
64-bit operand-size promotion or opcode-extension.
Definition: DecoderTypes.h:1350
ZyanU8 b
Broadcast/RC/SAE context.
Definition: DecoderTypes.h:1375
ZyanU8 vvvv
NDS/NDD (non-destructive-source/destination) register specifier (inverted).
Definition: DecoderTypes.h:1355
ZyanU8 V2
High-16 NDS/VIDX register specifier.
Definition: DecoderTypes.h:1379
ZyanU8 B
Extension of the ModRM.rm or SIB.base field (inverted).
Definition: DecoderTypes.h:1338
ZyanU8 mmm
Opcode-map specifier.
Definition: DecoderTypes.h:1346
Detailed info about immediate-bytes.
Definition: DecoderTypes.h:1520
ZyanU8 size
The physical immediate size, in bits.
Definition: DecoderTypes.h:1541
ZyanBool is_relative
Signals, if the immediate value contains a relative offset.
Definition: DecoderTypes.h:1529
ZyanBool is_signed
Signals, if the immediate value is signed.
Definition: DecoderTypes.h:1524
ZyanU8 offset
The offset of the immediate data, relative to the beginning of the instruction, in bytes.
Definition: DecoderTypes.h:1546
Detailed info about the MVEX prefix.
Definition: DecoderTypes.h:1394
ZyanU8 SSS
Swizzle/broadcast/up-convert/down-convert/static-rounding controls.
Definition: DecoderTypes.h:1435
ZyanU8 R2
High-16 register specifier modifier (inverted).
Definition: DecoderTypes.h:1410
ZyanU8 kkk
Embedded opmask register specifier.
Definition: DecoderTypes.h:1443
ZyanU8 X
Extension of the SIB.index/vidx field (inverted).
Definition: DecoderTypes.h:1402
ZyanU8 offset
The offset of the first mvex byte, relative to the beginning of the instruction, in bytes.
Definition: DecoderTypes.h:1448
ZyanU8 R
Extension of the ModRM.reg field (inverted).
Definition: DecoderTypes.h:1398
ZyanU8 pp
Compressed legacy prefix.
Definition: DecoderTypes.h:1427
ZyanU8 W
64-bit operand-size promotion or opcode-extension.
Definition: DecoderTypes.h:1418
ZyanU8 mmmm
Opcode-map specifier.
Definition: DecoderTypes.h:1414
ZyanU8 vvvv
NDS/NDD (non-destructive-source/destination) register specifier (inverted).
Definition: DecoderTypes.h:1423
ZyanU8 V2
High-16 NDS/VIDX register specifier.
Definition: DecoderTypes.h:1439
ZyanU8 E
Non-temporal/eviction hint.
Definition: DecoderTypes.h:1431
ZyanU8 B
Extension of the ModRM.rm or SIB.base field (inverted).
Definition: DecoderTypes.h:1406
Detailed info about the legacy prefixes (including REX).
Definition: DecoderTypes.h:1186
ZydisPrefixType type
The prefix type.
Definition: DecoderTypes.h:1190
Detailed info about the REX prefix.
Definition: DecoderTypes.h:1200
ZyanU8 X
Extension of the SIB.index field.
Definition: DecoderTypes.h:1212
ZyanU8 offset
The offset of the effective REX byte, relative to the beginning of the instruction,...
Definition: DecoderTypes.h:1228
ZyanU8 R
Extension of the ModRM.reg field.
Definition: DecoderTypes.h:1208
ZyanU8 W
64-bit operand-size promotion.
Definition: DecoderTypes.h:1204
ZyanU8 B
Extension of the ModRM.rm, SIB.base, or opcode.reg field.
Definition: DecoderTypes.h:1216
Detailed info about the SIB byte.
Definition: DecoderTypes.h:1477
ZyanU8 base
The base-register specifier.
Definition: DecoderTypes.h:1489
ZyanU8 offset
The offset of the SIB byte, relative to the beginning of the instruction, in bytes.
Definition: DecoderTypes.h:1494
ZyanU8 index
The index-register specifier.
Definition: DecoderTypes.h:1485
Detailed info about the VEX prefix.
Definition: DecoderTypes.h:1278
ZyanU8 m_mmmm
Opcode-map specifier.
Definition: DecoderTypes.h:1294
ZyanU8 X
Extension of the SIB.index field (inverted).
Definition: DecoderTypes.h:1286
ZyanU8 size
The size of the VEX prefix, in bytes.
Definition: DecoderTypes.h:1320
ZyanU8 L
Vector-length specifier.
Definition: DecoderTypes.h:1307
ZyanU8 offset
The offset of the first VEX byte, relative to the beginning of the instruction, in bytes.
Definition: DecoderTypes.h:1316
ZyanU8 R
Extension of the ModRM.reg field (inverted).
Definition: DecoderTypes.h:1282
ZyanU8 pp
Compressed legacy prefix.
Definition: DecoderTypes.h:1311
ZyanU8 W
64-bit operand-size promotion or opcode-extension.
Definition: DecoderTypes.h:1298
ZyanU8 vvvv
NDS/NDD (non-destructive-source/destination) register specifier (inverted).
Definition: DecoderTypes.h:1303
ZyanU8 B
Extension of the ModRM.rm, SIB.base, or opcode.reg field (inverted).
Definition: DecoderTypes.h:1290
Detailed info about the XOP prefix.
Definition: DecoderTypes.h:1234
ZyanU8 m_mmmm
Opcode-map specifier.
Definition: DecoderTypes.h:1250
ZyanU8 X
Extension of the SIB.index field (inverted).
Definition: DecoderTypes.h:1242
ZyanU8 L
Vector-length specifier.
Definition: DecoderTypes.h:1263
ZyanU8 offset
The offset of the first xop byte, relative to the beginning of the instruction, in bytes.
Definition: DecoderTypes.h:1272
ZyanU8 R
Extension of the ModRM.reg field (inverted).
Definition: DecoderTypes.h:1238
ZyanU8 pp
Compressed legacy prefix.
Definition: DecoderTypes.h:1267
ZyanU8 W
64-bit operand-size promotion or opcode-extension.
Definition: DecoderTypes.h:1254
ZyanU8 vvvv
NDS/NDD (non-destructive-source/destination) register specifier (inverted).
Definition: DecoderTypes.h:1259
ZyanU8 B
Extension of the ModRM.rm, SIB.base, or opcode.reg field (inverted).
Definition: DecoderTypes.h:1246
Detailed info about different instruction-parts like ModRM, SIB or encoding-prefixes.
Definition: DecoderTypes.h:1177
ZyanU8 prefix_count
The number of legacy prefixes.
Definition: DecoderTypes.h:1181
Information about a decoded instruction.
Definition: DecoderTypes.h:969
ZydisMnemonic mnemonic
The instruction-mnemonic.
Definition: DecoderTypes.h:977
ZyanU8 operand_width
The effective operand width.
Definition: DecoderTypes.h:1001
ZydisCPUFlags cpu_flags_written
A mask containing the CPU flags written by the instruction.
Definition: DecoderTypes.h:1056
ZyanU8 opcode
The instruction-opcode.
Definition: DecoderTypes.h:993
ZydisMachineMode machine_mode
The machine mode used to decode this instruction.
Definition: DecoderTypes.h:973
ZydisCPUFlags cpu_flags_read
A mask containing the CPU flags read by the instruction.
Definition: DecoderTypes.h:1047
ZydisOpcodeMap opcode_map
The opcode-map.
Definition: DecoderTypes.h:989
ZydisInstructionEncoding encoding
The instruction-encoding (LEGACY, 3DNOW, VEX, EVEX, XOP).
Definition: DecoderTypes.h:985
ZydisInstructionAttributes attributes
Instruction attributes.
Definition: DecoderTypes.h:1021
ZyanU8 stack_width
The stack width.
Definition: DecoderTypes.h:997
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT]
Detailed info for all instruction operands.
Definition: DecoderTypes.h:1017
ZyanU8 address_width
The effective address width.
Definition: DecoderTypes.h:1005
ZyanU8 operand_count
The number of instruction-operands.
Definition: DecoderTypes.h:1009
ZydisFPUFlags fpu_flags_written
A mask containing the FPU flags written by the instruction.
Definition: DecoderTypes.h:1064
ZyanU8 length
The length of the decoded instruction.
Definition: DecoderTypes.h:981
ZydisFPUFlags fpu_flags_read
A mask containing the FPU flags read by the instruction.
Definition: DecoderTypes.h:1060
Extended info for immediate-operands.
Definition: DecoderTypes.h:215
ZyanBool is_relative
Signals, if the immediate value contains a relative offset.
Definition: DecoderTypes.h:224
ZyanBool is_signed
Signals, if the immediate value is signed.
Definition: DecoderTypes.h:219
Extended info for memory-operands with displacement.
Definition: DecoderTypes.h:192
ZyanI64 value
The displacement value.
Definition: DecoderTypes.h:200
ZyanBool has_displacement
Signals, if the displacement value is used.
Definition: DecoderTypes.h:196
Extended info for memory-operands.
Definition: DecoderTypes.h:167
ZydisMemoryOperandType type
The type of the memory operand.
Definition: DecoderTypes.h:171
ZydisRegister segment
The segment register.
Definition: DecoderTypes.h:175
ZydisRegister base
The base register.
Definition: DecoderTypes.h:179
ZyanU8 scale
The scale factor.
Definition: DecoderTypes.h:187
ZydisRegister index
The index register.
Definition: DecoderTypes.h:183
Extended info for pointer-operands.
Definition: DecoderTypes.h:207
Extended info for register-operands.
Definition: DecoderTypes.h:156
ZydisRegister value
The register value.
Definition: DecoderTypes.h:160
Defines the ZydisDecodedOperand struct.
Definition: DecoderTypes.h:111
ZyanU16 size
The logical size of the operand (in bits).
Definition: DecoderTypes.h:135
ZyanU16 element_count
The number of elements.
Definition: DecoderTypes.h:147
ZydisOperandActions actions
The operand-actions.
Definition: DecoderTypes.h:127
ZydisOperandEncoding encoding
The operand-encoding.
Definition: DecoderTypes.h:131
ZydisElementType element_type
The element-type.
Definition: DecoderTypes.h:139
ZydisOperandVisibility visibility
The visibility of the operand.
Definition: DecoderTypes.h:123
ZydisOperandType type
The type of the operand.
Definition: DecoderTypes.h:119
ZyanU8 id
The operand-id.
Definition: DecoderTypes.h:115
ZydisElementSize element_size
The size of a single element.
Definition: DecoderTypes.h:143
The immediate value.
Definition: DecoderTypes.h:229