The Pedigree Project
0.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
system
include
pedigree
kernel
debugger
libudis86
system/include/pedigree/kernel/debugger/libudis86/types.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_TYPES_H
21
#define UD_TYPES_H
22
23
// include <stdio.h>
24
25
#ifdef _MSC_VER
26
#define FMT64 "%I64"
27
typedef
unsigned
__int8 uint8_t;
28
typedef
unsigned
__int16 uint16_t;
29
typedef
unsigned
__int32 uint32_t;
30
typedef
unsigned
__int64 uint64_t;
31
typedef
__int8 int8_t;
32
typedef
__int16 int16_t;
33
typedef
__int32 int32_t;
34
typedef
__int64 int64_t;
35
#else
36
// Changed from %ll to %l to make it work. JAMESM
37
#define FMT64 "%l"
38
// include <inttypes.h>
39
#endif
40
41
#include "pedigree/kernel/processor/types.h"
42
#ifndef NULL
43
#define NULL 0
44
#endif
45
46
#include "pedigree/kernel/debugger/libudis86/mnemonics.h"
47
48
/* -----------------------------------------------------------------------------
49
* All possible "types" of objects in udis86. Order is Important!
50
* -----------------------------------------------------------------------------
51
*/
52
enum
ud_type
53
{
54
UD_NONE,
55
56
/* 8 bit GPRs */
57
UD_R_AL,
58
UD_R_CL,
59
UD_R_DL,
60
UD_R_BL,
61
UD_R_AH,
62
UD_R_CH,
63
UD_R_DH,
64
UD_R_BH,
65
UD_R_SPL,
66
UD_R_BPL,
67
UD_R_SIL,
68
UD_R_DIL,
69
UD_R_R8B,
70
UD_R_R9B,
71
UD_R_R10B,
72
UD_R_R11B,
73
UD_R_R12B,
74
UD_R_R13B,
75
UD_R_R14B,
76
UD_R_R15B,
77
78
/* 16 bit GPRs */
79
UD_R_AX,
80
UD_R_CX,
81
UD_R_DX,
82
UD_R_BX,
83
UD_R_SP,
84
UD_R_BP,
85
UD_R_SI,
86
UD_R_DI,
87
UD_R_R8W,
88
UD_R_R9W,
89
UD_R_R10W,
90
UD_R_R11W,
91
UD_R_R12W,
92
UD_R_R13W,
93
UD_R_R14W,
94
UD_R_R15W,
95
96
/* 32 bit GPRs */
97
UD_R_EAX,
98
UD_R_ECX,
99
UD_R_EDX,
100
UD_R_EBX,
101
UD_R_ESP,
102
UD_R_EBP,
103
UD_R_ESI,
104
UD_R_EDI,
105
UD_R_R8D,
106
UD_R_R9D,
107
UD_R_R10D,
108
UD_R_R11D,
109
UD_R_R12D,
110
UD_R_R13D,
111
UD_R_R14D,
112
UD_R_R15D,
113
114
/* 64 bit GPRs */
115
UD_R_RAX,
116
UD_R_RCX,
117
UD_R_RDX,
118
UD_R_RBX,
119
UD_R_RSP,
120
UD_R_RBP,
121
UD_R_RSI,
122
UD_R_RDI,
123
UD_R_R8,
124
UD_R_R9,
125
UD_R_R10,
126
UD_R_R11,
127
UD_R_R12,
128
UD_R_R13,
129
UD_R_R14,
130
UD_R_R15,
131
132
/* segment registers */
133
UD_R_ES,
134
UD_R_CS,
135
UD_R_SS,
136
UD_R_DS,
137
UD_R_FS,
138
UD_R_GS,
139
140
/* control registers*/
141
UD_R_CR0,
142
UD_R_CR1,
143
UD_R_CR2,
144
UD_R_CR3,
145
UD_R_CR4,
146
UD_R_CR5,
147
UD_R_CR6,
148
UD_R_CR7,
149
UD_R_CR8,
150
UD_R_CR9,
151
UD_R_CR10,
152
UD_R_CR11,
153
UD_R_CR12,
154
UD_R_CR13,
155
UD_R_CR14,
156
UD_R_CR15,
157
158
/* debug registers */
159
UD_R_DR0,
160
UD_R_DR1,
161
UD_R_DR2,
162
UD_R_DR3,
163
UD_R_DR4,
164
UD_R_DR5,
165
UD_R_DR6,
166
UD_R_DR7,
167
UD_R_DR8,
168
UD_R_DR9,
169
UD_R_DR10,
170
UD_R_DR11,
171
UD_R_DR12,
172
UD_R_DR13,
173
UD_R_DR14,
174
UD_R_DR15,
175
176
/* mmx registers */
177
UD_R_MM0,
178
UD_R_MM1,
179
UD_R_MM2,
180
UD_R_MM3,
181
UD_R_MM4,
182
UD_R_MM5,
183
UD_R_MM6,
184
UD_R_MM7,
185
186
/* x87 registers */
187
UD_R_ST0,
188
UD_R_ST1,
189
UD_R_ST2,
190
UD_R_ST3,
191
UD_R_ST4,
192
UD_R_ST5,
193
UD_R_ST6,
194
UD_R_ST7,
195
196
/* extended multimedia registers */
197
UD_R_XMM0,
198
UD_R_XMM1,
199
UD_R_XMM2,
200
UD_R_XMM3,
201
UD_R_XMM4,
202
UD_R_XMM5,
203
UD_R_XMM6,
204
UD_R_XMM7,
205
UD_R_XMM8,
206
UD_R_XMM9,
207
UD_R_XMM10,
208
UD_R_XMM11,
209
UD_R_XMM12,
210
UD_R_XMM13,
211
UD_R_XMM14,
212
UD_R_XMM15,
213
214
UD_R_RIP,
215
216
/* Operand Types */
217
UD_OP_REG,
218
UD_OP_MEM,
219
UD_OP_PTR,
220
UD_OP_IMM,
221
UD_OP_JIMM,
222
UD_OP_CONST
223
};
224
225
/* -----------------------------------------------------------------------------
226
* struct ud_operand - Disassembled instruction Operand.
227
* -----------------------------------------------------------------------------
228
*/
229
struct
ud_operand
230
{
231
enum
ud_type type;
232
uint8_t size;
233
union
234
{
235
int8_t sbyte;
236
uint8_t ubyte;
237
int16_t sword;
238
uint16_t uword;
239
int32_t sdword;
240
uint32_t udword;
241
int64_t sqword;
242
uint64_t uqword;
243
244
struct
245
{
246
uint16_t seg;
247
uint32_t off;
248
} ptr;
249
} lval;
250
251
enum
ud_type base;
252
enum
ud_type index;
253
uint8_t offset;
254
uint8_t scale;
255
};
256
257
/* -----------------------------------------------------------------------------
258
* struct ud - The udis86 object.
259
* -----------------------------------------------------------------------------
260
*/
261
struct
ud
262
{
263
int (*inp_hook)(
struct
ud
*);
264
uint8_t inp_curr;
265
uint8_t inp_fill;
266
struct
FILE
*inp_file;
267
uint8_t inp_ctr;
268
uint8_t *inp_buff;
269
uint8_t *inp_buff_end;
270
uint8_t inp_end;
271
void (*translator)(
struct
ud
*);
272
uint64_t insn_offset;
273
char
insn_hexcode[32];
274
char
insn_buffer[64];
275
unsigned
int
insn_fill;
276
uint8_t dis_mode;
277
uint64_t pc;
278
uint8_t vendor;
279
struct
map_entry
*mapen;
280
enum
ud_mnemonic_code mnemonic;
281
struct
ud_operand
operand[3];
282
uint8_t error;
283
uint8_t pfx_rex;
284
uint8_t pfx_seg;
285
uint8_t pfx_opr;
286
uint8_t pfx_adr;
287
uint8_t pfx_lock;
288
uint8_t pfx_rep;
289
uint8_t pfx_repe;
290
uint8_t pfx_repne;
291
uint8_t pfx_insn;
292
uint8_t default64;
293
uint8_t opr_mode;
294
uint8_t adr_mode;
295
uint8_t br_far;
296
uint8_t br_near;
297
uint8_t c1;
298
uint8_t c2;
299
uint8_t c3;
300
uint8_t inp_cache[256];
301
uint8_t inp_sess[64];
302
};
303
304
/* -----------------------------------------------------------------------------
305
* Type-definitions
306
* -----------------------------------------------------------------------------
307
*/
308
typedef
enum
ud_type ud_type_t;
309
typedef
enum
ud_mnemonic_code ud_mnemonic_code_t;
310
311
typedef
struct
ud
ud_t;
312
typedef
struct
ud_operand
ud_operand_t;
313
314
#define UD_SYN_INTEL ud_translate_intel
315
#define UD_SYN_ATT ud_translate_att
316
#define UD_EOI -1
317
#define UD_INP_CACHE_SZ 32
318
#define UD_VENDOR_AMD 0
319
#define UD_VENDOR_INTEL 1
320
321
#define bail_out(ud, error_code) longjmp((ud)->bailout, error_code)
322
#define try_decode(ud) if (setjmp((ud)->bailout) == 0)
323
#define catch_error() else
324
325
#endif
FILE
Definition:
cdi-osdep.h:114
ud
Definition:
system/include/pedigree/kernel/debugger/libudis86/types.h:261
ud_operand
Definition:
system/include/pedigree/kernel/debugger/libudis86/types.h:229
map_entry
Definition:
opcmap.h:173
Generated on Fri Jan 24 2020 06:49:08 for The Pedigree Project by
1.8.11