ROSE 0.11.145.147
InstructionEnumsX86.h
1/* Enum constants for Intel x86 architectures */
2#ifndef ROSE_BinaryAnalysis_InstructionEnumsX86_H
3#define ROSE_BinaryAnalysis_InstructionEnumsX86_H
4#include <featureTests.h>
5#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6
7#include "AssemblerX86Init.h" /* A big enum whose members are all possible x86 instructions. */
8
9namespace Rose {
10namespace BinaryAnalysis {
11
12// Intel x86 instruction size constants.
13enum X86InstructionSize {
14 x86_insnsize_none,
15 x86_insnsize_16, // Instruction is for a 16-bit architecture.
16 x86_insnsize_32, // Instruction is for a 32-bit architecture.
17 x86_insnsize_64 // Instruction is for a 64-bit architecture.
18};
19
20// Intel x86 major register numbers
21enum X86RegisterClass {
22 x86_regclass_gpr, // Minors are X86GeneralPurposeRegister
23 // (ax,cx,dx,bx,sp,bp,si,di,r8..r15) */
24 x86_regclass_segment, // Minors are X86SegmentRegister (es,cs,ss,ds,fs,gs)
25 x86_regclass_cr, // Control registers; Minors are 0-4, 8
26 x86_regclass_dr, // Debug registers; Minors are 0-7
27 x86_regclass_st, // Floating point stack or MM registers; Minors are 0-7
28 x86_regclass_xmm, // 128-bit xmmN; Minors are 0-7.
29 x86_regclass_ip, // Instruction pointer; Only allowed minor is zero.
30 x86_regclass_flags // Status flags.
31};
32
33// Intel x86 segment registers.
34enum X86SegmentRegister {
35 x86_segreg_es = 0, // Numbering is based on Intel documentation
36 x86_segreg_cs = 1,
37 x86_segreg_ss = 2,
38 x86_segreg_ds = 3,
39 x86_segreg_fs = 4,
40 x86_segreg_gs = 5,
41 x86_segreg_none = 16 /* For unspecified segment overrides */
42};
43
44// Intel x86 general purpose registers
45enum X86GeneralPurposeRegister {
46 x86_gpr_ax = 0, // Numbering is based on Intel documentation
47 x86_gpr_cx = 1,
48 x86_gpr_dx = 2,
49 x86_gpr_bx = 3,
50 x86_gpr_sp = 4,
51 x86_gpr_bp = 5,
52 x86_gpr_si = 6,
53 x86_gpr_di = 7,
54 x86_gpr_r8 = 8,
55 x86_gpr_r9 = 9,
56 x86_gpr_r10 = 10,
57 x86_gpr_r11 = 11,
58 x86_gpr_r12 = 12,
59 x86_gpr_r13 = 13,
60 x86_gpr_r14 = 14,
61 x86_gpr_r15 = 15
62};
63
64// Intel x86 ST-related registers. These are the 8 80-bit floating point registers.
65enum X86StRegister {
66 x86_st_0 = 0,
67 x86_st_1 = 1,
68 x86_st_2 = 2,
69 x86_st_3 = 3,
70 x86_st_4 = 4,
71 x86_st_5 = 5,
72 x86_st_6 = 6,
73 x86_st_7 = 7,
74 x86_st_nregs = 8 // number of ST registers
75};
76
77// Minor numbers for x86_regclass_flag.
78enum X86Flags {
79 x86_flags_status = 0, // general-purpose status flags
80 x86_flags_fpstatus = 1, // floating-point status flags
81 x86_flags_fptag = 2, // floating-point tag register
82 x86_flags_fpctl = 3, // floating-point control register
83 x86_flags_mxcsr = 4 // SSE control and status register
84};
85
86// Intel x86 status flags. These are the bit offsets in the x86_flags_status register.
87enum X86Flag {
88 x86_flag_cf = 0,
89 x86_flag_pf = 2,
90 x86_flag_af = 4,
91 x86_flag_zf = 6,
92 x86_flag_sf = 7,
93 x86_flag_tf = 8,
94 x86_flag_if = 9,
95 x86_flag_df = 10,
96 x86_flag_of = 11,
97 x86_flag_iopl = 12, /* 2 bits, 12 and 13 */
98 x86_flag_nt = 14,
99 x86_flag_rf = 16,
100 x86_flag_vm = 17,
101 x86_flag_ac = 18,
102 x86_flag_vif = 19,
103 x86_flag_vip = 20,
104 x86_flag_id = 21
105};
106
107// Intel x86 branch prediction types.
108enum X86BranchPrediction
109{
110 x86_branch_prediction_none,
111 x86_branch_prediction_taken,
112 x86_branch_prediction_not_taken
113};
114
115// Intel x86 instruction repeat prefix.
116enum X86RepeatPrefix
117{
118 x86_repeat_none, // No repeat prefix
119 x86_repeat_repne, // Repeat not equal prefix 0xf2
120 x86_repeat_repe // Repeat equal prefix 0xf3
121};
122
123// Protected mode exceptions. These strange names come directly from the Intel documentation, section 3.1.1.11 in the Instruction
124// Set Reference (except for x86_exception_int, which ROSE uses internally for the INT instruction.
125enum X86Exception {
126 x86_exception_int, // INT instruction. minor is the imm8 argument.
127 x86_exception_sysenter, // SYSENTER instruction.
128 x86_exception_syscall, // SYSCALL instruction.
129 x86_exception_de, // Divide error. DIV and IDIV instructions.
130 x86_exception_db, // Debug. Any code or data reference.
131 x86_exception_bp, // Breakpoint. INT 3 instruction.
132 x86_exception_of, // Overflow. INTO instruction.
133 x86_exception_br, // BOUND range exceeded. BOUND instruction.
134 x86_exception_ud, // Invalid opcode. UD2 insn or reserved opcode.
135 x86_exception_nm, // Device not available (no math coproc). Floating-point or
136 // WAIT/FWAIT insn.
137 x86_exception_df, // Double fault. Any insn that can generate an exception, or NMI,
138 // INTR instruction.
139 x86_exception_ts, // Invalid TSS. Task switch or TSS access.
140 x86_exception_np, // Segment not present. Loading segment regs or accessing system
141 // segments.
142 x86_exception_ss, // Stack segment fault. Stack operations and SS register loads. */
143 x86_exception_gp, // General protection. Any memory reference and other protection
144 // checks.
145 x86_exception_pf, // Page fault. Any memory reference.
146 x86_exception_mf, // Floating point error (math fault). Floating-point or WAIT/FWAIT
147 // instruction.
148 x86_exception_ac, // Alignment check. Any data reference in memory.
149 x86_exception_mc, // Machine check. Model-dependent machine check errors.
150 x86_exception_xm // SIMD floating-point numeric error. SSE/SSE2/SSE3 floating-point
151 // instructions.
152};
153
154} // namespace
155} // namespace
156
157#endif
158#endif
The ROSE library.