Zydis  v3.2.0
SharedTypes.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_SHAREDTYPES_H
33 #define ZYDIS_SHAREDTYPES_H
34 
35 #include <Zycore/Types.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /* ============================================================================================== */
42 /* Macros */
43 /* ============================================================================================== */
44 
45 /* ---------------------------------------------------------------------------------------------- */
46 /* Constants */
47 /* ---------------------------------------------------------------------------------------------- */
48 
49 #define ZYDIS_MAX_INSTRUCTION_LENGTH 15
50 #define ZYDIS_MAX_OPERAND_COUNT 10
51 
52 /* ---------------------------------------------------------------------------------------------- */
53 
54 /* ============================================================================================== */
55 /* Enums and types */
56 /* ============================================================================================== */
57 
58 /* ---------------------------------------------------------------------------------------------- */
59 /* Machine mode */
60 /* ---------------------------------------------------------------------------------------------- */
61 
65 typedef enum ZydisMachineMode_
66 {
91 
101 
102 /* ---------------------------------------------------------------------------------------------- */
103 /* Address width */
104 /* ---------------------------------------------------------------------------------------------- */
105 
109 typedef enum ZydisAddressWidth_
110 {
114 
124 
125 /* ---------------------------------------------------------------------------------------------- */
126 /* Element type */
127 /* ---------------------------------------------------------------------------------------------- */
128 
132 typedef enum ZydisElementType_
133 {
171 
181 
182 /* ---------------------------------------------------------------------------------------------- */
183 /* Element size */
184 /* ---------------------------------------------------------------------------------------------- */
185 
189 typedef ZyanU16 ZydisElementSize;
190 
191 /* ---------------------------------------------------------------------------------------------- */
192 /* Operand type */
193 /* ---------------------------------------------------------------------------------------------- */
194 
198 typedef enum ZydisOperandType_
199 {
220 
230 
231 /* ---------------------------------------------------------------------------------------------- */
232 /* Operand encoding */
233 /* ---------------------------------------------------------------------------------------------- */
234 
239 {
275 
285 
286 /* ---------------------------------------------------------------------------------------------- */
287 /* Operand visibility */
288 /* ---------------------------------------------------------------------------------------------- */
289 
294 {
308 
317  ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_VISIBILITY_MAX_VALUE)
319 
320 /* ---------------------------------------------------------------------------------------------- */
321 /* Operand action */
322 /* ---------------------------------------------------------------------------------------------- */
323 
328 {
329  /* ------------------------------------------------------------------------------------------ */
330  /* Elemental actions */
331  /* ------------------------------------------------------------------------------------------ */
332 
349 
350  /* ------------------------------------------------------------------------------------------ */
351  /* Combined actions */
352  /* ------------------------------------------------------------------------------------------ */
353 
376 
385 
386  /* ------------------------------------------------------------------------------------------ */
387 
393 
397 typedef ZyanU8 ZydisOperandActions;
398 
399 /* ---------------------------------------------------------------------------------------------- */
400 /* Instruction encoding */
401 /* ---------------------------------------------------------------------------------------------- */
402 
407 {
432 
441  ZYAN_BITS_TO_REPRESENT(ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE)
443 
444 /* ---------------------------------------------------------------------------------------------- */
445 /* Opcode map */
446 /* ---------------------------------------------------------------------------------------------- */
447 
451 typedef enum ZydisOpcodeMap_
452 {
465 
475 
476 /* ---------------------------------------------------------------------------------------------- */
477 
478 /* ============================================================================================== */
479 
480 #ifdef __cplusplus
481 }
482 #endif
483 
484 #endif /* ZYDIS_SHAREDTYPES_H */
ZydisElementType_
Defines the ZydisElementType enum.
Definition: SharedTypes.h:133
@ ZYDIS_ELEMENT_TYPE_LONGBCD
Binary coded decimal value.
Definition: SharedTypes.h:166
@ ZYDIS_ELEMENT_TYPE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:179
@ ZYDIS_ELEMENT_TYPE_UINT
Unsigned integer value.
Definition: SharedTypes.h:142
@ ZYDIS_ELEMENT_TYPE_FLOAT64
64-bit floating point value (double).
Definition: SharedTypes.h:158
@ ZYDIS_ELEMENT_TYPE_INT
Signed integer value.
Definition: SharedTypes.h:146
@ ZYDIS_ELEMENT_TYPE_INVALID
Definition: SharedTypes.h:134
@ ZYDIS_ELEMENT_TYPE_STRUCT
A struct type.
Definition: SharedTypes.h:138
@ ZYDIS_ELEMENT_TYPE_FLOAT16
16-bit floating point value (half).
Definition: SharedTypes.h:150
@ ZYDIS_ELEMENT_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:175
@ ZYDIS_ELEMENT_TYPE_FLOAT32
32-bit floating point value (single).
Definition: SharedTypes.h:154
@ ZYDIS_ELEMENT_TYPE_FLOAT80
80-bit floating point value (extended).
Definition: SharedTypes.h:162
@ ZYDIS_ELEMENT_TYPE_CC
A condition code (e.g.
Definition: SharedTypes.h:170
enum ZydisOperandEncoding_ ZydisOperandEncoding
Defines the ZydisOperandEncoding enum.
ZydisOperandVisibility_
Defines the ZydisOperandVisibility enum.
Definition: SharedTypes.h:294
@ ZYDIS_OPERAND_VISIBILITY_IMPLICIT
The operand is part of the opcode, but listed as an operand.
Definition: SharedTypes.h:303
@ ZYDIS_OPERAND_VISIBILITY_EXPLICIT
The operand is explicitly encoded in the instruction.
Definition: SharedTypes.h:299
@ ZYDIS_OPERAND_VISIBILITY_INVALID
Definition: SharedTypes.h:295
@ ZYDIS_OPERAND_VISIBILITY_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:316
@ ZYDIS_OPERAND_VISIBILITY_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:312
@ ZYDIS_OPERAND_VISIBILITY_HIDDEN
The operand is part of the opcode, and not typically listed as an operand.
Definition: SharedTypes.h:307
ZydisMachineMode_
Defines the ZydisMachineMode enum.
Definition: SharedTypes.h:66
@ ZYDIS_MACHINE_MODE_LONG_COMPAT_16
16 bit protected mode.
Definition: SharedTypes.h:78
@ ZYDIS_MACHINE_MODE_LONG_COMPAT_32
32 bit protected mode.
Definition: SharedTypes.h:74
@ ZYDIS_MACHINE_MODE_REAL_16
16 bit real mode.
Definition: SharedTypes.h:90
@ ZYDIS_MACHINE_MODE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:99
@ ZYDIS_MACHINE_MODE_LEGACY_16
16 bit protected mode.
Definition: SharedTypes.h:86
@ ZYDIS_MACHINE_MODE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:95
@ ZYDIS_MACHINE_MODE_LEGACY_32
32 bit protected mode.
Definition: SharedTypes.h:82
@ ZYDIS_MACHINE_MODE_LONG_64
64 bit mode.
Definition: SharedTypes.h:70
enum ZydisOperandAction_ ZydisOperandAction
Defines the ZydisOperandAction enum.
enum ZydisInstructionEncoding_ ZydisInstructionEncoding
Defines the ZydisInstructionEncoding enum.
ZydisAddressWidth_
Defines the ZydisAddressWidth enum.
Definition: SharedTypes.h:110
@ ZYDIS_ADDRESS_WIDTH_16
Definition: SharedTypes.h:111
@ ZYDIS_ADDRESS_WIDTH_32
Definition: SharedTypes.h:112
@ ZYDIS_ADDRESS_WIDTH_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:118
@ ZYDIS_ADDRESS_WIDTH_64
Definition: SharedTypes.h:113
@ ZYDIS_ADDRESS_WIDTH_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:122
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.
ZydisOperandEncoding_
Defines the ZydisOperandEncoding enum.
Definition: SharedTypes.h:239
@ ZYDIS_OPERAND_ENCODING_MODRM_RM
Definition: SharedTypes.h:242
@ ZYDIS_OPERAND_ENCODING_DISP16_32_64
Definition: SharedTypes.h:251
@ ZYDIS_OPERAND_ENCODING_DISP16
Definition: SharedTypes.h:248
@ ZYDIS_OPERAND_ENCODING_DISP64
Definition: SharedTypes.h:250
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_64
Definition: SharedTypes.h:272
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_64
Definition: SharedTypes.h:265
@ ZYDIS_OPERAND_ENCODING_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:279
@ ZYDIS_OPERAND_ENCODING_DISP16_32_32
Definition: SharedTypes.h:253
@ ZYDIS_OPERAND_ENCODING_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:283
@ ZYDIS_OPERAND_ENCODING_SIMM32
Definition: SharedTypes.h:263
@ ZYDIS_OPERAND_ENCODING_UIMM64
Definition: SharedTypes.h:257
@ ZYDIS_OPERAND_ENCODING_JIMM8
Definition: SharedTypes.h:268
@ ZYDIS_OPERAND_ENCODING_NDSNDD
Definition: SharedTypes.h:244
@ ZYDIS_OPERAND_ENCODING_DISP32_32_64
Definition: SharedTypes.h:252
@ ZYDIS_OPERAND_ENCODING_JIMM16
Definition: SharedTypes.h:269
@ ZYDIS_OPERAND_ENCODING_JIMM32_32_64
Definition: SharedTypes.h:273
@ ZYDIS_OPERAND_ENCODING_IS4
Definition: SharedTypes.h:245
@ ZYDIS_OPERAND_ENCODING_SIMM64
Definition: SharedTypes.h:264
@ ZYDIS_OPERAND_ENCODING_UIMM32
Definition: SharedTypes.h:256
@ ZYDIS_OPERAND_ENCODING_MASK
Definition: SharedTypes.h:246
@ ZYDIS_OPERAND_ENCODING_SIMM16
Definition: SharedTypes.h:262
@ ZYDIS_OPERAND_ENCODING_UIMM32_32_64
Definition: SharedTypes.h:259
@ ZYDIS_OPERAND_ENCODING_UIMM16
Definition: SharedTypes.h:255
@ ZYDIS_OPERAND_ENCODING_UIMM8
Definition: SharedTypes.h:254
@ ZYDIS_OPERAND_ENCODING_DISP32
Definition: SharedTypes.h:249
@ ZYDIS_OPERAND_ENCODING_MODRM_REG
Definition: SharedTypes.h:241
@ ZYDIS_OPERAND_ENCODING_SIMM32_32_64
Definition: SharedTypes.h:266
@ ZYDIS_OPERAND_ENCODING_JIMM64
Definition: SharedTypes.h:271
@ ZYDIS_OPERAND_ENCODING_JIMM32
Definition: SharedTypes.h:270
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_64
Definition: SharedTypes.h:258
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_32
Definition: SharedTypes.h:274
@ ZYDIS_OPERAND_ENCODING_OPCODE
Definition: SharedTypes.h:243
@ ZYDIS_OPERAND_ENCODING_DISP8
Definition: SharedTypes.h:247
@ ZYDIS_OPERAND_ENCODING_NONE
Definition: SharedTypes.h:240
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_32
Definition: SharedTypes.h:267
@ ZYDIS_OPERAND_ENCODING_SIMM8
Definition: SharedTypes.h:261
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_32
Definition: SharedTypes.h:260
ZydisInstructionEncoding_
Defines the ZydisInstructionEncoding enum.
Definition: SharedTypes.h:407
@ ZYDIS_INSTRUCTION_ENCODING_VEX
The instruction uses the VEX-encoding.
Definition: SharedTypes.h:423
@ ZYDIS_INSTRUCTION_ENCODING_3DNOW
The instruction uses the AMD 3DNow-encoding.
Definition: SharedTypes.h:415
@ ZYDIS_INSTRUCTION_ENCODING_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:440
@ ZYDIS_INSTRUCTION_ENCODING_MVEX
The instruction uses the MVEX-encoding.
Definition: SharedTypes.h:431
@ ZYDIS_INSTRUCTION_ENCODING_LEGACY
The instruction uses the legacy encoding.
Definition: SharedTypes.h:411
@ ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:436
@ ZYDIS_INSTRUCTION_ENCODING_EVEX
The instruction uses the EVEX-encoding.
Definition: SharedTypes.h:427
@ ZYDIS_INSTRUCTION_ENCODING_XOP
The instruction uses the AMD XOP-encoding.
Definition: SharedTypes.h:419
ZydisOperandAction_
Defines the ZydisOperandAction enum.
Definition: SharedTypes.h:328
@ ZYDIS_OPERAND_ACTION_CONDWRITE
The operand is conditionally written by the instruction (may write).
Definition: SharedTypes.h:348
@ ZYDIS_OPERAND_ACTION_READWRITE
The operand is read (must read) and written by the instruction (must write).
Definition: SharedTypes.h:357
@ ZYDIS_OPERAND_ACTION_CONDREAD_WRITE
The operand is written (must write) and conditionally read by the instruction (may read).
Definition: SharedTypes.h:374
@ ZYDIS_OPERAND_ACTION_CONDREAD
The operand is conditionally read by the instruction.
Definition: SharedTypes.h:344
@ ZYDIS_OPERAND_ACTION_WRITE
The operand is written by the instruction (must write).
Definition: SharedTypes.h:340
@ ZYDIS_OPERAND_ACTION_MASK_READ
Mask combining all reading access flags.
Definition: SharedTypes.h:380
@ ZYDIS_OPERAND_ACTION_REQUIRED_BITS
The minimum number of bits required to represent all values of this bitset.
Definition: SharedTypes.h:391
@ ZYDIS_OPERAND_ACTION_CONDREAD_CONDWRITE
The operand is conditionally read (may read) and conditionally written by the instruction (may write)...
Definition: SharedTypes.h:362
@ ZYDIS_OPERAND_ACTION_READ
The operand is read by the instruction.
Definition: SharedTypes.h:336
@ ZYDIS_OPERAND_ACTION_READ_CONDWRITE
The operand is read (must read) and conditionally written by the instruction (may write).
Definition: SharedTypes.h:368
@ ZYDIS_OPERAND_ACTION_MASK_WRITE
Mask combining all writing access flags.
Definition: SharedTypes.h:384
ZydisOpcodeMap_
Defines the ZydisOpcodeMap enum.
Definition: SharedTypes.h:452
@ ZYDIS_OPCODE_MAP_XOP9
Definition: SharedTypes.h:463
@ ZYDIS_OPCODE_MAP_MAP7
Definition: SharedTypes.h:460
@ ZYDIS_OPCODE_MAP_0F38
Definition: SharedTypes.h:455
@ ZYDIS_OPCODE_MAP_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:473
@ ZYDIS_OPCODE_MAP_0F
Definition: SharedTypes.h:454
@ ZYDIS_OPCODE_MAP_MAP4
Definition: SharedTypes.h:457
@ ZYDIS_OPCODE_MAP_DEFAULT
Definition: SharedTypes.h:453
@ ZYDIS_OPCODE_MAP_XOP8
Definition: SharedTypes.h:462
@ ZYDIS_OPCODE_MAP_XOPA
Definition: SharedTypes.h:464
@ ZYDIS_OPCODE_MAP_MAP6
Definition: SharedTypes.h:459
@ ZYDIS_OPCODE_MAP_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:469
@ ZYDIS_OPCODE_MAP_MAP5
Definition: SharedTypes.h:458
@ ZYDIS_OPCODE_MAP_0F3A
Definition: SharedTypes.h:456
@ ZYDIS_OPCODE_MAP_0F0F
Definition: SharedTypes.h:461
enum ZydisAddressWidth_ ZydisAddressWidth
Defines the ZydisAddressWidth 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.
ZydisOperandType_
Defines the ZydisOperandType enum.
Definition: SharedTypes.h:199
@ ZYDIS_OPERAND_TYPE_IMMEDIATE
The operand is an immediate operand.
Definition: SharedTypes.h:219
@ ZYDIS_OPERAND_TYPE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:228
@ ZYDIS_OPERAND_TYPE_UNUSED
The operand is not used.
Definition: SharedTypes.h:203
@ ZYDIS_OPERAND_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:224
@ ZYDIS_OPERAND_TYPE_REGISTER
The operand is a register operand.
Definition: SharedTypes.h:207
@ ZYDIS_OPERAND_TYPE_MEMORY
The operand is a memory operand.
Definition: SharedTypes.h:211
@ ZYDIS_OPERAND_TYPE_POINTER
The operand is a pointer operand with a segment:offset lvalue.
Definition: SharedTypes.h:215