Zydis  v2.0
Decoder.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_DECODER_H
33 #define ZYDIS_DECODER_H
34 
35 #include <Zycore/Types.h>
36 #include <Zycore/Defines.h>
37 #include <Zydis/DecoderTypes.h>
38 #include <Zydis/Status.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /* ============================================================================================== */
45 /* Enums and types */
46 /* ============================================================================================== */
47 
48 /* ---------------------------------------------------------------------------------------------- */
49 /* Decoder mode */
50 /* ---------------------------------------------------------------------------------------------- */
51 
55 typedef enum ZydisDecoderMode_
56 {
139 
149 
150 /* ---------------------------------------------------------------------------------------------- */
151 /* Decoder struct */
152 /* ---------------------------------------------------------------------------------------------- */
153 
160 typedef struct ZydisDecoder_
161 {
174 } ZydisDecoder;
175 
176 /* ---------------------------------------------------------------------------------------------- */
177 
178 /* ============================================================================================== */
179 /* Exported functions */
180 /* ============================================================================================== */
181 
191 ZYDIS_EXPORT ZyanStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode machine_mode,
192  ZydisAddressWidth address_width);
193 
203 ZYDIS_EXPORT ZyanStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDecoderMode mode,
204  ZyanBool enabled);
205 
217 ZYDIS_EXPORT ZyanStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder,
218  const void* buffer, ZyanUSize length, ZydisDecodedInstruction* instruction);
219 
220 /* ============================================================================================== */
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif /* ZYDIS_DECODER_H */
ZydisMachineMode machineMode
The machine mode.
Definition: Decoder.h:165
ZYDIS_EXPORT ZyanStatus ZydisDecoderEnableMode(ZydisDecoder *decoder, ZydisDecoderMode mode, ZyanBool enabled)
Enables or disables the specified decoder-mode.
ZYDIS_EXPORT ZyanStatus ZydisDecoderDecodeBuffer(const ZydisDecoder *decoder, const void *buffer, ZyanUSize length, ZydisDecodedInstruction *instruction)
Decodes the instruction in the given input buffer.
Enables KNC compatibility-mode.
Definition: Decoder.h:89
Enables the LZCNT mode.
Definition: Decoder.h:113
Enables the CLDEMOTE mode.
Definition: Decoder.h:138
Enables the CET mode.
Definition: Decoder.h:105
enum ZydisMachineMode_ ZydisMachineMode
Defines the ZydisMachineMode enum.
The minimum number of bits required to represent all values of this enum.
Definition: Decoder.h:147
enum ZydisDecoderMode_ ZydisDecoderMode
Defines the ZydisDecoderMode enum.
Enables the TZCNT mode.
Definition: Decoder.h:121
Defines the basic ZydisDecodedInstruction and ZydisDecodedOperand structs.
Maximum value of this enum.
Definition: Decoder.h:143
Enables minimal instruction decoding without semantic analysis.
Definition: Decoder.h:69
Enables the MPX mode.
Definition: Decoder.h:97
ZydisAddressWidth addressWidth
The address width.
Definition: Decoder.h:169
Enables the WBNOINVD mode.
Definition: Decoder.h:130
ZydisDecoderMode_
Defines the ZydisDecoderMode enum.
Definition: Decoder.h:55
ZYDIS_EXPORT ZyanStatus ZydisDecoderInit(ZydisDecoder *decoder, ZydisMachineMode machine_mode, ZydisAddressWidth address_width)
Initializes the given ZydisDecoder instance.
Defines the ZydisDecoder struct.
Definition: Decoder.h:160
Defines the ZydisDecodedInstruction struct.
Definition: DecoderTypes.h:771
ZyanBool decoderMode[ZYDIS_DECODER_MODE_MAX_VALUE+1]
The decoder mode array.
Definition: Decoder.h:173
Status code definitions and check macros.
enum ZydisAddressWidth_ ZydisAddressWidth
Defines the ZydisAddressWidth enum.
Enables the AMD-branch mode.
Definition: Decoder.h:80
struct ZydisDecoder_ ZydisDecoder
Defines the ZydisDecoder struct.