Zydis  v3.0.0
Register.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_REGISTER_H
33 #define ZYDIS_REGISTER_H
34 
35 #include <Zycore/Defines.h>
36 #include <Zycore/Types.h>
37 #include <Zydis/SharedTypes.h>
38 #include <Zydis/ShortString.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /* ============================================================================================== */
45 /* Enums and types */
46 /* ============================================================================================== */
47 
48 /* ---------------------------------------------------------------------------------------------- */
49 /* Registers */
50 /* ---------------------------------------------------------------------------------------------- */
51 
52 #include <Zydis/Generated/EnumRegister.h>
53 
54 /* ---------------------------------------------------------------------------------------------- */
55 /* Register classes */
56 /* ---------------------------------------------------------------------------------------------- */
57 
68 typedef enum ZydisRegisterClass_
69 {
70  ZYDIS_REGCLASS_INVALID,
139 
149 
150 /* ---------------------------------------------------------------------------------------------- */
151 /* Register width */
152 /* ---------------------------------------------------------------------------------------------- */
153 
157 typedef ZyanU16 ZydisRegisterWidth;
158 
159 /* ---------------------------------------------------------------------------------------------- */
160 /* Register context */
161 /* ---------------------------------------------------------------------------------------------- */
162 
166 typedef struct ZydisRegisterContext_
167 {
171  ZyanU64 values[ZYDIS_REGISTER_MAX_VALUE + 1];
173 
174 /* ---------------------------------------------------------------------------------------------- */
175 
176 /* ============================================================================================== */
177 /* Exported functions */
178 /* ============================================================================================== */
179 
186 /* ---------------------------------------------------------------------------------------------- */
187 /* Register */
188 /* ---------------------------------------------------------------------------------------------- */
189 
199 ZYDIS_EXPORT ZydisRegister ZydisRegisterEncode(ZydisRegisterClass register_class, ZyanU8 id);
200 
208 ZYDIS_EXPORT ZyanI8 ZydisRegisterGetId(ZydisRegister reg);
209 
217 ZYDIS_EXPORT ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg);
218 
228 ZYDIS_EXPORT ZydisRegisterWidth ZydisRegisterGetWidth(ZydisMachineMode mode, ZydisRegister reg);
229 
239 ZYDIS_EXPORT ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode,
240  ZydisRegister reg);
241 
249 ZYDIS_EXPORT const char* ZydisRegisterGetString(ZydisRegister reg);
250 
260 ZYDIS_EXPORT const ZydisShortString* ZydisRegisterGetStringWrapped(ZydisRegister reg);
261 
262 /* ---------------------------------------------------------------------------------------------- */
263 /* Register class */
264 /* ---------------------------------------------------------------------------------------------- */
265 
275  ZydisRegisterClass register_class);
276 
277 /* ---------------------------------------------------------------------------------------------- */
278 
283 /* ============================================================================================== */
284 
285 #ifdef __cplusplus
286 }
287 #endif
288 
289 #endif /* ZYDIS_REGISTER_H */
32-bit general-purpose registers.
Definition: Register.h:82
struct ZydisRegisterContext_ ZydisRegisterContext
Defines the ZydisRegisterContext struct.
Test registers.
Definition: Register.h:122
ZYDIS_EXPORT ZydisRegisterWidth ZydisRegisterClassGetWidth(ZydisMachineMode mode, ZydisRegisterClass register_class)
Returns the width of the specified register-class.
ZYDIS_EXPORT const char * ZydisRegisterGetString(ZydisRegister reg)
Returns the specified register string.
Defines the ZydisRegisterContext struct.
Definition: Register.h:166
enum ZydisMachineMode_ ZydisMachineMode
Defines the ZydisMachineMode enum.
128-bit vector registers.
Definition: Register.h:98
Segment registers.
Definition: Register.h:118
Defines the ZydisShortString struct.
Definition: ShortString.h:58
Instruction-pointer registers.
Definition: Register.h:114
Maximum value of this enum.
Definition: Register.h:143
ZYDIS_EXPORT ZyanI8 ZydisRegisterGetId(ZydisRegister reg)
Returns the id of the specified register.
ZydisRegisterClass_
Defines the ZydisRegisterClass enum.
Definition: Register.h:68
Floating point legacy registers.
Definition: Register.h:90
512-bit vector registers.
Definition: Register.h:106
ZYDIS_EXPORT ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg)
Returns the register-class of the specified register.
Flags registers.
Definition: Register.h:110
ZYDIS_EXPORT ZydisRegisterWidth ZydisRegisterGetWidth(ZydisMachineMode mode, ZydisRegister reg)
Returns the width of the specified register.
Defines decoder/encoder-shared macros and types.
Control registers.
Definition: Register.h:126
enum ZydisRegisterClass_ ZydisRegisterClass
Defines the ZydisRegisterClass enum.
Floating point multimedia registers.
Definition: Register.h:94
16-bit general-purpose registers.
Definition: Register.h:78
8-bit general-purpose registers.
Definition: Register.h:74
ZYDIS_EXPORT ZydisRegister ZydisRegisterEncode(ZydisRegisterClass register_class, ZyanU8 id)
Returns the register specified by the register_class and id tuple.
ZyanU64 values[ZYDIS_REGISTER_MAX_VALUE+1]
The values stored in the register context.
Definition: Register.h:171
The minimum number of bits required to represent all values of this enum.
Definition: Register.h:147
64-bit general-purpose registers.
Definition: Register.h:86
ZYDIS_EXPORT const ZydisShortString * ZydisRegisterGetStringWrapped(ZydisRegister reg)
Returns the specified register string as ZydisShortString.
ZYDIS_EXPORT ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegister reg)
Returns the largest enclosing register of the given register.
256-bit vector registers.
Definition: Register.h:102
Debug registers.
Definition: Register.h:130
ZyanU16 ZydisRegisterWidth
Defines the ZydisRegisterWidth data-type.
Definition: Register.h:157
Mask registers.
Definition: Register.h:134
Defines the immutable and storage-efficient ZydisShortString struct, which is used to store strings i...
Bound registers.
Definition: Register.h:138