Zydis  v2.0.0-alpha2
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 <Zydis/CommonTypes.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 
52 typedef struct ZydisDecodedOperand_
53 {
57  uint8_t id;
77  uint16_t size;
89  uint16_t elementCount;
93  struct
94  {
99  // TODO: AVX512_4VNNIW MULTISOURCE registers
100  } reg;
104  struct
105  {
125  uint8_t scale;
129  struct
130  {
138  int64_t value;
139  } disp;
140  } mem;
144  struct
145  {
146  uint16_t segment;
147  uint32_t offset;
148  } ptr;
152  struct
153  {
166  union
167  {
168  uint64_t u;
169  int64_t s;
170  } value;
171  } imm;
173 
174 /* ============================================================================================== */
175 /* Decoded instruction */
176 /* ============================================================================================== */
177 
178 /* ---------------------------------------------------------------------------------------------- */
179 /* Instruction attributes */
180 /* ---------------------------------------------------------------------------------------------- */
181 
185 typedef uint64_t ZydisInstructionAttributes;
186 
190 #define ZYDIS_ATTRIB_HAS_MODRM 0x0000000000000001 // (1 << 0)
194 #define ZYDIS_ATTRIB_HAS_SIB 0x0000000000000002 // (1 << 1)
198 #define ZYDIS_ATTRIB_HAS_REX 0x0000000000000004 // (1 << 2)
202 #define ZYDIS_ATTRIB_HAS_XOP 0x0000000000000008 // (1 << 3)
206 #define ZYDIS_ATTRIB_HAS_VEX 0x0000000000000010 // (1 << 4)
210 #define ZYDIS_ATTRIB_HAS_EVEX 0x0000000000000020 // (1 << 5)
214 #define ZYDIS_ATTRIB_HAS_MVEX 0x0000000000000040 // (1 << 6)
218 #define ZYDIS_ATTRIB_IS_RELATIVE 0x0000000000000080 // (1 << 7)
224 #define ZYDIS_ATTRIB_IS_PRIVILEGED 0x0000000000000100 // (1 << 8)
225 
229 #define ZYDIS_ATTRIB_IS_FAR_BRANCH 0x0000001000000000 // (1 << 36) // TODO: rebase
230 
234 #define ZYDIS_ATTRIB_ACCEPTS_LOCK 0x0000000000000200 // (1 << 9)
238 #define ZYDIS_ATTRIB_ACCEPTS_REP 0x0000000000000400 // (1 << 10)
242 #define ZYDIS_ATTRIB_ACCEPTS_REPE 0x0000000000000800 // (1 << 11)
246 #define ZYDIS_ATTRIB_ACCEPTS_REPZ 0x0000000000000800 // (1 << 11)
250 #define ZYDIS_ATTRIB_ACCEPTS_REPNE 0x0000000000001000 // (1 << 12)
254 #define ZYDIS_ATTRIB_ACCEPTS_REPNZ 0x0000000000001000 // (1 << 12)
258 #define ZYDIS_ATTRIB_ACCEPTS_BOUND 0x0000000000002000 // (1 << 13)
262 #define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE 0x0000000000004000 // (1 << 14)
266 #define ZYDIS_ATTRIB_ACCEPTS_XRELEASE 0x0000000000008000 // (1 << 15)
271 #define ZYDIS_ATTRIB_ACCEPTS_HLE_WITHOUT_LOCK 0x0000000000010000 // (1 << 16)
275 #define ZYDIS_ATTRIB_ACCEPTS_BRANCH_HINTS 0x0000000000020000 // (1 << 17)
279 #define ZYDIS_ATTRIB_ACCEPTS_SEGMENT 0x0000000000040000 // (1 << 18)
283 #define ZYDIS_ATTRIB_HAS_LOCK 0x0000000000080000 // (1 << 19)
287 #define ZYDIS_ATTRIB_HAS_REP 0x0000000000100000 // (1 << 20)
291 #define ZYDIS_ATTRIB_HAS_REPE 0x0000000000200000 // (1 << 21)
295 #define ZYDIS_ATTRIB_HAS_REPZ 0x0000000000200000 // (1 << 21)
299 #define ZYDIS_ATTRIB_HAS_REPNE 0x0000000000400000 // (1 << 22)
303 #define ZYDIS_ATTRIB_HAS_REPNZ 0x0000000000400000 // (1 << 22)
307 #define ZYDIS_ATTRIB_HAS_BOUND 0x0000000000800000 // (1 << 23)
311 #define ZYDIS_ATTRIB_HAS_XACQUIRE 0x0000000001000000 // (1 << 24)
315 #define ZYDIS_ATTRIB_HAS_XRELEASE 0x0000000002000000 // (1 << 25)
319 #define ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN 0x0000000004000000 // (1 << 26)
323 #define ZYDIS_ATTRIB_HAS_BRANCH_TAKEN 0x0000000008000000 // (1 << 27)
327 #define ZYDIS_ATTRIB_HAS_SEGMENT 0x00000003F0000000
331 #define ZYDIS_ATTRIB_HAS_SEGMENT_CS 0x0000000010000000 // (1 << 28)
335 #define ZYDIS_ATTRIB_HAS_SEGMENT_SS 0x0000000020000000 // (1 << 29)
339 #define ZYDIS_ATTRIB_HAS_SEGMENT_DS 0x0000000040000000 // (1 << 30)
343 #define ZYDIS_ATTRIB_HAS_SEGMENT_ES 0x0000000080000000 // (1 << 31)
347 #define ZYDIS_ATTRIB_HAS_SEGMENT_FS 0x0000000100000000 // (1 << 32)
351 #define ZYDIS_ATTRIB_HAS_SEGMENT_GS 0x0000000200000000 // (1 << 33)
355 #define ZYDIS_ATTRIB_HAS_OPERANDSIZE 0x0000000400000000 // (1 << 34) // TODO: rename
359 #define ZYDIS_ATTRIB_HAS_ADDRESSSIZE 0x0000000800000000 // (1 << 35) // TODO: rename
360 
361 /* ---------------------------------------------------------------------------------------------- */
362 /* R/E/FLAGS info */
363 /* ---------------------------------------------------------------------------------------------- */
364 
368 typedef uint8_t ZydisCPUFlag;
369 
373 typedef uint32_t ZydisCPUFlagMask;
374 
379 {
468 };
469 
473 typedef uint8_t ZydisCPUFlagAction;
474 
479 {
490 };
491 
492 /* ---------------------------------------------------------------------------------------------- */
493 /* SSE/AVX exception-class */
494 /* ---------------------------------------------------------------------------------------------- */
495 
499 typedef uint8_t ZydisExceptionClass;
500 
505 {
507  // TODO: FP Exceptions
551 };
552 
553 /* ---------------------------------------------------------------------------------------------- */
554 /* AVX vector-length */
555 /* ---------------------------------------------------------------------------------------------- */
556 
560 typedef uint16_t ZydisVectorLength;
561 
566 {
575 };
576 
577 /* ---------------------------------------------------------------------------------------------- */
578 /* AVX mask mode */
579 /* ---------------------------------------------------------------------------------------------- */
580 
584 typedef uint8_t ZydisMaskMode;
585 
590 {
605 };
606 
607 /* ---------------------------------------------------------------------------------------------- */
608 /* AVX broadcast-mode */
609 /* ---------------------------------------------------------------------------------------------- */
610 
614 typedef uint8_t ZydisBroadcastMode;
615 
620 {
638 };
639 
640 /* ---------------------------------------------------------------------------------------------- */
641 /* AVX rounding-mode */
642 /* ---------------------------------------------------------------------------------------------- */
643 
647 typedef uint8_t ZydisRoundingMode;
648 
653 {
675 };
676 
677 /* ---------------------------------------------------------------------------------------------- */
678 /* KNC swizzle-mode */
679 /* ---------------------------------------------------------------------------------------------- */
680 
684 typedef uint8_t ZydisSwizzleMode;
685 
690 {
704 };
705 
706 /* ---------------------------------------------------------------------------------------------- */
707 /* KNC conversion-mode */
708 /* ---------------------------------------------------------------------------------------------- */
709 
713 typedef uint8_t ZydisConversionMode;
714 
719 {
730 };
731 
732 /* ---------------------------------------------------------------------------------------------- */
733 /* Decoded instruction */
734 /* ---------------------------------------------------------------------------------------------- */
735 
740 {
752  uint8_t length;
768  uint8_t opcode;
772  uint8_t stackWidth;
776  uint8_t operandWidth;
780  uint8_t addressWidth;
784  uint8_t operandCount;
797  uint64_t instrAddress;
804  uint64_t instrPointer;
808  struct
809  {
821  struct
822  {
830  struct
831  {
844  } mask;
848  struct
849  {
865  struct
866  {
875  struct
876  {
885  struct
886  {
900  } avx;
904  struct
905  {
922  } meta;
927  struct
928  {
932  struct
933  {
934  uint8_t data[ZYDIS_MAX_INSTRUCTION_LENGTH - 1];
935  uint8_t count;
936  uint8_t hasF0;
937  uint8_t hasF3;
938  uint8_t hasF2;
939  uint8_t has2E;
940  uint8_t has36;
941  uint8_t has3E;
942  uint8_t has26;
943  uint8_t has64;
944  uint8_t has65;
945  uint8_t has66;
946  uint8_t has67;
951  struct
952  {
960  uint8_t data[1];
964  uint8_t W;
968  uint8_t R;
972  uint8_t X;
976  uint8_t B;
977  } rex;
981  struct
982  {
990  uint8_t data[3];
994  uint8_t R;
998  uint8_t X;
1002  uint8_t B;
1006  uint8_t m_mmmm;
1010  uint8_t W;
1014  uint8_t vvvv;
1018  uint8_t L;
1022  uint8_t pp;
1023  } xop;
1027  struct
1028  {
1036  uint8_t data[3];
1040  uint8_t R;
1044  uint8_t X;
1048  uint8_t B;
1052  uint8_t m_mmmm;
1056  uint8_t W;
1060  uint8_t vvvv;
1064  uint8_t L;
1068  uint8_t pp;
1069  } vex;
1073  struct
1074  {
1082  uint8_t data[4];
1086  uint8_t R;
1090  uint8_t X;
1094  uint8_t B;
1098  uint8_t R2;
1102  uint8_t mm;
1106  uint8_t W;
1110  uint8_t vvvv;
1114  uint8_t pp;
1118  uint8_t z;
1122  uint8_t L2;
1126  uint8_t L;
1130  uint8_t b;
1134  uint8_t V2;
1138  uint8_t aaa;
1139  } evex;
1143  struct
1144  {
1152  uint8_t data[4];
1156  uint8_t R;
1160  uint8_t X;
1164  uint8_t B;
1168  uint8_t R2;
1172  uint8_t mmmm;
1176  uint8_t W;
1180  uint8_t vvvv;
1184  uint8_t pp;
1188  uint8_t E;
1192  uint8_t SSS;
1196  uint8_t V2;
1200  uint8_t kkk;
1201  } mvex;
1205  struct
1206  {
1208  uint8_t data[1];
1209  uint8_t mod;
1210  uint8_t reg;
1211  uint8_t rm;
1216  struct
1217  {
1219  uint8_t data[1];
1220  uint8_t scale;
1221  uint8_t index;
1222  uint8_t base;
1223  } sib;
1227  struct
1228  {
1232  int64_t value;
1236  uint8_t size;
1241  uint8_t offset;
1242  } disp;
1246  struct
1247  {
1260  union
1261  {
1262  uint64_t u;
1263  int64_t s;
1268  uint8_t size;
1273  uint8_t offset;
1274  } imm[2];
1275  } raw;
1277 
1278 /* ---------------------------------------------------------------------------------------------- */
1279 
1280 /* ============================================================================================== */
1281 
1282 #ifdef __cplusplus
1283 }
1284 #endif
1285 
1286 #endif /* ZYDIS_INSTRUCTIONINFO_H */
Includes and defines some default datatypes.
uint8_t ZydisBool
@briefs Defines the ZydisBool datatype.
Definition: CommonTypes.h:92
uint8_t ZydisBroadcastMode
Defines the ZydisBroadcastMode datatype.
Definition: DecoderTypes.h:614
ZydisConversionModes
Values that represent conversion-modes.
Definition: DecoderTypes.h:719
@ ZYDIS_CONVERSION_MODE_SINT8
Definition: DecoderTypes.h:722
@ ZYDIS_CONVERSION_MODE_INVALID
Definition: DecoderTypes.h:720
@ ZYDIS_CONVERSION_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:729
@ ZYDIS_CONVERSION_MODE_SINT16
Definition: DecoderTypes.h:724
@ ZYDIS_CONVERSION_MODE_UINT16
Definition: DecoderTypes.h:725
@ ZYDIS_CONVERSION_MODE_FLOAT16
Definition: DecoderTypes.h:721
@ ZYDIS_CONVERSION_MODE_UINT8
Definition: DecoderTypes.h:723
uint8_t ZydisExceptionClass
Defines the ZydisExceptionClass datatype.
Definition: DecoderTypes.h:499
ZydisExceptionClasses
Values that represent exception-classes.
Definition: DecoderTypes.h:505
@ ZYDIS_EXCEPTION_CLASS_E5
Definition: DecoderTypes.h:532
@ ZYDIS_EXCEPTION_CLASS_AVX4
Definition: DecoderTypes.h:517
@ ZYDIS_EXCEPTION_CLASS_E1NF
Definition: DecoderTypes.h:525
@ ZYDIS_EXCEPTION_CLASS_AVX7
Definition: DecoderTypes.h:520
@ ZYDIS_EXCEPTION_CLASS_E7NM128
Definition: DecoderTypes.h:537
@ ZYDIS_EXCEPTION_CLASS_AVX11
Definition: DecoderTypes.h:522
@ ZYDIS_EXCEPTION_CLASS_E12NP
Definition: DecoderTypes.h:544
@ ZYDIS_EXCEPTION_CLASS_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:550
@ ZYDIS_EXCEPTION_CLASS_AVX3
Definition: DecoderTypes.h:516
@ ZYDIS_EXCEPTION_CLASS_AVX5
Definition: DecoderTypes.h:518
@ ZYDIS_EXCEPTION_CLASS_SSE2
Definition: DecoderTypes.h:509
@ ZYDIS_EXCEPTION_CLASS_SSE3
Definition: DecoderTypes.h:510
@ ZYDIS_EXCEPTION_CLASS_E10
Definition: DecoderTypes.h:539
@ ZYDIS_EXCEPTION_CLASS_E3
Definition: DecoderTypes.h:528
@ ZYDIS_EXCEPTION_CLASS_E1
Definition: DecoderTypes.h:524
@ ZYDIS_EXCEPTION_CLASS_SSE5
Definition: DecoderTypes.h:512
@ ZYDIS_EXCEPTION_CLASS_SSE7
Definition: DecoderTypes.h:513
@ ZYDIS_EXCEPTION_CLASS_AVX6
Definition: DecoderTypes.h:519
@ ZYDIS_EXCEPTION_CLASS_K20
Definition: DecoderTypes.h:545
@ ZYDIS_EXCEPTION_CLASS_E9NF
Definition: DecoderTypes.h:538
@ ZYDIS_EXCEPTION_CLASS_SSE4
Definition: DecoderTypes.h:511
@ ZYDIS_EXCEPTION_CLASS_E3NF
Definition: DecoderTypes.h:529
@ ZYDIS_EXCEPTION_CLASS_E11
Definition: DecoderTypes.h:541
@ ZYDIS_EXCEPTION_CLASS_E4
Definition: DecoderTypes.h:530
@ ZYDIS_EXCEPTION_CLASS_E12
Definition: DecoderTypes.h:543
@ ZYDIS_EXCEPTION_CLASS_K21
Definition: DecoderTypes.h:546
@ ZYDIS_EXCEPTION_CLASS_E6NF
Definition: DecoderTypes.h:535
@ ZYDIS_EXCEPTION_CLASS_AVX2
Definition: DecoderTypes.h:515
@ ZYDIS_EXCEPTION_CLASS_E2NF
Definition: DecoderTypes.h:527
@ ZYDIS_EXCEPTION_CLASS_SSE1
Definition: DecoderTypes.h:508
@ ZYDIS_EXCEPTION_CLASS_E5NF
Definition: DecoderTypes.h:533
@ ZYDIS_EXCEPTION_CLASS_NONE
Definition: DecoderTypes.h:506
@ ZYDIS_EXCEPTION_CLASS_E6
Definition: DecoderTypes.h:534
@ ZYDIS_EXCEPTION_CLASS_E10NF
Definition: DecoderTypes.h:540
@ ZYDIS_EXCEPTION_CLASS_AVX8
Definition: DecoderTypes.h:521
@ ZYDIS_EXCEPTION_CLASS_E4NF
Definition: DecoderTypes.h:531
@ ZYDIS_EXCEPTION_CLASS_E11NF
Definition: DecoderTypes.h:542
@ ZYDIS_EXCEPTION_CLASS_E2
Definition: DecoderTypes.h:526
@ ZYDIS_EXCEPTION_CLASS_AVX1
Definition: DecoderTypes.h:514
@ ZYDIS_EXCEPTION_CLASS_E7NM
Definition: DecoderTypes.h:536
@ ZYDIS_EXCEPTION_CLASS_AVX12
Definition: DecoderTypes.h:523
uint8_t ZydisRoundingMode
Defines the ZydisRoundingMode datatype.
Definition: DecoderTypes.h:647
ZydisVectorLengths
Values that represent vector-lengths.
Definition: DecoderTypes.h:566
@ ZYDIS_VECTOR_LENGTH_256
Definition: DecoderTypes.h:569
@ ZYDIS_VECTOR_LENGTH_512
Definition: DecoderTypes.h:570
@ ZYDIS_VECTOR_LENGTH_128
Definition: DecoderTypes.h:568
@ ZYDIS_VECTOR_LENGTH_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:574
@ ZYDIS_VECTOR_LENGTH_INVALID
Definition: DecoderTypes.h:567
ZydisMaskModes
Values that represent AVX mask-modes.
Definition: DecoderTypes.h:590
@ ZYDIS_MASK_MODE_INVALID
Definition: DecoderTypes.h:591
@ ZYDIS_MASK_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:604
@ ZYDIS_MASK_MODE_MERGE
The embedded mask register is used as a merge-mask.
Definition: DecoderTypes.h:596
@ ZYDIS_MASK_MODE_ZERO
The embedded mask register is used as a zero-mask.
Definition: DecoderTypes.h:600
uint32_t ZydisCPUFlagMask
Defines the ZydisCPUFlagMask datatype.
Definition: DecoderTypes.h:373
uint64_t ZydisInstructionAttributes
Defines the ZydisInstructionAttributes datatype.
Definition: DecoderTypes.h:185
uint8_t ZydisConversionMode
Defines the ZydisConversionMode datatype.
Definition: DecoderTypes.h:713
ZydisCPUFlags
Values that represent CPU-flags.
Definition: DecoderTypes.h:379
@ ZYDIS_CPUFLAG_ZF
Zero flag.
Definition: DecoderTypes.h:395
@ ZYDIS_CPUFLAG_TF
Trap flag.
Definition: DecoderTypes.h:403
@ ZYDIS_CPUFLAG_C1
FPU condition-code flag 1.
Definition: DecoderTypes.h:455
@ ZYDIS_CPUFLAG_SF
Sign flag.
Definition: DecoderTypes.h:399
@ ZYDIS_CPUFLAG_OF
Overflow flag.
Definition: DecoderTypes.h:415
@ ZYDIS_CPUFLAG_IF
Interrupt enable flag.
Definition: DecoderTypes.h:407
@ ZYDIS_CPUFLAG_VIP
Virtual interrupt pending.
Definition: DecoderTypes.h:443
@ ZYDIS_CPUFLAG_VIF
Virtual interrupt flag.
Definition: DecoderTypes.h:439
@ ZYDIS_CPUFLAG_CF
Carry flag.
Definition: DecoderTypes.h:383
@ ZYDIS_CPUFLAG_PF
Parity flag.
Definition: DecoderTypes.h:387
@ ZYDIS_CPUFLAG_C3
FPU condition-code flag 3.
Definition: DecoderTypes.h:463
@ ZYDIS_CPUFLAG_C2
FPU condition-code flag 2.
Definition: DecoderTypes.h:459
@ ZYDIS_CPUFLAG_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:467
@ ZYDIS_CPUFLAG_C0
FPU condition-code flag 0.
Definition: DecoderTypes.h:451
@ ZYDIS_CPUFLAG_DF
Direction flag.
Definition: DecoderTypes.h:411
@ ZYDIS_CPUFLAG_AC
Alignment check.
Definition: DecoderTypes.h:435
@ ZYDIS_CPUFLAG_VM
Virtual 8086 mode flag.
Definition: DecoderTypes.h:431
@ ZYDIS_CPUFLAG_IOPL
I/O privilege level flag.
Definition: DecoderTypes.h:419
@ ZYDIS_CPUFLAG_RF
Resume flag.
Definition: DecoderTypes.h:427
@ ZYDIS_CPUFLAG_AF
Adjust flag.
Definition: DecoderTypes.h:391
@ ZYDIS_CPUFLAG_NT
Nested task flag.
Definition: DecoderTypes.h:423
@ ZYDIS_CPUFLAG_ID
Able to use CPUID instruction.
Definition: DecoderTypes.h:447
uint8_t ZydisSwizzleMode
Defines the ZydisSwizzleMode datatype.
Definition: DecoderTypes.h:684
uint8_t ZydisMaskMode
Defines the ZydisMaskMode datatype.
Definition: DecoderTypes.h:584
uint16_t ZydisVectorLength
Defines the ZydisVectorLength datatype.
Definition: DecoderTypes.h:560
struct ZydisDecodedOperand_ ZydisDecodedOperand
Defines the ZydisDecodedOperand struct.
uint8_t ZydisCPUFlagAction
Defines the ZydisCPUFlagAction datatype.
Definition: DecoderTypes.h:473
ZydisRoundingModes
Values that represent AVX rounding-modes.
Definition: DecoderTypes.h:653
@ ZYDIS_ROUNDING_MODE_INVALID
Definition: DecoderTypes.h:654
@ ZYDIS_ROUNDING_MODE_RN
Round to nearest.
Definition: DecoderTypes.h:658
@ ZYDIS_ROUNDING_MODE_RZ
Round towards zero.
Definition: DecoderTypes.h:670
@ ZYDIS_ROUNDING_MODE_RD
Round down.
Definition: DecoderTypes.h:662
@ ZYDIS_ROUNDING_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:674
@ ZYDIS_ROUNDING_MODE_RU
Round up.
Definition: DecoderTypes.h:666
uint8_t ZydisCPUFlag
Defines the ZydisCPUFlag datatype.
Definition: DecoderTypes.h:368
ZydisCPUFlagActions
Values that represent CPU-flag actions.
Definition: DecoderTypes.h:479
@ ZYDIS_CPUFLAG_ACTION_SET_0
Definition: DecoderTypes.h:483
@ ZYDIS_CPUFLAG_ACTION_NONE
Definition: DecoderTypes.h:480
@ ZYDIS_CPUFLAG_ACTION_UNDEFINED
Definition: DecoderTypes.h:485
@ ZYDIS_CPUFLAG_ACTION_MODIFIED
Definition: DecoderTypes.h:482
@ ZYDIS_CPUFLAG_ACTION_SET_1
Definition: DecoderTypes.h:484
@ ZYDIS_CPUFLAG_ACTION_TESTED
Definition: DecoderTypes.h:481
@ ZYDIS_CPUFLAG_ACTION_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:489
struct ZydisDecodedInstruction_ ZydisDecodedInstruction
Defines the ZydisDecodedInstruction struct.
ZydisSwizzleModes
Values that represent swizzle-modes.
Definition: DecoderTypes.h:690
@ ZYDIS_SWIZZLE_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:703
@ ZYDIS_SWIZZLE_MODE_DACB
Definition: DecoderTypes.h:695
@ ZYDIS_SWIZZLE_MODE_BADC
Definition: DecoderTypes.h:694
@ ZYDIS_SWIZZLE_MODE_AAAA
Definition: DecoderTypes.h:696
@ ZYDIS_SWIZZLE_MODE_DCBA
Definition: DecoderTypes.h:692
@ ZYDIS_SWIZZLE_MODE_BBBB
Definition: DecoderTypes.h:697
@ ZYDIS_SWIZZLE_MODE_CCCC
Definition: DecoderTypes.h:698
@ ZYDIS_SWIZZLE_MODE_DDDD
Definition: DecoderTypes.h:699
@ ZYDIS_SWIZZLE_MODE_CDAB
Definition: DecoderTypes.h:693
@ ZYDIS_SWIZZLE_MODE_INVALID
Definition: DecoderTypes.h:691
ZydisBroadcastModes
Values that represent AVX broadcast-modes.
Definition: DecoderTypes.h:620
@ ZYDIS_BROADCAST_MODE_1_TO_8
Definition: DecoderTypes.h:624
@ ZYDIS_BROADCAST_MODE_INVALID
Definition: DecoderTypes.h:621
@ ZYDIS_BROADCAST_MODE_1_TO_2
Definition: DecoderTypes.h:622
@ ZYDIS_BROADCAST_MODE_1_TO_64
Definition: DecoderTypes.h:627
@ ZYDIS_BROADCAST_MODE_2_TO_8
Definition: DecoderTypes.h:629
@ ZYDIS_BROADCAST_MODE_4_TO_16
Definition: DecoderTypes.h:632
@ ZYDIS_BROADCAST_MODE_4_TO_8
Definition: DecoderTypes.h:631
@ ZYDIS_BROADCAST_MODE_1_TO_16
Definition: DecoderTypes.h:625
@ ZYDIS_BROADCAST_MODE_1_TO_4
Definition: DecoderTypes.h:623
@ ZYDIS_BROADCAST_MODE_2_TO_4
Definition: DecoderTypes.h:628
@ ZYDIS_BROADCAST_MODE_2_TO_16
Definition: DecoderTypes.h:630
@ ZYDIS_BROADCAST_MODE_MAX_VALUE
Maximum value of this enum.
Definition: DecoderTypes.h:637
@ ZYDIS_BROADCAST_MODE_1_TO_32
Definition: DecoderTypes.h:626
@ ZYDIS_BROADCAST_MODE_8_TO_16
Definition: DecoderTypes.h:633
uint8_t ZydisISAExt
Defines the ZydisISAExt datatype.
Definition: EnumISAExt.h:4
uint8_t ZydisISASet
Defines the ZydisISASet datatype.
Definition: EnumISASet.h:4
uint8_t ZydisInstructionCategory
Defines the ZydisInstructionCategory datatype.
Definition: EnumInstructionCategory.h:4
uint16_t ZydisMnemonic
Defines the ZydisMnemonic datatype.
Definition: EnumMnemonic.h:4
Mnemonic constant definitions and helper functions.
Utility functions and constants for registers.
uint8_t ZydisRegister
Defines the ZydisRegister datatype.
Definition: Register.h:54
Defines decoder/encoder-shared macros and types.
uint8_t ZydisMachineMode
Defines the ZydisMachineMode datatype.
Definition: SharedTypes.h:65
uint16_t ZydisElementSize
Defines the ZydisElementSize datatype.
Definition: SharedTypes.h:153
uint8_t ZydisOperandAction
Defines the ZydisOperandAction datatype.
Definition: SharedTypes.h:287
uint8_t ZydisInstructionEncoding
Defines the ZydisInstructionEncoding datatype.
Definition: SharedTypes.h:350
#define ZYDIS_MAX_INSTRUCTION_LENGTH
Definition: SharedTypes.h:49
uint8_t ZydisOpcodeMap
Defines the ZydisOpcodeMap map.
Definition: SharedTypes.h:395
uint8_t ZydisOperandVisibility
Defines the ZydisOperandVisibility datatype.
Definition: SharedTypes.h:254
#define ZYDIS_MAX_OPERAND_COUNT
Definition: SharedTypes.h:50
uint8_t ZydisElementType
Defines the ZydisElementType datatype.
Definition: SharedTypes.h:131
uint8_t ZydisOperandType
Defines the ZydisOperandType datatype.
Definition: SharedTypes.h:162
uint8_t ZydisOperandEncoding
Defines the ZydisOperandEncoding datatype.
Definition: SharedTypes.h:202
Defines the ZydisDecodedInstruction struct.
Definition: DecoderTypes.h:740
uint8_t has2E
Definition: DecoderTypes.h:939
uint8_t rm
Definition: DecoderTypes.h:1211
struct ZydisDecodedInstruction_::@9::@18 vex
Detailed info about the VEX-prefix.
ZydisConversionMode mode
The AVX data-conversion mode (MVEX only).
Definition: DecoderTypes.h:890
int64_t s
Definition: DecoderTypes.h:1263
ZydisMnemonic mnemonic
The instruction-mnemonic.
Definition: DecoderTypes.h:748
uint8_t SSS
Swizzle/broadcast/up-convert/down-convert/static-rounding controls.
Definition: DecoderTypes.h:1192
struct ZydisDecodedInstruction_::@9::@23 disp
Detailed info about displacement-bytes.
uint8_t count
Definition: DecoderTypes.h:935
struct ZydisDecodedInstruction_::@9::@24 imm[2]
Detailed info about immediate-bytes.
ZydisRegister reg
The mask register.
Definition: DecoderTypes.h:839
ZydisCPUFlagAction action
The CPU-flag action.
Definition: DecoderTypes.h:816
uint8_t hasF3
Definition: DecoderTypes.h:937
ZydisExceptionClass exceptionClass
The exception class.
Definition: DecoderTypes.h:921
struct ZydisDecodedInstruction_::@9::@15 prefixes
Detailed info about the legacy prefixes.
uint8_t has64
Definition: DecoderTypes.h:943
uint8_t R2
High-16 register specifier modifier (inverted).
Definition: DecoderTypes.h:1098
struct ZydisDecodedInstruction_::@7 avx
Extended info for AVX instructions.
uint8_t addressWidth
The effective address width.
Definition: DecoderTypes.h:780
uint8_t aaa
Embedded opmask register specifier.
Definition: DecoderTypes.h:1138
uint8_t b
Broadcast/RC/SAE Context.
Definition: DecoderTypes.h:1130
ZydisBroadcastMode mode
The AVX broadcast-mode.
Definition: DecoderTypes.h:860
struct ZydisDecodedInstruction_::@9::@21 modrm
Detailed info about the ModRM-byte.
uint8_t E
Non-temporal/eviction hint.
Definition: DecoderTypes.h:1188
uint8_t W
64-bit operand-size promotion.
Definition: DecoderTypes.h:964
uint8_t opcode
The instruction-opcode.
Definition: DecoderTypes.h:768
struct ZydisDecodedInstruction_::@7::@13 swizzle
Contains info about the AVX register-swizzle (MVEX only).
uint8_t scale
Definition: DecoderTypes.h:1220
struct ZydisDecodedInstruction_::@6 accessedFlags[ZYDIS_CPUFLAG_MAX_VALUE+1]
Information about accessed CPU flags.
uint8_t mmmm
Opcode-map specifier.
Definition: DecoderTypes.h:1172
uint8_t has3E
Definition: DecoderTypes.h:941
struct ZydisDecodedInstruction_::@7::@14 conversion
Contains info about the AVX data-conversion (MVEX only).
uint8_t L2
Vector-length specifier or rounding-control (most significant bit).
Definition: DecoderTypes.h:1122
ZydisSwizzleMode mode
The AVX register-swizzle mode (MVEX only).
Definition: DecoderTypes.h:880
uint8_t operandWidth
The effective operand width.
Definition: DecoderTypes.h:776
struct ZydisDecodedInstruction_::@8 meta
Meta info.
ZydisBool isDecoded
TRUE if the prefix got already decoded.
Definition: DecoderTypes.h:956
ZydisISAExt isaExt
The ISA-set extension.
Definition: DecoderTypes.h:917
struct ZydisDecodedInstruction_::@9 raw
Extended info about different instruction-parts like ModRM, SIB or encoding-prefixes.
uint8_t hasF0
Definition: DecoderTypes.h:936
uint8_t mm
Opcode-map specifier.
Definition: DecoderTypes.h:1102
uint8_t B
Extension of the ModRM.rm, SIB.base, or opcode.reg field.
Definition: DecoderTypes.h:976
struct ZydisDecodedInstruction_::@7::@12 rounding
Contains info about the AVX rounding.
uint8_t mod
Definition: DecoderTypes.h:1209
ZydisVectorLength vectorLength
The AVX vector-length.
Definition: DecoderTypes.h:826
uint8_t operandCount
The number of instruction-operands.
Definition: DecoderTypes.h:784
ZydisInstructionEncoding encoding
The instruction-encoding (default, 3DNow, VEX, EVEX, XOP).
Definition: DecoderTypes.h:760
uint8_t hasF2
Definition: DecoderTypes.h:938
ZydisInstructionAttributes attributes
Instruction attributes.
Definition: DecoderTypes.h:792
struct ZydisDecodedInstruction_::@7::@11 broadcast
Contains info about the AVX broadcast.
ZydisRoundingMode mode
The AVX rounding-mode.
Definition: DecoderTypes.h:870
uint8_t reg
Definition: DecoderTypes.h:1210
ZydisISASet isaSet
The ISA-set.
Definition: DecoderTypes.h:913
struct ZydisDecodedInstruction_::@7::@10 mask
Info about the embedded writemask-register.
uint8_t vvvv
NDS register specifier (inverted).
Definition: DecoderTypes.h:1014
ZydisBool isRelative
Signals, if the immediate value contains a relative offset.
Definition: DecoderTypes.h:1256
uint8_t has26
Definition: DecoderTypes.h:942
ZydisMaskMode mode
The masking mode.
Definition: DecoderTypes.h:835
uint8_t stackWidth
The stack width.
Definition: DecoderTypes.h:772
uint8_t kkk
Embedded opmask register specifier.
Definition: DecoderTypes.h:1200
uint8_t has66
Definition: DecoderTypes.h:945
ZydisBool hasSAE
Signals, if the sae functionality is enabled for the instruction.
Definition: DecoderTypes.h:895
uint8_t offset
The offset of the displacement data, relative to the beginning of the instruction,...
Definition: DecoderTypes.h:1241
uint8_t X
Extension of the SIB.index field.
Definition: DecoderTypes.h:972
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT]
Detailed info for all instruction operands.
Definition: DecoderTypes.h:788
uint8_t index
Definition: DecoderTypes.h:1221
uint64_t instrAddress
The instruction address points at the current instruction (relative to the initial instruction pointe...
Definition: DecoderTypes.h:797
uint8_t length
The length of the decoded instruction.
Definition: DecoderTypes.h:752
uint8_t z
Zeroing/Merging.
Definition: DecoderTypes.h:1118
uint8_t has67
Definition: DecoderTypes.h:946
uint8_t has36
Definition: DecoderTypes.h:940
uint64_t u
Definition: DecoderTypes.h:1262
struct ZydisDecodedInstruction_::@9::@16 rex
Detailed info about the REX-prefix.
int64_t value
The displacement value.
Definition: DecoderTypes.h:1232
ZydisBool isStatic
Signals, if the broadcast is a static broadcast.
Definition: DecoderTypes.h:856
ZydisBool hasEvictionHint
Signals, if the instruction has a memory eviction-hint (MVEX only).
Definition: DecoderTypes.h:899
uint64_t instrPointer
The instruction pointer points at the address of the next instruction (relative to the initial instru...
Definition: DecoderTypes.h:804
uint8_t m_mmmm
Opcode-map specifier.
Definition: DecoderTypes.h:1006
struct ZydisDecodedInstruction_::@9::@19 evex
Detailed info about the EVEX-prefix.
uint8_t base
Definition: DecoderTypes.h:1222
uint8_t R
Extension of the ModRM.reg field.
Definition: DecoderTypes.h:968
ZydisBool isSigned
Signals, if the immediate value is signed.
Definition: DecoderTypes.h:1251
uint8_t V2
High-16 NDS/VIDX register specifier.
Definition: DecoderTypes.h:1134
ZydisOpcodeMap opcodeMap
The opcode-map.
Definition: DecoderTypes.h:764
uint8_t pp
Compressed legacy prefix.
Definition: DecoderTypes.h:1022
uint8_t size
The physical displacement size, in bits.
Definition: DecoderTypes.h:1236
struct ZydisDecodedInstruction_::@9::@20 mvex
Detailed info about the MVEX-prefix.
ZydisBool isControlMask
Signals, if the mask-register is used as a control mask.
Definition: DecoderTypes.h:843
struct ZydisDecodedInstruction_::@9::@22 sib
Detailed info about the SIB-byte.
uint8_t L
Vector-length specifier.
Definition: DecoderTypes.h:1018
struct ZydisDecodedInstruction_::@9::@17 xop
Detailed info about the XOP-prefix.
ZydisMachineMode machineMode
The machine mode used to decode this instruction.
Definition: DecoderTypes.h:744
uint8_t has65
Definition: DecoderTypes.h:944
uint8_t data[ZYDIS_MAX_INSTRUCTION_LENGTH]
The raw bytes of the decoded instruction.
Definition: DecoderTypes.h:756
ZydisInstructionCategory category
The instruction category.
Definition: DecoderTypes.h:909
Defines the ZydisDecodedOperand struct.
Definition: DecoderTypes.h:53
int64_t s
Definition: DecoderTypes.h:169
ZydisBool isAddressGenOnly
Signals, if the memory operand is only used for address generation.
Definition: DecoderTypes.h:109
ZydisOperandAction action
The operand-action.
Definition: DecoderTypes.h:69
uint8_t id
The operand-id.
Definition: DecoderTypes.h:57
struct ZydisDecodedOperand_::@0 reg
Extended info for register-operands.
ZydisOperandEncoding encoding
The operand-encoding.
Definition: DecoderTypes.h:73
ZydisRegister segment
The segment register.
Definition: DecoderTypes.h:113
struct ZydisDecodedOperand_::@2 ptr
Extended info for pointer-operands.
struct ZydisDecodedOperand_::@1::@4 disp
Extended info for memory-operands with displacement.
uint16_t elementCount
The number of elements.
Definition: DecoderTypes.h:89
ZydisRegister base
The base register.
Definition: DecoderTypes.h:117
ZydisOperandVisibility visibility
The visibility of the operand.
Definition: DecoderTypes.h:65
ZydisElementSize elementSize
The size of a single element.
Definition: DecoderTypes.h:85
uint8_t scale
The scale factor.
Definition: DecoderTypes.h:125
ZydisElementType elementType
The element-type.
Definition: DecoderTypes.h:81
uint32_t offset
Definition: DecoderTypes.h:147
ZydisBool isRelative
Signals, if the immediate value contains a relative offset.
Definition: DecoderTypes.h:162
uint16_t segment
Definition: DecoderTypes.h:146
ZydisBool hasDisplacement
Signals, if the displacement value is used.
Definition: DecoderTypes.h:134
uint16_t size
The logical size of the operand (in bits).
Definition: DecoderTypes.h:77
struct ZydisDecodedOperand_::@1 mem
Extended info for memory-operands.
uint64_t u
Definition: DecoderTypes.h:168
int64_t value
The displacement value.
Definition: DecoderTypes.h:138
ZydisRegister index
The index register.
Definition: DecoderTypes.h:121
ZydisBool isSigned
Signals, if the immediate value is signed.
Definition: DecoderTypes.h:157
struct ZydisDecodedOperand_::@3 imm
Extended info for immediate-operands.
ZydisOperandType type
The type of the operand.
Definition: DecoderTypes.h:61
ZydisRegister value
The register value.
Definition: DecoderTypes.h:98