Zydis  v2.0.0-alpha1
Status.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 
27 #ifndef ZYDIS_STATUS_H
28 #define ZYDIS_STATUS_H
29 
30 #include <Zydis/CommonTypes.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* ============================================================================================== */
37 /* Enums and types */
38 /* ============================================================================================== */
39 
43 typedef uint32_t ZydisStatus;
44 
49 {
50  /* ------------------------------------------------------------------------------------------ */
51  /* General */
52  /* ------------------------------------------------------------------------------------------ */
53 
57  ZYDIS_STATUS_SUCCESS = 0x00000000,
70 
71  /* ------------------------------------------------------------------------------------------ */
72  /* Decoder */
73  /* ------------------------------------------------------------------------------------------ */
74 
118  ZYDIS_STATUS_MALFORMED_MVEX, // TODO: Do we need this?
123 
124  /* ------------------------------------------------------------------------------------------ */
125  /* Encoder */
126  /* ------------------------------------------------------------------------------------------ */
127 
129 
130  /* ------------------------------------------------------------------------------------------ */
131  /* Misc */
132  /* ------------------------------------------------------------------------------------------ */
133 
137  ZYDIS_STATUS_USER = 0x10000000
138 };
139 
140 /* ============================================================================================== */
141 /* Macros */
142 /* ============================================================================================== */
143 
149 #define ZYDIS_SUCCESS(status) (status == ZYDIS_STATUS_SUCCESS)
150 
156 #define ZYDIS_CHECK(status) \
157  do \
158  { \
159  ZydisStatus s = status; \
160  if (!ZYDIS_SUCCESS(s)) \
161  { \
162  return s; \
163  } \
164  } while(0)
165 
166 /* ============================================================================================== */
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* ZYDIS_STATUS_H */
Includes and defines some default datatypes.
uint32_t ZydisStatus
Defines the ZydisStatus datatype.
Definition: Status.h:43
ZydisStatusCode
Values that represent a zydis status-codes.
Definition: Status.h:49
@ ZYDIS_STATUS_NO_MORE_DATA
An attempt was made to read data from an input data-source that has no more data available.
Definition: Status.h:79
@ ZYDIS_STATUS_MALFORMED_MVEX
An error occured while decoding the MVEX-prefix.
Definition: Status.h:118
@ ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION
Definition: Status.h:128
@ ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE
A buffer passed to a function was too small to complete the requested operation.
Definition: Status.h:69
@ ZYDIS_STATUS_INVALID_MASK
An invalid write-mask was specified for an EVEX/MVEX instruction.
Definition: Status.h:122
@ ZYDIS_STATUS_ILLEGAL_LEGACY_PFX
A legacy-prefix (F2, F3, 66) was found while decoding a XOP/VEX/EVEX/MVEX instruction.
Definition: Status.h:102
@ ZYDIS_STATUS_ILLEGAL_LOCK
A lock-prefix (F0) was found while decoding an instruction that does not support locking.
Definition: Status.h:97
@ ZYDIS_STATUS_ILLEGAL_REX
A rex-prefix was found while decoding a XOP/VEX/EVEX/MVEX instruction.
Definition: Status.h:106
@ ZYDIS_STATUS_SUCCESS
The operation completed successfully.
Definition: Status.h:57
@ ZYDIS_STATUS_USER
The base value for user-defined status codes.
Definition: Status.h:137
@ ZYDIS_STATUS_INVALID_PARAMETER
An invalid parameter was passed to a function.
Definition: Status.h:61
@ ZYDIS_STATUS_DECODING_ERROR
An general error occured while decoding the current instruction.
Definition: Status.h:84
@ ZYDIS_STATUS_INSTRUCTION_TOO_LONG
The instruction exceeded the maximum length of 15 bytes.
Definition: Status.h:88
@ ZYDIS_STATUS_INVALID_OPERATION
An attempt was made to perform an invalid operation.
Definition: Status.h:65
@ ZYDIS_STATUS_BAD_REGISTER
The instruction encoded an invalid register.
Definition: Status.h:92
@ ZYDIS_STATUS_INVALID_MAP
An invalid opcode-map value was found while decoding a XOP/VEX/EVEX/MVEX-prefix.
Definition: Status.h:110
@ ZYDIS_STATUS_MALFORMED_EVEX
An error occured while decoding the EVEX-prefix.
Definition: Status.h:114