Zydis  v2.0.0-alpha1
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 {
97 };
98 
99 /* ---------------------------------------------------------------------------------------------- */
100 /* Address width */
101 /* ---------------------------------------------------------------------------------------------- */
102 
106 typedef uint8_t ZydisAddressWidth;
107 
112 {
117 };
118 
119 /* ---------------------------------------------------------------------------------------------- */
120 /* Element types */
121 /* ---------------------------------------------------------------------------------------------- */
122 
126 typedef uint8_t ZydisElementType;
127 
132 {
142 };
143 
147 typedef uint16_t ZydisElementSize;
148 
149 /* ---------------------------------------------------------------------------------------------- */
150 /* Operand type */
151 /* ---------------------------------------------------------------------------------------------- */
152 
156 typedef uint8_t ZydisOperandType;
157 
162 {
183 };
184 
185 /* ---------------------------------------------------------------------------------------------- */
186 /* Operand encoding */
187 /* ---------------------------------------------------------------------------------------------- */
188 
192 typedef uint8_t ZydisOperandEncoding;
193 
198 {
234 };
235 
236 /* ---------------------------------------------------------------------------------------------- */
237 /* Operand visibility */
238 /* ---------------------------------------------------------------------------------------------- */
239 
243 typedef uint8_t ZydisOperandVisibility;
244 
249 {
263 };
264 
265 /* ---------------------------------------------------------------------------------------------- */
266 /* Operand action */
267 /* ---------------------------------------------------------------------------------------------- */
268 
272 typedef uint8_t ZydisOperandAction;
273 
278 {
308 };
309 
310 /* ---------------------------------------------------------------------------------------------- */
311 /* Instruction encoding */
312 /* ---------------------------------------------------------------------------------------------- */
313 
317 typedef uint8_t ZydisInstructionEncoding;
318 
323 {
349 };
350 
351 /* ---------------------------------------------------------------------------------------------- */
352 /* Opcode map */
353 /* ---------------------------------------------------------------------------------------------- */
354 
358 typedef uint8_t ZydisOpcodeMap;
359 
364 {
373 };
374 
375 /* ---------------------------------------------------------------------------------------------- */
376 
377 /* ============================================================================================== */
378 
379 #ifdef __cplusplus
380 }
381 #endif
382 
383 #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:364
@ ZYDIS_OPCODE_MAP_XOP9
Definition: SharedTypes.h:371
@ ZYDIS_OPCODE_MAP_0F38
Definition: SharedTypes.h:367
@ ZYDIS_OPCODE_MAP_0F
Definition: SharedTypes.h:366
@ ZYDIS_OPCODE_MAP_DEFAULT
Definition: SharedTypes.h:365
@ ZYDIS_OPCODE_MAP_XOP8
Definition: SharedTypes.h:370
@ ZYDIS_OPCODE_MAP_XOPA
Definition: SharedTypes.h:372
@ ZYDIS_OPCODE_MAP_0F3A
Definition: SharedTypes.h:368
@ ZYDIS_OPCODE_MAP_0F0F
Definition: SharedTypes.h:369
uint16_t ZydisElementSize
Defines the ZydisElementSize datatype.
Definition: SharedTypes.h:147
uint8_t ZydisOperandAction
Defines the ZydisOperandAction datatype.
Definition: SharedTypes.h:272
uint8_t ZydisInstructionEncoding
Defines the ZydisInstructionEncoding datatype.
Definition: SharedTypes.h:317
uint8_t ZydisOpcodeMap
Defines the ZydisOpcodeMap map.
Definition: SharedTypes.h:358
uint8_t ZydisOperandVisibility
Defines the ZydisOperandVisibility datatype.
Definition: SharedTypes.h:243
ZydisOperandActions
Values that represent operand-actions.
Definition: SharedTypes.h:278
@ ZYDIS_OPERAND_ACTION_CONDWRITE
The operand is conditionally written by the instruction (may write).
Definition: SharedTypes.h:299
@ ZYDIS_OPERAND_ACTION_READWRITE
The operand is read and written by the instruction (must write).
Definition: SharedTypes.h:291
@ ZYDIS_OPERAND_ACTION_CONDREAD_WRITE
The operand is written and conditionally read by the instruction (must write).
Definition: SharedTypes.h:307
@ ZYDIS_OPERAND_ACTION_CONDREAD
The operand is conditionally read by the instruction.
Definition: SharedTypes.h:295
@ ZYDIS_OPERAND_ACTION_WRITE
The operand is written by the instruction (must write).
Definition: SharedTypes.h:287
@ ZYDIS_OPERAND_ACTION_INVALID
Definition: SharedTypes.h:279
@ ZYDIS_OPERAND_ACTION_READ
The operand is read by the instruction.
Definition: SharedTypes.h:283
@ ZYDIS_OPERAND_ACTION_READ_CONDWRITE
The operand is read and conditionally written by the instruction (may write).
Definition: SharedTypes.h:303
uint8_t ZydisElementType
Defines the ZydisElementType datatype.
Definition: SharedTypes.h:126
ZydisInstructionEncodings
Values that represent instruction-encodings.
Definition: SharedTypes.h:323
@ ZYDIS_INSTRUCTION_ENCODING_VEX
The instruction uses the VEX-encoding.
Definition: SharedTypes.h:340
@ ZYDIS_INSTRUCTION_ENCODING_3DNOW
The instruction uses the AMD 3DNow-encoding.
Definition: SharedTypes.h:332
@ ZYDIS_INSTRUCTION_ENCODING_MVEX
The instruction uses the MVEX-encoding.
Definition: SharedTypes.h:348
@ ZYDIS_INSTRUCTION_ENCODING_INVALID
Definition: SharedTypes.h:324
@ ZYDIS_INSTRUCTION_ENCODING_DEFAULT
The instruction uses the default encoding.
Definition: SharedTypes.h:328
@ ZYDIS_INSTRUCTION_ENCODING_EVEX
The instruction uses the EVEX-encoding.
Definition: SharedTypes.h:344
@ ZYDIS_INSTRUCTION_ENCODING_XOP
The instruction uses the AMD XOP-encoding.
Definition: SharedTypes.h:336
ZydisElementTypes
Values that represent element-types.
Definition: SharedTypes.h:132
@ ZYDIS_ELEMENT_TYPE_LONGBCD
Definition: SharedTypes.h:141
@ ZYDIS_ELEMENT_TYPE_UINT
Definition: SharedTypes.h:135
@ ZYDIS_ELEMENT_TYPE_FLOAT64
Definition: SharedTypes.h:139
@ ZYDIS_ELEMENT_TYPE_INT
Definition: SharedTypes.h:136
@ ZYDIS_ELEMENT_TYPE_INVALID
Definition: SharedTypes.h:133
@ ZYDIS_ELEMENT_TYPE_STRUCT
Definition: SharedTypes.h:134
@ ZYDIS_ELEMENT_TYPE_FLOAT16
Definition: SharedTypes.h:137
@ ZYDIS_ELEMENT_TYPE_FLOAT32
Definition: SharedTypes.h:138
@ ZYDIS_ELEMENT_TYPE_FLOAT80
Definition: SharedTypes.h:140
ZydisAddressWidths
Values that represent address widths.
Definition: SharedTypes.h:112
@ ZYDIS_ADDRESS_WIDTH_INVALID
Definition: SharedTypes.h:113
@ ZYDIS_ADDRESS_WIDTH_16
Definition: SharedTypes.h:114
@ ZYDIS_ADDRESS_WIDTH_32
Definition: SharedTypes.h:115
@ ZYDIS_ADDRESS_WIDTH_64
Definition: SharedTypes.h:116
ZydisOperandEncodings
Values that represent operand-encodings.
Definition: SharedTypes.h:198
@ ZYDIS_OPERAND_ENCODING_MODRM_RM
Definition: SharedTypes.h:201
@ ZYDIS_OPERAND_ENCODING_DISP16_32_64
Definition: SharedTypes.h:210
@ ZYDIS_OPERAND_ENCODING_DISP16
Definition: SharedTypes.h:207
@ ZYDIS_OPERAND_ENCODING_DISP64
Definition: SharedTypes.h:209
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_64
Definition: SharedTypes.h:231
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_64
Definition: SharedTypes.h:224
@ ZYDIS_OPERAND_ENCODING_DISP16_32_32
Definition: SharedTypes.h:212
@ ZYDIS_OPERAND_ENCODING_SIMM32
Definition: SharedTypes.h:222
@ ZYDIS_OPERAND_ENCODING_UIMM64
Definition: SharedTypes.h:216
@ ZYDIS_OPERAND_ENCODING_JIMM8
Definition: SharedTypes.h:227
@ ZYDIS_OPERAND_ENCODING_NDSNDD
Definition: SharedTypes.h:203
@ ZYDIS_OPERAND_ENCODING_DISP32_32_64
Definition: SharedTypes.h:211
@ ZYDIS_OPERAND_ENCODING_JIMM16
Definition: SharedTypes.h:228
@ ZYDIS_OPERAND_ENCODING_JIMM32_32_64
Definition: SharedTypes.h:232
@ ZYDIS_OPERAND_ENCODING_IS4
Definition: SharedTypes.h:204
@ ZYDIS_OPERAND_ENCODING_SIMM64
Definition: SharedTypes.h:223
@ ZYDIS_OPERAND_ENCODING_UIMM32
Definition: SharedTypes.h:215
@ ZYDIS_OPERAND_ENCODING_MASK
Definition: SharedTypes.h:205
@ ZYDIS_OPERAND_ENCODING_SIMM16
Definition: SharedTypes.h:221
@ ZYDIS_OPERAND_ENCODING_UIMM32_32_64
Definition: SharedTypes.h:218
@ ZYDIS_OPERAND_ENCODING_UIMM16
Definition: SharedTypes.h:214
@ ZYDIS_OPERAND_ENCODING_UIMM8
Definition: SharedTypes.h:213
@ ZYDIS_OPERAND_ENCODING_DISP32
Definition: SharedTypes.h:208
@ ZYDIS_OPERAND_ENCODING_MODRM_REG
Definition: SharedTypes.h:200
@ ZYDIS_OPERAND_ENCODING_SIMM32_32_64
Definition: SharedTypes.h:225
@ ZYDIS_OPERAND_ENCODING_JIMM64
Definition: SharedTypes.h:230
@ ZYDIS_OPERAND_ENCODING_JIMM32
Definition: SharedTypes.h:229
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_64
Definition: SharedTypes.h:217
@ ZYDIS_OPERAND_ENCODING_JIMM16_32_32
Definition: SharedTypes.h:233
@ ZYDIS_OPERAND_ENCODING_OPCODE
Definition: SharedTypes.h:202
@ ZYDIS_OPERAND_ENCODING_DISP8
Definition: SharedTypes.h:206
@ ZYDIS_OPERAND_ENCODING_NONE
Definition: SharedTypes.h:199
@ ZYDIS_OPERAND_ENCODING_SIMM16_32_32
Definition: SharedTypes.h:226
@ ZYDIS_OPERAND_ENCODING_SIMM8
Definition: SharedTypes.h:220
@ ZYDIS_OPERAND_ENCODING_UIMM16_32_32
Definition: SharedTypes.h:219
ZydisOperandTypes
Values that represent operand-types.
Definition: SharedTypes.h:162
@ ZYDIS_OPERAND_TYPE_IMMEDIATE
The operand is an immediate operand.
Definition: SharedTypes.h:182
@ ZYDIS_OPERAND_TYPE_UNUSED
The operand is not used.
Definition: SharedTypes.h:166
@ ZYDIS_OPERAND_TYPE_REGISTER
The operand is a register operand.
Definition: SharedTypes.h:170
@ ZYDIS_OPERAND_TYPE_MEMORY
The operand is a memory operand.
Definition: SharedTypes.h:174
@ ZYDIS_OPERAND_TYPE_POINTER
The operand is a pointer operand with a segment:offset lvalue.
Definition: SharedTypes.h:178
ZydisOperandVisibilities
Values that represent operand-visibilities.
Definition: SharedTypes.h:249
@ ZYDIS_OPERAND_VISIBILITY_IMPLICIT
The operand is part of the opcode, but listed as an operand.
Definition: SharedTypes.h:258
@ ZYDIS_OPERAND_VISIBILITY_EXPLICIT
The operand is explicitly encoded in the instruction.
Definition: SharedTypes.h:254
@ ZYDIS_OPERAND_VISIBILITY_INVALID
Definition: SharedTypes.h:250
@ ZYDIS_OPERAND_VISIBILITY_HIDDEN
The operand is part of the opcode, and not typically listed as an operand.
Definition: SharedTypes.h:262
uint8_t ZydisOperandType
Defines the ZydisOperandType datatype.
Definition: SharedTypes.h:156
uint8_t ZydisOperandEncoding
Defines the ZydisOperandEncoding datatype.
Definition: SharedTypes.h:192
uint8_t ZydisAddressWidth
Defines the ZydisAddressWidth datatype.
Definition: SharedTypes.h:106
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_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