Zydis: include/Zydis/Zydis.h Source File

Zydis v4.1.0

Loading...
Searching...
No Matches
Zydis.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_H
33#define ZYDIS_H
34
35#include <Zycore/Defines.h>
36#include <Zycore/Types.h>
37
38#if !defined(ZYDIS_DISABLE_DECODER)
39# include <Zydis/Decoder.h>
40# include <Zydis/DecoderTypes.h>
41#endif
42
43#if !defined(ZYDIS_DISABLE_ENCODER)
44# include <Zydis/Encoder.h>
45#endif
46
47#if !defined(ZYDIS_DISABLE_FORMATTER)
48# include <Zydis/Formatter.h>
49#endif
50
51#if !defined(ZYDIS_DISABLE_SEGMENT)
52# include <Zydis/Segment.h>
53#endif
54
55#if !defined(ZYDIS_DISABLE_DECODER) && !defined(ZYDIS_DISABLE_FORMATTER)
56# include <Zydis/Disassembler.h>
57#endif
58
59#include <Zydis/MetaInfo.h>
60#include <Zydis/Mnemonic.h>
61#include <Zydis/Register.h>
62#include <Zydis/SharedTypes.h>
63#include <Zydis/Status.h>
64#include <Zydis/Utils.h>
65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
78/* ============================================================================================== */
79/* Macros */
80/* ============================================================================================== */
81
82/* ---------------------------------------------------------------------------------------------- */
83/* Constants */
84/* ---------------------------------------------------------------------------------------------- */
85
89#define ZYDIS_VERSION (ZyanU64)0x0004000100000000
90
91/* ---------------------------------------------------------------------------------------------- */
92/* Helper macros */
93/* ---------------------------------------------------------------------------------------------- */
94
100#define ZYDIS_VERSION_MAJOR(version) (ZyanU16)(((version) & 0xFFFF000000000000) >> 48)
101
107#define ZYDIS_VERSION_MINOR(version) (ZyanU16)(((version) & 0x0000FFFF00000000) >> 32)
108
114#define ZYDIS_VERSION_PATCH(version) (ZyanU16)(((version) & 0x00000000FFFF0000) >> 16)
115
121#define ZYDIS_VERSION_BUILD(version) (ZyanU16)((version) & 0x000000000000FFFF)
122
123/* ---------------------------------------------------------------------------------------------- */
124
125/* ============================================================================================== */
126/* Enums and types */
127/* ============================================================================================== */
128
132 typedef enum ZydisFeature_
133{
134 ZYDIS_FEATURE_DECODER,
135 ZYDIS_FEATURE_ENCODER,
136 ZYDIS_FEATURE_FORMATTER,
137 ZYDIS_FEATURE_AVX512,
138 ZYDIS_FEATURE_KNC,
139 ZYDIS_FEATURE_SEGMENT,
140
144 ZYDIS_FEATURE_MAX_VALUE = ZYDIS_FEATURE_SEGMENT,
148 ZYDIS_FEATURE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FEATURE_MAX_VALUE)
149} ZydisFeature;
150
151/* ============================================================================================== */
152/* Exported functions */
153/* ============================================================================================== */
154
163 ZYDIS_EXPORT ZyanU64 ZydisGetVersion(void);
164
173 ZYDIS_EXPORT ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature);
174
175/* ============================================================================================== */
176
181#ifdef __cplusplus
182}
183#endif
184
185#endif /* ZYDIS_H */
DecoderTypes.h
Defines the basic ZydisDecodedInstruction and ZydisDecodedOperand structs.
Decoder.h
Functions for decoding instructions.
ZYDIS_EXPORT
#define ZYDIS_EXPORT
Symbol is exported in shared library builds.
Definition Defines.h:67
Disassembler.h
All-in-one convenience function providing the simplest possible way to use Zydis.
Encoder.h
Functions for encoding instructions.
Formatter.h
Functions for formatting instructions to human-readable text.
MetaInfo.h
Mnemonic.h
Mnemonic constant definitions and helper functions.
Register.h
Utility functions and constants for registers.
Segment.h
Functions and types providing encoding information about individual instruction bytes.
SharedTypes.h
Defines decoder/encoder-shared macros and types.
Status.h
Status code definitions and check macros.
Utils.h
Other utility functions.
ZydisIsFeatureEnabled
ZYDIS_EXPORT ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature)
Checks, if the specified feature is enabled in the current zydis library instance.
ZydisFeature_
ZydisFeature_
Defines the ZydisFeature enum.
Definition Zydis.h:133
ZydisFeature
enum ZydisFeature_ ZydisFeature
Defines the ZydisFeature enum.
ZydisGetVersion
ZYDIS_EXPORT ZyanU64 ZydisGetVersion(void)
Returns the zydis version.
ZYDIS_FEATURE_SEGMENT
@ ZYDIS_FEATURE_SEGMENT
Definition Zydis.h:139
ZYDIS_FEATURE_KNC
@ ZYDIS_FEATURE_KNC
Definition Zydis.h:138
ZYDIS_FEATURE_MAX_VALUE
@ ZYDIS_FEATURE_MAX_VALUE
Maximum value of this enum.
Definition Zydis.h:144
ZYDIS_FEATURE_REQUIRED_BITS
@ ZYDIS_FEATURE_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition Zydis.h:148
ZYDIS_FEATURE_DECODER
@ ZYDIS_FEATURE_DECODER
Definition Zydis.h:134
ZYDIS_FEATURE_FORMATTER
@ ZYDIS_FEATURE_FORMATTER
Definition Zydis.h:136
ZYDIS_FEATURE_ENCODER
@ ZYDIS_FEATURE_ENCODER
Definition Zydis.h:135
ZYDIS_FEATURE_AVX512
@ ZYDIS_FEATURE_AVX512
Definition Zydis.h:137