Bug 1890513: Directly invoke variadic native functions. r=jandem
[gecko.git] / js / src / zydis / Zydis / Zydis.h
blob833a4b007bd1c15c5a01630555c1b0a7827968eb
1 /***************************************************************************************************
3 Zyan Disassembler Library (Zydis)
5 Original Author : Florian Bernd
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:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
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.
25 ***************************************************************************************************/
27 /**
28 * @file
29 * Master include file. Includes everything else.
32 #ifndef ZYDIS_H
33 #define ZYDIS_H
35 #include "zydis/Zycore/Defines.h"
36 #include "zydis/Zycore/Types.h"
38 #if !defined(ZYDIS_DISABLE_DECODER)
39 # include "zydis/Zydis/Decoder.h"
40 # include "zydis/Zydis/DecoderTypes.h"
41 #endif
43 #if !defined(ZYDIS_DISABLE_ENCODER)
44 # include "zydis/Zydis/Encoder.h"
45 #endif
47 #if !defined(ZYDIS_DISABLE_FORMATTER)
48 # include "zydis/Zydis/Formatter.h"
49 #endif
51 #if !defined(ZYDIS_DISABLE_SEGMENT)
52 # include "zydis/Zydis/Segment.h"
53 #endif
55 #if !defined(ZYDIS_DISABLE_DECODER) && !defined(ZYDIS_DISABLE_FORMATTER)
56 # include "zydis/Zydis/Disassembler.h"
57 #endif
59 #include "zydis/Zydis/MetaInfo.h"
60 #include "zydis/Zydis/Mnemonic.h"
61 #include "zydis/Zydis/Register.h"
62 #include "zydis/Zydis/SharedTypes.h"
63 #include "zydis/Zydis/Status.h"
64 #include "zydis/Zydis/Utils.h"
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
70 /**
71 * @addtogroup version Version
73 * Functions for checking the library version and build options.
75 * @{
78 /* ============================================================================================== */
79 /* Macros */
80 /* ============================================================================================== */
82 /* ---------------------------------------------------------------------------------------------- */
83 /* Constants */
84 /* ---------------------------------------------------------------------------------------------- */
86 /**
87 * A macro that defines the zydis version.
89 #define ZYDIS_VERSION (ZyanU64)0x0004000100000000
91 /* ---------------------------------------------------------------------------------------------- */
92 /* Helper macros */
93 /* ---------------------------------------------------------------------------------------------- */
95 /**
96 * Extracts the major-part of the zydis version.
98 * @param version The zydis version value
100 #define ZYDIS_VERSION_MAJOR(version) (ZyanU16)(((version) & 0xFFFF000000000000) >> 48)
103 * Extracts the minor-part of the zydis version.
105 * @param version The zydis version value
107 #define ZYDIS_VERSION_MINOR(version) (ZyanU16)(((version) & 0x0000FFFF00000000) >> 32)
110 * Extracts the patch-part of the zydis version.
112 * @param version The zydis version value
114 #define ZYDIS_VERSION_PATCH(version) (ZyanU16)(((version) & 0x00000000FFFF0000) >> 16)
117 * Extracts the build-part of the zydis version.
119 * @param version The zydis version value
121 #define ZYDIS_VERSION_BUILD(version) (ZyanU16)((version) & 0x000000000000FFFF)
123 /* ---------------------------------------------------------------------------------------------- */
125 /* ============================================================================================== */
126 /* Enums and types */
127 /* ============================================================================================== */
130 * Defines the `ZydisFeature` enum.
132 typedef enum ZydisFeature_
134 ZYDIS_FEATURE_DECODER,
135 ZYDIS_FEATURE_ENCODER,
136 ZYDIS_FEATURE_FORMATTER,
137 ZYDIS_FEATURE_AVX512,
138 ZYDIS_FEATURE_KNC,
139 ZYDIS_FEATURE_SEGMENT,
142 * Maximum value of this enum.
144 ZYDIS_FEATURE_MAX_VALUE = ZYDIS_FEATURE_SEGMENT,
146 * The minimum number of bits required to represent all values of this enum.
148 ZYDIS_FEATURE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FEATURE_MAX_VALUE)
149 } ZydisFeature;
151 /* ============================================================================================== */
152 /* Exported functions */
153 /* ============================================================================================== */
156 * Returns the zydis version.
158 * @return The zydis version.
160 * Use the macros provided in this file to extract the major, minor, patch and build part from the
161 * returned version value.
163 ZYDIS_EXPORT ZyanU64 ZydisGetVersion(void);
166 * Checks, if the specified feature is enabled in the current zydis library instance.
168 * @param feature The feature.
170 * @return `ZYAN_STATUS_TRUE` if the feature is enabled, `ZYAN_STATUS_FALSE` if not. Another
171 * zyan status code, if an error occured.
173 ZYDIS_EXPORT ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature);
175 /* ============================================================================================== */
178 * @}
181 #ifdef __cplusplus
183 #endif
185 #endif /* ZYDIS_H */