d3d9: Allow to pass NULL pointers to IDirect3DDevice9_GetRenderTargetData().
[wine.git] / programs / winedbg / db_disasm64.c
blobfe6a538c0e2a9797f1c17434bbc0ce3db228e4f8
1 /*-
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16 * Carnegie Mellon requests users of this software to return to
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
23 * any improvements or extensions that they make and grant Carnegie the
24 * rights to redistribute these changes.
28 * Instruction disassembler.
31 /* <Wine specific wrappers> */
32 #include <stdio.h>
33 #include "debugger.h"
35 #if defined(__GNUC__) && (__GNUC__ >= 3)
36 static int (*db_printf)(const char* format, ...) __attribute__((format (printf,1,2)));
37 #else
38 static int (*db_printf)(const char* format, ...);
39 #endif
41 static int no_printf(const char* format, ...) {return 0;}
43 typedef DWORD_PTR db_addr_t;
44 typedef BOOL boolean_t;
46 static ULONG64 db_get_value(db_addr_t addr, int size, int is_signed)
48 ULONG64 result = 0;
49 char buffer[8];
51 if (size != 1 && size != 2 && size != 4 && size != 8)
53 db_printf("Illegal size specified\n");
55 else if (dbg_read_memory((void*)addr, buffer, size))
57 switch (size)
59 case 8:
60 if (is_signed) result = (ULONG64)*(LONG64*)buffer;
61 else result = *(ULONG64*)buffer;
62 break;
63 case 4:
64 if (is_signed) result = (ULONG) *(LONG*)buffer;
65 else result = *(ULONG64*)buffer;
66 break;
67 case 2:
68 if (is_signed) result = (unsigned int) *(short int *)buffer;
69 else result = *(unsigned short int *)buffer;
70 break;
71 case 1:
72 if (is_signed) result = (unsigned int) *(char *)buffer;
73 else result = *(unsigned char *)buffer;
74 break;
77 return result;
80 #define DB_STGY_ANY 0
81 #define DB_STGY_XTRN 0
83 static void db_printsym(db_addr_t addr, unsigned unused)
85 if (db_printf != no_printf)
87 ADDRESS64 a;
89 a.Mode = AddrModeFlat;
90 a.Offset = addr;
92 print_address(&a, FALSE);
96 /* </Wine specific wrappers> */
99 * Size attributes
101 #define BYTE 0
102 #define WORD 1
103 #define LONG 2
104 #define QUAD 3
105 #define SNGL 4
106 #define DBLR 5
107 #define EXTR 6
108 #define SDEP 7
109 #define NONE 8
112 * REX prefix and bits
114 #define REX_B 1
115 #define REX_X 2
116 #define REX_R 4
117 #define REX_W 8
118 #define REX 0x40
121 * Addressing modes
123 #define E 1 /* general effective address */
124 #define Eind 2 /* indirect address (jump, call) */
125 #define Ew 3 /* address, word size */
126 #define Eb 4 /* address, byte size */
127 #define R 5 /* register, in 'reg' field */
128 #define Rw 6 /* word register, in 'reg' field */
129 #define Ri 7 /* register in instruction */
130 #define S 8 /* segment reg, in 'reg' field */
131 #define Si 9 /* segment reg, in instruction */
132 #define A 10 /* accumulator */
133 #define BX 11 /* (bx) */
134 #define CL 12 /* cl, for shifts */
135 #define DX 13 /* dx, for IO */
136 #define SI 14 /* si */
137 #define DI 15 /* di */
138 #define CR 16 /* control register */
139 #define DR 17 /* debug register */
140 #define TR 18 /* test register */
141 #define I 19 /* immediate, unsigned */
142 #define Is 20 /* immediate, signed */
143 #define Ib 21 /* byte immediate, unsigned */
144 #define Ibs 22 /* byte immediate, signed */
145 #define Iw 23 /* word immediate, unsigned */
146 #define Ilq 24 /* long/quad immediate, unsigned */
147 #define O 25 /* direct address */
148 #define Db 26 /* byte displacement from EIP */
149 #define Dl 27 /* long displacement from EIP */
150 #define o1 28 /* constant 1 */
151 #define o3 29 /* constant 3 */
152 #define OS 30 /* immediate offset/segment */
153 #define ST 31 /* FP stack top */
154 #define STI 32 /* FP stack */
155 #define X 33 /* extended FP op */
156 #define XA 34 /* for 'fstcw %ax' */
157 #define El 35 /* address, long/quad size */
158 #define Ril 36 /* long register in instruction */
159 #define Iba 37 /* byte immediate, don't print if 0xa */
160 #define EL 38 /* address, explicitly long size */
161 /* Wine extensions */
162 #define MX 39 /* special register (MMX reg %mm0-7) */
163 #define EMX 40 /* special register (MMX reg %mm0-7) */
164 #define XMM 41 /* special register (floating point reg %xmm0-7) */
165 #define EXMM 42 /* special register (floating point reg %xmm0-7) */
167 struct inst {
168 const char * i_name; /* name */
169 short i_has_modrm; /* has regmodrm byte */
170 short i_size; /* operand size */
171 int i_mode; /* addressing modes */
172 const void * i_extra; /* pointer to extra opcode table */
175 #define op1(x) (x)
176 #define op2(x,y) ((x)|((y)<<8))
177 #define op3(x,y,z) ((x)|((y)<<8)|((z)<<16))
179 struct finst {
180 const char * f_name; /* name for memory instruction */
181 int f_size; /* size for memory instruction */
182 int f_rrmode; /* mode for rr instruction */
183 const void * f_rrname; /* name for rr instruction
184 (or pointer to table) */
187 static const char * const db_Grp6[] = {
188 "sldt",
189 "str",
190 "lldt",
191 "ltr",
192 "verr",
193 "verw",
198 static const char * const db_Grp7[] = {
199 "sgdt",
200 "sidt",
201 "lgdt",
202 "lidt",
203 "smsw",
205 "lmsw",
206 "invlpg"
209 static const char * const db_Grp8[] = {
214 "bt",
215 "bts",
216 "btr",
217 "btc"
220 static const char * const db_Grp9[] = {
222 "cmpxchg8b",
231 static const char * const db_Grp15[] = {
232 "fxsave",
233 "fxrstor",
234 "ldmxcsr",
235 "stmxcsr",
239 "clflush"
242 static const char * const db_Grp15b[] = {
248 "lfence",
249 "mfence",
250 "sfence"
253 static const struct inst db_inst_0f0x[] = {
254 /*00*/ { "", TRUE, NONE, op1(Ew), db_Grp6 },
255 /*01*/ { "", TRUE, NONE, op1(Ew), db_Grp7 },
256 /*02*/ { "lar", TRUE, LONG, op2(E,R), 0 },
257 /*03*/ { "lsl", TRUE, LONG, op2(E,R), 0 },
258 /*04*/ { "", FALSE, NONE, 0, 0 },
259 /*05*/ { "syscall",FALSE,NONE, 0, 0 },
260 /*06*/ { "clts", FALSE, NONE, 0, 0 },
261 /*07*/ { "sysret",FALSE, NONE, 0, 0 },
263 /*08*/ { "invd", FALSE, NONE, 0, 0 },
264 /*09*/ { "wbinvd",FALSE, NONE, 0, 0 },
265 /*0a*/ { "", FALSE, NONE, 0, 0 },
266 /*0b*/ { "", FALSE, NONE, 0, 0 },
267 /*0c*/ { "", FALSE, NONE, 0, 0 },
268 /*0d*/ { "", FALSE, NONE, 0, 0 },
269 /*0e*/ { "", FALSE, NONE, 0, 0 },
270 /*0f*/ { "", FALSE, NONE, 0, 0 },
273 static const struct inst db_inst_0f2x[] = {
274 /*20*/ { "mov", TRUE, LONG, op2(CR,El), 0 },
275 /*21*/ { "mov", TRUE, LONG, op2(DR,El), 0 },
276 /*22*/ { "mov", TRUE, LONG, op2(El,CR), 0 },
277 /*23*/ { "mov", TRUE, LONG, op2(El,DR), 0 },
278 /*24*/ { "mov", TRUE, LONG, op2(TR,El), 0 },
279 /*25*/ { "", FALSE, NONE, 0, 0 },
280 /*26*/ { "mov", TRUE, LONG, op2(El,TR), 0 },
281 /*27*/ { "", FALSE, NONE, 0, 0 },
283 /*28*/ { "", FALSE, NONE, 0, 0 },
284 /*29*/ { "", FALSE, NONE, 0, 0 },
285 /*2a*/ { "", FALSE, NONE, 0, 0 },
286 /*2b*/ { "", FALSE, NONE, 0, 0 },
287 /*2c*/ { "", FALSE, NONE, 0, 0 },
288 /*2d*/ { "", FALSE, NONE, 0, 0 },
289 /*2e*/ { "", FALSE, NONE, 0, 0 },
290 /*2f*/ { "", FALSE, NONE, 0, 0 },
293 static const struct inst db_inst_0f3x[] = {
294 /*30*/ { "wrmsr", FALSE, NONE, 0, 0 },
295 /*31*/ { "rdtsc", FALSE, NONE, 0, 0 },
296 /*32*/ { "rdmsr", FALSE, NONE, 0, 0 },
297 /*33*/ { "rdpmc", FALSE, NONE, 0, 0 },
298 /*34*/ { "sysenter",FALSE,NONE, 0, 0 },
299 /*35*/ { "sysexit",FALSE,NONE, 0, 0 },
300 /*36*/ { "", FALSE, NONE, 0, 0 },
301 /*37*/ { "getsec",FALSE, NONE, 0, 0 },
303 /*38*/ { "", FALSE, NONE, 0, 0 },
304 /*39*/ { "", FALSE, NONE, 0, 0 },
305 /*3a*/ { "", FALSE, NONE, 0, 0 },
306 /*3b*/ { "", FALSE, NONE, 0, 0 },
307 /*3c*/ { "", FALSE, NONE, 0, 0 },
308 /*3d*/ { "", FALSE, NONE, 0, 0 },
309 /*3e*/ { "", FALSE, NONE, 0, 0 },
310 /*3f*/ { "", FALSE, NONE, 0, 0 },
313 static const struct inst db_inst_0f4x[] = {
314 /*40*/ { "cmovo", TRUE, NONE, op2(E, R), 0 },
315 /*41*/ { "cmovno", TRUE, NONE, op2(E, R), 0 },
316 /*42*/ { "cmovb", TRUE, NONE, op2(E, R), 0 },
317 /*43*/ { "cmovnb", TRUE, NONE, op2(E, R), 0 },
318 /*44*/ { "cmovz", TRUE, NONE, op2(E, R), 0 },
319 /*45*/ { "cmovnz", TRUE, NONE, op2(E, R), 0 },
320 /*46*/ { "cmovbe", TRUE, NONE, op2(E, R), 0 },
321 /*47*/ { "cmovnbe",TRUE, NONE, op2(E, R), 0 },
323 /*48*/ { "cmovs", TRUE, NONE, op2(E, R), 0 },
324 /*49*/ { "cmovns", TRUE, NONE, op2(E, R), 0 },
325 /*4a*/ { "cmovp", TRUE, NONE, op2(E, R), 0 },
326 /*4b*/ { "cmovnp", TRUE, NONE, op2(E, R), 0 },
327 /*4c*/ { "cmovl", TRUE, NONE, op2(E, R), 0 },
328 /*4d*/ { "cmovnl", TRUE, NONE, op2(E, R), 0 },
329 /*4e*/ { "cmovle", TRUE, NONE, op2(E, R), 0 },
330 /*4f*/ { "cmovnle",TRUE, NONE, op2(E, R), 0 },
333 static const struct inst db_inst_0f5x[] = {
334 /*50*/ { "movmskps",TRUE, NONE, op2(E, XMM), 0 },
335 /*51*/ { "sqrtps", TRUE, NONE, op2(XMM, EXMM), 0 },
336 /*52*/ { "rsqrtps", TRUE, NONE, op2(XMM, EXMM), 0 },
337 /*53*/ { "rcpps", TRUE, NONE, op2(XMM, EXMM), 0 },
338 /*54*/ { "andps", TRUE, NONE, op2(XMM, EXMM), 0 },
339 /*55*/ { "andnps", TRUE, NONE, op2(XMM, EXMM), 0 },
340 /*56*/ { "orps", TRUE, NONE, op2(XMM, EXMM), 0 },
341 /*57*/ { "xorps", TRUE, NONE, op2(XMM, EXMM), 0 },
343 /*58*/ { "addps", TRUE, NONE, op2(XMM, EXMM), 0 },
344 /*59*/ { "mulps", TRUE, NONE, op2(XMM, EXMM), 0 },
345 /*5a*/ { "(bad)", FALSE, NONE, 0, 0 },
346 /*5b*/ { "(bad)", FALSE, NONE, 0, 0 },
347 /*5c*/ { "subps", TRUE, NONE, op2(XMM, EXMM), 0 },
348 /*5d*/ { "minps", TRUE, NONE, op2(XMM, EXMM), 0 },
349 /*5e*/ { "divps", TRUE, NONE, op2(XMM, EXMM), 0 },
350 /*5f*/ { "maxps", TRUE, NONE, op2(XMM, EXMM), 0 },
353 static const struct inst db_inst_0f6x[] = {
354 /*60*/ { "punpcklbw", TRUE, NONE, op2(E, MX), 0 },
355 /*61*/ { "punpcklwd", TRUE, NONE, op2(E, MX), 0 },
356 /*62*/ { "punpckldq", TRUE, NONE, op2(E, MX), 0 },
357 /*63*/ { "packsswb", TRUE, NONE, op2(E, MX), 0 },
358 /*64*/ { "pcmpgtb", TRUE, NONE, op2(E, MX), 0 },
359 /*65*/ { "pcmpgtw", TRUE, NONE, op2(E, MX), 0 },
360 /*66*/ { "pcmpgtd", TRUE, NONE, op2(E, MX), 0 },
361 /*67*/ { "packuswb", TRUE, NONE, op2(E, MX), 0 },
363 /*68*/ { "punpckhbw", TRUE, NONE, op2(E, MX), 0 },
364 /*69*/ { "punpckhwd", TRUE, NONE, op2(E, MX), 0 },
365 /*6a*/ { "punpckhdq", TRUE, NONE, op2(E, MX), 0 },
366 /*6b*/ { "packssdw", TRUE, NONE, op2(E, MX), 0 },
367 /*6c*/ { "(bad)", TRUE, NONE, 0, 0 },
368 /*6d*/ { "(bad)", TRUE, NONE, 0, 0 },
369 /*6e*/ { "movd", TRUE, NONE, op2(E, MX), 0 },
370 /*6f*/ { "movq", TRUE, NONE, op2(E, MX), 0 },
373 static const struct inst db_inst_0f7x[] = {
374 /*70*/ { "pshufw", TRUE, NONE, op2(MX, EMX), 0 },
375 /*71*/ { "(bad)", TRUE, NONE, 0, 0 }, /* FIXME: grp 12 */
376 /*72*/ { "(bad)", TRUE, NONE, 0, 0 }, /* FIXME: grp 13 */
377 /*73*/ { "(bad)", TRUE, NONE, 0, 0 }, /* FIXME: grp 14 */
378 /*74*/ { "pcmpeqb", TRUE, NONE, op2(E, MX), 0 },
379 /*75*/ { "pcmpeqw", TRUE, NONE, op2(E, MX), 0 },
380 /*76*/ { "pcmpeqd", TRUE, NONE, op2(E, MX), 0 },
381 /*77*/ { "emms", FALSE,NONE, 0, 0 },
383 /*78*/ { "(bad)", TRUE, NONE, 0, 0 },
384 /*79*/ { "(bad)", TRUE, NONE, 0, 0 },
385 /*7a*/ { "(bad)", TRUE, NONE, 0, 0 },
386 /*7b*/ { "(bad)", TRUE, NONE, 0, 0 },
387 /*7c*/ { "(bad)", TRUE, NONE, 0, 0 },
388 /*7d*/ { "(bad)", TRUE, NONE, 0, 0 },
389 /*7e*/ { "movd", TRUE, NONE, op2(E, MX), 0 },
390 /*7f*/ { "movq", TRUE, NONE, op2(EMX, MX), 0 },
393 static const struct inst db_inst_0f8x[] = {
394 /*80*/ { "jo", FALSE, NONE, op1(Dl), 0 },
395 /*81*/ { "jno", FALSE, NONE, op1(Dl), 0 },
396 /*82*/ { "jb", FALSE, NONE, op1(Dl), 0 },
397 /*83*/ { "jnb", FALSE, NONE, op1(Dl), 0 },
398 /*84*/ { "jz", FALSE, NONE, op1(Dl), 0 },
399 /*85*/ { "jnz", FALSE, NONE, op1(Dl), 0 },
400 /*86*/ { "jbe", FALSE, NONE, op1(Dl), 0 },
401 /*87*/ { "jnbe", FALSE, NONE, op1(Dl), 0 },
403 /*88*/ { "js", FALSE, NONE, op1(Dl), 0 },
404 /*89*/ { "jns", FALSE, NONE, op1(Dl), 0 },
405 /*8a*/ { "jp", FALSE, NONE, op1(Dl), 0 },
406 /*8b*/ { "jnp", FALSE, NONE, op1(Dl), 0 },
407 /*8c*/ { "jl", FALSE, NONE, op1(Dl), 0 },
408 /*8d*/ { "jnl", FALSE, NONE, op1(Dl), 0 },
409 /*8e*/ { "jle", FALSE, NONE, op1(Dl), 0 },
410 /*8f*/ { "jnle", FALSE, NONE, op1(Dl), 0 },
413 static const struct inst db_inst_0f9x[] = {
414 /*90*/ { "seto", TRUE, NONE, op1(Eb), 0 },
415 /*91*/ { "setno", TRUE, NONE, op1(Eb), 0 },
416 /*92*/ { "setb", TRUE, NONE, op1(Eb), 0 },
417 /*93*/ { "setnb", TRUE, NONE, op1(Eb), 0 },
418 /*94*/ { "setz", TRUE, NONE, op1(Eb), 0 },
419 /*95*/ { "setnz", TRUE, NONE, op1(Eb), 0 },
420 /*96*/ { "setbe", TRUE, NONE, op1(Eb), 0 },
421 /*97*/ { "setnbe",TRUE, NONE, op1(Eb), 0 },
423 /*98*/ { "sets", TRUE, NONE, op1(Eb), 0 },
424 /*99*/ { "setns", TRUE, NONE, op1(Eb), 0 },
425 /*9a*/ { "setp", TRUE, NONE, op1(Eb), 0 },
426 /*9b*/ { "setnp", TRUE, NONE, op1(Eb), 0 },
427 /*9c*/ { "setl", TRUE, NONE, op1(Eb), 0 },
428 /*9d*/ { "setnl", TRUE, NONE, op1(Eb), 0 },
429 /*9e*/ { "setle", TRUE, NONE, op1(Eb), 0 },
430 /*9f*/ { "setnle",TRUE, NONE, op1(Eb), 0 },
433 static const struct inst db_inst_0fax[] = {
434 /*a0*/ { "push", FALSE, NONE, op1(Si), 0 },
435 /*a1*/ { "pop", FALSE, NONE, op1(Si), 0 },
436 /*a2*/ { "cpuid", FALSE, NONE, 0, 0 },
437 /*a3*/ { "bt", TRUE, LONG, op2(R,E), 0 },
438 /*a4*/ { "shld", TRUE, LONG, op3(Ib,R,E), 0 },
439 /*a5*/ { "shld", TRUE, LONG, op3(CL,R,E), 0 },
440 /*a6*/ { "", FALSE, NONE, 0, 0 },
441 /*a7*/ { "", FALSE, NONE, 0, 0 },
443 /*a8*/ { "push", FALSE, NONE, op1(Si), 0 },
444 /*a9*/ { "pop", FALSE, NONE, op1(Si), 0 },
445 /*aa*/ { "rsm", FALSE, NONE, 0, 0 },
446 /*ab*/ { "bts", TRUE, LONG, op2(R,E), 0 },
447 /*ac*/ { "shrd", TRUE, LONG, op3(Ib,R,E), 0 },
448 /*ad*/ { "shrd", TRUE, LONG, op3(CL,R,E), 0 },
449 /*ae*/ { "", TRUE, LONG, op1(E), db_Grp15 },
450 /*af*/ { "imul", TRUE, LONG, op2(E,R), 0 },
453 static const struct inst db_inst_0fbx[] = {
454 /*b0*/ { "cmpxchg",TRUE, BYTE, op2(R, E), 0 },
455 /*b0*/ { "cmpxchg",TRUE, LONG, op2(R, E), 0 },
456 /*b2*/ { "lss", TRUE, LONG, op2(E, R), 0 },
457 /*b3*/ { "btr", TRUE, LONG, op2(R, E), 0 },
458 /*b4*/ { "lfs", TRUE, LONG, op2(E, R), 0 },
459 /*b5*/ { "lgs", TRUE, LONG, op2(E, R), 0 },
460 /*b6*/ { "movzb", TRUE, LONG, op2(Eb, R), 0 },
461 /*b7*/ { "movzw", TRUE, LONG, op2(Ew, R), 0 },
463 /*b8*/ { "", FALSE, NONE, 0, 0 },
464 /*b9*/ { "", FALSE, NONE, 0, 0 },
465 /*ba*/ { "", TRUE, LONG, op2(Ib, E), db_Grp8 },
466 /*bb*/ { "btc", TRUE, LONG, op2(R, E), 0 },
467 /*bc*/ { "bsf", TRUE, LONG, op2(E, R), 0 },
468 /*bd*/ { "bsr", TRUE, LONG, op2(E, R), 0 },
469 /*be*/ { "movsb", TRUE, LONG, op2(Eb, R), 0 },
470 /*bf*/ { "movsw", TRUE, LONG, op2(Ew, R), 0 },
473 static const struct inst db_inst_0fcx[] = {
474 /*c0*/ { "xadd", TRUE, BYTE, op2(R, E), 0 },
475 /*c1*/ { "xadd", TRUE, LONG, op2(R, E), 0 },
476 /*c2*/ { "", FALSE, NONE, 0, 0 },
477 /*c3*/ { "", FALSE, NONE, 0, 0 },
478 /*c4*/ { "", FALSE, NONE, 0, 0 },
479 /*c5*/ { "", FALSE, NONE, 0, 0 },
480 /*c6*/ { "", FALSE, NONE, 0, 0 },
481 /*c7*/ { "", TRUE, NONE, op1(E), db_Grp9 },
482 /*c8*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
483 /*c9*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
484 /*ca*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
485 /*cb*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
486 /*cc*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
487 /*cd*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
488 /*ce*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
489 /*cf*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
492 static const struct inst * const db_inst_0f[] = {
493 db_inst_0f0x,
495 db_inst_0f2x,
496 db_inst_0f3x,
497 db_inst_0f4x,
498 db_inst_0f5x,
499 db_inst_0f6x,
500 db_inst_0f7x,
501 db_inst_0f8x,
502 db_inst_0f9x,
503 db_inst_0fax,
504 db_inst_0fbx,
505 db_inst_0fcx,
511 static const char * const db_Esc92[] = {
512 "fnop", "", "", "", "", "", "", ""
514 static const char * const db_Esc94[] = {
515 "fchs", "fabs", "", "", "ftst", "fxam", "", ""
517 static const char * const db_Esc95[] = {
518 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz",""
520 static const char * const db_Esc96[] = {
521 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp",
522 "fincstp"
524 static const char * const db_Esc97[] = {
525 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos"
528 static const char * const db_Esca5[] = {
529 "", "fucompp","", "", "", "", "", ""
532 static const char * const db_Escb4[] = {
533 "fneni","fndisi", "fnclex","fninit","fsetpm", "", "", ""
536 static const char * const db_Esce3[] = {
537 "", "fcompp","", "", "", "", "", ""
540 static const char * const db_Escf4[] = {
541 "fnstsw","", "", "", "", "", "", ""
544 static const struct finst db_Esc8[] = {
545 /*0*/ { "fadd", SNGL, op2(STI,ST), 0 },
546 /*1*/ { "fmul", SNGL, op2(STI,ST), 0 },
547 /*2*/ { "fcom", SNGL, op2(STI,ST), 0 },
548 /*3*/ { "fcomp", SNGL, op2(STI,ST), 0 },
549 /*4*/ { "fsub", SNGL, op2(STI,ST), 0 },
550 /*5*/ { "fsubr", SNGL, op2(STI,ST), 0 },
551 /*6*/ { "fdiv", SNGL, op2(STI,ST), 0 },
552 /*7*/ { "fdivr", SNGL, op2(STI,ST), 0 },
555 static const struct finst db_Esc9[] = {
556 /*0*/ { "fld", SNGL, op1(STI), 0 },
557 /*1*/ { "", NONE, op1(STI), "fxch" },
558 /*2*/ { "fst", SNGL, op1(X), db_Esc92 },
559 /*3*/ { "fstp", SNGL, 0, 0 },
560 /*4*/ { "fldenv", NONE, op1(X), db_Esc94 },
561 /*5*/ { "fldcw", NONE, op1(X), db_Esc95 },
562 /*6*/ { "fnstenv",NONE, op1(X), db_Esc96 },
563 /*7*/ { "fnstcw", NONE, op1(X), db_Esc97 },
566 static const struct finst db_Esca[] = {
567 /*0*/ { "fiadd", LONG, 0, 0 },
568 /*1*/ { "fimul", LONG, 0, 0 },
569 /*2*/ { "ficom", LONG, 0, 0 },
570 /*3*/ { "ficomp", LONG, 0, 0 },
571 /*4*/ { "fisub", LONG, 0, 0 },
572 /*5*/ { "fisubr", LONG, op1(X), db_Esca5 },
573 /*6*/ { "fidiv", LONG, 0, 0 },
574 /*7*/ { "fidivr", LONG, 0, 0 }
577 static const struct finst db_Escb[] = {
578 /*0*/ { "fild", LONG, 0, 0 },
579 /*1*/ { "", NONE, 0, 0 },
580 /*2*/ { "fist", LONG, 0, 0 },
581 /*3*/ { "fistp", LONG, 0, 0 },
582 /*4*/ { "", WORD, op1(X), db_Escb4 },
583 /*5*/ { "fld", EXTR, 0, 0 },
584 /*6*/ { "", WORD, 0, 0 },
585 /*7*/ { "fstp", EXTR, 0, 0 },
588 static const struct finst db_Escc[] = {
589 /*0*/ { "fadd", DBLR, op2(ST,STI), 0 },
590 /*1*/ { "fmul", DBLR, op2(ST,STI), 0 },
591 /*2*/ { "fcom", DBLR, 0, 0 },
592 /*3*/ { "fcomp", DBLR, 0, 0 },
593 /*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" },
594 /*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" },
595 /*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" },
596 /*7*/ { "fdivr", DBLR, op2(ST,STI), "fdiv" },
599 static const struct finst db_Escd[] = {
600 /*0*/ { "fld", DBLR, op1(STI), "ffree" },
601 /*1*/ { "", NONE, 0, 0 },
602 /*2*/ { "fst", DBLR, op1(STI), 0 },
603 /*3*/ { "fstp", DBLR, op1(STI), 0 },
604 /*4*/ { "frstor", NONE, op1(STI), "fucom" },
605 /*5*/ { "", NONE, op1(STI), "fucomp" },
606 /*6*/ { "fnsave", NONE, 0, 0 },
607 /*7*/ { "fnstsw", NONE, 0, 0 },
610 static const struct finst db_Esce[] = {
611 /*0*/ { "fiadd", WORD, op2(ST,STI), "faddp" },
612 /*1*/ { "fimul", WORD, op2(ST,STI), "fmulp" },
613 /*2*/ { "ficom", WORD, 0, 0 },
614 /*3*/ { "ficomp", WORD, op1(X), db_Esce3 },
615 /*4*/ { "fisub", WORD, op2(ST,STI), "fsubrp" },
616 /*5*/ { "fisubr", WORD, op2(ST,STI), "fsubp" },
617 /*6*/ { "fidiv", WORD, op2(ST,STI), "fdivrp" },
618 /*7*/ { "fidivr", WORD, op2(ST,STI), "fdivp" },
621 static const struct finst db_Escf[] = {
622 /*0*/ { "fild", WORD, 0, 0 },
623 /*1*/ { "", NONE, 0, 0 },
624 /*2*/ { "fist", WORD, 0, 0 },
625 /*3*/ { "fistp", WORD, 0, 0 },
626 /*4*/ { "fbld", NONE, op1(XA), db_Escf4 },
627 /*5*/ { "fild", QUAD, 0, 0 },
628 /*6*/ { "fbstp", NONE, 0, 0 },
629 /*7*/ { "fistp", QUAD, 0, 0 },
632 static const struct finst * const db_Esc_inst[] = {
633 db_Esc8, db_Esc9, db_Esca, db_Escb,
634 db_Escc, db_Escd, db_Esce, db_Escf
637 static const char * const db_Grp1[] = {
638 "add",
639 "or",
640 "adc",
641 "sbb",
642 "and",
643 "sub",
644 "xor",
645 "cmp"
648 static const char * const db_Grp2[] = {
649 "rol",
650 "ror",
651 "rcl",
652 "rcr",
653 "shl",
654 "shr",
655 "shl",
656 "sar"
659 static const struct inst db_Grp3[] = {
660 { "test", TRUE, NONE, op2(I,E), 0 },
661 { "test", TRUE, NONE, op2(I,E), 0 },
662 { "not", TRUE, NONE, op1(E), 0 },
663 { "neg", TRUE, NONE, op1(E), 0 },
664 { "mul", TRUE, NONE, op2(E,A), 0 },
665 { "imul", TRUE, NONE, op2(E,A), 0 },
666 { "div", TRUE, NONE, op2(E,A), 0 },
667 { "idiv", TRUE, NONE, op2(E,A), 0 },
670 static const struct inst db_Grp4[] = {
671 { "inc", TRUE, BYTE, op1(E), 0 },
672 { "dec", TRUE, BYTE, op1(E), 0 },
673 { "", TRUE, NONE, 0, 0 },
674 { "", TRUE, NONE, 0, 0 },
675 { "", TRUE, NONE, 0, 0 },
676 { "", TRUE, NONE, 0, 0 },
677 { "", TRUE, NONE, 0, 0 },
678 { "", TRUE, NONE, 0, 0 }
681 static const struct inst db_Grp5[] = {
682 { "inc", TRUE, LONG, op1(E), 0 },
683 { "dec", TRUE, LONG, op1(E), 0 },
684 { "call", TRUE, LONG, op1(Eind),0 },
685 { "lcall", TRUE, LONG, op1(Eind),0 },
686 { "jmp", TRUE, LONG, op1(Eind),0 },
687 { "ljmp", TRUE, LONG, op1(Eind),0 },
688 { "push", TRUE, LONG, op1(E), 0 },
689 { "", TRUE, NONE, 0, 0 }
692 static const struct inst db_inst_table[256] = {
693 /*00*/ { "add", TRUE, BYTE, op2(R, E), 0 },
694 /*01*/ { "add", TRUE, LONG, op2(R, E), 0 },
695 /*02*/ { "add", TRUE, BYTE, op2(E, R), 0 },
696 /*03*/ { "add", TRUE, LONG, op2(E, R), 0 },
697 /*04*/ { "add", FALSE, BYTE, op2(I, A), 0 },
698 /*05*/ { "add", FALSE, LONG, op2(Is, A), 0 },
699 /*06*/ { "push", FALSE, NONE, op1(Si), 0 },
700 /*07*/ { "pop", FALSE, NONE, op1(Si), 0 },
702 /*08*/ { "or", TRUE, BYTE, op2(R, E), 0 },
703 /*09*/ { "or", TRUE, LONG, op2(R, E), 0 },
704 /*0a*/ { "or", TRUE, BYTE, op2(E, R), 0 },
705 /*0b*/ { "or", TRUE, LONG, op2(E, R), 0 },
706 /*0c*/ { "or", FALSE, BYTE, op2(I, A), 0 },
707 /*0d*/ { "or", FALSE, LONG, op2(I, A), 0 },
708 /*0e*/ { "push", FALSE, NONE, op1(Si), 0 },
709 /*0f*/ { "", FALSE, NONE, 0, 0 },
711 /*10*/ { "adc", TRUE, BYTE, op2(R, E), 0 },
712 /*11*/ { "adc", TRUE, LONG, op2(R, E), 0 },
713 /*12*/ { "adc", TRUE, BYTE, op2(E, R), 0 },
714 /*13*/ { "adc", TRUE, LONG, op2(E, R), 0 },
715 /*14*/ { "adc", FALSE, BYTE, op2(I, A), 0 },
716 /*15*/ { "adc", FALSE, LONG, op2(Is, A), 0 },
717 /*16*/ { "push", FALSE, NONE, op1(Si), 0 },
718 /*17*/ { "pop", FALSE, NONE, op1(Si), 0 },
720 /*18*/ { "sbb", TRUE, BYTE, op2(R, E), 0 },
721 /*19*/ { "sbb", TRUE, LONG, op2(R, E), 0 },
722 /*1a*/ { "sbb", TRUE, BYTE, op2(E, R), 0 },
723 /*1b*/ { "sbb", TRUE, LONG, op2(E, R), 0 },
724 /*1c*/ { "sbb", FALSE, BYTE, op2(I, A), 0 },
725 /*1d*/ { "sbb", FALSE, LONG, op2(Is, A), 0 },
726 /*1e*/ { "push", FALSE, NONE, op1(Si), 0 },
727 /*1f*/ { "pop", FALSE, NONE, op1(Si), 0 },
729 /*20*/ { "and", TRUE, BYTE, op2(R, E), 0 },
730 /*21*/ { "and", TRUE, LONG, op2(R, E), 0 },
731 /*22*/ { "and", TRUE, BYTE, op2(E, R), 0 },
732 /*23*/ { "and", TRUE, LONG, op2(E, R), 0 },
733 /*24*/ { "and", FALSE, BYTE, op2(I, A), 0 },
734 /*25*/ { "and", FALSE, LONG, op2(I, A), 0 },
735 /*26*/ { "", FALSE, NONE, 0, 0 },
736 /*27*/ { "daa", FALSE, NONE, 0, 0 },
738 /*28*/ { "sub", TRUE, BYTE, op2(R, E), 0 },
739 /*29*/ { "sub", TRUE, LONG, op2(R, E), 0 },
740 /*2a*/ { "sub", TRUE, BYTE, op2(E, R), 0 },
741 /*2b*/ { "sub", TRUE, LONG, op2(E, R), 0 },
742 /*2c*/ { "sub", FALSE, BYTE, op2(I, A), 0 },
743 /*2d*/ { "sub", FALSE, LONG, op2(Is, A), 0 },
744 /*2e*/ { "", FALSE, NONE, 0, 0 },
745 /*2f*/ { "das", FALSE, NONE, 0, 0 },
747 /*30*/ { "xor", TRUE, BYTE, op2(R, E), 0 },
748 /*31*/ { "xor", TRUE, LONG, op2(R, E), 0 },
749 /*32*/ { "xor", TRUE, BYTE, op2(E, R), 0 },
750 /*33*/ { "xor", TRUE, LONG, op2(E, R), 0 },
751 /*34*/ { "xor", FALSE, BYTE, op2(I, A), 0 },
752 /*35*/ { "xor", FALSE, LONG, op2(I, A), 0 },
753 /*36*/ { "", FALSE, NONE, 0, 0 },
754 /*37*/ { "aaa", FALSE, NONE, 0, 0 },
756 /*38*/ { "cmp", TRUE, BYTE, op2(R, E), 0 },
757 /*39*/ { "cmp", TRUE, LONG, op2(R, E), 0 },
758 /*3a*/ { "cmp", TRUE, BYTE, op2(E, R), 0 },
759 /*3b*/ { "cmp", TRUE, LONG, op2(E, R), 0 },
760 /*3c*/ { "cmp", FALSE, BYTE, op2(I, A), 0 },
761 /*3d*/ { "cmp", FALSE, LONG, op2(Is, A), 0 },
762 /*3e*/ { "", FALSE, NONE, 0, 0 },
763 /*3f*/ { "aas", FALSE, NONE, 0, 0 },
765 /*40*/ { "rex", FALSE, NONE, 0, 0 },
766 /*41*/ { "rex.b", FALSE, NONE, 0, 0 },
767 /*42*/ { "rex.x", FALSE, NONE, 0, 0 },
768 /*43*/ { "rex.xb", FALSE, NONE, 0, 0 },
769 /*44*/ { "rex.r", FALSE, NONE, 0, 0 },
770 /*45*/ { "rex.rb", FALSE, NONE, 0, 0 },
771 /*46*/ { "rex.rx", FALSE, NONE, 0, 0 },
772 /*47*/ { "rex.rxb", FALSE, NONE, 0, 0 },
774 /*48*/ { "rex.w", FALSE, NONE, 0, 0 },
775 /*49*/ { "rex.wb", FALSE, NONE, 0, 0 },
776 /*4a*/ { "rex.wx", FALSE, NONE, 0, 0 },
777 /*4b*/ { "rex.wxb", FALSE, NONE, 0, 0 },
778 /*4c*/ { "rex.wr", FALSE, NONE, 0, 0 },
779 /*4d*/ { "rex.wrb", FALSE, NONE, 0, 0 },
780 /*4e*/ { "rex.wrx", FALSE, NONE, 0, 0 },
781 /*4f*/ { "rex.wrxb", FALSE, NONE, 0, 0 },
783 /*50*/ { "push", FALSE, LONG, op1(Ri), 0 },
784 /*51*/ { "push", FALSE, LONG, op1(Ri), 0 },
785 /*52*/ { "push", FALSE, LONG, op1(Ri), 0 },
786 /*53*/ { "push", FALSE, LONG, op1(Ri), 0 },
787 /*54*/ { "push", FALSE, LONG, op1(Ri), 0 },
788 /*55*/ { "push", FALSE, LONG, op1(Ri), 0 },
789 /*56*/ { "push", FALSE, LONG, op1(Ri), 0 },
790 /*57*/ { "push", FALSE, LONG, op1(Ri), 0 },
792 /*58*/ { "pop", FALSE, LONG, op1(Ri), 0 },
793 /*59*/ { "pop", FALSE, LONG, op1(Ri), 0 },
794 /*5a*/ { "pop", FALSE, LONG, op1(Ri), 0 },
795 /*5b*/ { "pop", FALSE, LONG, op1(Ri), 0 },
796 /*5c*/ { "pop", FALSE, LONG, op1(Ri), 0 },
797 /*5d*/ { "pop", FALSE, LONG, op1(Ri), 0 },
798 /*5e*/ { "pop", FALSE, LONG, op1(Ri), 0 },
799 /*5f*/ { "pop", FALSE, LONG, op1(Ri), 0 },
801 /*60*/ { "pusha", FALSE, LONG, 0, 0 },
802 /*61*/ { "popa", FALSE, LONG, 0, 0 },
803 /*62*/ { "bound", TRUE, LONG, op2(E, R), 0 },
804 /*63*/ { "movslq", TRUE, NONE, op2(EL,R), 0 },
806 /*64*/ { "", FALSE, NONE, 0, 0 },
807 /*65*/ { "", FALSE, NONE, 0, 0 },
808 /*66*/ { "", FALSE, NONE, 0, 0 },
809 /*67*/ { "", FALSE, NONE, 0, 0 },
811 /*68*/ { "push", FALSE, LONG, op1(I), 0 },
812 /*69*/ { "imul", TRUE, LONG, op3(I,E,R), 0 },
813 /*6a*/ { "push", FALSE, LONG, op1(Ibs), 0 },
814 /*6b*/ { "imul", TRUE, LONG, op3(Ibs,E,R),0 },
815 /*6c*/ { "ins", FALSE, BYTE, op2(DX, DI), 0 },
816 /*6d*/ { "ins", FALSE, LONG, op2(DX, DI), 0 },
817 /*6e*/ { "outs", FALSE, BYTE, op2(SI, DX), 0 },
818 /*6f*/ { "outs", FALSE, LONG, op2(SI, DX), 0 },
820 /*70*/ { "jo", FALSE, NONE, op1(Db), 0 },
821 /*71*/ { "jno", FALSE, NONE, op1(Db), 0 },
822 /*72*/ { "jb", FALSE, NONE, op1(Db), 0 },
823 /*73*/ { "jnb", FALSE, NONE, op1(Db), 0 },
824 /*74*/ { "jz", FALSE, NONE, op1(Db), 0 },
825 /*75*/ { "jnz", FALSE, NONE, op1(Db), 0 },
826 /*76*/ { "jbe", FALSE, NONE, op1(Db), 0 },
827 /*77*/ { "jnbe", FALSE, NONE, op1(Db), 0 },
829 /*78*/ { "js", FALSE, NONE, op1(Db), 0 },
830 /*79*/ { "jns", FALSE, NONE, op1(Db), 0 },
831 /*7a*/ { "jp", FALSE, NONE, op1(Db), 0 },
832 /*7b*/ { "jnp", FALSE, NONE, op1(Db), 0 },
833 /*7c*/ { "jl", FALSE, NONE, op1(Db), 0 },
834 /*7d*/ { "jnl", FALSE, NONE, op1(Db), 0 },
835 /*7e*/ { "jle", FALSE, NONE, op1(Db), 0 },
836 /*7f*/ { "jnle", FALSE, NONE, op1(Db), 0 },
838 /*80*/ { "", TRUE, BYTE, op2(I, E), db_Grp1 },
839 /*81*/ { "", TRUE, LONG, op2(I, E), db_Grp1 },
840 /*82*/ { "", TRUE, BYTE, op2(I, E), db_Grp1 },
841 /*83*/ { "", TRUE, LONG, op2(Ibs,E), db_Grp1 },
842 /*84*/ { "test", TRUE, BYTE, op2(R, E), 0 },
843 /*85*/ { "test", TRUE, LONG, op2(R, E), 0 },
844 /*86*/ { "xchg", TRUE, BYTE, op2(R, E), 0 },
845 /*87*/ { "xchg", TRUE, LONG, op2(R, E), 0 },
847 /*88*/ { "mov", TRUE, BYTE, op2(R, E), 0 },
848 /*89*/ { "mov", TRUE, LONG, op2(R, E), 0 },
849 /*8a*/ { "mov", TRUE, BYTE, op2(E, R), 0 },
850 /*8b*/ { "mov", TRUE, LONG, op2(E, R), 0 },
851 /*8c*/ { "mov", TRUE, NONE, op2(S, Ew), 0 },
852 /*8d*/ { "lea", TRUE, LONG, op2(E, R), 0 },
853 /*8e*/ { "mov", TRUE, NONE, op2(Ew, S), 0 },
854 /*8f*/ { "pop", TRUE, LONG, op1(E), 0 },
856 /*90*/ { "nop", FALSE, NONE, 0, 0 },
857 /*91*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
858 /*92*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
859 /*93*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
860 /*94*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
861 /*95*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
862 /*96*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
863 /*97*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
865 /*98*/ { "cbw", FALSE, SDEP, 0, "cwde" }, /* cbw/cwde */
866 /*99*/ { "cwd", FALSE, SDEP, 0, "cdq" }, /* cwd/cdq */
867 /*9a*/ { "lcall", FALSE, NONE, op1(OS), 0 },
868 /*9b*/ { "wait", FALSE, NONE, 0, 0 },
869 /*9c*/ { "pushf", FALSE, LONG, 0, 0 },
870 /*9d*/ { "popf", FALSE, LONG, 0, 0 },
871 /*9e*/ { "sahf", FALSE, NONE, 0, 0 },
872 /*9f*/ { "lahf", FALSE, NONE, 0, 0 },
874 /*a0*/ { "mov", FALSE, BYTE, op2(O, A), 0 },
875 /*a1*/ { "mov", FALSE, LONG, op2(O, A), 0 },
876 /*a2*/ { "mov", FALSE, BYTE, op2(A, O), 0 },
877 /*a3*/ { "mov", FALSE, LONG, op2(A, O), 0 },
878 /*a4*/ { "movs", FALSE, BYTE, op2(SI,DI), 0 },
879 /*a5*/ { "movs", FALSE, LONG, op2(SI,DI), 0 },
880 /*a6*/ { "cmps", FALSE, BYTE, op2(SI,DI), 0 },
881 /*a7*/ { "cmps", FALSE, LONG, op2(SI,DI), 0 },
883 /*a8*/ { "test", FALSE, BYTE, op2(I, A), 0 },
884 /*a9*/ { "test", FALSE, LONG, op2(I, A), 0 },
885 /*aa*/ { "stos", FALSE, BYTE, op1(DI), 0 },
886 /*ab*/ { "stos", FALSE, LONG, op1(DI), 0 },
887 /*ac*/ { "lods", FALSE, BYTE, op1(SI), 0 },
888 /*ad*/ { "lods", FALSE, LONG, op1(SI), 0 },
889 /*ae*/ { "scas", FALSE, BYTE, op1(SI), 0 },
890 /*af*/ { "scas", FALSE, LONG, op1(SI), 0 },
892 /*b0*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
893 /*b1*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
894 /*b2*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
895 /*b3*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
896 /*b4*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
897 /*b5*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
898 /*b6*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
899 /*b7*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
901 /*b8*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
902 /*b9*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
903 /*ba*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
904 /*bb*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
905 /*bc*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
906 /*bd*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
907 /*be*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
908 /*bf*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
910 /*c0*/ { "", TRUE, BYTE, op2(Ib, E), db_Grp2 },
911 /*c1*/ { "", TRUE, LONG, op2(Ib, E), db_Grp2 },
912 /*c2*/ { "ret", FALSE, NONE, op1(Iw), 0 },
913 /*c3*/ { "ret", FALSE, NONE, 0, 0 },
914 /*c4*/ { "les", TRUE, LONG, op2(E, R), 0 },
915 /*c5*/ { "lds", TRUE, LONG, op2(E, R), 0 },
916 /*c6*/ { "mov", TRUE, BYTE, op2(I, E), 0 },
917 /*c7*/ { "mov", TRUE, LONG, op2(I, E), 0 },
919 /*c8*/ { "enter", FALSE, NONE, op2(Iw, Ib), 0 },
920 /*c9*/ { "leave", FALSE, NONE, 0, 0 },
921 /*ca*/ { "lret", FALSE, NONE, op1(Iw), 0 },
922 /*cb*/ { "lret", FALSE, NONE, 0, 0 },
923 /*cc*/ { "int", FALSE, NONE, op1(o3), 0 },
924 /*cd*/ { "int", FALSE, NONE, op1(Ib), 0 },
925 /*ce*/ { "into", FALSE, NONE, 0, 0 },
926 /*cf*/ { "iret", FALSE, NONE, 0, 0 },
928 /*d0*/ { "", TRUE, BYTE, op2(o1, E), db_Grp2 },
929 /*d1*/ { "", TRUE, LONG, op2(o1, E), db_Grp2 },
930 /*d2*/ { "", TRUE, BYTE, op2(CL, E), db_Grp2 },
931 /*d3*/ { "", TRUE, LONG, op2(CL, E), db_Grp2 },
932 /*d4*/ { "aam", FALSE, NONE, op1(Iba), 0 },
933 /*d5*/ { "aad", FALSE, NONE, op1(Iba), 0 },
934 /*d6*/ { ".byte\t0xd6", FALSE, NONE, 0, 0 },
935 /*d7*/ { "xlat", FALSE, BYTE, op1(BX), 0 },
937 /*d8*/ { "", TRUE, NONE, 0, db_Esc8 },
938 /*d9*/ { "", TRUE, NONE, 0, db_Esc9 },
939 /*da*/ { "", TRUE, NONE, 0, db_Esca },
940 /*db*/ { "", TRUE, NONE, 0, db_Escb },
941 /*dc*/ { "", TRUE, NONE, 0, db_Escc },
942 /*dd*/ { "", TRUE, NONE, 0, db_Escd },
943 /*de*/ { "", TRUE, NONE, 0, db_Esce },
944 /*df*/ { "", TRUE, NONE, 0, db_Escf },
946 /*e0*/ { "loopne",FALSE, NONE, op1(Db), 0 },
947 /*e1*/ { "loope", FALSE, NONE, op1(Db), 0 },
948 /*e2*/ { "loop", FALSE, NONE, op1(Db), 0 },
949 /*e3*/ { "jcxz", FALSE, SDEP, op1(Db), "jecxz" },
950 /*e4*/ { "in", FALSE, BYTE, op2(Ib, A), 0 },
951 /*e5*/ { "in", FALSE, LONG, op2(Ib, A) , 0 },
952 /*e6*/ { "out", FALSE, BYTE, op2(A, Ib), 0 },
953 /*e7*/ { "out", FALSE, LONG, op2(A, Ib) , 0 },
955 /*e8*/ { "call", FALSE, NONE, op1(Dl), 0 },
956 /*e9*/ { "jmp", FALSE, NONE, op1(Dl), 0 },
957 /*ea*/ { "ljmp", FALSE, NONE, op1(OS), 0 },
958 /*eb*/ { "jmp", FALSE, NONE, op1(Db), 0 },
959 /*ec*/ { "in", FALSE, BYTE, op2(DX, A), 0 },
960 /*ed*/ { "in", FALSE, LONG, op2(DX, A) , 0 },
961 /*ee*/ { "out", FALSE, BYTE, op2(A, DX), 0 },
962 /*ef*/ { "out", FALSE, LONG, op2(A, DX) , 0 },
964 /*f0*/ { "", FALSE, NONE, 0, 0 },
965 /*f1*/ { ".byte\t0xf1", FALSE, NONE, 0, 0 },
966 /*f2*/ { "", FALSE, NONE, 0, 0 },
967 /*f3*/ { "", FALSE, NONE, 0, 0 },
968 /*f4*/ { "hlt", FALSE, NONE, 0, 0 },
969 /*f5*/ { "cmc", FALSE, NONE, 0, 0 },
970 /*f6*/ { "", TRUE, BYTE, 0, db_Grp3 },
971 /*f7*/ { "", TRUE, LONG, 0, db_Grp3 },
973 /*f8*/ { "clc", FALSE, NONE, 0, 0 },
974 /*f9*/ { "stc", FALSE, NONE, 0, 0 },
975 /*fa*/ { "cli", FALSE, NONE, 0, 0 },
976 /*fb*/ { "sti", FALSE, NONE, 0, 0 },
977 /*fc*/ { "cld", FALSE, NONE, 0, 0 },
978 /*fd*/ { "std", FALSE, NONE, 0, 0 },
979 /*fe*/ { "", TRUE, NONE, 0, db_Grp4 },
980 /*ff*/ { "", TRUE, NONE, 0, db_Grp5 },
983 static const struct inst db_bad_inst =
984 { "???", FALSE, NONE, 0, 0 }
987 #define f_mod(rex, byte) ((byte)>>6)
988 #define f_reg(rex, byte) ((((byte)>>3)&0x7) | (rex & REX_R ? 0x8 : 0x0))
989 #define f_rm(rex, byte) (((byte)&0x7) | (rex & REX_B ? 0x8 : 0x0))
991 #define sib_ss(rex, byte) ((byte)>>6)
992 #define sib_index(rex, byte) ((((byte)>>3)&0x7) | (rex & REX_X ? 0x8 : 0x0))
993 #define sib_base(rex, byte) (((byte)&0x7) | (rex & REX_B ? 0x8 : 0x0))
995 struct i_addr {
996 int is_reg; /* if reg, reg number is in 'disp' */
997 int disp;
998 const char * base;
999 const char * index;
1000 int ss;
1003 static const char * const db_reg[2][4][16] = {
1005 {{"%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
1006 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b" },
1007 { "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
1008 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w" },
1009 { "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
1010 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d" },
1011 { "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
1012 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" }},
1014 {{"%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
1015 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b" },
1016 { "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
1017 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w" },
1018 { "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
1019 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d" },
1020 { "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
1021 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" }}
1024 static const char * const db_seg_reg[8] = {
1025 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "", ""
1029 * lengths for size attributes
1031 static const int db_lengths[] = {
1032 1, /* BYTE */
1033 2, /* WORD */
1034 4, /* LONG */
1035 8, /* QUAD */
1036 4, /* SNGL */
1037 8, /* DBLR */
1038 10, /* EXTR */
1041 #define get_value_inc(result, loc, size, is_signed) \
1042 result = db_get_value((loc), (size), (is_signed)); \
1043 (loc) += (size);
1045 static db_addr_t
1046 db_disasm_esc(db_addr_t loc, int inst, int rex, int short_addr,
1047 int size, const char *seg);
1048 static void db_print_address(const char *seg, int size, int rex,
1049 struct i_addr *addrp);
1050 static db_addr_t
1051 db_read_address(db_addr_t loc, int short_addr, int rex, int regmodrm,
1052 struct i_addr *addrp);
1055 * Read address at location and return updated location.
1057 static db_addr_t
1058 db_read_address(loc, short_addr, rex, regmodrm, addrp)
1059 db_addr_t loc;
1060 int short_addr;
1061 int rex;
1062 int regmodrm;
1063 struct i_addr * addrp; /* out */
1065 int mod, rm, sib, index, disp, size, have_sib;
1067 mod = f_mod(rex, regmodrm);
1068 rm = f_rm(rex, regmodrm);
1070 if (mod == 3) {
1071 addrp->is_reg = TRUE;
1072 addrp->disp = rm;
1073 return (loc);
1075 addrp->is_reg = FALSE;
1076 addrp->index = 0;
1078 if (short_addr)
1079 size = LONG;
1080 else
1081 size = QUAD;
1083 if ((rm & 0x7) == 4) {
1084 get_value_inc(sib, loc, 1, FALSE);
1085 rm = sib_base(rex, sib);
1086 index = sib_index(rex, sib);
1087 if (index != 4)
1088 addrp->index = db_reg[1][size][index];
1089 addrp->ss = sib_ss(rex, sib);
1090 have_sib = 1;
1091 } else
1092 have_sib = 0;
1094 switch (mod) {
1095 case 0:
1096 if (rm == 5) {
1097 get_value_inc(addrp->disp, loc, 4, FALSE);
1098 if (have_sib)
1099 addrp->base = 0;
1100 else if (short_addr)
1101 addrp->base = "%eip";
1102 else
1103 addrp->base = "%rip";
1104 } else {
1105 addrp->disp = 0;
1106 addrp->base = db_reg[1][size][rm];
1108 break;
1110 case 1:
1111 get_value_inc(disp, loc, 1, TRUE);
1112 addrp->disp = disp;
1113 addrp->base = db_reg[1][size][rm];
1114 break;
1116 case 2:
1117 get_value_inc(disp, loc, 4, FALSE);
1118 addrp->disp = disp;
1119 addrp->base = db_reg[1][size][rm];
1120 break;
1122 return (loc);
1125 static void
1126 db_print_address(seg, size, rex, addrp)
1127 const char * seg;
1128 int size;
1129 int rex;
1130 struct i_addr * addrp;
1132 if (addrp->is_reg) {
1133 db_printf("%s", db_reg[rex != 0 ? 1 : 0][(size == LONG && (rex & REX_W)) ? QUAD : size][addrp->disp]);
1134 return;
1137 if (seg) {
1138 db_printf("%s:", seg);
1141 if (addrp->disp != 0 || (addrp->base == 0 && addrp->index == 0))
1142 db_printsym((db_addr_t)addrp->disp, DB_STGY_ANY);
1143 if (addrp->base != 0 || addrp->index != 0) {
1144 db_printf("(");
1145 if (addrp->base)
1146 db_printf("%s", addrp->base);
1147 if (addrp->index)
1148 db_printf(",%s,%d", addrp->index, 1<<addrp->ss);
1149 db_printf(")");
1154 * Disassemble floating-point ("escape") instruction
1155 * and return updated location.
1157 static db_addr_t
1158 db_disasm_esc(loc, inst, rex, short_addr, size, seg)
1159 db_addr_t loc;
1160 int inst;
1161 int rex;
1162 int short_addr;
1163 int size;
1164 const char * seg;
1166 int regmodrm;
1167 const struct finst * fp;
1168 int mod;
1169 struct i_addr address;
1170 const char * name;
1172 get_value_inc(regmodrm, loc, 1, FALSE);
1173 fp = &db_Esc_inst[inst - 0xd8][f_reg(rex, regmodrm)];
1174 mod = f_mod(rex, regmodrm);
1175 if (mod != 3) {
1176 if (*fp->f_name == '\0') {
1177 db_printf("<bad instruction>");
1178 return (loc);
1181 * Normal address modes.
1183 loc = db_read_address(loc, short_addr, rex, regmodrm, &address);
1184 db_printf("%s", fp->f_name);
1185 switch(fp->f_size) {
1186 case SNGL:
1187 db_printf("s");
1188 break;
1189 case DBLR:
1190 db_printf("l");
1191 break;
1192 case EXTR:
1193 db_printf("t");
1194 break;
1195 case WORD:
1196 db_printf("s");
1197 break;
1198 case LONG:
1199 db_printf("l");
1200 break;
1201 case QUAD:
1202 db_printf("q");
1203 break;
1204 default:
1205 break;
1207 db_printf("\t");
1208 db_print_address(seg, BYTE, rex, &address);
1210 else {
1212 * 'reg-reg' - special formats
1214 switch (fp->f_rrmode) {
1215 case op2(ST,STI):
1216 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1217 db_printf("%s\t%%st,%%st(%d)",name,f_rm(rex, regmodrm));
1218 break;
1219 case op2(STI,ST):
1220 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1221 db_printf("%s\t%%st(%d),%%st",name, f_rm(rex, regmodrm));
1222 break;
1223 case op1(STI):
1224 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1225 db_printf("%s\t%%st(%d)",name, f_rm(rex, regmodrm));
1226 break;
1227 case op1(X):
1228 name = ((const char * const *)fp->f_rrname)[f_rm(rex, regmodrm)];
1229 if (*name == '\0')
1230 goto bad;
1231 db_printf("%s", name);
1232 break;
1233 case op1(XA):
1234 name = ((const char * const *)fp->f_rrname)[f_rm(rex, regmodrm)];
1235 if (*name == '\0')
1236 goto bad;
1237 db_printf("%s\t%%ax", name);
1238 break;
1239 default:
1240 bad:
1241 db_printf("<bad instruction>");
1242 break;
1246 return (loc);
1250 * Disassemble instruction at 'loc'. 'altfmt' specifies an
1251 * (optional) alternate format. Return address of start of
1252 * next instruction.
1254 static db_addr_t
1255 db_disasm(db_addr_t loc, boolean_t altfmt)
1257 int inst;
1258 int size;
1259 int short_addr;
1260 const char * seg;
1261 const struct inst * ip;
1262 const char * i_name;
1263 int i_size;
1264 int i_mode;
1265 int rex = 0;
1266 int regmodrm = 0;
1267 boolean_t first;
1268 int displ;
1269 int prefix;
1270 int rep;
1271 int imm;
1272 int imm2;
1273 long imm64;
1274 int len;
1275 struct i_addr address;
1276 db_addr_t addr;
1278 get_value_inc(inst, loc, 1, FALSE);
1279 short_addr = FALSE;
1280 size = LONG;
1281 seg = 0;
1284 * Get prefixes
1286 rep = FALSE;
1287 prefix = TRUE;
1288 do {
1289 switch (inst) {
1290 case 0x66: /* data16 */
1291 size = WORD;
1292 break;
1293 case 0x67:
1294 short_addr = TRUE;
1295 break;
1296 case 0x26:
1297 seg = "%es";
1298 break;
1299 case 0x36:
1300 seg = "%ss";
1301 break;
1302 case 0x2e:
1303 seg = "%cs";
1304 break;
1305 case 0x3e:
1306 seg = "%ds";
1307 break;
1308 case 0x64:
1309 seg = "%fs";
1310 break;
1311 case 0x65:
1312 seg = "%gs";
1313 break;
1314 case 0xf0:
1315 db_printf("lock ");
1316 break;
1317 case 0xf2:
1318 db_printf("repne ");
1319 break;
1320 case 0xf3:
1321 rep = TRUE;
1322 break;
1323 default:
1324 prefix = FALSE;
1325 break;
1327 if (inst >= 0x40 && inst < 0x50) {
1328 rex = inst;
1329 prefix = TRUE;
1331 if (prefix) {
1332 get_value_inc(inst, loc, 1, FALSE);
1334 if (rep == TRUE) {
1335 if (inst == 0x90) {
1336 db_printf("pause\n");
1337 return (loc);
1339 db_printf("repe "); /* XXX repe VS rep */
1340 rep = FALSE;
1342 } while (prefix);
1344 if (inst >= 0xd8 && inst <= 0xdf) {
1345 loc = db_disasm_esc(loc, inst, rex, short_addr, size, seg);
1346 db_printf("\n");
1347 return (loc);
1350 if (inst == 0x0f) {
1351 get_value_inc(inst, loc, 1, FALSE);
1352 ip = db_inst_0f[inst>>4];
1353 if (ip == 0) {
1354 ip = &db_bad_inst;
1356 else {
1357 ip = &ip[inst&0xf];
1360 else
1361 ip = &db_inst_table[inst];
1363 if (ip->i_has_modrm) {
1364 get_value_inc(regmodrm, loc, 1, FALSE);
1365 loc = db_read_address(loc, short_addr, rex, regmodrm, &address);
1368 i_name = ip->i_name;
1369 i_size = ip->i_size;
1370 i_mode = ip->i_mode;
1372 if (ip->i_extra == db_Grp1 || ip->i_extra == db_Grp2 ||
1373 ip->i_extra == db_Grp6 || ip->i_extra == db_Grp7 ||
1374 ip->i_extra == db_Grp8 || ip->i_extra == db_Grp9 ||
1375 ip->i_extra == db_Grp15) {
1376 i_name = ((const char * const *)ip->i_extra)[f_reg(rex, regmodrm)];
1378 else if (ip->i_extra == db_Grp3) {
1379 ip = ip->i_extra;
1380 ip = &ip[f_reg(rex, regmodrm)];
1381 i_name = ip->i_name;
1382 i_mode = ip->i_mode;
1384 else if (ip->i_extra == db_Grp4 || ip->i_extra == db_Grp5) {
1385 ip = ip->i_extra;
1386 ip = &ip[f_reg(rex, regmodrm)];
1387 i_name = ip->i_name;
1388 i_mode = ip->i_mode;
1389 i_size = ip->i_size;
1392 /* Special cases that don't fit well in the tables. */
1393 if (ip->i_extra == db_Grp7 && f_mod(rex, regmodrm) == 3) {
1394 switch (regmodrm) {
1395 case 0xc8:
1396 i_name = "monitor";
1397 i_size = NONE;
1398 i_mode = 0;
1399 break;
1400 case 0xc9:
1401 i_name = "mwait";
1402 i_size = NONE;
1403 i_mode = 0;
1404 break;
1405 case 0xf8:
1406 i_name = "swapgs";
1407 i_size = NONE;
1408 i_mode = 0;
1409 break;
1412 if (ip->i_extra == db_Grp15 && f_mod(0, regmodrm) == 3) {
1413 i_name = db_Grp15b[f_reg(0, regmodrm)];
1414 i_size = NONE;
1415 i_mode = 0;
1418 if (i_size == SDEP) {
1419 if (size == WORD)
1420 db_printf("%s", i_name);
1421 else
1422 db_printf("%s", (const char *)ip->i_extra);
1424 else {
1425 db_printf("%s", i_name);
1426 if ((inst >= 0x50 && inst <= 0x5f) || inst == 0x68 || inst == 0x6a) {
1427 i_size = NONE;
1428 db_printf("q");
1430 if (i_size != NONE) {
1431 if (i_size == BYTE) {
1432 db_printf("b");
1433 size = BYTE;
1435 else if (i_size == WORD) {
1436 db_printf("w");
1437 size = WORD;
1439 else if (size == WORD)
1440 db_printf("w");
1441 else {
1442 if (rex & REX_W)
1443 db_printf("q");
1444 else
1445 db_printf("l");
1449 db_printf("\t");
1450 for (first = TRUE;
1451 i_mode != 0;
1452 i_mode >>= 8, first = FALSE)
1454 if (!first)
1455 db_printf(",");
1457 switch (i_mode & 0xFF) {
1459 case E:
1460 db_print_address(seg, size, rex, &address);
1461 break;
1463 case Eind:
1464 db_printf("*");
1465 db_print_address(seg, size, rex, &address);
1466 break;
1468 case El:
1469 db_print_address(seg, (rex & REX_W) ? QUAD : LONG, rex, &address);
1470 break;
1472 case EL:
1473 db_print_address(seg, LONG, 0, &address);
1474 break;
1476 case Ew:
1477 db_print_address(seg, WORD, rex, &address);
1478 break;
1480 case Eb:
1481 db_print_address(seg, BYTE, rex, &address);
1482 break;
1484 case R:
1485 db_printf("%s", db_reg[rex != 0 ? 1 : 0][(size == LONG && (rex & REX_W)) ? QUAD : size][f_reg(rex, regmodrm)]);
1486 break;
1488 case Rw:
1489 db_printf("%s", db_reg[rex != 0 ? 1 : 0][WORD][f_reg(rex, regmodrm)]);
1490 break;
1492 case Ri:
1493 db_printf("%s", db_reg[0][QUAD][f_rm(rex, inst)]);
1494 break;
1496 case Ril:
1497 db_printf("%s", db_reg[rex != 0 ? 1 : 0][(rex & REX_R) ? QUAD : LONG][f_rm(rex, inst)]);
1498 break;
1500 case S:
1501 db_printf("%s", db_seg_reg[f_reg(0, regmodrm)]);
1502 break;
1504 case Si:
1505 db_printf("%s", db_seg_reg[f_reg(0, inst)]);
1506 break;
1508 case A:
1509 db_printf("%s", db_reg[rex != 0 ? 1 : 0][size][0]); /* acc */
1510 break;
1512 case BX:
1513 if (seg)
1514 db_printf("%s:", seg);
1515 db_printf("(%s)", short_addr ? "%bx" : "%ebx");
1516 break;
1518 case CL:
1519 db_printf("%%cl");
1520 break;
1522 case DX:
1523 db_printf("%%dx");
1524 break;
1526 case SI:
1527 if (seg)
1528 db_printf("%s:", seg);
1529 db_printf("(%s)", short_addr ? "%si" : "%rsi");
1530 break;
1532 case DI:
1533 db_printf("%%es:(%s)", short_addr ? "%di" : "%rdi");
1534 break;
1536 case CR:
1537 db_printf("%%cr%d", f_reg(rex, regmodrm));
1538 break;
1540 case DR:
1541 db_printf("%%dr%d", f_reg(rex, regmodrm));
1542 break;
1544 case TR:
1545 db_printf("%%tr%d", f_reg(rex, regmodrm));
1546 break;
1548 case I:
1549 len = db_lengths[size];
1550 get_value_inc(imm, loc, len, FALSE);
1551 db_printf("$%#x", imm);
1552 break;
1554 case Is:
1555 len = db_lengths[(size == LONG && (rex & REX_W)) ? QUAD : size];
1556 get_value_inc(imm, loc, len, FALSE);
1557 db_printf("$%x", imm);
1558 break;
1560 case Ib:
1561 get_value_inc(imm, loc, 1, FALSE);
1562 db_printf("$%#x", imm);
1563 break;
1565 case Iba:
1566 get_value_inc(imm, loc, 1, FALSE);
1567 if (imm != 0x0a)
1568 db_printf("$%#x", imm);
1569 break;
1571 case Ibs:
1572 get_value_inc(imm, loc, 1, TRUE);
1573 if (size == WORD)
1574 imm &= 0xFFFF;
1575 db_printf("$%x", imm);
1576 break;
1578 case Iw:
1579 get_value_inc(imm, loc, 2, FALSE);
1580 db_printf("$%#x", imm);
1581 break;
1583 case Ilq:
1584 len = db_lengths[rex & REX_W ? QUAD : LONG];
1585 get_value_inc(imm64, loc, len, FALSE);
1586 db_printf("$%#lx", imm64);
1587 break;
1589 case O:
1590 len = (short_addr ? 2 : 4);
1591 get_value_inc(displ, loc, len, FALSE);
1592 if (seg)
1593 db_printf("%s:%x",seg, displ);
1594 else
1595 db_printsym((db_addr_t)displ, DB_STGY_ANY);
1596 break;
1598 case Db:
1599 get_value_inc(displ, loc, 1, TRUE);
1600 addr = loc + (LONG64)displ;
1601 if (size == WORD)
1602 addr &= 0xFFFF;
1603 db_printsym(addr, DB_STGY_XTRN);
1604 break;
1606 case Dl:
1607 len = db_lengths[(size == LONG && (rex & REX_W)) ? QUAD : size];
1608 get_value_inc(displ, loc, len, FALSE);
1609 addr = loc + (LONG64)displ;
1610 if (size == WORD)
1611 addr &= 0xFFFF;
1612 db_printsym(addr, DB_STGY_XTRN);
1613 break;
1615 case o1:
1616 db_printf("$1");
1617 break;
1619 case o3:
1620 db_printf("$3");
1621 break;
1623 case OS:
1624 len = db_lengths[size];
1625 get_value_inc(imm, loc, len, FALSE); /* offset */
1626 get_value_inc(imm2, loc, 2, FALSE); /* segment */
1627 db_printf("$%#x,%#x", imm2, imm);
1628 break;
1629 case MX:
1630 db_printf("%%mm%d", f_reg(rex, regmodrm));
1631 break;
1632 case EMX:
1633 db_printf("%%mm%d", f_rm(rex, regmodrm));
1634 break;
1635 case XMM:
1636 db_printf("%%xmm%d", f_reg(rex, regmodrm));
1637 break;
1638 case EXMM:
1639 db_printf("%%xmm%d", f_rm(rex, regmodrm));
1640 break;
1643 return (loc);
1646 void be_x86_64_disasm_one_insn(ADDRESS64 *addr, int display)
1648 db_printf = display ? dbg_printf : no_printf;
1649 addr->Offset = db_disasm(addr->Offset, TRUE);