Zydis  v3.0.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 {
111  ZYDIS_ADDRESS_WIDTH_16,
112  ZYDIS_ADDRESS_WIDTH_32,
113  ZYDIS_ADDRESS_WIDTH_64,
114 
118  ZYDIS_ADDRESS_WIDTH_MAX_VALUE = ZYDIS_ADDRESS_WIDTH_64,
124 
125 /* ---------------------------------------------------------------------------------------------- */
126 /* Element type */
127 /* ---------------------------------------------------------------------------------------------- */
128 
132 typedef enum ZydisElementType_
133 {
134  ZYDIS_ELEMENT_TYPE_INVALID,
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 {
240  ZYDIS_OPERAND_ENCODING_NONE,
241  ZYDIS_OPERAND_ENCODING_MODRM_REG,
242  ZYDIS_OPERAND_ENCODING_MODRM_RM,
243  ZYDIS_OPERAND_ENCODING_OPCODE,
244  ZYDIS_OPERAND_ENCODING_NDSNDD,
245  ZYDIS_OPERAND_ENCODING_IS4,
246  ZYDIS_OPERAND_ENCODING_MASK,
247  ZYDIS_OPERAND_ENCODING_DISP8,
248  ZYDIS_OPERAND_ENCODING_DISP16,
249  ZYDIS_OPERAND_ENCODING_DISP32,
250  ZYDIS_OPERAND_ENCODING_DISP64,
251  ZYDIS_OPERAND_ENCODING_DISP16_32_64,
252  ZYDIS_OPERAND_ENCODING_DISP32_32_64,
253  ZYDIS_OPERAND_ENCODING_DISP16_32_32,
254  ZYDIS_OPERAND_ENCODING_UIMM8,
255  ZYDIS_OPERAND_ENCODING_UIMM16,
256  ZYDIS_OPERAND_ENCODING_UIMM32,
257  ZYDIS_OPERAND_ENCODING_UIMM64,
258  ZYDIS_OPERAND_ENCODING_UIMM16_32_64,
259  ZYDIS_OPERAND_ENCODING_UIMM32_32_64,
260  ZYDIS_OPERAND_ENCODING_UIMM16_32_32,
261  ZYDIS_OPERAND_ENCODING_SIMM8,
262  ZYDIS_OPERAND_ENCODING_SIMM16,
263  ZYDIS_OPERAND_ENCODING_SIMM32,
264  ZYDIS_OPERAND_ENCODING_SIMM64,
265  ZYDIS_OPERAND_ENCODING_SIMM16_32_64,
266  ZYDIS_OPERAND_ENCODING_SIMM32_32_64,
267  ZYDIS_OPERAND_ENCODING_SIMM16_32_32,
268  ZYDIS_OPERAND_ENCODING_JIMM8,
269  ZYDIS_OPERAND_ENCODING_JIMM16,
270  ZYDIS_OPERAND_ENCODING_JIMM32,
271  ZYDIS_OPERAND_ENCODING_JIMM64,
272  ZYDIS_OPERAND_ENCODING_JIMM16_32_64,
273  ZYDIS_OPERAND_ENCODING_JIMM32_32_64,
274  ZYDIS_OPERAND_ENCODING_JIMM16_32_32,
275 
279  ZYDIS_OPERAND_ENCODING_MAX_VALUE = ZYDIS_OPERAND_ENCODING_JIMM16_32_32,
285 
286 /* ---------------------------------------------------------------------------------------------- */
287 /* Operand visibility */
288 /* ---------------------------------------------------------------------------------------------- */
289 
294 {
295  ZYDIS_OPERAND_VISIBILITY_INVALID,
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 {
453  ZYDIS_OPCODE_MAP_DEFAULT,
454  ZYDIS_OPCODE_MAP_0F,
455  ZYDIS_OPCODE_MAP_0F38,
456  ZYDIS_OPCODE_MAP_0F3A,
457  ZYDIS_OPCODE_MAP_0F0F,
458  ZYDIS_OPCODE_MAP_XOP8,
459  ZYDIS_OPCODE_MAP_XOP9,
460  ZYDIS_OPCODE_MAP_XOPA,
461 
465  ZYDIS_OPCODE_MAP_MAX_VALUE = ZYDIS_OPCODE_MAP_XOPA,
471 
472 /* ---------------------------------------------------------------------------------------------- */
473 
474 /* ============================================================================================== */
475 
476 #ifdef __cplusplus
477 }
478 #endif
479 
480 #endif /* ZYDIS_SHAREDTYPES_H */
ZydisMachineMode_
Defines the ZydisMachineMode enum.
Definition: SharedTypes.h:65
A condition code (e.g. used by CMPPD, VCMPPD, ...).
Definition: SharedTypes.h:170
The operand is explicitly encoded in the instruction.
Definition: SharedTypes.h:299
The instruction uses the EVEX-encoding.
Definition: SharedTypes.h:427
16-bit floating point value (half).
Definition: SharedTypes.h:150
64-bit floating point value (double).
Definition: SharedTypes.h:158
The operand is conditionally read by the instruction.
Definition: SharedTypes.h:344
Mask combining all writing access flags.
Definition: SharedTypes.h:384
The operand is an immediate operand.
Definition: SharedTypes.h:219
enum ZydisMachineMode_ ZydisMachineMode
Defines the ZydisMachineMode enum.
Maximum value of this enum.
Definition: SharedTypes.h:175
Maximum value of this enum.
Definition: SharedTypes.h:436
16 bit protected mode.
Definition: SharedTypes.h:78
Maximum value of this enum.
Definition: SharedTypes.h:279
enum ZydisOperandAction_ ZydisOperandAction
Defines the ZydisOperandAction enum.
ZydisOperandAction_
Defines the ZydisOperandAction enum.
Definition: SharedTypes.h:327
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:316
Maximum value of this enum.
Definition: SharedTypes.h:224
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:440
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:122
ZydisOperandType_
Defines the ZydisOperandType enum.
Definition: SharedTypes.h:198
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:228
Signed integer value.
Definition: SharedTypes.h:146
The operand is not used.
Definition: SharedTypes.h:203
Unsigned integer value.
Definition: SharedTypes.h:142
enum ZydisOperandEncoding_ ZydisOperandEncoding
Defines the ZydisOperandEncoding enum.
The operand is written by the instruction (must write).
Definition: SharedTypes.h:340
The operand is read by the instruction.
Definition: SharedTypes.h:336
64 bit mode.
Definition: SharedTypes.h:70
enum ZydisOperandType_ ZydisOperandType
Defines the ZydisOperandType enum.
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:99
The operand is conditionally written by the instruction (may write).
Definition: SharedTypes.h:348
32-bit floating point value (single).
Definition: SharedTypes.h:154
The operand is part of the opcode, but listed as an operand.
Definition: SharedTypes.h:303
A struct type.
Definition: SharedTypes.h:138
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:179
The instruction uses the AMD 3DNow-encoding.
Definition: SharedTypes.h:415
Maximum value of this enum.
Definition: SharedTypes.h:95
The operand is a register operand.
Definition: SharedTypes.h:207
The operand is read (must read) and written by the instruction (must write).
Definition: SharedTypes.h:357
32 bit protected mode.
Definition: SharedTypes.h:82
Maximum value of this enum.
Definition: SharedTypes.h:118
enum ZydisElementType_ ZydisElementType
Defines the ZydisElementType enum.
The instruction uses the AMD XOP-encoding.
Definition: SharedTypes.h:419
The operand is written (must write) and conditionally read by the instruction (may read)...
Definition: SharedTypes.h:374
16 bit real mode.
Definition: SharedTypes.h:90
ZydisOperandEncoding_
Defines the ZydisOperandEncoding enum.
Definition: SharedTypes.h:238
enum ZydisOperandVisibility_ ZydisOperandVisibility
Defines the ZydisOperandVisibility enum.
enum ZydisInstructionEncoding_ ZydisInstructionEncoding
Defines the ZydisInstructionEncoding enum.
enum ZydisOpcodeMap_ ZydisOpcodeMap
Defines the ZydisOpcodeMap enum.
The operand is read (must read) and conditionally written by the instruction (may write)...
Definition: SharedTypes.h:368
The operand is conditionally read (may read) and conditionally written by the instruction (may write)...
Definition: SharedTypes.h:362
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:469
Maximum value of this enum.
Definition: SharedTypes.h:465
The operand is part of the opcode, and not typically listed as an operand.
Definition: SharedTypes.h:307
16 bit protected mode.
Definition: SharedTypes.h:86
80-bit floating point value (extended).
Definition: SharedTypes.h:162
ZydisOperandVisibility_
Defines the ZydisOperandVisibility enum.
Definition: SharedTypes.h:293
ZydisAddressWidth_
Defines the ZydisAddressWidth enum.
Definition: SharedTypes.h:109
The operand is a pointer operand with a segment:offset lvalue.
Definition: SharedTypes.h:215
ZydisInstructionEncoding_
Defines the ZydisInstructionEncoding enum.
Definition: SharedTypes.h:406
The instruction uses the MVEX-encoding.
Definition: SharedTypes.h:431
Maximum value of this enum.
Definition: SharedTypes.h:312
The instruction uses the VEX-encoding.
Definition: SharedTypes.h:423
The minimum number of bits required to represent all values of this bitset.
Definition: SharedTypes.h:391
The instruction uses the legacy encoding.
Definition: SharedTypes.h:411
ZydisElementType_
Defines the ZydisElementType enum.
Definition: SharedTypes.h:132
enum ZydisAddressWidth_ ZydisAddressWidth
Defines the ZydisAddressWidth enum.
ZyanU16 ZydisElementSize
Defines the ZydisElementSize datatype.
Definition: SharedTypes.h:189
Binary coded decimal value.
Definition: SharedTypes.h:166
32 bit protected mode.
Definition: SharedTypes.h:74
ZydisOpcodeMap_
Defines the ZydisOpcodeMap enum.
Definition: SharedTypes.h:451
The minimum number of bits required to represent all values of this enum.
Definition: SharedTypes.h:283
The operand is a memory operand.
Definition: SharedTypes.h:211
Mask combining all reading access flags.
Definition: SharedTypes.h:380
ZyanU8 ZydisOperandActions
Defines the ZydisOperandActions data-type.
Definition: SharedTypes.h:397