Zydis  v2.0.0-alpha2
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 <Zydis/CommonTypes.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 9
51 
52 /* ---------------------------------------------------------------------------------------------- */
53 
54 /* ============================================================================================== */
55 /* Enums and types */
56 /* ============================================================================================== */
57 
58 /* ---------------------------------------------------------------------------------------------- */
59 /* Machine mode */
60 /* ---------------------------------------------------------------------------------------------- */
61 
65 typedef uint8_t ZydisMachineMode;
66 
71 {
101 };
102 
103 /* ---------------------------------------------------------------------------------------------- */
104 /* Address width */
105 /* ---------------------------------------------------------------------------------------------- */
106 
110 typedef uint8_t ZydisAddressWidth;
111 
116 {
122 };
123 
124 /* ---------------------------------------------------------------------------------------------- */
125 /* Element types */
126 /* ---------------------------------------------------------------------------------------------- */
127 
131 typedef uint8_t ZydisElementType;
132 
137 {
148 };
149 
153 typedef uint16_t ZydisElementSize;
154 
155 /* ---------------------------------------------------------------------------------------------- */
156 /* Operand type */
157 /* ---------------------------------------------------------------------------------------------- */
158 
162 typedef uint8_t ZydisOperandType;
163 
168 {
193 };
194 
195 /* ---------------------------------------------------------------------------------------------- */
196 /* Operand encoding */
197 /* ---------------------------------------------------------------------------------------------- */
198 
202 typedef uint8_t ZydisOperandEncoding;
203 
208 {
245 };
246 
247 /* ---------------------------------------------------------------------------------------------- */
248 /* Operand visibility */
249 /* ---------------------------------------------------------------------------------------------- */
250 
254 typedef uint8_t ZydisOperandVisibility;
255 
260 {
278 };
279 
280 /* ---------------------------------------------------------------------------------------------- */
281 /* Operand action */
282 /* ---------------------------------------------------------------------------------------------- */
283 
287 typedef uint8_t ZydisOperandAction;
288 
293 {
323 
336 
341 };
342 
343 /* ---------------------------------------------------------------------------------------------- */
344 /* Instruction encoding */
345 /* ---------------------------------------------------------------------------------------------- */
346 
350 typedef uint8_t ZydisInstructionEncoding;
351 
356 {
386 };
387 
388 /* ---------------------------------------------------------------------------------------------- */
389 /* Opcode map */
390 /* ---------------------------------------------------------------------------------------------- */
391 
395 typedef uint8_t ZydisOpcodeMap;
396 
401 {
411 };
412 
413 /* ---------------------------------------------------------------------------------------------- */
414 
415 /* ============================================================================================== */
416 
417 #ifdef __cplusplus
418 }
419 #endif
420 
421 #endif /* ZYDIS_SHAREDTYPES_H */
Includes and defines some default datatypes.
uint8_t ZydisMachineMode
Defines the ZydisMachineMode datatype.
Definition: SharedTypes.h:65
ZydisOpcodeMaps
Values that represent opcode-maps.
Definition: SharedTypes.h:401
@ ZYDIS_OPCODE_MAP_XOP9
Definition: SharedTypes.h:408
@ ZYDIS_OPCODE_MAP_0F38
Definition: SharedTypes.h:404
@ ZYDIS_OPCODE_MAP_0F
Definition: SharedTypes.h:403
@ ZYDIS_OPCODE_MAP_DEFAULT
Definition: SharedTypes.h:402
@ ZYDIS_OPCODE_MAP_XOP8
Definition: SharedTypes.h:407
@ ZYDIS_OPCODE_MAP_XOPA
Definition: SharedTypes.h:409
@ ZYDIS_OPCODE_MAP_MAX_VALUE
Definition: SharedTypes.h:410
@ ZYDIS_OPCODE_MAP_0F3A
Definition: SharedTypes.h:405
@ ZYDIS_OPCODE_MAP_0F0F
Definition: SharedTypes.h:406
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
uint8_t ZydisOpcodeMap
Defines the ZydisOpcodeMap map.
Definition: SharedTypes.h:395
uint8_t ZydisOperandVisibility
Defines the ZydisOperandVisibility datatype.
Definition: SharedTypes.h:254
ZydisOperandActions
Values that represent operand-actions.
Definition: SharedTypes.h:293
@ ZYDIS_OPERAND_ACTION_CONDWRITE
The operand is conditionally written by the instruction (may write).
Definition: SharedTypes.h:314
@ ZYDIS_OPERAND_ACTION_READWRITE
The operand is read and written by the instruction (must write).
Definition: SharedTypes.h:306
@ ZYDIS_OPERAND_ACTION_CONDREAD_WRITE
The operand is written and conditionally read by the instruction (must write).
Definition: SharedTypes.h:322
@ ZYDIS_OPERAND_ACTION_CONDREAD
The operand is conditionally read by the instruction.
Definition: SharedTypes.h:310
@ ZYDIS_OPERAND_ACTION_WRITE
The operand is written by the instruction (must write).
Definition: SharedTypes.h:302
@ ZYDIS_OPERAND_ACTION_MASK_READ
Mask combining all reading access flags.
Definition: SharedTypes.h:333
@ ZYDIS_OPERAND_ACTION_INVALID
Definition: SharedTypes.h:294
@ ZYDIS_OPERAND_ACTION_READ
The operand is read by the instruction.
Definition: SharedTypes.h:298
@ ZYDIS_OPERAND_ACTION_READ_CONDWRITE
The operand is read and conditionally written by the instruction (may write).
Definition: SharedTypes.h:318
@ ZYDIS_OPERAND_ACTION_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:340
@ ZYDIS_OPERAND_ACTION_MASK_WRITE
Mask combining all writing access flags.
Definition: SharedTypes.h:327
uint8_t ZydisElementType
Defines the ZydisElementType datatype.
Definition: SharedTypes.h:131
ZydisInstructionEncodings
Values that represent instruction-encodings.
Definition: SharedTypes.h:356
@ ZYDIS_INSTRUCTION_ENCODING_VEX
The instruction uses the VEX-encoding.
Definition: SharedTypes.h:373
@ ZYDIS_INSTRUCTION_ENCODING_3DNOW
The instruction uses the AMD 3DNow-encoding.
Definition: SharedTypes.h:365
@ ZYDIS_INSTRUCTION_ENCODING_MVEX
The instruction uses the MVEX-encoding.
Definition: SharedTypes.h:381
@ ZYDIS_INSTRUCTION_ENCODING_INVALID
Definition: SharedTypes.h:357
@ ZYDIS_INSTRUCTION_ENCODING_DEFAULT
The instruction uses the default encoding.
Definition: SharedTypes.h:361
@ ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:385
@ ZYDIS_INSTRUCTION_ENCODING_EVEX
The instruction uses the EVEX-encoding.
Definition: SharedTypes.h:377
@ ZYDIS_INSTRUCTION_ENCODING_XOP
The instruction uses the AMD XOP-encoding.
Definition: SharedTypes.h:369
ZydisElementTypes
Values that represent element-types.
Definition: SharedTypes.h:137
@ ZYDIS_ELEMENT_TYPE_LONGBCD
Definition: SharedTypes.h:146
@ ZYDIS_ELEMENT_TYPE_UINT
Definition: SharedTypes.h:140
@ ZYDIS_ELEMENT_TYPE_FLOAT64
Definition: SharedTypes.h:144
@ ZYDIS_ELEMENT_TYPE_INT
Definition: SharedTypes.h:141
@ ZYDIS_ELEMENT_TYPE_INVALID
Definition: SharedTypes.h:138
@ ZYDIS_ELEMENT_TYPE_STRUCT
Definition: SharedTypes.h:139
@ ZYDIS_ELEMENT_TYPE_FLOAT16
Definition: SharedTypes.h:142
@ ZYDIS_ELEMENT_TYPE_MAX_VALUE
Definition: SharedTypes.h:147
@ ZYDIS_ELEMENT_TYPE_FLOAT32
Definition: SharedTypes.h:143
@ ZYDIS_ELEMENT_TYPE_FLOAT80
Definition: SharedTypes.h:145
ZydisAddressWidths
Values that represent address widths.
Definition: SharedTypes.h:116
@ ZYDIS_ADDRESS_WIDTH_INVALID
Definition: SharedTypes.h:117
@ ZYDIS_ADDRESS_WIDTH_16
Definition: SharedTypes.h:118
@ ZYDIS_ADDRESS_WIDTH_32
Definition: SharedTypes.h:119
@ ZYDIS_ADDRESS_WIDTH_MAX_VALUE
Definition: SharedTypes.h:121
@ ZYDIS_ADDRESS_WIDTH_64
Definition: SharedTypes.h:120
ZydisOperandEncodings
Values that represent operand-encodings.
Definition: SharedTypes.h:208
@ ZYDIS_OPERAND_ENCODING_MODRM_RM
Definition: SharedTypes.h:211
@ ZYDIS_OPERAND_ENCODING_DISP16_32_64
Definition: SharedTypes.h:220
@ ZYDIS_OPERAND_ENCODING_DISP16
Definition: SharedTypes.h:217
@ ZYDIS_OPERAND_ENCODING_DISP64
Definition: SharedTypes.h:219
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_64
Definition: SharedTypes.h:241
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_64
Definition: SharedTypes.h:234
@ ZYDIS_OPERAND_ENCODING_MAX_VALUE
Definition: SharedTypes.h:244
@ ZYDIS_OPERAND_ENCODING_DISP16_32_32
Definition: SharedTypes.h:222
@ ZYDIS_OPERAND_ENCODING_SIMM32
Definition: SharedTypes.h:232
@ ZYDIS_OPERAND_ENCODING_UIMM64
Definition: SharedTypes.h:226
@ ZYDIS_OPERAND_ENCODING_JIMM8
Definition: SharedTypes.h:237
@ ZYDIS_OPERAND_ENCODING_NDSNDD
Definition: SharedTypes.h:213
@ ZYDIS_OPERAND_ENCODING_DISP32_32_64
Definition: SharedTypes.h:221
@ ZYDIS_OPERAND_ENCODING_JIMM16
Definition: SharedTypes.h:238
@ ZYDIS_OPERAND_ENCODING_JIMM32_32_64
Definition: SharedTypes.h:242
@ ZYDIS_OPERAND_ENCODING_IS4
Definition: SharedTypes.h:214
@ ZYDIS_OPERAND_ENCODING_SIMM64
Definition: SharedTypes.h:233
@ ZYDIS_OPERAND_ENCODING_UIMM32
Definition: SharedTypes.h:225
@ ZYDIS_OPERAND_ENCODING_MASK
Definition: SharedTypes.h:215
@ ZYDIS_OPERAND_ENCODING_SIMM16
Definition: SharedTypes.h:231
@ ZYDIS_OPERAND_ENCODING_UIMM32_32_64
Definition: SharedTypes.h:228
@ ZYDIS_OPERAND_ENCODING_UIMM16
Definition: SharedTypes.h:224
@ ZYDIS_OPERAND_ENCODING_UIMM8
Definition: SharedTypes.h:223
@ ZYDIS_OPERAND_ENCODING_DISP32
Definition: SharedTypes.h:218
@ ZYDIS_OPERAND_ENCODING_MODRM_REG
Definition: SharedTypes.h:210
@ ZYDIS_OPERAND_ENCODING_SIMM32_32_64
Definition: SharedTypes.h:235
@ ZYDIS_OPERAND_ENCODING_JIMM64
Definition: SharedTypes.h:240
@ ZYDIS_OPERAND_ENCODING_JIMM32
Definition: SharedTypes.h:239
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_64
Definition: SharedTypes.h:227
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_32
Definition: SharedTypes.h:243
@ ZYDIS_OPERAND_ENCODING_OPCODE
Definition: SharedTypes.h:212
@ ZYDIS_OPERAND_ENCODING_DISP8
Definition: SharedTypes.h:216
@ ZYDIS_OPERAND_ENCODING_NONE
Definition: SharedTypes.h:209
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_32
Definition: SharedTypes.h:236
@ ZYDIS_OPERAND_ENCODING_SIMM8
Definition: SharedTypes.h:230
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_32
Definition: SharedTypes.h:229
ZydisOperandTypes
Values that represent operand-types.
Definition: SharedTypes.h:168
@ ZYDIS_OPERAND_TYPE_IMMEDIATE
The operand is an immediate operand.
Definition: SharedTypes.h:188
@ ZYDIS_OPERAND_TYPE_UNUSED
The operand is not used.
Definition: SharedTypes.h:172
@ ZYDIS_OPERAND_TYPE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:192
@ ZYDIS_OPERAND_TYPE_REGISTER
The operand is a register operand.
Definition: SharedTypes.h:176
@ ZYDIS_OPERAND_TYPE_MEMORY
The operand is a memory operand.
Definition: SharedTypes.h:180
@ ZYDIS_OPERAND_TYPE_POINTER
The operand is a pointer operand with a segment:offset lvalue.
Definition: SharedTypes.h:184
ZydisOperandVisibilities
Values that represent operand-visibilities.
Definition: SharedTypes.h:260
@ ZYDIS_OPERAND_VISIBILITY_IMPLICIT
The operand is part of the opcode, but listed as an operand.
Definition: SharedTypes.h:269
@ ZYDIS_OPERAND_VISIBILITY_EXPLICIT
The operand is explicitly encoded in the instruction.
Definition: SharedTypes.h:265
@ ZYDIS_OPERAND_VISIBILITY_INVALID
Definition: SharedTypes.h:261
@ ZYDIS_OPERAND_VISIBILITY_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:277
@ ZYDIS_OPERAND_VISIBILITY_HIDDEN
The operand is part of the opcode, and not typically listed as an operand.
Definition: SharedTypes.h:273
uint8_t ZydisOperandType
Defines the ZydisOperandType datatype.
Definition: SharedTypes.h:162
uint8_t ZydisOperandEncoding
Defines the ZydisOperandEncoding datatype.
Definition: SharedTypes.h:202
uint8_t ZydisAddressWidth
Defines the ZydisAddressWidth datatype.
Definition: SharedTypes.h:110
ZydisMachineModes
Values that represent machine modes.
Definition: SharedTypes.h:71
@ ZYDIS_MACHINE_MODE_LONG_COMPAT_16
16 bit protected mode.
Definition: SharedTypes.h:84
@ ZYDIS_MACHINE_MODE_LONG_COMPAT_32
32 bit protected mode.
Definition: SharedTypes.h:80
@ ZYDIS_MACHINE_MODE_REAL_16
16 bit real mode.
Definition: SharedTypes.h:96
@ ZYDIS_MACHINE_MODE_LEGACY_16
16 bit protected mode.
Definition: SharedTypes.h:92
@ ZYDIS_MACHINE_MODE_MAX_VALUE
Maximum value of this enum.
Definition: SharedTypes.h:100
@ ZYDIS_MACHINE_MODE_LEGACY_32
32 bit protected mode.
Definition: SharedTypes.h:88
@ ZYDIS_MACHINE_MODE_LONG_64
64 bit mode.
Definition: SharedTypes.h:76
@ ZYDIS_MACHINE_MODE_INVALID
Definition: SharedTypes.h:72