The Pedigree Project
0.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
system
include
pedigree
kernel
debugger
libudis86
opcmap.h
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
20
#ifndef UD_OPCMAP_H
21
#define UD_OPCMAP_H
22
23
#include "pedigree/kernel/debugger/libudis86/types.h"
24
25
/* Prefixes/Macros */
26
27
#define Pnone 0x00
28
#define Pa32 0x01
29
#define P_A32(n) ((n) &0x01)
30
#define Po32 0x04
31
#define P_O32(n) ((n) &0x04)
32
#define Pdef64 0x08
33
#define P_DEF64(n) ((n) &0x08)
34
#define Pinv64 0x10
35
#define P_INV64(n) ((n) &0x10)
36
#define Pc1 0x20
37
#define P_C1(n) ((n) &0x20)
38
#define Pc2 0x40
39
#define P_C2(n) ((n) &0x40)
40
#define Pc3 0x80
41
#define P_C3(n) ((n) &0x80)
42
#define PdepM 0x100
43
#define P_DEPM(n) ((n) &0x100)
44
#define REX(c) ((0x40 | c) << 16)
45
#define P_REX(c) (c & 0xFF0000)
46
#define P_REX_MASK(n) (0x40 | (0xF & ((n) >> 16)))
47
#define _W 8
48
#define _R 4
49
#define _X 2
50
#define _B 1
51
#define P_REX_W(r) ((0xF & (r)) >> 3)
52
#define P_REX_R(r) ((0x7 & (r)) >> 2)
53
#define P_REX_X(r) ((0x3 & (r)) >> 1)
54
#define P_REX_B(r) ((0x1 & (r)) >> 0)
55
#define SIB_S(b) ((b) >> 6)
56
#define SIB_I(b) (((b) >> 3) & 7)
57
#define SIB_B(b) ((b) &7)
58
#define MODRM_REG(b) (((b) >> 3) & 7)
59
#define MODRM_NNN(b) (((b) >> 3) & 7)
60
#define MODRM_MOD(b) (((b) >> 6) & 3)
61
#define MODRM_RM(b) ((b) &7)
62
63
#define SZ_Z 1
64
#define SZ_V 2
65
#define SZ_P 3
66
#define SZ_WP 4
67
#define SZ_DP 5
68
#define SZ_MDQ 6
69
#define SZ_RDQ 7
70
#define SZ_B 8
71
#define SZ_W 16
72
#define SZ_D 32
73
#define SZ_Q 64
74
#define SZ_T 80
75
76
/* -----------------------------------------------------------------------------
77
* Enumeration of types of the operands in the opcode map. The naming was
78
* inspired by the AMD manuals. To understand the specifics, read the manuals.
79
* -----------------------------------------------------------------------------
80
*/
81
enum
map_operand_type
82
{
83
OP_NONE = 0,
84
OP_A,
85
OP_E,
86
OP_M,
87
OP_G,
88
OP_I,
89
OP_AL,
90
OP_CL,
91
OP_DL,
92
OP_BL,
93
OP_AH,
94
OP_CH,
95
OP_DH,
96
OP_BH,
97
OP_ALr8b,
98
OP_CLr9b,
99
OP_DLr10b,
100
OP_BLr11b,
101
OP_AHr12b,
102
OP_CHr13b,
103
OP_DHr14b,
104
OP_BHr15b,
105
OP_AX,
106
OP_CX,
107
OP_DX,
108
OP_BX,
109
OP_SI,
110
OP_DI,
111
OP_SP,
112
OP_BP,
113
OP_rAX,
114
OP_rCX,
115
OP_rDX,
116
OP_rBX,
117
OP_rSP,
118
OP_rBP,
119
OP_rSI,
120
OP_rDI,
121
OP_rAXr8,
122
OP_rCXr9,
123
OP_rDXr10,
124
OP_rBXr11,
125
OP_rSPr12,
126
OP_rBPr13,
127
OP_rSIr14,
128
OP_rDIr15,
129
OP_eAX,
130
OP_eCX,
131
OP_eDX,
132
OP_eBX,
133
OP_eSP,
134
OP_eBP,
135
OP_eSI,
136
OP_eDI,
137
OP_ES,
138
OP_CS,
139
OP_SS,
140
OP_DS,
141
OP_FS,
142
OP_GS,
143
OP_ST0,
144
OP_ST1,
145
OP_ST2,
146
OP_ST3,
147
OP_ST4,
148
OP_ST5,
149
OP_ST6,
150
OP_ST7,
151
OP_J,
152
OP_S,
153
OP_O,
154
OP_I1,
155
OP_I3,
156
OP_V,
157
OP_W,
158
OP_Q,
159
OP_P,
160
OP_R,
161
OP_C,
162
OP_D,
163
OP_VR,
164
OP_PR
165
};
166
167
struct
map_operand
168
{
169
enum
map_operand_type type;
170
uint8_t size;
171
};
172
173
struct
map_entry
174
{
175
enum
ud_mnemonic_code mnemonic;
176
struct
map_operand
operand1;
177
struct
map_operand
operand2;
178
struct
map_operand
operand3;
179
uint32_t prefix;
180
};
181
182
int
ud_search_map(
struct
ud
*);
183
enum
ud_mnemonic_code ud_map_get_3dnow(uint8_t);
184
185
#endif
ud
Definition:
system/include/pedigree/kernel/debugger/libudis86/types.h:261
map_operand
Definition:
opcmap.h:167
map_entry
Definition:
opcmap.h:173
Generated on Fri Jan 24 2020 06:46:14 for The Pedigree Project by
1.8.11