configure: Don't warn about libhal if we can use an alternative.
[wine/multimedia.git] / programs / winedbg / db_disasm64.c
blob98f7ef2f3f35742861035b1b038e296dcc51b20d
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 #ifndef __GNUC__
36 #define __attribute__(X)
37 #endif
39 static int db_debug = 0;
40 static int db_printf(const char* format, ...) __attribute__((format (printf,1,2)));
41 int db_printf(const char* format, ...)
43 va_list valist;
44 int len = 0;
45 if (db_debug)
47 va_start(valist, format);
48 len = dbg_printf(format, valist);
49 va_end(valist);
51 return len;
54 typedef DWORD_PTR db_addr_t;
55 typedef BOOL boolean_t;
57 static ULONG64 db_get_value(db_addr_t addr, int size, int is_signed)
59 ULONG64 result = 0;
60 char buffer[8];
62 if (size != 1 && size != 2 && size != 4 && size != 8)
64 db_printf("Illegal size specified\n");
66 else if (dbg_read_memory((void*)addr, buffer, size))
68 switch (size)
70 case 8:
71 if (is_signed) result = (ULONG64)*(LONG64*)buffer;
72 else result = *(ULONG64*)buffer;
73 break;
74 case 4:
75 if (is_signed) result = (ULONG) *(LONG*)buffer;
76 else result = *(ULONG64*)buffer;
77 break;
78 case 2:
79 if (is_signed) result = (unsigned int) *(short int *)buffer;
80 else result = *(unsigned short int *)buffer;
81 break;
82 case 1:
83 if (is_signed) result = (unsigned int) *(char *)buffer;
84 else result = *(unsigned char *)buffer;
85 break;
88 return result;
91 #define DB_STGY_ANY 0
92 #define DB_STGY_XTRN 0
94 static void db_printsym(db_addr_t addr, unsigned unused)
96 if (db_debug)
98 ADDRESS64 a;
100 a.Mode = AddrModeFlat;
101 a.Offset = addr;
103 print_address(&a, FALSE);
107 /* </Wine specific wrappers> */
110 * Size attributes
112 #define BYTE 0
113 #define WORD 1
114 #define LONG 2
115 #define QUAD 3
116 #define SNGL 4
117 #define DBLR 5
118 #define EXTR 6
119 #define SDEP 7
120 #define NONE 8
123 * REX prefix and bits
125 #define REX_B 1
126 #define REX_X 2
127 #define REX_R 4
128 #define REX_W 8
129 #define REX 0x40
132 * Addressing modes
134 #define E 1 /* general effective address */
135 #define Eind 2 /* indirect address (jump, call) */
136 #define Ew 3 /* address, word size */
137 #define Eb 4 /* address, byte size */
138 #define R 5 /* register, in 'reg' field */
139 #define Rw 6 /* word register, in 'reg' field */
140 #define Ri 7 /* register in instruction */
141 #define S 8 /* segment reg, in 'reg' field */
142 #define Si 9 /* segment reg, in instruction */
143 #define A 10 /* accumulator */
144 #define BX 11 /* (bx) */
145 #define CL 12 /* cl, for shifts */
146 #define DX 13 /* dx, for IO */
147 #define SI 14 /* si */
148 #define DI 15 /* di */
149 #define CR 16 /* control register */
150 #define DR 17 /* debug register */
151 #define TR 18 /* test register */
152 #define I 19 /* immediate, unsigned */
153 #define Is 20 /* immediate, signed */
154 #define Ib 21 /* byte immediate, unsigned */
155 #define Ibs 22 /* byte immediate, signed */
156 #define Iw 23 /* word immediate, unsigned */
157 #define Ilq 24 /* long/quad immediate, unsigned */
158 #define O 25 /* direct address */
159 #define Db 26 /* byte displacement from EIP */
160 #define Dl 27 /* long displacement from EIP */
161 #define o1 28 /* constant 1 */
162 #define o3 29 /* constant 3 */
163 #define OS 30 /* immediate offset/segment */
164 #define ST 31 /* FP stack top */
165 #define STI 32 /* FP stack */
166 #define X 33 /* extended FP op */
167 #define XA 34 /* for 'fstcw %ax' */
168 #define El 35 /* address, long/quad size */
169 #define Ril 36 /* long register in instruction */
170 #define Iba 37 /* byte immediate, don't print if 0xa */
171 #define EL 38 /* address, explicitly long size */
172 /* Wine extensions */
173 #define MX 39 /* special register (MMX reg %mm0-7) */
174 #define EMX 40 /* special register (MMX reg %mm0-7) */
175 #define XMM 41 /* special register (floating point reg %xmm0-7) */
176 #define EXMM 42 /* special register (floating point reg %xmm0-7) */
178 struct inst {
179 const char * i_name; /* name */
180 short i_has_modrm; /* has regmodrm byte */
181 short i_size; /* operand size */
182 int i_mode; /* addressing modes */
183 const void * i_extra; /* pointer to extra opcode table */
186 #define op1(x) (x)
187 #define op2(x,y) ((x)|((y)<<8))
188 #define op3(x,y,z) ((x)|((y)<<8)|((z)<<16))
190 struct finst {
191 const char * f_name; /* name for memory instruction */
192 int f_size; /* size for memory instruction */
193 int f_rrmode; /* mode for rr instruction */
194 const void * f_rrname; /* name for rr instruction
195 (or pointer to table) */
198 static const char * const db_Grp6[] = {
199 "sldt",
200 "str",
201 "lldt",
202 "ltr",
203 "verr",
204 "verw",
209 static const char * const db_Grp7[] = {
210 "sgdt",
211 "sidt",
212 "lgdt",
213 "lidt",
214 "smsw",
216 "lmsw",
217 "invlpg"
220 static const char * const db_Grp8[] = {
225 "bt",
226 "bts",
227 "btr",
228 "btc"
231 static const char * const db_Grp9[] = {
233 "cmpxchg8b",
242 static const char * const db_Grp15[] = {
243 "fxsave",
244 "fxrstor",
245 "ldmxcsr",
246 "stmxcsr",
250 "clflush"
253 static const char * const db_Grp15b[] = {
259 "lfence",
260 "mfence",
261 "sfence"
264 static const struct inst db_inst_0f0x[] = {
265 /*00*/ { "", TRUE, NONE, op1(Ew), db_Grp6 },
266 /*01*/ { "", TRUE, NONE, op1(Ew), db_Grp7 },
267 /*02*/ { "lar", TRUE, LONG, op2(E,R), 0 },
268 /*03*/ { "lsl", TRUE, LONG, op2(E,R), 0 },
269 /*04*/ { "", FALSE, NONE, 0, 0 },
270 /*05*/ { "syscall",FALSE,NONE, 0, 0 },
271 /*06*/ { "clts", FALSE, NONE, 0, 0 },
272 /*07*/ { "sysret",FALSE, NONE, 0, 0 },
274 /*08*/ { "invd", FALSE, NONE, 0, 0 },
275 /*09*/ { "wbinvd",FALSE, NONE, 0, 0 },
276 /*0a*/ { "", FALSE, NONE, 0, 0 },
277 /*0b*/ { "", FALSE, NONE, 0, 0 },
278 /*0c*/ { "", FALSE, NONE, 0, 0 },
279 /*0d*/ { "", FALSE, NONE, 0, 0 },
280 /*0e*/ { "", FALSE, NONE, 0, 0 },
281 /*0f*/ { "", FALSE, NONE, 0, 0 },
284 static const struct inst db_inst_0f2x[] = {
285 /*20*/ { "mov", TRUE, LONG, op2(CR,El), 0 },
286 /*21*/ { "mov", TRUE, LONG, op2(DR,El), 0 },
287 /*22*/ { "mov", TRUE, LONG, op2(El,CR), 0 },
288 /*23*/ { "mov", TRUE, LONG, op2(El,DR), 0 },
289 /*24*/ { "mov", TRUE, LONG, op2(TR,El), 0 },
290 /*25*/ { "", FALSE, NONE, 0, 0 },
291 /*26*/ { "mov", TRUE, LONG, op2(El,TR), 0 },
292 /*27*/ { "", FALSE, NONE, 0, 0 },
294 /*28*/ { "", FALSE, NONE, 0, 0 },
295 /*29*/ { "", FALSE, NONE, 0, 0 },
296 /*2a*/ { "", FALSE, NONE, 0, 0 },
297 /*2b*/ { "", FALSE, NONE, 0, 0 },
298 /*2c*/ { "", FALSE, NONE, 0, 0 },
299 /*2d*/ { "", FALSE, NONE, 0, 0 },
300 /*2e*/ { "", FALSE, NONE, 0, 0 },
301 /*2f*/ { "", FALSE, NONE, 0, 0 },
304 static const struct inst db_inst_0f3x[] = {
305 /*30*/ { "wrmsr", FALSE, NONE, 0, 0 },
306 /*31*/ { "rdtsc", FALSE, NONE, 0, 0 },
307 /*32*/ { "rdmsr", FALSE, NONE, 0, 0 },
308 /*33*/ { "rdpmc", FALSE, NONE, 0, 0 },
309 /*34*/ { "sysenter",FALSE,NONE, 0, 0 },
310 /*35*/ { "sysexit",FALSE,NONE, 0, 0 },
311 /*36*/ { "", FALSE, NONE, 0, 0 },
312 /*37*/ { "getsec",FALSE, NONE, 0, 0 },
314 /*38*/ { "", FALSE, NONE, 0, 0 },
315 /*39*/ { "", FALSE, NONE, 0, 0 },
316 /*3a*/ { "", FALSE, NONE, 0, 0 },
317 /*3b*/ { "", FALSE, NONE, 0, 0 },
318 /*3c*/ { "", FALSE, NONE, 0, 0 },
319 /*3d*/ { "", FALSE, NONE, 0, 0 },
320 /*3e*/ { "", FALSE, NONE, 0, 0 },
321 /*3f*/ { "", FALSE, NONE, 0, 0 },
324 static const struct inst db_inst_0f4x[] = {
325 /*40*/ { "cmovo", TRUE, NONE, op2(E, R), 0 },
326 /*41*/ { "cmovno", TRUE, NONE, op2(E, R), 0 },
327 /*42*/ { "cmovb", TRUE, NONE, op2(E, R), 0 },
328 /*43*/ { "cmovnb", TRUE, NONE, op2(E, R), 0 },
329 /*44*/ { "cmovz", TRUE, NONE, op2(E, R), 0 },
330 /*45*/ { "cmovnz", TRUE, NONE, op2(E, R), 0 },
331 /*46*/ { "cmovbe", TRUE, NONE, op2(E, R), 0 },
332 /*47*/ { "cmovnbe",TRUE, NONE, op2(E, R), 0 },
334 /*48*/ { "cmovs", TRUE, NONE, op2(E, R), 0 },
335 /*49*/ { "cmovns", TRUE, NONE, op2(E, R), 0 },
336 /*4a*/ { "cmovp", TRUE, NONE, op2(E, R), 0 },
337 /*4b*/ { "cmovnp", TRUE, NONE, op2(E, R), 0 },
338 /*4c*/ { "cmovl", TRUE, NONE, op2(E, R), 0 },
339 /*4d*/ { "cmovnl", TRUE, NONE, op2(E, R), 0 },
340 /*4e*/ { "cmovle", TRUE, NONE, op2(E, R), 0 },
341 /*4f*/ { "cmovnle",TRUE, NONE, op2(E, R), 0 },
344 static const struct inst db_inst_0f5x[] = {
345 /*50*/ { "movmskps",TRUE, NONE, op2(E, XMM), 0 },
346 /*51*/ { "sqrtps", TRUE, NONE, op2(XMM, EXMM), 0 },
347 /*52*/ { "rsqrtps", TRUE, NONE, op2(XMM, EXMM), 0 },
348 /*53*/ { "rcpps", TRUE, NONE, op2(XMM, EXMM), 0 },
349 /*54*/ { "andps", TRUE, NONE, op2(XMM, EXMM), 0 },
350 /*55*/ { "andnps", TRUE, NONE, op2(XMM, EXMM), 0 },
351 /*56*/ { "orps", TRUE, NONE, op2(XMM, EXMM), 0 },
352 /*57*/ { "xorps", TRUE, NONE, op2(XMM, EXMM), 0 },
354 /*58*/ { "addps", TRUE, NONE, op2(XMM, EXMM), 0 },
355 /*59*/ { "mulps", TRUE, NONE, op2(XMM, EXMM), 0 },
356 /*5a*/ { "(bad)", FALSE, NONE, 0, 0 },
357 /*5b*/ { "(bad)", FALSE, NONE, 0, 0 },
358 /*5c*/ { "subps", TRUE, NONE, op2(XMM, EXMM), 0 },
359 /*5d*/ { "minps", TRUE, NONE, op2(XMM, EXMM), 0 },
360 /*5e*/ { "divps", TRUE, NONE, op2(XMM, EXMM), 0 },
361 /*5f*/ { "maxps", TRUE, NONE, op2(XMM, EXMM), 0 },
364 static const struct inst db_inst_0f6x[] = {
365 /*60*/ { "punpcklbw", TRUE, NONE, op2(E, MX), 0 },
366 /*61*/ { "punpcklwd", TRUE, NONE, op2(E, MX), 0 },
367 /*62*/ { "punpckldq", TRUE, NONE, op2(E, MX), 0 },
368 /*63*/ { "packsswb", TRUE, NONE, op2(E, MX), 0 },
369 /*64*/ { "pcmpgtb", TRUE, NONE, op2(E, MX), 0 },
370 /*65*/ { "pcmpgtw", TRUE, NONE, op2(E, MX), 0 },
371 /*66*/ { "pcmpgtd", TRUE, NONE, op2(E, MX), 0 },
372 /*67*/ { "packuswb", TRUE, NONE, op2(E, MX), 0 },
374 /*68*/ { "punpckhbw", TRUE, NONE, op2(E, MX), 0 },
375 /*69*/ { "punpckhwd", TRUE, NONE, op2(E, MX), 0 },
376 /*6a*/ { "punpckhdq", TRUE, NONE, op2(E, MX), 0 },
377 /*6b*/ { "packssdw", TRUE, NONE, op2(E, MX), 0 },
378 /*6c*/ { "(bad)", TRUE, NONE, 0, 0 },
379 /*6d*/ { "(bad)", TRUE, NONE, 0, 0 },
380 /*6e*/ { "movd", TRUE, NONE, op2(E, MX), 0 },
381 /*6f*/ { "movq", TRUE, NONE, op2(E, MX), 0 },
384 static const struct inst db_inst_0f7x[] = {
385 /*70*/ { "pshufw", TRUE, NONE, op2(MX, EMX), 0 },
386 /*71*/ { "(bad)", TRUE, NONE, 0, 0 }, /* FIXME: grp 12 */
387 /*72*/ { "(bad)", TRUE, NONE, 0, 0 }, /* FIXME: grp 13 */
388 /*73*/ { "(bad)", TRUE, NONE, 0, 0 }, /* FIXME: grp 14 */
389 /*74*/ { "pcmpeqb", TRUE, NONE, op2(E, MX), 0 },
390 /*75*/ { "pcmpeqw", TRUE, NONE, op2(E, MX), 0 },
391 /*76*/ { "pcmpeqd", TRUE, NONE, op2(E, MX), 0 },
392 /*77*/ { "emms", FALSE,NONE, 0, 0 },
394 /*78*/ { "(bad)", TRUE, NONE, 0, 0 },
395 /*79*/ { "(bad)", TRUE, NONE, 0, 0 },
396 /*7a*/ { "(bad)", TRUE, NONE, 0, 0 },
397 /*7b*/ { "(bad)", TRUE, NONE, 0, 0 },
398 /*7c*/ { "(bad)", TRUE, NONE, 0, 0 },
399 /*7d*/ { "(bad)", TRUE, NONE, 0, 0 },
400 /*7e*/ { "movd", TRUE, NONE, op2(E, MX), 0 },
401 /*7f*/ { "movq", TRUE, NONE, op2(EMX, MX), 0 },
404 static const struct inst db_inst_0f8x[] = {
405 /*80*/ { "jo", FALSE, NONE, op1(Dl), 0 },
406 /*81*/ { "jno", FALSE, NONE, op1(Dl), 0 },
407 /*82*/ { "jb", FALSE, NONE, op1(Dl), 0 },
408 /*83*/ { "jnb", FALSE, NONE, op1(Dl), 0 },
409 /*84*/ { "jz", FALSE, NONE, op1(Dl), 0 },
410 /*85*/ { "jnz", FALSE, NONE, op1(Dl), 0 },
411 /*86*/ { "jbe", FALSE, NONE, op1(Dl), 0 },
412 /*87*/ { "jnbe", FALSE, NONE, op1(Dl), 0 },
414 /*88*/ { "js", FALSE, NONE, op1(Dl), 0 },
415 /*89*/ { "jns", FALSE, NONE, op1(Dl), 0 },
416 /*8a*/ { "jp", FALSE, NONE, op1(Dl), 0 },
417 /*8b*/ { "jnp", FALSE, NONE, op1(Dl), 0 },
418 /*8c*/ { "jl", FALSE, NONE, op1(Dl), 0 },
419 /*8d*/ { "jnl", FALSE, NONE, op1(Dl), 0 },
420 /*8e*/ { "jle", FALSE, NONE, op1(Dl), 0 },
421 /*8f*/ { "jnle", FALSE, NONE, op1(Dl), 0 },
424 static const struct inst db_inst_0f9x[] = {
425 /*90*/ { "seto", TRUE, NONE, op1(Eb), 0 },
426 /*91*/ { "setno", TRUE, NONE, op1(Eb), 0 },
427 /*92*/ { "setb", TRUE, NONE, op1(Eb), 0 },
428 /*93*/ { "setnb", TRUE, NONE, op1(Eb), 0 },
429 /*94*/ { "setz", TRUE, NONE, op1(Eb), 0 },
430 /*95*/ { "setnz", TRUE, NONE, op1(Eb), 0 },
431 /*96*/ { "setbe", TRUE, NONE, op1(Eb), 0 },
432 /*97*/ { "setnbe",TRUE, NONE, op1(Eb), 0 },
434 /*98*/ { "sets", TRUE, NONE, op1(Eb), 0 },
435 /*99*/ { "setns", TRUE, NONE, op1(Eb), 0 },
436 /*9a*/ { "setp", TRUE, NONE, op1(Eb), 0 },
437 /*9b*/ { "setnp", TRUE, NONE, op1(Eb), 0 },
438 /*9c*/ { "setl", TRUE, NONE, op1(Eb), 0 },
439 /*9d*/ { "setnl", TRUE, NONE, op1(Eb), 0 },
440 /*9e*/ { "setle", TRUE, NONE, op1(Eb), 0 },
441 /*9f*/ { "setnle",TRUE, NONE, op1(Eb), 0 },
444 static const struct inst db_inst_0fax[] = {
445 /*a0*/ { "push", FALSE, NONE, op1(Si), 0 },
446 /*a1*/ { "pop", FALSE, NONE, op1(Si), 0 },
447 /*a2*/ { "cpuid", FALSE, NONE, 0, 0 },
448 /*a3*/ { "bt", TRUE, LONG, op2(R,E), 0 },
449 /*a4*/ { "shld", TRUE, LONG, op3(Ib,R,E), 0 },
450 /*a5*/ { "shld", TRUE, LONG, op3(CL,R,E), 0 },
451 /*a6*/ { "", FALSE, NONE, 0, 0 },
452 /*a7*/ { "", FALSE, NONE, 0, 0 },
454 /*a8*/ { "push", FALSE, NONE, op1(Si), 0 },
455 /*a9*/ { "pop", FALSE, NONE, op1(Si), 0 },
456 /*aa*/ { "rsm", FALSE, NONE, 0, 0 },
457 /*ab*/ { "bts", TRUE, LONG, op2(R,E), 0 },
458 /*ac*/ { "shrd", TRUE, LONG, op3(Ib,R,E), 0 },
459 /*ad*/ { "shrd", TRUE, LONG, op3(CL,R,E), 0 },
460 /*ae*/ { "", TRUE, LONG, op1(E), db_Grp15 },
461 /*af*/ { "imul", TRUE, LONG, op2(E,R), 0 },
464 static const struct inst db_inst_0fbx[] = {
465 /*b0*/ { "cmpxchg",TRUE, BYTE, op2(R, E), 0 },
466 /*b0*/ { "cmpxchg",TRUE, LONG, op2(R, E), 0 },
467 /*b2*/ { "lss", TRUE, LONG, op2(E, R), 0 },
468 /*b3*/ { "btr", TRUE, LONG, op2(R, E), 0 },
469 /*b4*/ { "lfs", TRUE, LONG, op2(E, R), 0 },
470 /*b5*/ { "lgs", TRUE, LONG, op2(E, R), 0 },
471 /*b6*/ { "movzb", TRUE, LONG, op2(Eb, R), 0 },
472 /*b7*/ { "movzw", TRUE, LONG, op2(Ew, R), 0 },
474 /*b8*/ { "", FALSE, NONE, 0, 0 },
475 /*b9*/ { "", FALSE, NONE, 0, 0 },
476 /*ba*/ { "", TRUE, LONG, op2(Ib, E), db_Grp8 },
477 /*bb*/ { "btc", TRUE, LONG, op2(R, E), 0 },
478 /*bc*/ { "bsf", TRUE, LONG, op2(E, R), 0 },
479 /*bd*/ { "bsr", TRUE, LONG, op2(E, R), 0 },
480 /*be*/ { "movsb", TRUE, LONG, op2(Eb, R), 0 },
481 /*bf*/ { "movsw", TRUE, LONG, op2(Ew, R), 0 },
484 static const struct inst db_inst_0fcx[] = {
485 /*c0*/ { "xadd", TRUE, BYTE, op2(R, E), 0 },
486 /*c1*/ { "xadd", TRUE, LONG, op2(R, E), 0 },
487 /*c2*/ { "", FALSE, NONE, 0, 0 },
488 /*c3*/ { "", FALSE, NONE, 0, 0 },
489 /*c4*/ { "", FALSE, NONE, 0, 0 },
490 /*c5*/ { "", FALSE, NONE, 0, 0 },
491 /*c6*/ { "", FALSE, NONE, 0, 0 },
492 /*c7*/ { "", TRUE, NONE, op1(E), db_Grp9 },
493 /*c8*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
494 /*c9*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
495 /*ca*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
496 /*cb*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
497 /*cc*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
498 /*cd*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
499 /*ce*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
500 /*cf*/ { "bswap", FALSE, LONG, op1(Ril), 0 },
503 static const struct inst * const db_inst_0f[] = {
504 db_inst_0f0x,
506 db_inst_0f2x,
507 db_inst_0f3x,
508 db_inst_0f4x,
509 db_inst_0f5x,
510 db_inst_0f6x,
511 db_inst_0f7x,
512 db_inst_0f8x,
513 db_inst_0f9x,
514 db_inst_0fax,
515 db_inst_0fbx,
516 db_inst_0fcx,
522 static const char * const db_Esc92[] = {
523 "fnop", "", "", "", "", "", "", ""
525 static const char * const db_Esc94[] = {
526 "fchs", "fabs", "", "", "ftst", "fxam", "", ""
528 static const char * const db_Esc95[] = {
529 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz",""
531 static const char * const db_Esc96[] = {
532 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp",
533 "fincstp"
535 static const char * const db_Esc97[] = {
536 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos"
539 static const char * const db_Esca5[] = {
540 "", "fucompp","", "", "", "", "", ""
543 static const char * const db_Escb4[] = {
544 "fneni","fndisi", "fnclex","fninit","fsetpm", "", "", ""
547 static const char * const db_Esce3[] = {
548 "", "fcompp","", "", "", "", "", ""
551 static const char * const db_Escf4[] = {
552 "fnstsw","", "", "", "", "", "", ""
555 static const struct finst db_Esc8[] = {
556 /*0*/ { "fadd", SNGL, op2(STI,ST), 0 },
557 /*1*/ { "fmul", SNGL, op2(STI,ST), 0 },
558 /*2*/ { "fcom", SNGL, op2(STI,ST), 0 },
559 /*3*/ { "fcomp", SNGL, op2(STI,ST), 0 },
560 /*4*/ { "fsub", SNGL, op2(STI,ST), 0 },
561 /*5*/ { "fsubr", SNGL, op2(STI,ST), 0 },
562 /*6*/ { "fdiv", SNGL, op2(STI,ST), 0 },
563 /*7*/ { "fdivr", SNGL, op2(STI,ST), 0 },
566 static const struct finst db_Esc9[] = {
567 /*0*/ { "fld", SNGL, op1(STI), 0 },
568 /*1*/ { "", NONE, op1(STI), "fxch" },
569 /*2*/ { "fst", SNGL, op1(X), db_Esc92 },
570 /*3*/ { "fstp", SNGL, 0, 0 },
571 /*4*/ { "fldenv", NONE, op1(X), db_Esc94 },
572 /*5*/ { "fldcw", NONE, op1(X), db_Esc95 },
573 /*6*/ { "fnstenv",NONE, op1(X), db_Esc96 },
574 /*7*/ { "fnstcw", NONE, op1(X), db_Esc97 },
577 static const struct finst db_Esca[] = {
578 /*0*/ { "fiadd", LONG, 0, 0 },
579 /*1*/ { "fimul", LONG, 0, 0 },
580 /*2*/ { "ficom", LONG, 0, 0 },
581 /*3*/ { "ficomp", LONG, 0, 0 },
582 /*4*/ { "fisub", LONG, 0, 0 },
583 /*5*/ { "fisubr", LONG, op1(X), db_Esca5 },
584 /*6*/ { "fidiv", LONG, 0, 0 },
585 /*7*/ { "fidivr", LONG, 0, 0 }
588 static const struct finst db_Escb[] = {
589 /*0*/ { "fild", LONG, 0, 0 },
590 /*1*/ { "", NONE, 0, 0 },
591 /*2*/ { "fist", LONG, 0, 0 },
592 /*3*/ { "fistp", LONG, 0, 0 },
593 /*4*/ { "", WORD, op1(X), db_Escb4 },
594 /*5*/ { "fld", EXTR, 0, 0 },
595 /*6*/ { "", WORD, 0, 0 },
596 /*7*/ { "fstp", EXTR, 0, 0 },
599 static const struct finst db_Escc[] = {
600 /*0*/ { "fadd", DBLR, op2(ST,STI), 0 },
601 /*1*/ { "fmul", DBLR, op2(ST,STI), 0 },
602 /*2*/ { "fcom", DBLR, 0, 0 },
603 /*3*/ { "fcomp", DBLR, 0, 0 },
604 /*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" },
605 /*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" },
606 /*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" },
607 /*7*/ { "fdivr", DBLR, op2(ST,STI), "fdiv" },
610 static const struct finst db_Escd[] = {
611 /*0*/ { "fld", DBLR, op1(STI), "ffree" },
612 /*1*/ { "", NONE, 0, 0 },
613 /*2*/ { "fst", DBLR, op1(STI), 0 },
614 /*3*/ { "fstp", DBLR, op1(STI), 0 },
615 /*4*/ { "frstor", NONE, op1(STI), "fucom" },
616 /*5*/ { "", NONE, op1(STI), "fucomp" },
617 /*6*/ { "fnsave", NONE, 0, 0 },
618 /*7*/ { "fnstsw", NONE, 0, 0 },
621 static const struct finst db_Esce[] = {
622 /*0*/ { "fiadd", WORD, op2(ST,STI), "faddp" },
623 /*1*/ { "fimul", WORD, op2(ST,STI), "fmulp" },
624 /*2*/ { "ficom", WORD, 0, 0 },
625 /*3*/ { "ficomp", WORD, op1(X), db_Esce3 },
626 /*4*/ { "fisub", WORD, op2(ST,STI), "fsubrp" },
627 /*5*/ { "fisubr", WORD, op2(ST,STI), "fsubp" },
628 /*6*/ { "fidiv", WORD, op2(ST,STI), "fdivrp" },
629 /*7*/ { "fidivr", WORD, op2(ST,STI), "fdivp" },
632 static const struct finst db_Escf[] = {
633 /*0*/ { "fild", WORD, 0, 0 },
634 /*1*/ { "", NONE, 0, 0 },
635 /*2*/ { "fist", WORD, 0, 0 },
636 /*3*/ { "fistp", WORD, 0, 0 },
637 /*4*/ { "fbld", NONE, op1(XA), db_Escf4 },
638 /*5*/ { "fild", QUAD, 0, 0 },
639 /*6*/ { "fbstp", NONE, 0, 0 },
640 /*7*/ { "fistp", QUAD, 0, 0 },
643 static const struct finst * const db_Esc_inst[] = {
644 db_Esc8, db_Esc9, db_Esca, db_Escb,
645 db_Escc, db_Escd, db_Esce, db_Escf
648 static const char * const db_Grp1[] = {
649 "add",
650 "or",
651 "adc",
652 "sbb",
653 "and",
654 "sub",
655 "xor",
656 "cmp"
659 static const char * const db_Grp2[] = {
660 "rol",
661 "ror",
662 "rcl",
663 "rcr",
664 "shl",
665 "shr",
666 "shl",
667 "sar"
670 static const struct inst db_Grp3[] = {
671 { "test", TRUE, NONE, op2(I,E), 0 },
672 { "test", TRUE, NONE, op2(I,E), 0 },
673 { "not", TRUE, NONE, op1(E), 0 },
674 { "neg", TRUE, NONE, op1(E), 0 },
675 { "mul", TRUE, NONE, op2(E,A), 0 },
676 { "imul", TRUE, NONE, op2(E,A), 0 },
677 { "div", TRUE, NONE, op2(E,A), 0 },
678 { "idiv", TRUE, NONE, op2(E,A), 0 },
681 static const struct inst db_Grp4[] = {
682 { "inc", TRUE, BYTE, op1(E), 0 },
683 { "dec", TRUE, BYTE, op1(E), 0 },
684 { "", TRUE, NONE, 0, 0 },
685 { "", TRUE, NONE, 0, 0 },
686 { "", TRUE, NONE, 0, 0 },
687 { "", TRUE, NONE, 0, 0 },
688 { "", TRUE, NONE, 0, 0 },
689 { "", TRUE, NONE, 0, 0 }
692 static const struct inst db_Grp5[] = {
693 { "inc", TRUE, LONG, op1(E), 0 },
694 { "dec", TRUE, LONG, op1(E), 0 },
695 { "call", TRUE, LONG, op1(Eind),0 },
696 { "lcall", TRUE, LONG, op1(Eind),0 },
697 { "jmp", TRUE, LONG, op1(Eind),0 },
698 { "ljmp", TRUE, LONG, op1(Eind),0 },
699 { "push", TRUE, LONG, op1(E), 0 },
700 { "", TRUE, NONE, 0, 0 }
703 static const struct inst db_inst_table[256] = {
704 /*00*/ { "add", TRUE, BYTE, op2(R, E), 0 },
705 /*01*/ { "add", TRUE, LONG, op2(R, E), 0 },
706 /*02*/ { "add", TRUE, BYTE, op2(E, R), 0 },
707 /*03*/ { "add", TRUE, LONG, op2(E, R), 0 },
708 /*04*/ { "add", FALSE, BYTE, op2(I, A), 0 },
709 /*05*/ { "add", FALSE, LONG, op2(Is, A), 0 },
710 /*06*/ { "push", FALSE, NONE, op1(Si), 0 },
711 /*07*/ { "pop", FALSE, NONE, op1(Si), 0 },
713 /*08*/ { "or", TRUE, BYTE, op2(R, E), 0 },
714 /*09*/ { "or", TRUE, LONG, op2(R, E), 0 },
715 /*0a*/ { "or", TRUE, BYTE, op2(E, R), 0 },
716 /*0b*/ { "or", TRUE, LONG, op2(E, R), 0 },
717 /*0c*/ { "or", FALSE, BYTE, op2(I, A), 0 },
718 /*0d*/ { "or", FALSE, LONG, op2(I, A), 0 },
719 /*0e*/ { "push", FALSE, NONE, op1(Si), 0 },
720 /*0f*/ { "", FALSE, NONE, 0, 0 },
722 /*10*/ { "adc", TRUE, BYTE, op2(R, E), 0 },
723 /*11*/ { "adc", TRUE, LONG, op2(R, E), 0 },
724 /*12*/ { "adc", TRUE, BYTE, op2(E, R), 0 },
725 /*13*/ { "adc", TRUE, LONG, op2(E, R), 0 },
726 /*14*/ { "adc", FALSE, BYTE, op2(I, A), 0 },
727 /*15*/ { "adc", FALSE, LONG, op2(Is, A), 0 },
728 /*16*/ { "push", FALSE, NONE, op1(Si), 0 },
729 /*17*/ { "pop", FALSE, NONE, op1(Si), 0 },
731 /*18*/ { "sbb", TRUE, BYTE, op2(R, E), 0 },
732 /*19*/ { "sbb", TRUE, LONG, op2(R, E), 0 },
733 /*1a*/ { "sbb", TRUE, BYTE, op2(E, R), 0 },
734 /*1b*/ { "sbb", TRUE, LONG, op2(E, R), 0 },
735 /*1c*/ { "sbb", FALSE, BYTE, op2(I, A), 0 },
736 /*1d*/ { "sbb", FALSE, LONG, op2(Is, A), 0 },
737 /*1e*/ { "push", FALSE, NONE, op1(Si), 0 },
738 /*1f*/ { "pop", FALSE, NONE, op1(Si), 0 },
740 /*20*/ { "and", TRUE, BYTE, op2(R, E), 0 },
741 /*21*/ { "and", TRUE, LONG, op2(R, E), 0 },
742 /*22*/ { "and", TRUE, BYTE, op2(E, R), 0 },
743 /*23*/ { "and", TRUE, LONG, op2(E, R), 0 },
744 /*24*/ { "and", FALSE, BYTE, op2(I, A), 0 },
745 /*25*/ { "and", FALSE, LONG, op2(I, A), 0 },
746 /*26*/ { "", FALSE, NONE, 0, 0 },
747 /*27*/ { "daa", FALSE, NONE, 0, 0 },
749 /*28*/ { "sub", TRUE, BYTE, op2(R, E), 0 },
750 /*29*/ { "sub", TRUE, LONG, op2(R, E), 0 },
751 /*2a*/ { "sub", TRUE, BYTE, op2(E, R), 0 },
752 /*2b*/ { "sub", TRUE, LONG, op2(E, R), 0 },
753 /*2c*/ { "sub", FALSE, BYTE, op2(I, A), 0 },
754 /*2d*/ { "sub", FALSE, LONG, op2(Is, A), 0 },
755 /*2e*/ { "", FALSE, NONE, 0, 0 },
756 /*2f*/ { "das", FALSE, NONE, 0, 0 },
758 /*30*/ { "xor", TRUE, BYTE, op2(R, E), 0 },
759 /*31*/ { "xor", TRUE, LONG, op2(R, E), 0 },
760 /*32*/ { "xor", TRUE, BYTE, op2(E, R), 0 },
761 /*33*/ { "xor", TRUE, LONG, op2(E, R), 0 },
762 /*34*/ { "xor", FALSE, BYTE, op2(I, A), 0 },
763 /*35*/ { "xor", FALSE, LONG, op2(I, A), 0 },
764 /*36*/ { "", FALSE, NONE, 0, 0 },
765 /*37*/ { "aaa", FALSE, NONE, 0, 0 },
767 /*38*/ { "cmp", TRUE, BYTE, op2(R, E), 0 },
768 /*39*/ { "cmp", TRUE, LONG, op2(R, E), 0 },
769 /*3a*/ { "cmp", TRUE, BYTE, op2(E, R), 0 },
770 /*3b*/ { "cmp", TRUE, LONG, op2(E, R), 0 },
771 /*3c*/ { "cmp", FALSE, BYTE, op2(I, A), 0 },
772 /*3d*/ { "cmp", FALSE, LONG, op2(Is, A), 0 },
773 /*3e*/ { "", FALSE, NONE, 0, 0 },
774 /*3f*/ { "aas", FALSE, NONE, 0, 0 },
776 /*40*/ { "rex", FALSE, NONE, 0, 0 },
777 /*41*/ { "rex.b", FALSE, NONE, 0, 0 },
778 /*42*/ { "rex.x", FALSE, NONE, 0, 0 },
779 /*43*/ { "rex.xb", FALSE, NONE, 0, 0 },
780 /*44*/ { "rex.r", FALSE, NONE, 0, 0 },
781 /*45*/ { "rex.rb", FALSE, NONE, 0, 0 },
782 /*46*/ { "rex.rx", FALSE, NONE, 0, 0 },
783 /*47*/ { "rex.rxb", FALSE, NONE, 0, 0 },
785 /*48*/ { "rex.w", FALSE, NONE, 0, 0 },
786 /*49*/ { "rex.wb", FALSE, NONE, 0, 0 },
787 /*4a*/ { "rex.wx", FALSE, NONE, 0, 0 },
788 /*4b*/ { "rex.wxb", FALSE, NONE, 0, 0 },
789 /*4c*/ { "rex.wr", FALSE, NONE, 0, 0 },
790 /*4d*/ { "rex.wrb", FALSE, NONE, 0, 0 },
791 /*4e*/ { "rex.wrx", FALSE, NONE, 0, 0 },
792 /*4f*/ { "rex.wrxb", FALSE, NONE, 0, 0 },
794 /*50*/ { "push", FALSE, LONG, op1(Ri), 0 },
795 /*51*/ { "push", FALSE, LONG, op1(Ri), 0 },
796 /*52*/ { "push", FALSE, LONG, op1(Ri), 0 },
797 /*53*/ { "push", FALSE, LONG, op1(Ri), 0 },
798 /*54*/ { "push", FALSE, LONG, op1(Ri), 0 },
799 /*55*/ { "push", FALSE, LONG, op1(Ri), 0 },
800 /*56*/ { "push", FALSE, LONG, op1(Ri), 0 },
801 /*57*/ { "push", FALSE, LONG, op1(Ri), 0 },
803 /*58*/ { "pop", FALSE, LONG, op1(Ri), 0 },
804 /*59*/ { "pop", FALSE, LONG, op1(Ri), 0 },
805 /*5a*/ { "pop", FALSE, LONG, op1(Ri), 0 },
806 /*5b*/ { "pop", FALSE, LONG, op1(Ri), 0 },
807 /*5c*/ { "pop", FALSE, LONG, op1(Ri), 0 },
808 /*5d*/ { "pop", FALSE, LONG, op1(Ri), 0 },
809 /*5e*/ { "pop", FALSE, LONG, op1(Ri), 0 },
810 /*5f*/ { "pop", FALSE, LONG, op1(Ri), 0 },
812 /*60*/ { "pusha", FALSE, LONG, 0, 0 },
813 /*61*/ { "popa", FALSE, LONG, 0, 0 },
814 /*62*/ { "bound", TRUE, LONG, op2(E, R), 0 },
815 /*63*/ { "movslq", TRUE, NONE, op2(EL,R), 0 },
817 /*64*/ { "", FALSE, NONE, 0, 0 },
818 /*65*/ { "", FALSE, NONE, 0, 0 },
819 /*66*/ { "", FALSE, NONE, 0, 0 },
820 /*67*/ { "", FALSE, NONE, 0, 0 },
822 /*68*/ { "push", FALSE, LONG, op1(I), 0 },
823 /*69*/ { "imul", TRUE, LONG, op3(I,E,R), 0 },
824 /*6a*/ { "push", FALSE, LONG, op1(Ibs), 0 },
825 /*6b*/ { "imul", TRUE, LONG, op3(Ibs,E,R),0 },
826 /*6c*/ { "ins", FALSE, BYTE, op2(DX, DI), 0 },
827 /*6d*/ { "ins", FALSE, LONG, op2(DX, DI), 0 },
828 /*6e*/ { "outs", FALSE, BYTE, op2(SI, DX), 0 },
829 /*6f*/ { "outs", FALSE, LONG, op2(SI, DX), 0 },
831 /*70*/ { "jo", FALSE, NONE, op1(Db), 0 },
832 /*71*/ { "jno", FALSE, NONE, op1(Db), 0 },
833 /*72*/ { "jb", FALSE, NONE, op1(Db), 0 },
834 /*73*/ { "jnb", FALSE, NONE, op1(Db), 0 },
835 /*74*/ { "jz", FALSE, NONE, op1(Db), 0 },
836 /*75*/ { "jnz", FALSE, NONE, op1(Db), 0 },
837 /*76*/ { "jbe", FALSE, NONE, op1(Db), 0 },
838 /*77*/ { "jnbe", FALSE, NONE, op1(Db), 0 },
840 /*78*/ { "js", FALSE, NONE, op1(Db), 0 },
841 /*79*/ { "jns", FALSE, NONE, op1(Db), 0 },
842 /*7a*/ { "jp", FALSE, NONE, op1(Db), 0 },
843 /*7b*/ { "jnp", FALSE, NONE, op1(Db), 0 },
844 /*7c*/ { "jl", FALSE, NONE, op1(Db), 0 },
845 /*7d*/ { "jnl", FALSE, NONE, op1(Db), 0 },
846 /*7e*/ { "jle", FALSE, NONE, op1(Db), 0 },
847 /*7f*/ { "jnle", FALSE, NONE, op1(Db), 0 },
849 /*80*/ { "", TRUE, BYTE, op2(I, E), db_Grp1 },
850 /*81*/ { "", TRUE, LONG, op2(I, E), db_Grp1 },
851 /*82*/ { "", TRUE, BYTE, op2(I, E), db_Grp1 },
852 /*83*/ { "", TRUE, LONG, op2(Ibs,E), db_Grp1 },
853 /*84*/ { "test", TRUE, BYTE, op2(R, E), 0 },
854 /*85*/ { "test", TRUE, LONG, op2(R, E), 0 },
855 /*86*/ { "xchg", TRUE, BYTE, op2(R, E), 0 },
856 /*87*/ { "xchg", TRUE, LONG, op2(R, E), 0 },
858 /*88*/ { "mov", TRUE, BYTE, op2(R, E), 0 },
859 /*89*/ { "mov", TRUE, LONG, op2(R, E), 0 },
860 /*8a*/ { "mov", TRUE, BYTE, op2(E, R), 0 },
861 /*8b*/ { "mov", TRUE, LONG, op2(E, R), 0 },
862 /*8c*/ { "mov", TRUE, NONE, op2(S, Ew), 0 },
863 /*8d*/ { "lea", TRUE, LONG, op2(E, R), 0 },
864 /*8e*/ { "mov", TRUE, NONE, op2(Ew, S), 0 },
865 /*8f*/ { "pop", TRUE, LONG, op1(E), 0 },
867 /*90*/ { "nop", FALSE, NONE, 0, 0 },
868 /*91*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
869 /*92*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
870 /*93*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
871 /*94*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
872 /*95*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
873 /*96*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
874 /*97*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 },
876 /*98*/ { "cbw", FALSE, SDEP, 0, "cwde" }, /* cbw/cwde */
877 /*99*/ { "cwd", FALSE, SDEP, 0, "cdq" }, /* cwd/cdq */
878 /*9a*/ { "lcall", FALSE, NONE, op1(OS), 0 },
879 /*9b*/ { "wait", FALSE, NONE, 0, 0 },
880 /*9c*/ { "pushf", FALSE, LONG, 0, 0 },
881 /*9d*/ { "popf", FALSE, LONG, 0, 0 },
882 /*9e*/ { "sahf", FALSE, NONE, 0, 0 },
883 /*9f*/ { "lahf", FALSE, NONE, 0, 0 },
885 /*a0*/ { "mov", FALSE, BYTE, op2(O, A), 0 },
886 /*a1*/ { "mov", FALSE, LONG, op2(O, A), 0 },
887 /*a2*/ { "mov", FALSE, BYTE, op2(A, O), 0 },
888 /*a3*/ { "mov", FALSE, LONG, op2(A, O), 0 },
889 /*a4*/ { "movs", FALSE, BYTE, op2(SI,DI), 0 },
890 /*a5*/ { "movs", FALSE, LONG, op2(SI,DI), 0 },
891 /*a6*/ { "cmps", FALSE, BYTE, op2(SI,DI), 0 },
892 /*a7*/ { "cmps", FALSE, LONG, op2(SI,DI), 0 },
894 /*a8*/ { "test", FALSE, BYTE, op2(I, A), 0 },
895 /*a9*/ { "test", FALSE, LONG, op2(I, A), 0 },
896 /*aa*/ { "stos", FALSE, BYTE, op1(DI), 0 },
897 /*ab*/ { "stos", FALSE, LONG, op1(DI), 0 },
898 /*ac*/ { "lods", FALSE, BYTE, op1(SI), 0 },
899 /*ad*/ { "lods", FALSE, LONG, op1(SI), 0 },
900 /*ae*/ { "scas", FALSE, BYTE, op1(SI), 0 },
901 /*af*/ { "scas", FALSE, LONG, op1(SI), 0 },
903 /*b0*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
904 /*b1*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
905 /*b2*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
906 /*b3*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
907 /*b4*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
908 /*b5*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
909 /*b6*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
910 /*b7*/ { "mov", FALSE, BYTE, op2(I, Ri), 0 },
912 /*b8*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
913 /*b9*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
914 /*ba*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
915 /*bb*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
916 /*bc*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
917 /*bd*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
918 /*be*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
919 /*bf*/ { "mov", FALSE, LONG, op2(Ilq, Ri), 0 },
921 /*c0*/ { "", TRUE, BYTE, op2(Ib, E), db_Grp2 },
922 /*c1*/ { "", TRUE, LONG, op2(Ib, E), db_Grp2 },
923 /*c2*/ { "ret", FALSE, NONE, op1(Iw), 0 },
924 /*c3*/ { "ret", FALSE, NONE, 0, 0 },
925 /*c4*/ { "les", TRUE, LONG, op2(E, R), 0 },
926 /*c5*/ { "lds", TRUE, LONG, op2(E, R), 0 },
927 /*c6*/ { "mov", TRUE, BYTE, op2(I, E), 0 },
928 /*c7*/ { "mov", TRUE, LONG, op2(I, E), 0 },
930 /*c8*/ { "enter", FALSE, NONE, op2(Iw, Ib), 0 },
931 /*c9*/ { "leave", FALSE, NONE, 0, 0 },
932 /*ca*/ { "lret", FALSE, NONE, op1(Iw), 0 },
933 /*cb*/ { "lret", FALSE, NONE, 0, 0 },
934 /*cc*/ { "int", FALSE, NONE, op1(o3), 0 },
935 /*cd*/ { "int", FALSE, NONE, op1(Ib), 0 },
936 /*ce*/ { "into", FALSE, NONE, 0, 0 },
937 /*cf*/ { "iret", FALSE, NONE, 0, 0 },
939 /*d0*/ { "", TRUE, BYTE, op2(o1, E), db_Grp2 },
940 /*d1*/ { "", TRUE, LONG, op2(o1, E), db_Grp2 },
941 /*d2*/ { "", TRUE, BYTE, op2(CL, E), db_Grp2 },
942 /*d3*/ { "", TRUE, LONG, op2(CL, E), db_Grp2 },
943 /*d4*/ { "aam", FALSE, NONE, op1(Iba), 0 },
944 /*d5*/ { "aad", FALSE, NONE, op1(Iba), 0 },
945 /*d6*/ { ".byte\t0xd6", FALSE, NONE, 0, 0 },
946 /*d7*/ { "xlat", FALSE, BYTE, op1(BX), 0 },
948 /*d8*/ { "", TRUE, NONE, 0, db_Esc8 },
949 /*d9*/ { "", TRUE, NONE, 0, db_Esc9 },
950 /*da*/ { "", TRUE, NONE, 0, db_Esca },
951 /*db*/ { "", TRUE, NONE, 0, db_Escb },
952 /*dc*/ { "", TRUE, NONE, 0, db_Escc },
953 /*dd*/ { "", TRUE, NONE, 0, db_Escd },
954 /*de*/ { "", TRUE, NONE, 0, db_Esce },
955 /*df*/ { "", TRUE, NONE, 0, db_Escf },
957 /*e0*/ { "loopne",FALSE, NONE, op1(Db), 0 },
958 /*e1*/ { "loope", FALSE, NONE, op1(Db), 0 },
959 /*e2*/ { "loop", FALSE, NONE, op1(Db), 0 },
960 /*e3*/ { "jcxz", FALSE, SDEP, op1(Db), "jecxz" },
961 /*e4*/ { "in", FALSE, BYTE, op2(Ib, A), 0 },
962 /*e5*/ { "in", FALSE, LONG, op2(Ib, A) , 0 },
963 /*e6*/ { "out", FALSE, BYTE, op2(A, Ib), 0 },
964 /*e7*/ { "out", FALSE, LONG, op2(A, Ib) , 0 },
966 /*e8*/ { "call", FALSE, NONE, op1(Dl), 0 },
967 /*e9*/ { "jmp", FALSE, NONE, op1(Dl), 0 },
968 /*ea*/ { "ljmp", FALSE, NONE, op1(OS), 0 },
969 /*eb*/ { "jmp", FALSE, NONE, op1(Db), 0 },
970 /*ec*/ { "in", FALSE, BYTE, op2(DX, A), 0 },
971 /*ed*/ { "in", FALSE, LONG, op2(DX, A) , 0 },
972 /*ee*/ { "out", FALSE, BYTE, op2(A, DX), 0 },
973 /*ef*/ { "out", FALSE, LONG, op2(A, DX) , 0 },
975 /*f0*/ { "", FALSE, NONE, 0, 0 },
976 /*f1*/ { ".byte\t0xf1", FALSE, NONE, 0, 0 },
977 /*f2*/ { "", FALSE, NONE, 0, 0 },
978 /*f3*/ { "", FALSE, NONE, 0, 0 },
979 /*f4*/ { "hlt", FALSE, NONE, 0, 0 },
980 /*f5*/ { "cmc", FALSE, NONE, 0, 0 },
981 /*f6*/ { "", TRUE, BYTE, 0, db_Grp3 },
982 /*f7*/ { "", TRUE, LONG, 0, db_Grp3 },
984 /*f8*/ { "clc", FALSE, NONE, 0, 0 },
985 /*f9*/ { "stc", FALSE, NONE, 0, 0 },
986 /*fa*/ { "cli", FALSE, NONE, 0, 0 },
987 /*fb*/ { "sti", FALSE, NONE, 0, 0 },
988 /*fc*/ { "cld", FALSE, NONE, 0, 0 },
989 /*fd*/ { "std", FALSE, NONE, 0, 0 },
990 /*fe*/ { "", TRUE, NONE, 0, db_Grp4 },
991 /*ff*/ { "", TRUE, NONE, 0, db_Grp5 },
994 static const struct inst db_bad_inst =
995 { "???", FALSE, NONE, 0, 0 }
998 #define f_mod(rex, byte) ((byte)>>6)
999 #define f_reg(rex, byte) ((((byte)>>3)&0x7) | (rex & REX_R ? 0x8 : 0x0))
1000 #define f_rm(rex, byte) (((byte)&0x7) | (rex & REX_B ? 0x8 : 0x0))
1002 #define sib_ss(rex, byte) ((byte)>>6)
1003 #define sib_index(rex, byte) ((((byte)>>3)&0x7) | (rex & REX_X ? 0x8 : 0x0))
1004 #define sib_base(rex, byte) (((byte)&0x7) | (rex & REX_B ? 0x8 : 0x0))
1006 struct i_addr {
1007 int is_reg; /* if reg, reg number is in 'disp' */
1008 int disp;
1009 const char * base;
1010 const char * index;
1011 int ss;
1014 static const char * const db_reg[2][4][16] = {
1016 {{"%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
1017 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b" },
1018 { "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
1019 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w" },
1020 { "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
1021 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d" },
1022 { "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
1023 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" }},
1025 {{"%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
1026 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b" },
1027 { "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
1028 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w" },
1029 { "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
1030 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d" },
1031 { "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
1032 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" }}
1035 static const char * const db_seg_reg[8] = {
1036 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "", ""
1040 * lengths for size attributes
1042 static const int db_lengths[] = {
1043 1, /* BYTE */
1044 2, /* WORD */
1045 4, /* LONG */
1046 8, /* QUAD */
1047 4, /* SNGL */
1048 8, /* DBLR */
1049 10, /* EXTR */
1052 #define get_value_inc(result, loc, size, is_signed) \
1053 result = db_get_value((loc), (size), (is_signed)); \
1054 (loc) += (size);
1056 static db_addr_t
1057 db_disasm_esc(db_addr_t loc, int inst, int rex, int short_addr,
1058 int size, const char *seg);
1059 static void db_print_address(const char *seg, int size, int rex,
1060 struct i_addr *addrp);
1061 static db_addr_t
1062 db_read_address(db_addr_t loc, int short_addr, int rex, int regmodrm,
1063 struct i_addr *addrp);
1066 * Read address at location and return updated location.
1068 static db_addr_t
1069 db_read_address(loc, short_addr, rex, regmodrm, addrp)
1070 db_addr_t loc;
1071 int short_addr;
1072 int rex;
1073 int regmodrm;
1074 struct i_addr * addrp; /* out */
1076 int mod, rm, sib, index, disp, size, have_sib;
1078 mod = f_mod(rex, regmodrm);
1079 rm = f_rm(rex, regmodrm);
1081 if (mod == 3) {
1082 addrp->is_reg = TRUE;
1083 addrp->disp = rm;
1084 return (loc);
1086 addrp->is_reg = FALSE;
1087 addrp->index = 0;
1089 if (short_addr)
1090 size = LONG;
1091 else
1092 size = QUAD;
1094 if ((rm & 0x7) == 4) {
1095 get_value_inc(sib, loc, 1, FALSE);
1096 rm = sib_base(rex, sib);
1097 index = sib_index(rex, sib);
1098 if (index != 4)
1099 addrp->index = db_reg[1][size][index];
1100 addrp->ss = sib_ss(rex, sib);
1101 have_sib = 1;
1102 } else
1103 have_sib = 0;
1105 switch (mod) {
1106 case 0:
1107 if (rm == 5) {
1108 get_value_inc(addrp->disp, loc, 4, FALSE);
1109 if (have_sib)
1110 addrp->base = 0;
1111 else if (short_addr)
1112 addrp->base = "%eip";
1113 else
1114 addrp->base = "%rip";
1115 } else {
1116 addrp->disp = 0;
1117 addrp->base = db_reg[1][size][rm];
1119 break;
1121 case 1:
1122 get_value_inc(disp, loc, 1, TRUE);
1123 addrp->disp = disp;
1124 addrp->base = db_reg[1][size][rm];
1125 break;
1127 case 2:
1128 get_value_inc(disp, loc, 4, FALSE);
1129 addrp->disp = disp;
1130 addrp->base = db_reg[1][size][rm];
1131 break;
1133 return (loc);
1136 static void
1137 db_print_address(seg, size, rex, addrp)
1138 const char * seg;
1139 int size;
1140 int rex;
1141 struct i_addr * addrp;
1143 if (addrp->is_reg) {
1144 db_printf("%s", db_reg[rex != 0 ? 1 : 0][(size == LONG && (rex & REX_W)) ? QUAD : size][addrp->disp]);
1145 return;
1148 if (seg) {
1149 db_printf("%s:", seg);
1152 if (addrp->disp != 0 || (addrp->base == 0 && addrp->index == 0))
1153 db_printsym((db_addr_t)addrp->disp, DB_STGY_ANY);
1154 if (addrp->base != 0 || addrp->index != 0) {
1155 db_printf("(");
1156 if (addrp->base)
1157 db_printf("%s", addrp->base);
1158 if (addrp->index)
1159 db_printf(",%s,%d", addrp->index, 1<<addrp->ss);
1160 db_printf(")");
1165 * Disassemble floating-point ("escape") instruction
1166 * and return updated location.
1168 static db_addr_t
1169 db_disasm_esc(loc, inst, rex, short_addr, size, seg)
1170 db_addr_t loc;
1171 int inst;
1172 int rex;
1173 int short_addr;
1174 int size;
1175 const char * seg;
1177 int regmodrm;
1178 const struct finst * fp;
1179 int mod;
1180 struct i_addr address;
1181 const char * name;
1183 get_value_inc(regmodrm, loc, 1, FALSE);
1184 fp = &db_Esc_inst[inst - 0xd8][f_reg(rex, regmodrm)];
1185 mod = f_mod(rex, regmodrm);
1186 if (mod != 3) {
1187 if (*fp->f_name == '\0') {
1188 db_printf("<bad instruction>");
1189 return (loc);
1192 * Normal address modes.
1194 loc = db_read_address(loc, short_addr, rex, regmodrm, &address);
1195 db_printf("%s", fp->f_name);
1196 switch(fp->f_size) {
1197 case SNGL:
1198 db_printf("s");
1199 break;
1200 case DBLR:
1201 db_printf("l");
1202 break;
1203 case EXTR:
1204 db_printf("t");
1205 break;
1206 case WORD:
1207 db_printf("s");
1208 break;
1209 case LONG:
1210 db_printf("l");
1211 break;
1212 case QUAD:
1213 db_printf("q");
1214 break;
1215 default:
1216 break;
1218 db_printf("\t");
1219 db_print_address(seg, BYTE, rex, &address);
1221 else {
1223 * 'reg-reg' - special formats
1225 switch (fp->f_rrmode) {
1226 case op2(ST,STI):
1227 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1228 db_printf("%s\t%%st,%%st(%d)",name,f_rm(rex, regmodrm));
1229 break;
1230 case op2(STI,ST):
1231 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1232 db_printf("%s\t%%st(%d),%%st",name, f_rm(rex, regmodrm));
1233 break;
1234 case op1(STI):
1235 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1236 db_printf("%s\t%%st(%d)",name, f_rm(rex, regmodrm));
1237 break;
1238 case op1(X):
1239 name = ((const char * const *)fp->f_rrname)[f_rm(rex, regmodrm)];
1240 if (*name == '\0')
1241 goto bad;
1242 db_printf("%s", name);
1243 break;
1244 case op1(XA):
1245 name = ((const char * const *)fp->f_rrname)[f_rm(rex, regmodrm)];
1246 if (*name == '\0')
1247 goto bad;
1248 db_printf("%s\t%%ax", name);
1249 break;
1250 default:
1251 bad:
1252 db_printf("<bad instruction>");
1253 break;
1257 return (loc);
1261 * Disassemble instruction at 'loc'. 'altfmt' specifies an
1262 * (optional) alternate format. Return address of start of
1263 * next instruction.
1265 static db_addr_t
1266 db_disasm(db_addr_t loc, boolean_t altfmt)
1268 int inst;
1269 int size;
1270 int short_addr;
1271 const char * seg;
1272 const struct inst * ip;
1273 const char * i_name;
1274 int i_size;
1275 int i_mode;
1276 int rex = 0;
1277 int regmodrm = 0;
1278 boolean_t first;
1279 int displ;
1280 int prefix;
1281 int rep;
1282 int imm;
1283 int imm2;
1284 long imm64;
1285 int len;
1286 struct i_addr address;
1287 db_addr_t addr;
1289 get_value_inc(inst, loc, 1, FALSE);
1290 short_addr = FALSE;
1291 size = LONG;
1292 seg = 0;
1295 * Get prefixes
1297 rep = FALSE;
1298 prefix = TRUE;
1299 do {
1300 switch (inst) {
1301 case 0x66: /* data16 */
1302 size = WORD;
1303 break;
1304 case 0x67:
1305 short_addr = TRUE;
1306 break;
1307 case 0x26:
1308 seg = "%es";
1309 break;
1310 case 0x36:
1311 seg = "%ss";
1312 break;
1313 case 0x2e:
1314 seg = "%cs";
1315 break;
1316 case 0x3e:
1317 seg = "%ds";
1318 break;
1319 case 0x64:
1320 seg = "%fs";
1321 break;
1322 case 0x65:
1323 seg = "%gs";
1324 break;
1325 case 0xf0:
1326 db_printf("lock ");
1327 break;
1328 case 0xf2:
1329 db_printf("repne ");
1330 break;
1331 case 0xf3:
1332 rep = TRUE;
1333 break;
1334 default:
1335 prefix = FALSE;
1336 break;
1338 if (inst >= 0x40 && inst < 0x50) {
1339 rex = inst;
1340 prefix = TRUE;
1342 if (prefix) {
1343 get_value_inc(inst, loc, 1, FALSE);
1345 if (rep == TRUE) {
1346 if (inst == 0x90) {
1347 db_printf("pause\n");
1348 return (loc);
1350 db_printf("repe "); /* XXX repe VS rep */
1351 rep = FALSE;
1353 } while (prefix);
1355 if (inst >= 0xd8 && inst <= 0xdf) {
1356 loc = db_disasm_esc(loc, inst, rex, short_addr, size, seg);
1357 db_printf("\n");
1358 return (loc);
1361 if (inst == 0x0f) {
1362 get_value_inc(inst, loc, 1, FALSE);
1363 ip = db_inst_0f[inst>>4];
1364 if (ip == 0) {
1365 ip = &db_bad_inst;
1367 else {
1368 ip = &ip[inst&0xf];
1371 else
1372 ip = &db_inst_table[inst];
1374 if (ip->i_has_modrm) {
1375 get_value_inc(regmodrm, loc, 1, FALSE);
1376 loc = db_read_address(loc, short_addr, rex, regmodrm, &address);
1379 i_name = ip->i_name;
1380 i_size = ip->i_size;
1381 i_mode = ip->i_mode;
1383 if (ip->i_extra == db_Grp1 || ip->i_extra == db_Grp2 ||
1384 ip->i_extra == db_Grp6 || ip->i_extra == db_Grp7 ||
1385 ip->i_extra == db_Grp8 || ip->i_extra == db_Grp9 ||
1386 ip->i_extra == db_Grp15) {
1387 i_name = ((const char * const *)ip->i_extra)[f_reg(rex, regmodrm)];
1389 else if (ip->i_extra == db_Grp3) {
1390 ip = ip->i_extra;
1391 ip = &ip[f_reg(rex, regmodrm)];
1392 i_name = ip->i_name;
1393 i_mode = ip->i_mode;
1395 else if (ip->i_extra == db_Grp4 || ip->i_extra == db_Grp5) {
1396 ip = ip->i_extra;
1397 ip = &ip[f_reg(rex, regmodrm)];
1398 i_name = ip->i_name;
1399 i_mode = ip->i_mode;
1400 i_size = ip->i_size;
1403 /* Special cases that don't fit well in the tables. */
1404 if (ip->i_extra == db_Grp7 && f_mod(rex, regmodrm) == 3) {
1405 switch (regmodrm) {
1406 case 0xc8:
1407 i_name = "monitor";
1408 i_size = NONE;
1409 i_mode = 0;
1410 break;
1411 case 0xc9:
1412 i_name = "mwait";
1413 i_size = NONE;
1414 i_mode = 0;
1415 break;
1416 case 0xf8:
1417 i_name = "swapgs";
1418 i_size = NONE;
1419 i_mode = 0;
1420 break;
1423 if (ip->i_extra == db_Grp15 && f_mod(0, regmodrm) == 3) {
1424 i_name = db_Grp15b[f_reg(0, regmodrm)];
1425 i_size = NONE;
1426 i_mode = 0;
1429 if (i_size == SDEP) {
1430 if (size == WORD)
1431 db_printf("%s", i_name);
1432 else
1433 db_printf("%s", (const char *)ip->i_extra);
1435 else {
1436 db_printf("%s", i_name);
1437 if ((inst >= 0x50 && inst <= 0x5f) || inst == 0x68 || inst == 0x6a) {
1438 i_size = NONE;
1439 db_printf("q");
1441 if (i_size != NONE) {
1442 if (i_size == BYTE) {
1443 db_printf("b");
1444 size = BYTE;
1446 else if (i_size == WORD) {
1447 db_printf("w");
1448 size = WORD;
1450 else if (size == WORD)
1451 db_printf("w");
1452 else {
1453 if (rex & REX_W)
1454 db_printf("q");
1455 else
1456 db_printf("l");
1460 db_printf("\t");
1461 for (first = TRUE;
1462 i_mode != 0;
1463 i_mode >>= 8, first = FALSE)
1465 if (!first)
1466 db_printf(",");
1468 switch (i_mode & 0xFF) {
1470 case E:
1471 db_print_address(seg, size, rex, &address);
1472 break;
1474 case Eind:
1475 db_printf("*");
1476 db_print_address(seg, size, rex, &address);
1477 break;
1479 case El:
1480 db_print_address(seg, (rex & REX_W) ? QUAD : LONG, rex, &address);
1481 break;
1483 case EL:
1484 db_print_address(seg, LONG, 0, &address);
1485 break;
1487 case Ew:
1488 db_print_address(seg, WORD, rex, &address);
1489 break;
1491 case Eb:
1492 db_print_address(seg, BYTE, rex, &address);
1493 break;
1495 case R:
1496 db_printf("%s", db_reg[rex != 0 ? 1 : 0][(size == LONG && (rex & REX_W)) ? QUAD : size][f_reg(rex, regmodrm)]);
1497 break;
1499 case Rw:
1500 db_printf("%s", db_reg[rex != 0 ? 1 : 0][WORD][f_reg(rex, regmodrm)]);
1501 break;
1503 case Ri:
1504 db_printf("%s", db_reg[0][QUAD][f_rm(rex, inst)]);
1505 break;
1507 case Ril:
1508 db_printf("%s", db_reg[rex != 0 ? 1 : 0][(rex & REX_R) ? QUAD : LONG][f_rm(rex, inst)]);
1509 break;
1511 case S:
1512 db_printf("%s", db_seg_reg[f_reg(0, regmodrm)]);
1513 break;
1515 case Si:
1516 db_printf("%s", db_seg_reg[f_reg(0, inst)]);
1517 break;
1519 case A:
1520 db_printf("%s", db_reg[rex != 0 ? 1 : 0][size][0]); /* acc */
1521 break;
1523 case BX:
1524 if (seg)
1525 db_printf("%s:", seg);
1526 db_printf("(%s)", short_addr ? "%bx" : "%ebx");
1527 break;
1529 case CL:
1530 db_printf("%%cl");
1531 break;
1533 case DX:
1534 db_printf("%%dx");
1535 break;
1537 case SI:
1538 if (seg)
1539 db_printf("%s:", seg);
1540 db_printf("(%s)", short_addr ? "%si" : "%rsi");
1541 break;
1543 case DI:
1544 db_printf("%%es:(%s)", short_addr ? "%di" : "%rdi");
1545 break;
1547 case CR:
1548 db_printf("%%cr%d", f_reg(rex, regmodrm));
1549 break;
1551 case DR:
1552 db_printf("%%dr%d", f_reg(rex, regmodrm));
1553 break;
1555 case TR:
1556 db_printf("%%tr%d", f_reg(rex, regmodrm));
1557 break;
1559 case I:
1560 len = db_lengths[size];
1561 get_value_inc(imm, loc, len, FALSE);
1562 db_printf("$%#x", imm);
1563 break;
1565 case Is:
1566 len = db_lengths[(size == LONG && (rex & REX_W)) ? QUAD : size];
1567 get_value_inc(imm, loc, len, FALSE);
1568 db_printf("$%x", imm);
1569 break;
1571 case Ib:
1572 get_value_inc(imm, loc, 1, FALSE);
1573 db_printf("$%#x", imm);
1574 break;
1576 case Iba:
1577 get_value_inc(imm, loc, 1, FALSE);
1578 if (imm != 0x0a)
1579 db_printf("$%#x", imm);
1580 break;
1582 case Ibs:
1583 get_value_inc(imm, loc, 1, TRUE);
1584 if (size == WORD)
1585 imm &= 0xFFFF;
1586 db_printf("$%x", imm);
1587 break;
1589 case Iw:
1590 get_value_inc(imm, loc, 2, FALSE);
1591 db_printf("$%#x", imm);
1592 break;
1594 case Ilq:
1595 len = db_lengths[rex & REX_W ? QUAD : LONG];
1596 get_value_inc(imm64, loc, len, FALSE);
1597 db_printf("$%#lx", imm64);
1598 break;
1600 case O:
1601 len = (short_addr ? 2 : 4);
1602 get_value_inc(displ, loc, len, FALSE);
1603 if (seg)
1604 db_printf("%s:%x",seg, displ);
1605 else
1606 db_printsym((db_addr_t)displ, DB_STGY_ANY);
1607 break;
1609 case Db:
1610 get_value_inc(displ, loc, 1, TRUE);
1611 addr = loc + (LONG64)displ;
1612 if (size == WORD)
1613 addr &= 0xFFFF;
1614 db_printsym(addr, DB_STGY_XTRN);
1615 break;
1617 case Dl:
1618 len = db_lengths[(size == LONG && (rex & REX_W)) ? QUAD : size];
1619 get_value_inc(displ, loc, len, FALSE);
1620 addr = loc + (LONG64)displ;
1621 if (size == WORD)
1622 addr &= 0xFFFF;
1623 db_printsym(addr, DB_STGY_XTRN);
1624 break;
1626 case o1:
1627 db_printf("$1");
1628 break;
1630 case o3:
1631 db_printf("$3");
1632 break;
1634 case OS:
1635 len = db_lengths[size];
1636 get_value_inc(imm, loc, len, FALSE); /* offset */
1637 get_value_inc(imm2, loc, 2, FALSE); /* segment */
1638 db_printf("$%#x,%#x", imm2, imm);
1639 break;
1640 case MX:
1641 db_printf("%%mm%d", f_reg(rex, regmodrm));
1642 break;
1643 case EMX:
1644 db_printf("%%mm%d", f_rm(rex, regmodrm));
1645 break;
1646 case XMM:
1647 db_printf("%%xmm%d", f_reg(rex, regmodrm));
1648 break;
1649 case EXMM:
1650 db_printf("%%xmm%d", f_rm(rex, regmodrm));
1651 break;
1654 return (loc);
1657 void be_x86_64_disasm_one_insn(ADDRESS64 *addr, int display)
1659 db_debug = display;
1660 addr->Offset = db_disasm(addr->Offset, TRUE);