Zydis  v4.1.0
Segment.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_SEGMENT_H
33 #define ZYDIS_SEGMENT_H
34 
35 #include <Zycore/Defines.h>
36 #include <Zydis/DecoderTypes.h>
37 #include <Zydis/Status.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
49 /* ============================================================================================== */
50 /* Macros */
51 /* ============================================================================================== */
52 
53 /* ---------------------------------------------------------------------------------------------- */
54 /* Constants */
55 /* ---------------------------------------------------------------------------------------------- */
56 
57 #define ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT 9
58 
59 /* ---------------------------------------------------------------------------------------------- */
60 
61 /* ============================================================================================== */
62 /* Enums and types */
63 /* ============================================================================================== */
64 
69 {
115 
125 
130 {
134  ZyanU8 count;
135  struct
136  {
144  ZyanU8 offset;
148  ZyanU8 size;
151 
152 /* ============================================================================================== */
153 /* Exported functions */
154 /* ============================================================================================== */
155 
166  ZydisInstructionSegments* segments);
167 
168 /* ============================================================================================== */
169 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif /* ZYDIS_SEGMENT_H */
Defines the basic ZydisDecodedInstruction and ZydisDecodedOperand structs.
#define ZYDIS_EXPORT
Symbol is exported in shared library builds.
Definition: Defines.h:67
Status code definitions and check macros.
ZYDIS_EXPORT ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction *instruction, ZydisInstructionSegments *segments)
Returns offsets and sizes of all logical instruction segments (e.g.
enum ZydisInstructionSegment_ ZydisInstructionSegment
Defines the ZydisInstructionSegment struct.
#define ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT
Definition: Segment.h:57
struct ZydisInstructionSegments_ ZydisInstructionSegments
Defines the ZydisInstructionSegments struct.
ZydisInstructionSegment_
Defines the ZydisInstructionSegment struct.
Definition: Segment.h:69
@ ZYDIS_INSTR_SEGMENT_NONE
Definition: Segment.h:70
@ ZYDIS_INSTR_SEGMENT_XOP
The XOP prefix bytes.
Definition: Segment.h:82
@ ZYDIS_INSTR_SEGMENT_IMMEDIATE
The immediate bytes.
Definition: Segment.h:114
@ ZYDIS_INSTR_SEGMENT_OPCODE
The opcode bytes.
Definition: Segment.h:98
@ ZYDIS_INSTR_SEGMENT_MODRM
The ModRM byte.
Definition: Segment.h:102
@ ZYDIS_INSTR_SEGMENT_MVEX
The MVEX prefix bytes.
Definition: Segment.h:94
@ ZYDIS_INSTR_SEGMENT_REX
The effective REX prefix byte.
Definition: Segment.h:78
@ ZYDIS_INSTR_SEGMENT_SIB
The SIB byte.
Definition: Segment.h:106
@ ZYDIS_INSTR_SEGMENT_REQUIRED_BITS
The minimum number of bits required to represent all values of this enum.
Definition: Segment.h:123
@ ZYDIS_INSTR_SEGMENT_EVEX
The EVEX prefix bytes.
Definition: Segment.h:90
@ ZYDIS_INSTR_SEGMENT_VEX
The VEX prefix bytes.
Definition: Segment.h:86
@ ZYDIS_INSTR_SEGMENT_DISPLACEMENT
The displacement bytes.
Definition: Segment.h:110
@ ZYDIS_INSTR_SEGMENT_PREFIXES
The legacy prefixes (including ignored REX prefixes).
Definition: Segment.h:74
@ ZYDIS_INSTR_SEGMENT_MAX_VALUE
Maximum value of this enum.
Definition: Segment.h:119
Information about a decoded instruction.
Definition: DecoderTypes.h:1238
Defines the ZydisInstructionSegments struct.
Definition: Segment.h:130
ZyanU8 count
The number of logical instruction segments.
Definition: Segment.h:134
ZyanU8 size
The size of the segment, in bytes.
Definition: Segment.h:148
struct ZydisInstructionSegments_::@15 segments[ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT]
ZydisInstructionSegment type
The type of the segment.
Definition: Segment.h:140
ZyanU8 offset
The offset of the segment relative to the start of the instruction (in bytes).
Definition: Segment.h:144