1 /* Print i386 instructions for GDB, the GNU debugger.
2 Copyright (C) 1988, 89, 91, 93, 94, 95, 96, 97, 98, 1999
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
24 * modified by John Hassey (hassey@dg-rtp.dg.com)
25 * x86-64 support added by Jan Hubicka (jh@suse.cz)
29 * The main tables describing the instructions is essentially a copy
30 * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
31 * Programmers Manual. Usually, there is a capital letter, followed
32 * by a small letter. The capital letter tell the addressing mode,
33 * and the small letter tells about the operand size. Refer to
34 * the Intel manual for details.
45 #ifndef UNIXWARE_COMPAT
46 /* Set non-zero for broken, compatible instructions. Set to zero for
47 non-broken opcodes. */
48 #define UNIXWARE_COMPAT 1
51 static int fetch_data
PARAMS ((struct disassemble_info
*, bfd_byte
*));
55 /* Points to first byte not fetched. */
56 bfd_byte
*max_fetched
;
57 bfd_byte the_buffer
[MAXLEN
];
62 /* The opcode for the fwait instruction, which we treat as a prefix
64 #define FWAIT_OPCODE (0x9b)
66 /* Set to 1 for 64bit mode disassembly. */
67 static int mode_64bit
;
69 /* Flags for the prefixes for the current instruction. See below. */
72 /* REX prefix the current instruction. See below. */
74 /* Bits of REX we've already used. */
80 /* Mark parts used in the REX prefix. When we are testing for
81 empty prefix (for 8bit register REX extension), just mask it
82 out. Otherwise test for REX bit is excuse for existence of REX
83 only in case value is nonzero. */
84 #define USED_REX(value) \
87 rex_used |= (rex & value) ? (value) | 0x40 : 0; \
92 /* Flags for prefixes which we somehow handled when printing the
93 current instruction. */
94 static int used_prefixes
;
96 /* Flags stored in PREFIXES. */
98 #define PREFIX_REPNZ 2
101 #define PREFIX_SS 0x10
102 #define PREFIX_DS 0x20
103 #define PREFIX_ES 0x40
104 #define PREFIX_FS 0x80
105 #define PREFIX_GS 0x100
106 #define PREFIX_DATA 0x200
107 #define PREFIX_ADDR 0x400
108 #define PREFIX_FWAIT 0x800
110 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
111 to ADDR (exclusive) are valid. Returns 1 for success, longjmps
113 #define FETCH_DATA(info, addr) \
114 ((addr) <= ((struct dis_private *)(info->private_data))->max_fetched \
115 ? 1 : fetch_data ((info), (addr)))
118 fetch_data (info
, addr
)
119 struct disassemble_info
*info
;
123 struct dis_private
*priv
= (struct dis_private
*)info
->private_data
;
124 bfd_vma start
= priv
->insn_start
+ (priv
->max_fetched
- priv
->the_buffer
);
126 status
= (*info
->read_memory_func
) (start
,
128 addr
- priv
->max_fetched
,
132 /* If we did manage to read at least one byte, then
133 print_insn_i386 will do something sensible. Otherwise, print
134 an error. We do that here because this is where we know
136 if (priv
->max_fetched
== priv
->the_buffer
)
137 (*info
->memory_error_func
) (status
, start
, info
);
138 longjmp (priv
->bailout
, 1);
141 priv
->max_fetched
= addr
;
147 #define Eb OP_E, b_mode
148 #define Ev OP_E, v_mode
149 #define Ed OP_E, d_mode
150 #define indirEb OP_indirE, b_mode
151 #define Gb OP_G, b_mode
152 #define Ev OP_E, v_mode
153 #define Ed OP_E, d_mode
154 #define indirEv OP_indirE, v_mode
155 #define Ew OP_E, w_mode
156 #define Ma OP_E, v_mode
157 #define M OP_E, 0 /* lea */
158 #define Mp OP_E, 0 /* 32 or 48 bit memory operand for LDS, LES etc */
159 #define Gv OP_G, v_mode
160 #define Gw OP_G, w_mode
161 #define Rd OP_Rd, d_mode
162 #define Rm OP_Rd, m_mode
163 #define Ib OP_I, b_mode
164 #define sIb OP_sI, b_mode /* sign extened byte */
165 #define Iv OP_I, v_mode
166 #define Iq OP_I, q_mode
167 #define Iv64 OP_I64, v_mode
168 #define Iw OP_I, w_mode
169 #define Jb OP_J, b_mode
170 #define Jv OP_J, v_mode
171 #define Cm OP_C, m_mode
172 #define Dm OP_D, m_mode
173 #define Td OP_T, d_mode
175 #define RMeAX OP_REG, eAX_reg
176 #define RMeBX OP_REG, eBX_reg
177 #define RMeCX OP_REG, eCX_reg
178 #define RMeDX OP_REG, eDX_reg
179 #define RMeSP OP_REG, eSP_reg
180 #define RMeBP OP_REG, eBP_reg
181 #define RMeSI OP_REG, eSI_reg
182 #define RMeDI OP_REG, eDI_reg
183 #define RMrAX OP_REG, rAX_reg
184 #define RMrBX OP_REG, rBX_reg
185 #define RMrCX OP_REG, rCX_reg
186 #define RMrDX OP_REG, rDX_reg
187 #define RMrSP OP_REG, rSP_reg
188 #define RMrBP OP_REG, rBP_reg
189 #define RMrSI OP_REG, rSI_reg
190 #define RMrDI OP_REG, rDI_reg
191 #define RMAL OP_REG, al_reg
192 #define RMAL OP_REG, al_reg
193 #define RMCL OP_REG, cl_reg
194 #define RMDL OP_REG, dl_reg
195 #define RMBL OP_REG, bl_reg
196 #define RMAH OP_REG, ah_reg
197 #define RMCH OP_REG, ch_reg
198 #define RMDH OP_REG, dh_reg
199 #define RMBH OP_REG, bh_reg
200 #define RMAX OP_REG, ax_reg
201 #define RMDX OP_REG, dx_reg
203 #define eAX OP_IMREG, eAX_reg
204 #define eBX OP_IMREG, eBX_reg
205 #define eCX OP_IMREG, eCX_reg
206 #define eDX OP_IMREG, eDX_reg
207 #define eSP OP_IMREG, eSP_reg
208 #define eBP OP_IMREG, eBP_reg
209 #define eSI OP_IMREG, eSI_reg
210 #define eDI OP_IMREG, eDI_reg
211 #define AL OP_IMREG, al_reg
212 #define AL OP_IMREG, al_reg
213 #define CL OP_IMREG, cl_reg
214 #define DL OP_IMREG, dl_reg
215 #define BL OP_IMREG, bl_reg
216 #define AH OP_IMREG, ah_reg
217 #define CH OP_IMREG, ch_reg
218 #define DH OP_IMREG, dh_reg
219 #define BH OP_IMREG, bh_reg
220 #define AX OP_IMREG, ax_reg
221 #define DX OP_IMREG, dx_reg
222 #define indirDX OP_IMREG, indir_dx_reg
224 #define Sw OP_SEG, w_mode
226 #define Ob OP_OFF, b_mode
227 #define Ob64 OP_OFF64, b_mode
228 #define Ov OP_OFF, v_mode
229 #define Ov64 OP_OFF64, v_mode
230 #define Xb OP_DSreg, eSI_reg
231 #define Xv OP_DSreg, eSI_reg
232 #define Yb OP_ESreg, eDI_reg
233 #define Yv OP_ESreg, eDI_reg
234 #define DSBX OP_DSreg, eBX_reg
236 #define es OP_REG, es_reg
237 #define ss OP_REG, ss_reg
238 #define cs OP_REG, cs_reg
239 #define ds OP_REG, ds_reg
240 #define fs OP_REG, fs_reg
241 #define gs OP_REG, gs_reg
245 #define EM OP_EM, v_mode
246 #define EX OP_EX, v_mode
247 #define MS OP_MS, v_mode
249 #define OPSUF OP_3DNowSuffix, 0
250 #define OPSIMD OP_SIMD_Suffix, 0
252 /* bits in sizeflag */
253 #if 0 /* leave undefined until someone adds the extra flag to objdump */
254 #define SUFFIX_ALWAYS 4
259 typedef void (*op_rtn
) PARAMS ((int bytemode
, int sizeflag
));
261 static void OP_E
PARAMS ((int, int));
262 static void OP_G
PARAMS ((int, int));
263 static void OP_I
PARAMS ((int, int));
264 static void OP_I64
PARAMS ((int, int));
265 static void OP_OFF
PARAMS ((int, int));
266 static void OP_REG
PARAMS ((int, int));
267 static void OP_IMREG
PARAMS ((int, int));
268 static void OP_OFF64
PARAMS ((int, int));
269 static void OP_indirE
PARAMS ((int, int));
270 static void OP_sI
PARAMS ((int, int));
271 static void OP_REG
PARAMS ((int, int));
272 static void OP_J
PARAMS ((int, int));
273 static void OP_DIR
PARAMS ((int, int));
274 static void OP_OFF
PARAMS ((int, int));
275 static void OP_ESreg
PARAMS ((int, int));
276 static void OP_DSreg
PARAMS ((int, int));
277 static void OP_SEG
PARAMS ((int, int));
278 static void OP_C
PARAMS ((int, int));
279 static void OP_D
PARAMS ((int, int));
280 static void OP_T
PARAMS ((int, int));
281 static void OP_Rd
PARAMS ((int, int));
282 static void OP_ST
PARAMS ((int, int));
283 static void OP_STi
PARAMS ((int, int));
284 static void OP_MMX
PARAMS ((int, int));
285 static void OP_XMM
PARAMS ((int, int));
286 static void OP_EM
PARAMS ((int, int));
287 static void OP_EX
PARAMS ((int, int));
288 static void OP_MS
PARAMS ((int, int));
289 static void OP_3DNowSuffix
PARAMS ((int, int));
290 static void OP_SIMD_Suffix
PARAMS ((int, int));
291 static void SIMD_Fixup
PARAMS ((int, int));
293 static void append_seg
PARAMS ((void));
294 static void set_op
PARAMS ((unsigned int op
, int));
295 static void putop
PARAMS ((const char *template, int sizeflag
));
296 static void dofloat
PARAMS ((int sizeflag
));
297 static int get16
PARAMS ((void));
298 static bfd_vma get64
PARAMS ((void));
299 static bfd_signed_vma get32
PARAMS ((void));
300 static bfd_signed_vma get32s
PARAMS ((void));
301 static void ckprefix
PARAMS ((void));
302 static const char *prefix_name
PARAMS ((int, int));
303 static void ptr_reg
PARAMS ((int, int));
304 static void BadOp
PARAMS ((void));
306 #define b_mode 1 /* byte operand */
307 #define v_mode 2 /* operand size depends on prefixes */
308 #define w_mode 3 /* word operand */
309 #define d_mode 4 /* double word operand */
310 #define q_mode 5 /* quad word operand */
312 #define m_mode 7 /* d_mode in 32bit, q_mode in 64bit mode. */
357 #define indir_dx_reg 150
360 #define USE_PREFIX_USER_TABLE 2
362 #define GRP1b NULL, NULL, 0, NULL, USE_GROUPS, NULL, 0
363 #define GRP1S NULL, NULL, 1, NULL, USE_GROUPS, NULL, 0
364 #define GRP1Ss NULL, NULL, 2, NULL, USE_GROUPS, NULL, 0
365 #define GRP2b NULL, NULL, 3, NULL, USE_GROUPS, NULL, 0
366 #define GRP2S NULL, NULL, 4, NULL, USE_GROUPS, NULL, 0
367 #define GRP2b_one NULL, NULL, 5, NULL, USE_GROUPS, NULL, 0
368 #define GRP2S_one NULL, NULL, 6, NULL, USE_GROUPS, NULL, 0
369 #define GRP2b_cl NULL, NULL, 7, NULL, USE_GROUPS, NULL, 0
370 #define GRP2S_cl NULL, NULL, 8, NULL, USE_GROUPS, NULL, 0
371 #define GRP3b NULL, NULL, 9, NULL, USE_GROUPS, NULL, 0
372 #define GRP3S NULL, NULL, 10, NULL, USE_GROUPS, NULL, 0
373 #define GRP4 NULL, NULL, 11, NULL, USE_GROUPS, NULL, 0
374 #define GRP5 NULL, NULL, 12, NULL, USE_GROUPS, NULL, 0
375 #define GRP6 NULL, NULL, 13, NULL, USE_GROUPS, NULL, 0
376 #define GRP7 NULL, NULL, 14, NULL, USE_GROUPS, NULL, 0
377 #define GRP8 NULL, NULL, 15, NULL, USE_GROUPS, NULL, 0
378 #define GRP9 NULL, NULL, 16, NULL, USE_GROUPS, NULL, 0
379 #define GRP10 NULL, NULL, 17, NULL, USE_GROUPS, NULL, 0
380 #define GRP11 NULL, NULL, 18, NULL, USE_GROUPS, NULL, 0
381 #define GRP12 NULL, NULL, 19, NULL, USE_GROUPS, NULL, 0
382 #define GRP13 NULL, NULL, 20, NULL, USE_GROUPS, NULL, 0
383 #define GRP14 NULL, NULL, 21, NULL, USE_GROUPS, NULL, 0
384 #define GRPAMD NULL, NULL, 22, NULL, USE_GROUPS, NULL, 0
386 #define PREGRP0 NULL, NULL, 0, NULL, USE_PREFIX_USER_TABLE, NULL, 0
387 #define PREGRP1 NULL, NULL, 1, NULL, USE_PREFIX_USER_TABLE, NULL, 0
388 #define PREGRP2 NULL, NULL, 2, NULL, USE_PREFIX_USER_TABLE, NULL, 0
389 #define PREGRP3 NULL, NULL, 3, NULL, USE_PREFIX_USER_TABLE, NULL, 0
390 #define PREGRP4 NULL, NULL, 4, NULL, USE_PREFIX_USER_TABLE, NULL, 0
391 #define PREGRP5 NULL, NULL, 5, NULL, USE_PREFIX_USER_TABLE, NULL, 0
392 #define PREGRP6 NULL, NULL, 6, NULL, USE_PREFIX_USER_TABLE, NULL, 0
393 #define PREGRP7 NULL, NULL, 7, NULL, USE_PREFIX_USER_TABLE, NULL, 0
394 #define PREGRP8 NULL, NULL, 8, NULL, USE_PREFIX_USER_TABLE, NULL, 0
395 #define PREGRP9 NULL, NULL, 9, NULL, USE_PREFIX_USER_TABLE, NULL, 0
396 #define PREGRP10 NULL, NULL, 10, NULL, USE_PREFIX_USER_TABLE, NULL, 0
397 #define PREGRP11 NULL, NULL, 11, NULL, USE_PREFIX_USER_TABLE, NULL, 0
398 #define PREGRP12 NULL, NULL, 12, NULL, USE_PREFIX_USER_TABLE, NULL, 0
399 #define PREGRP13 NULL, NULL, 13, NULL, USE_PREFIX_USER_TABLE, NULL, 0
400 #define PREGRP14 NULL, NULL, 14, NULL, USE_PREFIX_USER_TABLE, NULL, 0
401 #define PREGRP15 NULL, NULL, 15, NULL, USE_PREFIX_USER_TABLE, NULL, 0
402 #define PREGRP16 NULL, NULL, 16, NULL, USE_PREFIX_USER_TABLE, NULL, 0
403 #define PREGRP17 NULL, NULL, 17, NULL, USE_PREFIX_USER_TABLE, NULL, 0
404 #define PREGRP18 NULL, NULL, 18, NULL, USE_PREFIX_USER_TABLE, NULL, 0
405 #define PREGRP19 NULL, NULL, 19, NULL, USE_PREFIX_USER_TABLE, NULL, 0
406 #define PREGRP20 NULL, NULL, 20, NULL, USE_PREFIX_USER_TABLE, NULL, 0
407 #define PREGRP21 NULL, NULL, 21, NULL, USE_PREFIX_USER_TABLE, NULL, 0
408 #define PREGRP22 NULL, NULL, 22, NULL, USE_PREFIX_USER_TABLE, NULL, 0
409 #define PREGRP23 NULL, NULL, 23, NULL, USE_PREFIX_USER_TABLE, NULL, 0
410 #define PREGRP24 NULL, NULL, 24, NULL, USE_PREFIX_USER_TABLE, NULL, 0
413 #define FLOAT NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
425 /* Upper case letters in the instruction names here are macros.
426 'A' => print 'b' if no register operands or suffix_always is true
427 'B' => print 'b' if suffix_always is true
428 'E' => print 'e' if 32-bit form of jcxz
429 'L' => print 'l' if suffix_always is true
430 'N' => print 'n' if instruction has no wait "prefix"
431 'O' => print 'd', or 'o'
432 'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
433 or suffix_always is true
434 print 'q' if rex prefix is present.
435 'I' => print 'q' in 64bit mode and behave as 'P' otherwise
436 'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always is true
437 'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
438 'S' => print 'w', 'l' or 'q' if suffix_always is true
439 'T' => print 'q' in 64bit mode and behave as 'I' otherwise
440 'X' => print 's', 'd' depending on data16 prefix (for XMM)
441 'W' => print 'b' or 'w' ("w" or "de" in intel mode)
442 'Y' => 'q' if instruction has an REX 64bit overwrite prefix
445 static const struct dis386 dis386_att
[] = {
447 { "addB", Eb
, Gb
, XX
},
448 { "addS", Ev
, Gv
, XX
},
449 { "addB", Gb
, Eb
, XX
},
450 { "addS", Gv
, Ev
, XX
},
451 { "addB", AL
, Ib
, XX
},
452 { "addS", eAX
, Iv
, XX
},
453 { "pushI", es
, XX
, XX
},
454 { "popI", es
, XX
, XX
},
456 { "orB", Eb
, Gb
, XX
},
457 { "orS", Ev
, Gv
, XX
},
458 { "orB", Gb
, Eb
, XX
},
459 { "orS", Gv
, Ev
, XX
},
460 { "orB", AL
, Ib
, XX
},
461 { "orS", eAX
, Iv
, XX
},
462 { "pushI", cs
, XX
, XX
},
463 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
465 { "adcB", Eb
, Gb
, XX
},
466 { "adcS", Ev
, Gv
, XX
},
467 { "adcB", Gb
, Eb
, XX
},
468 { "adcS", Gv
, Ev
, XX
},
469 { "adcB", AL
, Ib
, XX
},
470 { "adcS", eAX
, Iv
, XX
},
471 { "pushI", ss
, XX
, XX
},
472 { "popI", ss
, XX
, XX
},
474 { "sbbB", Eb
, Gb
, XX
},
475 { "sbbS", Ev
, Gv
, XX
},
476 { "sbbB", Gb
, Eb
, XX
},
477 { "sbbS", Gv
, Ev
, XX
},
478 { "sbbB", AL
, Ib
, XX
},
479 { "sbbS", eAX
, Iv
, XX
},
480 { "pushI", ds
, XX
, XX
},
481 { "popI", ds
, XX
, XX
},
483 { "andB", Eb
, Gb
, XX
},
484 { "andS", Ev
, Gv
, XX
},
485 { "andB", Gb
, Eb
, XX
},
486 { "andS", Gv
, Ev
, XX
},
487 { "andB", AL
, Ib
, XX
},
488 { "andS", eAX
, Iv
, XX
},
489 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
490 { "daa", XX
, XX
, XX
},
492 { "subB", Eb
, Gb
, XX
},
493 { "subS", Ev
, Gv
, XX
},
494 { "subB", Gb
, Eb
, XX
},
495 { "subS", Gv
, Ev
, XX
},
496 { "subB", AL
, Ib
, XX
},
497 { "subS", eAX
, Iv
, XX
},
498 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
499 { "das", XX
, XX
, XX
},
501 { "xorB", Eb
, Gb
, XX
},
502 { "xorS", Ev
, Gv
, XX
},
503 { "xorB", Gb
, Eb
, XX
},
504 { "xorS", Gv
, Ev
, XX
},
505 { "xorB", AL
, Ib
, XX
},
506 { "xorS", eAX
, Iv
, XX
},
507 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
508 { "aaa", XX
, XX
, XX
},
510 { "cmpB", Eb
, Gb
, XX
},
511 { "cmpS", Ev
, Gv
, XX
},
512 { "cmpB", Gb
, Eb
, XX
},
513 { "cmpS", Gv
, Ev
, XX
},
514 { "cmpB", AL
, Ib
, XX
},
515 { "cmpS", eAX
, Iv
, XX
},
516 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
517 { "aas", XX
, XX
, XX
},
519 { "incS", RMeAX
, XX
, XX
},
520 { "incS", RMeCX
, XX
, XX
},
521 { "incS", RMeDX
, XX
, XX
},
522 { "incS", RMeBX
, XX
, XX
},
523 { "incS", RMeSP
, XX
, XX
},
524 { "incS", RMeBP
, XX
, XX
},
525 { "incS", RMeSI
, XX
, XX
},
526 { "incS", RMeDI
, XX
, XX
},
528 { "decS", RMeAX
, XX
, XX
},
529 { "decS", RMeCX
, XX
, XX
},
530 { "decS", RMeDX
, XX
, XX
},
531 { "decS", RMeBX
, XX
, XX
},
532 { "decS", RMeSP
, XX
, XX
},
533 { "decS", RMeBP
, XX
, XX
},
534 { "decS", RMeSI
, XX
, XX
},
535 { "decS", RMeDI
, XX
, XX
},
537 { "pushS", RMeAX
, XX
, XX
},
538 { "pushS", RMeCX
, XX
, XX
},
539 { "pushS", RMeDX
, XX
, XX
},
540 { "pushS", RMeBX
, XX
, XX
},
541 { "pushS", RMeSP
, XX
, XX
},
542 { "pushS", RMeBP
, XX
, XX
},
543 { "pushS", RMeSI
, XX
, XX
},
544 { "pushS", RMeDI
, XX
, XX
},
546 { "popS", RMeAX
, XX
, XX
},
547 { "popS", RMeCX
, XX
, XX
},
548 { "popS", RMeDX
, XX
, XX
},
549 { "popS", RMeBX
, XX
, XX
},
550 { "popS", RMeSP
, XX
, XX
},
551 { "popS", RMeBP
, XX
, XX
},
552 { "popS", RMeSI
, XX
, XX
},
553 { "popS", RMeDI
, XX
, XX
},
555 { "pushaP", XX
, XX
, XX
},
556 { "popaP", XX
, XX
, XX
},
557 { "boundS", Gv
, Ma
, XX
},
558 { "arpl", Ew
, Gw
, XX
},
559 { "(bad)", XX
, XX
, XX
}, /* seg fs */
560 { "(bad)", XX
, XX
, XX
}, /* seg gs */
561 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
562 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
564 { "pushI", Iv
, XX
, XX
}, /* 386 book wrong */
565 { "imulS", Gv
, Ev
, Iv
},
566 { "pushI", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
567 { "imulS", Gv
, Ev
, sIb
},
568 { "insb", Yb
, indirDX
, XX
},
569 { "insR", Yv
, indirDX
, XX
},
570 { "outsb", indirDX
, Xb
, XX
},
571 { "outsR", indirDX
, Xv
, XX
},
573 { "jo", Jb
, XX
, XX
},
574 { "jno", Jb
, XX
, XX
},
575 { "jb", Jb
, XX
, XX
},
576 { "jae", Jb
, XX
, XX
},
577 { "je", Jb
, XX
, XX
},
578 { "jne", Jb
, XX
, XX
},
579 { "jbe", Jb
, XX
, XX
},
580 { "ja", Jb
, XX
, XX
},
582 { "js", Jb
, XX
, XX
},
583 { "jns", Jb
, XX
, XX
},
584 { "jp", Jb
, XX
, XX
},
585 { "jnp", Jb
, XX
, XX
},
586 { "jl", Jb
, XX
, XX
},
587 { "jge", Jb
, XX
, XX
},
588 { "jle", Jb
, XX
, XX
},
589 { "jg", Jb
, XX
, XX
},
593 { "(bad)", XX
, XX
, XX
},
595 { "testB", Eb
, Gb
, XX
},
596 { "testS", Ev
, Gv
, XX
},
597 { "xchgB", Eb
, Gb
, XX
},
598 { "xchgS", Ev
, Gv
, XX
},
600 { "movB", Eb
, Gb
, XX
},
601 { "movS", Ev
, Gv
, XX
},
602 { "movB", Gb
, Eb
, XX
},
603 { "movS", Gv
, Ev
, XX
},
604 { "movQ", Ev
, Sw
, XX
},
605 { "leaS", Gv
, M
, XX
},
606 { "movQ", Sw
, Ev
, XX
},
607 { "popT", Ev
, XX
, XX
},
609 { "nop", XX
, XX
, XX
},
610 /* FIXME: NOP with REPz prefix is called PAUSE. */
611 { "xchgS", RMeCX
, eAX
, XX
},
612 { "xchgS", RMeDX
, eAX
, XX
},
613 { "xchgS", RMeBX
, eAX
, XX
},
614 { "xchgS", RMeSP
, eAX
, XX
},
615 { "xchgS", RMeBP
, eAX
, XX
},
616 { "xchgS", RMeSI
, eAX
, XX
},
617 { "xchgS", RMeDI
, eAX
, XX
},
619 { "cWtR", XX
, XX
, XX
},
620 { "cRtO", XX
, XX
, XX
},
621 { "lcallI", Ap
, XX
, XX
},
622 { "(bad)", XX
, XX
, XX
}, /* fwait */
623 { "pushfI", XX
, XX
, XX
},
624 { "popfI", XX
, XX
, XX
},
625 { "sahf", XX
, XX
, XX
},
626 { "lahf", XX
, XX
, XX
},
628 { "movB", AL
, Ob
, XX
},
629 { "movS", eAX
, Ov
, XX
},
630 { "movB", Ob
, AL
, XX
},
631 { "movS", Ov
, eAX
, XX
},
632 { "movsb", Yb
, Xb
, XX
},
633 { "movsR", Yv
, Xv
, XX
},
634 { "cmpsb", Xb
, Yb
, XX
},
635 { "cmpsR", Xv
, Yv
, XX
},
637 { "testB", AL
, Ib
, XX
},
638 { "testS", eAX
, Iv
, XX
},
639 { "stosB", Yb
, AL
, XX
},
640 { "stosS", Yv
, eAX
, XX
},
641 { "lodsB", AL
, Xb
, XX
},
642 { "lodsS", eAX
, Xv
, XX
},
643 { "scasB", AL
, Yb
, XX
},
644 { "scasS", eAX
, Yv
, XX
},
646 { "movB", RMAL
, Ib
, XX
},
647 { "movB", RMCL
, Ib
, XX
},
648 { "movB", RMDL
, Ib
, XX
},
649 { "movB", RMBL
, Ib
, XX
},
650 { "movB", RMAH
, Ib
, XX
},
651 { "movB", RMCH
, Ib
, XX
},
652 { "movB", RMDH
, Ib
, XX
},
653 { "movB", RMBH
, Ib
, XX
},
655 { "movS", RMeAX
, Iv
, XX
},
656 { "movS", RMeCX
, Iv
, XX
},
657 { "movS", RMeDX
, Iv
, XX
},
658 { "movS", RMeBX
, Iv
, XX
},
659 { "movS", RMeSP
, Iv
, XX
},
660 { "movS", RMeBP
, Iv
, XX
},
661 { "movS", RMeSI
, Iv
, XX
},
662 { "movS", RMeDI
, Iv
, XX
},
666 { "retI", Iw
, XX
, XX
},
667 { "retI", XX
, XX
, XX
},
668 { "lesS", Gv
, Mp
, XX
},
669 { "ldsS", Gv
, Mp
, XX
},
670 { "movA", Eb
, Ib
, XX
},
671 { "movQ", Ev
, Iv
, XX
},
673 { "enterI", Iw
, Ib
, XX
},
674 { "leaveI", XX
, XX
, XX
},
675 { "lretP", Iw
, XX
, XX
},
676 { "lretP", XX
, XX
, XX
},
677 { "int3", XX
, XX
, XX
},
678 { "int", Ib
, XX
, XX
},
679 { "into", XX
, XX
, XX
},
680 { "iretP", XX
, XX
, XX
},
686 { "aam", sIb
, XX
, XX
},
687 { "aad", sIb
, XX
, XX
},
688 { "(bad)", XX
, XX
, XX
},
689 { "xlat", DSBX
, XX
, XX
},
700 { "loopne", Jb
, XX
, XX
},
701 { "loope", Jb
, XX
, XX
},
702 { "loop", Jb
, XX
, XX
},
703 { "jEcxz", Jb
, XX
, XX
},
704 { "inB", AL
, Ib
, XX
},
705 { "inS", eAX
, Ib
, XX
},
706 { "outB", Ib
, AL
, XX
},
707 { "outS", Ib
, eAX
, XX
},
709 { "callI", Jv
, XX
, XX
},
710 { "jmpI", Jv
, XX
, XX
},
711 { "ljmpI", Ap
, XX
, XX
},
712 { "jmp", Jb
, XX
, XX
},
713 { "inB", AL
, indirDX
, XX
},
714 { "inS", eAX
, indirDX
, XX
},
715 { "outB", indirDX
, AL
, XX
},
716 { "outS", indirDX
, eAX
, XX
},
718 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
719 { "(bad)", XX
, XX
, XX
},
720 { "(bad)", XX
, XX
, XX
}, /* repne */
721 { "(bad)", XX
, XX
, XX
}, /* repz */
722 { "hlt", XX
, XX
, XX
},
723 { "cmc", XX
, XX
, XX
},
727 { "clc", XX
, XX
, XX
},
728 { "stc", XX
, XX
, XX
},
729 { "cli", XX
, XX
, XX
},
730 { "sti", XX
, XX
, XX
},
731 { "cld", XX
, XX
, XX
},
732 { "std", XX
, XX
, XX
},
737 static const struct dis386 dis386_intel
[] = {
739 { "add", Eb
, Gb
, XX
},
740 { "add", Ev
, Gv
, XX
},
741 { "add", Gb
, Eb
, XX
},
742 { "add", Gv
, Ev
, XX
},
743 { "add", AL
, Ib
, XX
},
744 { "add", eAX
, Iv
, XX
},
745 { "push", es
, XX
, XX
},
746 { "pop", es
, XX
, XX
},
748 { "or", Eb
, Gb
, XX
},
749 { "or", Ev
, Gv
, XX
},
750 { "or", Gb
, Eb
, XX
},
751 { "or", Gv
, Ev
, XX
},
752 { "or", AL
, Ib
, XX
},
753 { "or", eAX
, Iv
, XX
},
754 { "push", cs
, XX
, XX
},
755 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
757 { "adc", Eb
, Gb
, XX
},
758 { "adc", Ev
, Gv
, XX
},
759 { "adc", Gb
, Eb
, XX
},
760 { "adc", Gv
, Ev
, XX
},
761 { "adc", AL
, Ib
, XX
},
762 { "adc", eAX
, Iv
, XX
},
763 { "push", ss
, XX
, XX
},
764 { "pop", ss
, XX
, XX
},
766 { "sbb", Eb
, Gb
, XX
},
767 { "sbb", Ev
, Gv
, XX
},
768 { "sbb", Gb
, Eb
, XX
},
769 { "sbb", Gv
, Ev
, XX
},
770 { "sbb", AL
, Ib
, XX
},
771 { "sbb", eAX
, Iv
, XX
},
772 { "push", ds
, XX
, XX
},
773 { "pop", ds
, XX
, XX
},
775 { "and", Eb
, Gb
, XX
},
776 { "and", Ev
, Gv
, XX
},
777 { "and", Gb
, Eb
, XX
},
778 { "and", Gv
, Ev
, XX
},
779 { "and", AL
, Ib
, XX
},
780 { "and", eAX
, Iv
, XX
},
781 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
782 { "daa", XX
, XX
, XX
},
784 { "sub", Eb
, Gb
, XX
},
785 { "sub", Ev
, Gv
, XX
},
786 { "sub", Gb
, Eb
, XX
},
787 { "sub", Gv
, Ev
, XX
},
788 { "sub", AL
, Ib
, XX
},
789 { "sub", eAX
, Iv
, XX
},
790 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
791 { "das", XX
, XX
, XX
},
793 { "xor", Eb
, Gb
, XX
},
794 { "xor", Ev
, Gv
, XX
},
795 { "xor", Gb
, Eb
, XX
},
796 { "xor", Gv
, Ev
, XX
},
797 { "xor", AL
, Ib
, XX
},
798 { "xor", eAX
, Iv
, XX
},
799 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
800 { "aaa", XX
, XX
, XX
},
802 { "cmp", Eb
, Gb
, XX
},
803 { "cmp", Ev
, Gv
, XX
},
804 { "cmp", Gb
, Eb
, XX
},
805 { "cmp", Gv
, Ev
, XX
},
806 { "cmp", AL
, Ib
, XX
},
807 { "cmp", eAX
, Iv
, XX
},
808 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
809 { "aas", XX
, XX
, XX
},
811 { "inc", RMeAX
, XX
, XX
},
812 { "inc", RMeCX
, XX
, XX
},
813 { "inc", RMeDX
, XX
, XX
},
814 { "inc", RMeBX
, XX
, XX
},
815 { "inc", RMeSP
, XX
, XX
},
816 { "inc", RMeBP
, XX
, XX
},
817 { "inc", RMeSI
, XX
, XX
},
818 { "inc", RMeDI
, XX
, XX
},
820 { "dec", RMeAX
, XX
, XX
},
821 { "dec", RMeCX
, XX
, XX
},
822 { "dec", RMeDX
, XX
, XX
},
823 { "dec", RMeBX
, XX
, XX
},
824 { "dec", RMeSP
, XX
, XX
},
825 { "dec", RMeBP
, XX
, XX
},
826 { "dec", RMeSI
, XX
, XX
},
827 { "dec", RMeDI
, XX
, XX
},
829 { "push", RMeAX
, XX
, XX
},
830 { "push", RMeCX
, XX
, XX
},
831 { "push", RMeDX
, XX
, XX
},
832 { "push", RMeBX
, XX
, XX
},
833 { "push", RMeSP
, XX
, XX
},
834 { "push", RMeBP
, XX
, XX
},
835 { "push", RMeSI
, XX
, XX
},
836 { "push", RMeDI
, XX
, XX
},
838 { "pop", RMeAX
, XX
, XX
},
839 { "pop", RMeCX
, XX
, XX
},
840 { "pop", RMeDX
, XX
, XX
},
841 { "pop", RMeBX
, XX
, XX
},
842 { "pop", RMeSP
, XX
, XX
},
843 { "pop", RMeBP
, XX
, XX
},
844 { "pop", RMeSI
, XX
, XX
},
845 { "pop", RMeDI
, XX
, XX
},
847 { "pusha", XX
, XX
, XX
},
848 { "popa", XX
, XX
, XX
},
849 { "bound", Gv
, Ma
, XX
},
850 { "arpl", Ew
, Gw
, XX
},
851 { "(bad)", XX
, XX
, XX
}, /* seg fs */
852 { "(bad)", XX
, XX
, XX
}, /* seg gs */
853 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
854 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
856 { "push", Iv
, XX
, XX
}, /* 386 book wrong */
857 { "imul", Gv
, Ev
, Iv
},
858 { "push", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
859 { "imul", Gv
, Ev
, sIb
},
860 { "ins", Yb
, indirDX
, XX
},
861 { "ins", Yv
, indirDX
, XX
},
862 { "outs", indirDX
, Xb
, XX
},
863 { "outs", indirDX
, Xv
, XX
},
865 { "jo", Jb
, XX
, XX
},
866 { "jno", Jb
, XX
, XX
},
867 { "jb", Jb
, XX
, XX
},
868 { "jae", Jb
, XX
, XX
},
869 { "je", Jb
, XX
, XX
},
870 { "jne", Jb
, XX
, XX
},
871 { "jbe", Jb
, XX
, XX
},
872 { "ja", Jb
, XX
, XX
},
874 { "js", Jb
, XX
, XX
},
875 { "jns", Jb
, XX
, XX
},
876 { "jp", Jb
, XX
, XX
},
877 { "jnp", Jb
, XX
, XX
},
878 { "jl", Jb
, XX
, XX
},
879 { "jge", Jb
, XX
, XX
},
880 { "jle", Jb
, XX
, XX
},
881 { "jg", Jb
, XX
, XX
},
885 { "(bad)", XX
, XX
, XX
},
887 { "test", Eb
, Gb
, XX
},
888 { "test", Ev
, Gv
, XX
},
889 { "xchg", Eb
, Gb
, XX
},
890 { "xchg", Ev
, Gv
, XX
},
892 { "mov", Eb
, Gb
, XX
},
893 { "mov", Ev
, Gv
, XX
},
894 { "mov", Gb
, Eb
, XX
},
895 { "mov", Gv
, Ev
, XX
},
896 { "mov", Ev
, Sw
, XX
},
897 { "lea", Gv
, M
, XX
},
898 { "mov", Sw
, Ev
, XX
},
899 { "pop", Ev
, XX
, XX
},
901 { "nop", XX
, XX
, XX
},
902 /* FIXME: NOP with REPz prefix is called PAUSE. */
903 { "xchg", RMeCX
, eAX
, XX
},
904 { "xchg", RMeDX
, eAX
, XX
},
905 { "xchg", RMeBX
, eAX
, XX
},
906 { "xchg", RMeSP
, eAX
, XX
},
907 { "xchg", RMeBP
, eAX
, XX
},
908 { "xchg", RMeSI
, eAX
, XX
},
909 { "xchg", RMeDI
, eAX
, XX
},
911 { "cW", XX
, XX
, XX
}, /* cwde and cbw */
912 { "cR", XX
, XX
, XX
}, /* cdq and cwd */
913 { "lcall", Ap
, XX
, XX
},
914 { "(bad)", XX
, XX
, XX
}, /* fwait */
915 { "pushf", XX
, XX
, XX
},
916 { "popf", XX
, XX
, XX
},
917 { "sahf", XX
, XX
, XX
},
918 { "lahf", XX
, XX
, XX
},
920 { "mov", AL
, Ob
, XX
},
921 { "mov", eAX
, Ov
, XX
},
922 { "mov", Ob
, AL
, XX
},
923 { "mov", Ov
, eAX
, XX
},
924 { "movs", Yb
, Xb
, XX
},
925 { "movs", Yv
, Xv
, XX
},
926 { "cmps", Xb
, Yb
, XX
},
927 { "cmps", Xv
, Yv
, XX
},
929 { "test", AL
, Ib
, XX
},
930 { "test", eAX
, Iv
, XX
},
931 { "stos", Yb
, AL
, XX
},
932 { "stos", Yv
, eAX
, XX
},
933 { "lods", AL
, Xb
, XX
},
934 { "lods", eAX
, Xv
, XX
},
935 { "scas", AL
, Yb
, XX
},
936 { "scas", eAX
, Yv
, XX
},
938 { "mov", RMAL
, Ib
, XX
},
939 { "mov", RMCL
, Ib
, XX
},
940 { "mov", RMDL
, Ib
, XX
},
941 { "mov", RMBL
, Ib
, XX
},
942 { "mov", RMAH
, Ib
, XX
},
943 { "mov", RMCH
, Ib
, XX
},
944 { "mov", RMDH
, Ib
, XX
},
945 { "mov", RMBH
, Ib
, XX
},
947 { "mov", RMeAX
, Iv
, XX
},
948 { "mov", RMeCX
, Iv
, XX
},
949 { "mov", RMeDX
, Iv
, XX
},
950 { "mov", RMeBX
, Iv
, XX
},
951 { "mov", RMeSP
, Iv
, XX
},
952 { "mov", RMeBP
, Iv
, XX
},
953 { "mov", RMeSI
, Iv
, XX
},
954 { "mov", RMeDI
, Iv
, XX
},
958 { "ret", Iw
, XX
, XX
},
959 { "ret", XX
, XX
, XX
},
960 { "les", Gv
, Mp
, XX
},
961 { "lds", Gv
, Mp
, XX
},
962 { "mov", Eb
, Ib
, XX
},
963 { "mov", Ev
, Iv
, XX
},
965 { "enter", Iw
, Ib
, XX
},
966 { "leave", XX
, XX
, XX
},
967 { "lret", Iw
, XX
, XX
},
968 { "lret", XX
, XX
, XX
},
969 { "int3", XX
, XX
, XX
},
970 { "int", Ib
, XX
, XX
},
971 { "into", XX
, XX
, XX
},
972 { "iret", XX
, XX
, XX
},
978 { "aam", sIb
, XX
, XX
},
979 { "aad", sIb
, XX
, XX
},
980 { "(bad)", XX
, XX
, XX
},
981 { "xlat", DSBX
, XX
, XX
},
992 { "loopne", Jb
, XX
, XX
},
993 { "loope", Jb
, XX
, XX
},
994 { "loop", Jb
, XX
, XX
},
995 { "jEcxz", Jb
, XX
, XX
},
996 { "in", AL
, Ib
, XX
},
997 { "in", eAX
, Ib
, XX
},
998 { "out", Ib
, AL
, XX
},
999 { "out", Ib
, eAX
, XX
},
1001 { "call", Jv
, XX
, XX
},
1002 { "jmp", Jv
, XX
, XX
},
1003 { "ljmp", Ap
, XX
, XX
},
1004 { "jmp", Jb
, XX
, XX
},
1005 { "in", AL
, indirDX
, XX
},
1006 { "in", eAX
, indirDX
, XX
},
1007 { "out", indirDX
, AL
, XX
},
1008 { "out", indirDX
, eAX
, XX
},
1010 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
1011 { "(bad)", XX
, XX
, XX
},
1012 { "(bad)", XX
, XX
, XX
}, /* repne */
1013 { "(bad)", XX
, XX
, XX
}, /* repz */
1014 { "hlt", XX
, XX
, XX
},
1015 { "cmc", XX
, XX
, XX
},
1019 { "clc", XX
, XX
, XX
},
1020 { "stc", XX
, XX
, XX
},
1021 { "cli", XX
, XX
, XX
},
1022 { "sti", XX
, XX
, XX
},
1023 { "cld", XX
, XX
, XX
},
1024 { "std", XX
, XX
, XX
},
1029 /* 64bit mode is having some instruction set differences, so separate table is
1031 static const struct dis386 disx86_64_att
[] = {
1033 { "addB", Eb
, Gb
, XX
},
1034 { "addS", Ev
, Gv
, XX
},
1035 { "addB", Gb
, Eb
, XX
},
1036 { "addS", Gv
, Ev
, XX
},
1037 { "addB", AL
, Ib
, XX
},
1038 { "addS", eAX
, Iv
, XX
},
1039 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1040 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1042 { "orB", Eb
, Gb
, XX
},
1043 { "orS", Ev
, Gv
, XX
},
1044 { "orB", Gb
, Eb
, XX
},
1045 { "orS", Gv
, Ev
, XX
},
1046 { "orB", AL
, Ib
, XX
},
1047 { "orS", eAX
, Iv
, XX
},
1048 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1049 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
1051 { "adcB", Eb
, Gb
, XX
},
1052 { "adcS", Ev
, Gv
, XX
},
1053 { "adcB", Gb
, Eb
, XX
},
1054 { "adcS", Gv
, Ev
, XX
},
1055 { "adcB", AL
, Ib
, XX
},
1056 { "adcS", eAX
, Iv
, XX
},
1057 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1058 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1060 { "sbbB", Eb
, Gb
, XX
},
1061 { "sbbS", Ev
, Gv
, XX
},
1062 { "sbbB", Gb
, Eb
, XX
},
1063 { "sbbS", Gv
, Ev
, XX
},
1064 { "sbbB", AL
, Ib
, XX
},
1065 { "sbbS", eAX
, Iv
, XX
},
1066 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1067 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1069 { "andB", Eb
, Gb
, XX
},
1070 { "andS", Ev
, Gv
, XX
},
1071 { "andB", Gb
, Eb
, XX
},
1072 { "andS", Gv
, Ev
, XX
},
1073 { "andB", AL
, Ib
, XX
},
1074 { "andS", eAX
, Iv
, XX
},
1075 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
1076 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1078 { "subB", Eb
, Gb
, XX
},
1079 { "subS", Ev
, Gv
, XX
},
1080 { "subB", Gb
, Eb
, XX
},
1081 { "subS", Gv
, Ev
, XX
},
1082 { "subB", AL
, Ib
, XX
},
1083 { "subS", eAX
, Iv
, XX
},
1084 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
1085 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1087 { "xorB", Eb
, Gb
, XX
},
1088 { "xorS", Ev
, Gv
, XX
},
1089 { "xorB", Gb
, Eb
, XX
},
1090 { "xorS", Gv
, Ev
, XX
},
1091 { "xorB", AL
, Ib
, XX
},
1092 { "xorS", eAX
, Iv
, XX
},
1093 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
1094 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1096 { "cmpB", Eb
, Gb
, XX
},
1097 { "cmpS", Ev
, Gv
, XX
},
1098 { "cmpB", Gb
, Eb
, XX
},
1099 { "cmpS", Gv
, Ev
, XX
},
1100 { "cmpB", AL
, Ib
, XX
},
1101 { "cmpS", eAX
, Iv
, XX
},
1102 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
1103 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1105 { "(bad)", XX
, XX
, XX
}, /* REX prefix area. */
1106 { "(bad)", XX
, XX
, XX
},
1107 { "(bad)", XX
, XX
, XX
},
1108 { "(bad)", XX
, XX
, XX
},
1109 { "(bad)", XX
, XX
, XX
},
1110 { "(bad)", XX
, XX
, XX
},
1111 { "(bad)", XX
, XX
, XX
},
1112 { "(bad)", XX
, XX
, XX
},
1114 { "(bad)", XX
, XX
, XX
},
1115 { "(bad)", XX
, XX
, XX
},
1116 { "(bad)", XX
, XX
, XX
},
1117 { "(bad)", XX
, XX
, XX
},
1118 { "(bad)", XX
, XX
, XX
},
1119 { "(bad)", XX
, XX
, XX
},
1120 { "(bad)", XX
, XX
, XX
},
1121 { "(bad)", XX
, XX
, XX
},
1123 { "pushI", RMrAX
, XX
, XX
},
1124 { "pushI", RMrCX
, XX
, XX
},
1125 { "pushI", RMrDX
, XX
, XX
},
1126 { "pushI", RMrBX
, XX
, XX
},
1127 { "pushI", RMrSP
, XX
, XX
},
1128 { "pushI", RMrBP
, XX
, XX
},
1129 { "pushI", RMrSI
, XX
, XX
},
1130 { "pushI", RMrDI
, XX
, XX
},
1132 { "popI", RMrAX
, XX
, XX
},
1133 { "popI", RMrCX
, XX
, XX
},
1134 { "popI", RMrDX
, XX
, XX
},
1135 { "popI", RMrBX
, XX
, XX
},
1136 { "popI", RMrSP
, XX
, XX
},
1137 { "popI", RMrBP
, XX
, XX
},
1138 { "popI", RMrSI
, XX
, XX
},
1139 { "popI", RMrDI
, XX
, XX
},
1141 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1142 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1143 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1144 { "movslR", Gv
, Ed
, XX
},
1145 { "(bad)", XX
, XX
, XX
}, /* seg fs */
1146 { "(bad)", XX
, XX
, XX
}, /* seg gs */
1147 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
1148 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
1150 { "pushI", Iq
, XX
, XX
}, /* 386 book wrong */
1151 { "imulS", Gv
, Ev
, Iv
},
1152 { "pushI", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
1153 { "imulS", Gv
, Ev
, sIb
},
1154 { "insb", Yb
, indirDX
, XX
},
1155 { "insR", Yv
, indirDX
, XX
},
1156 { "outsb", indirDX
, Xb
, XX
},
1157 { "outsR", indirDX
, Xv
, XX
},
1159 { "jo", Jb
, XX
, XX
},
1160 { "jno", Jb
, XX
, XX
},
1161 { "jb", Jb
, XX
, XX
},
1162 { "jae", Jb
, XX
, XX
},
1163 { "je", Jb
, XX
, XX
},
1164 { "jne", Jb
, XX
, XX
},
1165 { "jbe", Jb
, XX
, XX
},
1166 { "ja", Jb
, XX
, XX
},
1168 { "js", Jb
, XX
, XX
},
1169 { "jns", Jb
, XX
, XX
},
1170 { "jp", Jb
, XX
, XX
},
1171 { "jnp", Jb
, XX
, XX
},
1172 { "jl", Jb
, XX
, XX
},
1173 { "jge", Jb
, XX
, XX
},
1174 { "jle", Jb
, XX
, XX
},
1175 { "jg", Jb
, XX
, XX
},
1179 { "(bad)", XX
, XX
, XX
},
1181 { "testB", Eb
, Gb
, XX
},
1182 { "testS", Ev
, Gv
, XX
},
1183 { "xchgB", Eb
, Gb
, XX
},
1184 { "xchgS", Ev
, Gv
, XX
},
1186 { "movB", Eb
, Gb
, XX
},
1187 { "movS", Ev
, Gv
, XX
},
1188 { "movB", Gb
, Eb
, XX
},
1189 { "movS", Gv
, Ev
, XX
},
1190 { "movQ", Ev
, Sw
, XX
},
1191 { "leaS", Gv
, M
, XX
},
1192 { "movQ", Sw
, Ev
, XX
},
1193 { "popI", Ev
, XX
, XX
},
1195 { "nop", XX
, XX
, XX
},
1196 /* FIXME: NOP with REPz prefix is called PAUSE. */
1197 { "xchgS", RMeCX
, eAX
, XX
},
1198 { "xchgS", RMeDX
, eAX
, XX
},
1199 { "xchgS", RMeBX
, eAX
, XX
},
1200 { "xchgS", RMeSP
, eAX
, XX
},
1201 { "xchgS", RMeBP
, eAX
, XX
},
1202 { "xchgS", RMeSI
, eAX
, XX
},
1203 { "xchgS", RMeDI
, eAX
, XX
},
1205 { "cWtR", XX
, XX
, XX
},
1206 { "cRtO", XX
, XX
, XX
},
1207 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1208 { "(bad)", XX
, XX
, XX
}, /* fwait */
1209 { "pushfI", XX
, XX
, XX
},
1210 { "popfI", XX
, XX
, XX
},
1211 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1212 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1214 { "movB", AL
, Ob64
, XX
},
1215 { "movS", eAX
, Ov64
, XX
},
1216 { "movB", Ob64
, AL
, XX
},
1217 { "movS", Ov64
, eAX
, XX
},
1218 { "movsb", Yb
, Xb
, XX
},
1219 { "movsR", Yv
, Xv
, XX
},
1220 { "cmpsb", Xb
, Yb
, XX
},
1221 { "cmpsR", Xv
, Yv
, XX
},
1223 { "testB", AL
, Ib
, XX
},
1224 { "testS", eAX
, Iv
, XX
},
1225 { "stosB", Yb
, AL
, XX
},
1226 { "stosS", Yv
, eAX
, XX
},
1227 { "lodsB", AL
, Xb
, XX
},
1228 { "lodsS", eAX
, Xv
, XX
},
1229 { "scasB", AL
, Yb
, XX
},
1230 { "scasS", eAX
, Yv
, XX
},
1232 { "movB", RMAL
, Ib
, XX
},
1233 { "movB", RMCL
, Ib
, XX
},
1234 { "movB", RMDL
, Ib
, XX
},
1235 { "movB", RMBL
, Ib
, XX
},
1236 { "movB", RMAH
, Ib
, XX
},
1237 { "movB", RMCH
, Ib
, XX
},
1238 { "movB", RMDH
, Ib
, XX
},
1239 { "movB", RMBH
, Ib
, XX
},
1241 { "movS", RMeAX
, Iv64
, XX
},
1242 { "movS", RMeCX
, Iv64
, XX
},
1243 { "movS", RMeDX
, Iv64
, XX
},
1244 { "movS", RMeBX
, Iv64
, XX
},
1245 { "movS", RMeSP
, Iv64
, XX
},
1246 { "movS", RMeBP
, Iv64
, XX
},
1247 { "movS", RMeSI
, Iv64
, XX
},
1248 { "movS", RMeDI
, Iv64
, XX
},
1252 { "retI", Iw
, XX
, XX
},
1253 { "retI", XX
, XX
, XX
},
1254 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1255 { "ldsS", Gv
, Mp
, XX
},
1256 { "movA", Eb
, Ib
, XX
},
1257 { "movQ", Ev
, Iv
, XX
},
1259 { "enterI", Iw
, Ib
, XX
},
1260 { "leaveI", XX
, XX
, XX
},
1261 { "lretP", Iw
, XX
, XX
},
1262 { "lretP", XX
, XX
, XX
},
1263 { "int3", XX
, XX
, XX
},
1264 { "int", Ib
, XX
, XX
},
1265 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1266 { "iretP", XX
, XX
, XX
},
1272 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1273 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1274 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1275 { "xlat", DSBX
, XX
, XX
},
1286 { "loopne", Jb
, XX
, XX
},
1287 { "loope", Jb
, XX
, XX
},
1288 { "loop", Jb
, XX
, XX
},
1289 { "jEcxz", Jb
, XX
, XX
},
1290 { "inB", AL
, Ib
, XX
},
1291 { "inS", eAX
, Ib
, XX
},
1292 { "outB", Ib
, AL
, XX
},
1293 { "outS", Ib
, eAX
, XX
},
1295 { "callI", Jv
, XX
, XX
},
1296 { "jmpI", Jv
, XX
, XX
},
1297 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1298 { "jmp", Jb
, XX
, XX
},
1299 { "inB", AL
, indirDX
, XX
},
1300 { "inS", eAX
, indirDX
, XX
},
1301 { "outB", indirDX
, AL
, XX
},
1302 { "outS", indirDX
, eAX
, XX
},
1304 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
1305 { "(bad)", XX
, XX
, XX
},
1306 { "(bad)", XX
, XX
, XX
}, /* repne */
1307 { "(bad)", XX
, XX
, XX
}, /* repz */
1308 { "hlt", XX
, XX
, XX
},
1309 { "cmc", XX
, XX
, XX
},
1313 { "clc", XX
, XX
, XX
},
1314 { "stc", XX
, XX
, XX
},
1315 { "cli", XX
, XX
, XX
},
1316 { "sti", XX
, XX
, XX
},
1317 { "cld", XX
, XX
, XX
},
1318 { "std", XX
, XX
, XX
},
1323 static const struct dis386 dis386_64_intel
[] = {
1325 { "add", Eb
, Gb
, XX
},
1326 { "add", Ev
, Gv
, XX
},
1327 { "add", Gb
, Eb
, XX
},
1328 { "add", Gv
, Ev
, XX
},
1329 { "add", AL
, Ib
, XX
},
1330 { "add", eAX
, Iv
, XX
},
1331 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1332 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1334 { "or", Eb
, Gb
, XX
},
1335 { "or", Ev
, Gv
, XX
},
1336 { "or", Gb
, Eb
, XX
},
1337 { "or", Gv
, Ev
, XX
},
1338 { "or", AL
, Ib
, XX
},
1339 { "or", eAX
, Iv
, XX
},
1340 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1341 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
1343 { "adc", Eb
, Gb
, XX
},
1344 { "adc", Ev
, Gv
, XX
},
1345 { "adc", Gb
, Eb
, XX
},
1346 { "adc", Gv
, Ev
, XX
},
1347 { "adc", AL
, Ib
, XX
},
1348 { "adc", eAX
, Iv
, XX
},
1349 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1350 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1352 { "sbb", Eb
, Gb
, XX
},
1353 { "sbb", Ev
, Gv
, XX
},
1354 { "sbb", Gb
, Eb
, XX
},
1355 { "sbb", Gv
, Ev
, XX
},
1356 { "sbb", AL
, Ib
, XX
},
1357 { "sbb", eAX
, Iv
, XX
},
1358 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1359 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1361 { "and", Eb
, Gb
, XX
},
1362 { "and", Ev
, Gv
, XX
},
1363 { "and", Gb
, Eb
, XX
},
1364 { "and", Gv
, Ev
, XX
},
1365 { "and", AL
, Ib
, XX
},
1366 { "and", eAX
, Iv
, XX
},
1367 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
1368 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1370 { "sub", Eb
, Gb
, XX
},
1371 { "sub", Ev
, Gv
, XX
},
1372 { "sub", Gb
, Eb
, XX
},
1373 { "sub", Gv
, Ev
, XX
},
1374 { "sub", AL
, Ib
, XX
},
1375 { "sub", eAX
, Iv
, XX
},
1376 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
1377 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1379 { "xor", Eb
, Gb
, XX
},
1380 { "xor", Ev
, Gv
, XX
},
1381 { "xor", Gb
, Eb
, XX
},
1382 { "xor", Gv
, Ev
, XX
},
1383 { "xor", AL
, Ib
, XX
},
1384 { "xor", eAX
, Iv
, XX
},
1385 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
1386 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1388 { "cmp", Eb
, Gb
, XX
},
1389 { "cmp", Ev
, Gv
, XX
},
1390 { "cmp", Gb
, Eb
, XX
},
1391 { "cmp", Gv
, Ev
, XX
},
1392 { "cmp", AL
, Ib
, XX
},
1393 { "cmp", eAX
, Iv
, XX
},
1394 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
1395 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1397 { "(bad)", XX
, XX
, XX
}, /* REX prefix area. */
1398 { "(bad)", XX
, XX
, XX
},
1399 { "(bad)", XX
, XX
, XX
},
1400 { "(bad)", XX
, XX
, XX
},
1401 { "(bad)", XX
, XX
, XX
},
1402 { "(bad)", XX
, XX
, XX
},
1403 { "(bad)", XX
, XX
, XX
},
1404 { "(bad)", XX
, XX
, XX
},
1406 { "(bad)", XX
, XX
, XX
},
1407 { "(bad)", XX
, XX
, XX
},
1408 { "(bad)", XX
, XX
, XX
},
1409 { "(bad)", XX
, XX
, XX
},
1410 { "(bad)", XX
, XX
, XX
},
1411 { "(bad)", XX
, XX
, XX
},
1412 { "(bad)", XX
, XX
, XX
},
1413 { "(bad)", XX
, XX
, XX
},
1415 { "push", RMrAX
, XX
, XX
},
1416 { "push", RMrCX
, XX
, XX
},
1417 { "push", RMrDX
, XX
, XX
},
1418 { "push", RMrBX
, XX
, XX
},
1419 { "push", RMrSP
, XX
, XX
},
1420 { "push", RMrBP
, XX
, XX
},
1421 { "push", RMrSI
, XX
, XX
},
1422 { "push", RMrDI
, XX
, XX
},
1424 { "pop", RMrAX
, XX
, XX
},
1425 { "pop", RMrCX
, XX
, XX
},
1426 { "pop", RMrDX
, XX
, XX
},
1427 { "pop", RMrBX
, XX
, XX
},
1428 { "pop", RMrSP
, XX
, XX
},
1429 { "pop", RMrBP
, XX
, XX
},
1430 { "pop", RMrSI
, XX
, XX
},
1431 { "pop", RMrDI
, XX
, XX
},
1433 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1434 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1435 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1436 { "movsx", Gv
, Ed
, XX
},
1437 { "(bad)", XX
, XX
, XX
}, /* seg fs */
1438 { "(bad)", XX
, XX
, XX
}, /* seg gs */
1439 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
1440 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
1442 { "push", Iq
, XX
, XX
}, /* 386 book wrong */
1443 { "imul", Gv
, Ev
, Iv
},
1444 { "push", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
1445 { "imul", Gv
, Ev
, sIb
},
1446 { "ins", Yb
, indirDX
, XX
},
1447 { "ins", Yv
, indirDX
, XX
},
1448 { "outs", indirDX
, Xb
, XX
},
1449 { "outs", indirDX
, Xv
, XX
},
1451 { "jo", Jb
, XX
, XX
},
1452 { "jno", Jb
, XX
, XX
},
1453 { "jb", Jb
, XX
, XX
},
1454 { "jae", Jb
, XX
, XX
},
1455 { "je", Jb
, XX
, XX
},
1456 { "jne", Jb
, XX
, XX
},
1457 { "jbe", Jb
, XX
, XX
},
1458 { "ja", Jb
, XX
, XX
},
1460 { "js", Jb
, XX
, XX
},
1461 { "jns", Jb
, XX
, XX
},
1462 { "jp", Jb
, XX
, XX
},
1463 { "jnp", Jb
, XX
, XX
},
1464 { "jl", Jb
, XX
, XX
},
1465 { "jge", Jb
, XX
, XX
},
1466 { "jle", Jb
, XX
, XX
},
1467 { "jg", Jb
, XX
, XX
},
1471 { "(bad)", XX
, XX
, XX
},
1473 { "test", Eb
, Gb
, XX
},
1474 { "test", Ev
, Gv
, XX
},
1475 { "xchg", Eb
, Gb
, XX
},
1476 { "xchg", Ev
, Gv
, XX
},
1478 { "mov", Eb
, Gb
, XX
},
1479 { "mov", Ev
, Gv
, XX
},
1480 { "mov", Gb
, Eb
, XX
},
1481 { "mov", Gv
, Ev
, XX
},
1482 { "mov", Ev
, Sw
, XX
},
1483 { "lea", Gv
, M
, XX
},
1484 { "mov", Sw
, Ev
, XX
},
1485 { "pop", Ev
, XX
, XX
},
1487 { "nop", XX
, XX
, XX
},
1488 /* FIXME: NOP with REPz prefix is called PAUSE. */
1489 { "xchg", RMeCX
, eAX
, XX
},
1490 { "xchg", RMeDX
, eAX
, XX
},
1491 { "xchg", RMeBX
, eAX
, XX
},
1492 { "xchg", RMeSP
, eAX
, XX
},
1493 { "xchg", RMeBP
, eAX
, XX
},
1494 { "xchg", RMeSI
, eAX
, XX
},
1495 { "xchg", RMeDI
, eAX
, XX
},
1497 { "cW", XX
, XX
, XX
}, /* cwde and cbw */
1498 { "cR", XX
, XX
, XX
}, /* cdq and cwd */
1499 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1500 { "(bad)", XX
, XX
, XX
}, /* fwait */
1501 { "pushf", XX
, XX
, XX
},
1502 { "popf", XX
, XX
, XX
},
1503 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1504 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1506 { "mov", AL
, Ob
, XX
},
1507 { "mov", eAX
, Ov
, XX
},
1508 { "mov", Ob
, AL
, XX
},
1509 { "mov", Ov
, eAX
, XX
},
1510 { "movs", Yb
, Xb
, XX
},
1511 { "movs", Yv
, Xv
, XX
},
1512 { "cmps", Xb
, Yb
, XX
},
1513 { "cmps", Xv
, Yv
, XX
},
1515 { "test", AL
, Ib
, XX
},
1516 { "test", eAX
, Iv
, XX
},
1517 { "stos", Yb
, AL
, XX
},
1518 { "stos", Yv
, eAX
, XX
},
1519 { "lods", AL
, Xb
, XX
},
1520 { "lods", eAX
, Xv
, XX
},
1521 { "scas", AL
, Yb
, XX
},
1522 { "scas", eAX
, Yv
, XX
},
1524 { "mov", RMAL
, Ib
, XX
},
1525 { "mov", RMCL
, Ib
, XX
},
1526 { "mov", RMDL
, Ib
, XX
},
1527 { "mov", RMBL
, Ib
, XX
},
1528 { "mov", RMAH
, Ib
, XX
},
1529 { "mov", RMCH
, Ib
, XX
},
1530 { "mov", RMDH
, Ib
, XX
},
1531 { "mov", RMBH
, Ib
, XX
},
1533 { "mov", RMeAX
, Iv
, XX
},
1534 { "mov", RMeCX
, Iv
, XX
},
1535 { "mov", RMeDX
, Iv
, XX
},
1536 { "mov", RMeBX
, Iv
, XX
},
1537 { "mov", RMeSP
, Iv
, XX
},
1538 { "mov", RMeBP
, Iv
, XX
},
1539 { "mov", RMeSI
, Iv
, XX
},
1540 { "mov", RMeDI
, Iv
, XX
},
1544 { "ret", Iw
, XX
, XX
},
1545 { "ret", XX
, XX
, XX
},
1546 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1547 { "lds", Gv
, Mp
, XX
},
1548 { "mov", Eb
, Ib
, XX
},
1549 { "mov", Ev
, Iv
, XX
},
1551 { "enter", Iw
, Ib
, XX
},
1552 { "leave", XX
, XX
, XX
},
1553 { "lret", Iw
, XX
, XX
},
1554 { "lret", XX
, XX
, XX
},
1555 { "int3", XX
, XX
, XX
},
1556 { "int", Ib
, XX
, XX
},
1557 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1558 { "iret", XX
, XX
, XX
},
1564 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1565 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1566 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1567 { "xlat", DSBX
, XX
, XX
},
1578 { "loopne", Jb
, XX
, XX
},
1579 { "loope", Jb
, XX
, XX
},
1580 { "loop", Jb
, XX
, XX
},
1581 { "jEcxz", Jb
, XX
, XX
},
1582 { "in", AL
, Ib
, XX
},
1583 { "in", eAX
, Ib
, XX
},
1584 { "out", Ib
, AL
, XX
},
1585 { "out", Ib
, eAX
, XX
},
1587 { "call", Jv
, XX
, XX
},
1588 { "jmp", Jv
, XX
, XX
},
1589 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1590 { "jmp", Jb
, XX
, XX
},
1591 { "in", AL
, indirDX
, XX
},
1592 { "in", eAX
, indirDX
, XX
},
1593 { "out", indirDX
, AL
, XX
},
1594 { "out", indirDX
, eAX
, XX
},
1596 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
1597 { "(bad)", XX
, XX
, XX
},
1598 { "(bad)", XX
, XX
, XX
}, /* repne */
1599 { "(bad)", XX
, XX
, XX
}, /* repz */
1600 { "hlt", XX
, XX
, XX
},
1601 { "cmc", XX
, XX
, XX
},
1605 { "clc", XX
, XX
, XX
},
1606 { "stc", XX
, XX
, XX
},
1607 { "cli", XX
, XX
, XX
},
1608 { "sti", XX
, XX
, XX
},
1609 { "cld", XX
, XX
, XX
},
1610 { "std", XX
, XX
, XX
},
1615 static const struct dis386 dis386_twobyte_att
[] = {
1619 { "larS", Gv
, Ew
, XX
},
1620 { "lslS", Gv
, Ew
, XX
},
1621 { "(bad)", XX
, XX
, XX
},
1622 { "syscall", XX
, XX
, XX
},
1623 { "clts", XX
, XX
, XX
},
1624 { "sysretP", XX
, XX
, XX
},
1626 { "invd", XX
, XX
, XX
},
1627 { "wbinvd", XX
, XX
, XX
},
1628 { "(bad)", XX
, XX
, XX
},
1629 { "ud2a", XX
, XX
, XX
},
1630 { "(bad)", XX
, XX
, XX
},
1632 { "femms", XX
, XX
, XX
},
1633 { "", MX
, EM
, OPSUF
}, /* See OP_3DNowSuffix */
1637 { "movlpX", XM
, EX
, SIMD_Fixup
, 'h' }, /* really only 2 operands */
1638 { "movlpX", EX
, XM
, SIMD_Fixup
, 'h' },
1639 { "unpcklpX", XM
, EX
, XX
},
1640 { "unpckhpX", XM
, EX
, XX
},
1641 { "movhpX", XM
, EX
, SIMD_Fixup
, 'l' },
1642 { "movhpX", EX
, XM
, SIMD_Fixup
, 'l' },
1645 { "(bad)", XX
, XX
, XX
},
1646 { "(bad)", XX
, XX
, XX
},
1647 { "(bad)", XX
, XX
, XX
},
1648 { "(bad)", XX
, XX
, XX
},
1649 { "(bad)", XX
, XX
, XX
},
1650 { "(bad)", XX
, XX
, XX
},
1651 { "(bad)", XX
, XX
, XX
},
1653 /* these are all backward in appendix A of the intel book */
1654 { "movL", Rm
, Cm
, XX
},
1655 { "movL", Rm
, Dm
, XX
},
1656 { "movL", Cm
, Rm
, XX
},
1657 { "movL", Dm
, Rm
, XX
},
1658 { "movL", Rd
, Td
, XX
},
1659 { "(bad)", XX
, XX
, XX
},
1660 { "movL", Td
, Rd
, XX
},
1661 { "(bad)", XX
, XX
, XX
},
1663 { "movapX", XM
, EX
, XX
},
1664 { "movapX", EX
, XM
, XX
},
1666 { "movntpX", Ev
, XM
, XX
},
1669 { "ucomisX", XM
,EX
, XX
},
1670 { "comisX", XM
,EX
, XX
},
1672 { "wrmsr", XX
, XX
, XX
},
1673 { "rdtsc", XX
, XX
, XX
},
1674 { "rdmsr", XX
, XX
, XX
},
1675 { "rdpmc", XX
, XX
, XX
},
1676 { "sysenter", XX
, XX
, XX
},
1677 { "sysexit", XX
, XX
, XX
},
1678 { "(bad)", XX
, XX
, XX
},
1679 { "(bad)", XX
, XX
, XX
},
1681 { "(bad)", XX
, XX
, XX
},
1682 { "(bad)", XX
, XX
, XX
},
1683 { "(bad)", XX
, XX
, XX
},
1684 { "(bad)", XX
, XX
, XX
},
1685 { "(bad)", XX
, XX
, XX
},
1686 { "(bad)", XX
, XX
, XX
},
1687 { "(bad)", XX
, XX
, XX
},
1688 { "(bad)", XX
, XX
, XX
},
1690 { "cmovo", Gv
, Ev
, XX
},
1691 { "cmovno", Gv
, Ev
, XX
},
1692 { "cmovb", Gv
, Ev
, XX
},
1693 { "cmovae", Gv
, Ev
, XX
},
1694 { "cmove", Gv
, Ev
, XX
},
1695 { "cmovne", Gv
, Ev
, XX
},
1696 { "cmovbe", Gv
, Ev
, XX
},
1697 { "cmova", Gv
, Ev
, XX
},
1699 { "cmovs", Gv
, Ev
, XX
},
1700 { "cmovns", Gv
, Ev
, XX
},
1701 { "cmovp", Gv
, Ev
, XX
},
1702 { "cmovnp", Gv
, Ev
, XX
},
1703 { "cmovl", Gv
, Ev
, XX
},
1704 { "cmovge", Gv
, Ev
, XX
},
1705 { "cmovle", Gv
, Ev
, XX
},
1706 { "cmovg", Gv
, Ev
, XX
},
1708 { "movmskpX", Gv
, EX
, XX
},
1712 { "andpX", XM
, EX
, XX
},
1713 { "andnpX", XM
, EX
, XX
},
1714 { "orpX", XM
, EX
, XX
},
1715 { "xorpX", XM
, EX
, XX
},
1726 { "punpcklbw", MX
, EM
, XX
},
1727 { "punpcklwd", MX
, EM
, XX
},
1728 { "punpckldq", MX
, EM
, XX
},
1729 { "packsswb", MX
, EM
, XX
},
1730 { "pcmpgtb", MX
, EM
, XX
},
1731 { "pcmpgtw", MX
, EM
, XX
},
1732 { "pcmpgtd", MX
, EM
, XX
},
1733 { "packuswb", MX
, EM
, XX
},
1735 { "punpckhbw", MX
, EM
, XX
},
1736 { "punpckhwd", MX
, EM
, XX
},
1737 { "punpckhdq", MX
, EM
, XX
},
1738 { "packssdw", MX
, EM
, XX
},
1739 { "(bad)", XX
, XX
, XX
},
1741 { "movd", MX
, Ed
, XX
},
1748 { "pcmpeqb", MX
, EM
, XX
},
1749 { "pcmpeqw", MX
, EM
, XX
},
1750 { "pcmpeqd", MX
, EM
, XX
},
1751 { "emms", XX
, XX
, XX
},
1753 { "(bad)", XX
, XX
, XX
},
1754 { "(bad)", XX
, XX
, XX
},
1755 { "(bad)", XX
, XX
, XX
},
1756 { "(bad)", XX
, XX
, XX
},
1757 { "(bad)", XX
, XX
, XX
},
1758 { "(bad)", XX
, XX
, XX
},
1762 { "jo", Jv
, XX
, XX
},
1763 { "jno", Jv
, XX
, XX
},
1764 { "jb", Jv
, XX
, XX
},
1765 { "jae", Jv
, XX
, XX
},
1766 { "je", Jv
, XX
, XX
},
1767 { "jne", Jv
, XX
, XX
},
1768 { "jbe", Jv
, XX
, XX
},
1769 { "ja", Jv
, XX
, XX
},
1771 { "js", Jv
, XX
, XX
},
1772 { "jns", Jv
, XX
, XX
},
1773 { "jp", Jv
, XX
, XX
},
1774 { "jnp", Jv
, XX
, XX
},
1775 { "jl", Jv
, XX
, XX
},
1776 { "jge", Jv
, XX
, XX
},
1777 { "jle", Jv
, XX
, XX
},
1778 { "jg", Jv
, XX
, XX
},
1780 { "seto", Eb
, XX
, XX
},
1781 { "setno", Eb
, XX
, XX
},
1782 { "setb", Eb
, XX
, XX
},
1783 { "setae", Eb
, XX
, XX
},
1784 { "sete", Eb
, XX
, XX
},
1785 { "setne", Eb
, XX
, XX
},
1786 { "setbe", Eb
, XX
, XX
},
1787 { "seta", Eb
, XX
, XX
},
1789 { "sets", Eb
, XX
, XX
},
1790 { "setns", Eb
, XX
, XX
},
1791 { "setp", Eb
, XX
, XX
},
1792 { "setnp", Eb
, XX
, XX
},
1793 { "setl", Eb
, XX
, XX
},
1794 { "setge", Eb
, XX
, XX
},
1795 { "setle", Eb
, XX
, XX
},
1796 { "setg", Eb
, XX
, XX
},
1798 { "pushI", fs
, XX
, XX
},
1799 { "popI", fs
, XX
, XX
},
1800 { "cpuid", XX
, XX
, XX
},
1801 { "btS", Ev
, Gv
, XX
},
1802 { "shldS", Ev
, Gv
, Ib
},
1803 { "shldS", Ev
, Gv
, CL
},
1804 { "(bad)", XX
, XX
, XX
},
1805 { "(bad)", XX
, XX
, XX
},
1807 { "pushI", gs
, XX
, XX
},
1808 { "popI", gs
, XX
, XX
},
1809 { "rsm", XX
, XX
, XX
},
1810 { "btsS", Ev
, Gv
, XX
},
1811 { "shrdS", Ev
, Gv
, Ib
},
1812 { "shrdS", Ev
, Gv
, CL
},
1814 { "imulS", Gv
, Ev
, XX
},
1816 { "cmpxchgB", Eb
, Gb
, XX
},
1817 { "cmpxchgS", Ev
, Gv
, XX
},
1818 { "lssS", Gv
, Mp
, XX
},
1819 { "btrS", Ev
, Gv
, XX
},
1820 { "lfsS", Gv
, Mp
, XX
},
1821 { "lgsS", Gv
, Mp
, XX
},
1822 { "movzbR", Gv
, Eb
, XX
},
1823 { "movzwR", Gv
, Ew
, XX
}, /* yes, there really is movzww ! */
1825 { "(bad)", XX
, XX
, XX
},
1826 { "ud2b", XX
, XX
, XX
},
1828 { "btcS", Ev
, Gv
, XX
},
1829 { "bsfS", Gv
, Ev
, XX
},
1830 { "bsrS", Gv
, Ev
, XX
},
1831 { "movsbR", Gv
, Eb
, XX
},
1832 { "movswR", Gv
, Ew
, XX
}, /* yes, there really is movsww ! */
1834 { "xaddB", Eb
, Gb
, XX
},
1835 { "xaddS", Ev
, Gv
, XX
},
1837 { "movntiS", Ev
, Gv
, XX
},
1838 { "pinsrw", MX
, Ev
, Ib
},
1839 { "pextrw", Ev
, MX
, Ib
},
1840 { "shufpX", XM
, EX
, Ib
},
1843 { "bswap", RMeAX
, XX
, XX
}, /* bswap doesn't support 16 bit regs */
1844 { "bswap", RMeCX
, XX
, XX
},
1845 { "bswap", RMeDX
, XX
, XX
},
1846 { "bswap", RMeBX
, XX
, XX
},
1847 { "bswap", RMeSP
, XX
, XX
},
1848 { "bswap", RMeBP
, XX
, XX
},
1849 { "bswap", RMeSI
, XX
, XX
},
1850 { "bswap", RMeDI
, XX
, XX
},
1852 { "(bad)", XX
, XX
, XX
},
1853 { "psrlw", MX
, EM
, XX
},
1854 { "psrld", MX
, EM
, XX
},
1855 { "psrlq", MX
, EM
, XX
},
1856 { "(bad)", XX
, XX
, XX
},
1857 { "pmullw", MX
, EM
, XX
},
1859 { "pmovmskb", Ev
, MX
, XX
},
1861 { "psubusb", MX
, EM
, XX
},
1862 { "psubusw", MX
, EM
, XX
},
1863 { "pminub", MX
, EM
, XX
},
1864 { "pand", MX
, EM
, XX
},
1865 { "paddusb", MX
, EM
, XX
},
1866 { "paddusw", MX
, EM
, XX
},
1867 { "pmaxub", MX
, EM
, XX
},
1868 { "pandn", MX
, EM
, XX
},
1870 { "pavgb", MX
, EM
, XX
},
1871 { "psraw", MX
, EM
, XX
},
1872 { "psrad", MX
, EM
, XX
},
1873 { "pavgw", MX
, EM
, XX
},
1874 { "pmulhuw", MX
, EM
, XX
},
1875 { "pmulhw", MX
, EM
, XX
},
1877 { "movntq", Ev
, MX
, XX
},
1879 { "psubsb", MX
, EM
, XX
},
1880 { "psubsw", MX
, EM
, XX
},
1881 { "pminsw", MX
, EM
, XX
},
1882 { "por", MX
, EM
, XX
},
1883 { "paddsb", MX
, EM
, XX
},
1884 { "paddsw", MX
, EM
, XX
},
1885 { "pmaxsw", MX
, EM
, XX
},
1886 { "pxor", MX
, EM
, XX
},
1888 { "(bad)", XX
, XX
, XX
},
1889 { "psllw", MX
, EM
, XX
},
1890 { "pslld", MX
, EM
, XX
},
1891 { "psllq", MX
, EM
, XX
},
1892 { "pmuludq", MX
, EM
, XX
},
1893 { "pmaddwd", MX
, EM
, XX
},
1894 { "psadbw", MX
, EM
, XX
},
1897 { "psubb", MX
, EM
, XX
},
1898 { "psubw", MX
, EM
, XX
},
1899 { "psubd", MX
, EM
, XX
},
1900 { "(bad)", XX
, XX
, XX
},
1901 { "paddb", MX
, EM
, XX
},
1902 { "paddw", MX
, EM
, XX
},
1903 { "paddd", MX
, EM
, XX
},
1904 { "(bad)", XX
, XX
, XX
}
1907 static const struct dis386 dis386_twobyte_intel
[] = {
1911 { "lar", Gv
, Ew
, XX
},
1912 { "lsl", Gv
, Ew
, XX
},
1913 { "(bad)", XX
, XX
, XX
},
1914 { "syscall", XX
, XX
, XX
},
1915 { "clts", XX
, XX
, XX
},
1916 { "sysretP", XX
, XX
, XX
},
1918 { "invd", XX
, XX
, XX
},
1919 { "wbinvd", XX
, XX
, XX
},
1920 { "(bad)", XX
, XX
, XX
},
1921 { "ud2a", XX
, XX
, XX
},
1922 { "(bad)", XX
, XX
, XX
},
1924 { "femms" , XX
, XX
, XX
},
1925 { "", MX
, EM
, OPSUF
}, /* See OP_3DNowSuffix */
1929 { "movlpX", XM
, EX
, SIMD_Fixup
, 'h' }, /* really only 2 operands */
1930 { "movlpX", EX
, XM
, SIMD_Fixup
, 'h' },
1931 { "unpcklpX", XM
, EX
, XX
},
1932 { "unpckhpX", XM
, EX
, XX
},
1933 { "movhpX", XM
, EX
, SIMD_Fixup
, 'l' },
1934 { "movhpX", EX
, XM
, SIMD_Fixup
, 'l' },
1937 { "(bad)", XX
, XX
, XX
},
1938 { "(bad)", XX
, XX
, XX
},
1939 { "(bad)", XX
, XX
, XX
},
1940 { "(bad)", XX
, XX
, XX
},
1941 { "(bad)", XX
, XX
, XX
},
1942 { "(bad)", XX
, XX
, XX
},
1943 { "(bad)", XX
, XX
, XX
},
1945 /* these are all backward in appendix A of the intel book */
1946 { "mov", Rm
, Cm
, XX
},
1947 { "mov", Rm
, Dm
, XX
},
1948 { "mov", Cm
, Rm
, XX
},
1949 { "mov", Dm
, Rm
, XX
},
1950 { "mov", Rd
, Td
, XX
},
1951 { "(bad)", XX
, XX
, XX
},
1952 { "mov", Td
, Rd
, XX
},
1953 { "(bad)", XX
, XX
, XX
},
1955 { "movapX", XM
, EX
, XX
},
1956 { "movapX", EX
, XM
, XX
},
1958 { "movntpX", Ev
, XM
, XX
},
1961 { "ucomisX", XM
,EX
, XX
},
1962 { "comisX", XM
,EX
, XX
},
1964 { "wrmsr", XX
, XX
, XX
},
1965 { "rdtsc", XX
, XX
, XX
},
1966 { "rdmsr", XX
, XX
, XX
},
1967 { "rdpmc", XX
, XX
, XX
},
1968 { "sysenter", XX
, XX
, XX
},
1969 { "sysexit", XX
, XX
, XX
},
1970 { "(bad)", XX
, XX
, XX
},
1971 { "(bad)", XX
, XX
, XX
},
1973 { "(bad)", XX
, XX
, XX
},
1974 { "(bad)", XX
, XX
, XX
},
1975 { "(bad)", XX
, XX
, XX
},
1976 { "(bad)", XX
, XX
, XX
},
1977 { "(bad)", XX
, XX
, XX
},
1978 { "(bad)", XX
, XX
, XX
},
1979 { "(bad)", XX
, XX
, XX
},
1980 { "(bad)", XX
, XX
, XX
},
1982 { "cmovo", Gv
, Ev
, XX
},
1983 { "cmovno", Gv
, Ev
, XX
},
1984 { "cmovb", Gv
, Ev
, XX
},
1985 { "cmovae", Gv
, Ev
, XX
},
1986 { "cmove", Gv
, Ev
, XX
},
1987 { "cmovne", Gv
, Ev
, XX
},
1988 { "cmovbe", Gv
, Ev
, XX
},
1989 { "cmova", Gv
, Ev
, XX
},
1991 { "cmovs", Gv
, Ev
, XX
},
1992 { "cmovns", Gv
, Ev
, XX
},
1993 { "cmovp", Gv
, Ev
, XX
},
1994 { "cmovnp", Gv
, Ev
, XX
},
1995 { "cmovl", Gv
, Ev
, XX
},
1996 { "cmovge", Gv
, Ev
, XX
},
1997 { "cmovle", Gv
, Ev
, XX
},
1998 { "cmovg", Gv
, Ev
, XX
},
2000 { "movmskpX", Gv
, EX
, XX
},
2004 { "andpX", XM
, EX
, XX
},
2005 { "andnpX", XM
, EX
, XX
},
2006 { "orpX", XM
, EX
, XX
},
2007 { "xorpX", XM
, EX
, XX
},
2018 { "punpcklbw", MX
, EM
, XX
},
2019 { "punpcklwd", MX
, EM
, XX
},
2020 { "punpckldq", MX
, EM
, XX
},
2021 { "packsswb", MX
, EM
, XX
},
2022 { "pcmpgtb", MX
, EM
, XX
},
2023 { "pcmpgtw", MX
, EM
, XX
},
2024 { "pcmpgtd", MX
, EM
, XX
},
2025 { "packuswb", MX
, EM
, XX
},
2027 { "punpckhbw", MX
, EM
, XX
},
2028 { "punpckhwd", MX
, EM
, XX
},
2029 { "punpckhdq", MX
, EM
, XX
},
2030 { "packssdw", MX
, EM
, XX
},
2031 { "(bad)", XX
, XX
, XX
},
2033 { "movd", MX
, Ed
, XX
},
2040 { "pcmpeqb", MX
, EM
, XX
},
2041 { "pcmpeqw", MX
, EM
, XX
},
2042 { "pcmpeqd", MX
, EM
, XX
},
2043 { "emms", XX
, XX
, XX
},
2045 { "(bad)", XX
, XX
, XX
},
2046 { "(bad)", XX
, XX
, XX
},
2047 { "(bad)", XX
, XX
, XX
},
2048 { "(bad)", XX
, XX
, XX
},
2049 { "(bad)", XX
, XX
, XX
},
2050 { "(bad)", XX
, XX
, XX
},
2054 { "jo", Jv
, XX
, XX
},
2055 { "jno", Jv
, XX
, XX
},
2056 { "jb", Jv
, XX
, XX
},
2057 { "jae", Jv
, XX
, XX
},
2058 { "je", Jv
, XX
, XX
},
2059 { "jne", Jv
, XX
, XX
},
2060 { "jbe", Jv
, XX
, XX
},
2061 { "ja", Jv
, XX
, XX
},
2063 { "js", Jv
, XX
, XX
},
2064 { "jns", Jv
, XX
, XX
},
2065 { "jp", Jv
, XX
, XX
},
2066 { "jnp", Jv
, XX
, XX
},
2067 { "jl", Jv
, XX
, XX
},
2068 { "jge", Jv
, XX
, XX
},
2069 { "jle", Jv
, XX
, XX
},
2070 { "jg", Jv
, XX
, XX
},
2072 { "seto", Eb
, XX
, XX
},
2073 { "setno", Eb
, XX
, XX
},
2074 { "setb", Eb
, XX
, XX
},
2075 { "setae", Eb
, XX
, XX
},
2076 { "sete", Eb
, XX
, XX
},
2077 { "setne", Eb
, XX
, XX
},
2078 { "setbe", Eb
, XX
, XX
},
2079 { "seta", Eb
, XX
, XX
},
2081 { "sets", Eb
, XX
, XX
},
2082 { "setns", Eb
, XX
, XX
},
2083 { "setp", Eb
, XX
, XX
},
2084 { "setnp", Eb
, XX
, XX
},
2085 { "setl", Eb
, XX
, XX
},
2086 { "setge", Eb
, XX
, XX
},
2087 { "setle", Eb
, XX
, XX
},
2088 { "setg", Eb
, XX
, XX
},
2090 { "push", fs
, XX
, XX
},
2091 { "pop", fs
, XX
, XX
},
2092 { "cpuid", XX
, XX
, XX
},
2093 { "bt", Ev
, Gv
, XX
},
2094 { "shld", Ev
, Gv
, Ib
},
2095 { "shld", Ev
, Gv
, CL
},
2096 { "(bad)", XX
, XX
, XX
},
2097 { "(bad)", XX
, XX
, XX
},
2099 { "push", gs
, XX
, XX
},
2100 { "pop", gs
, XX
, XX
},
2101 { "rsm" , XX
, XX
, XX
},
2102 { "bts", Ev
, Gv
, XX
},
2103 { "shrd", Ev
, Gv
, Ib
},
2104 { "shrd", Ev
, Gv
, CL
},
2106 { "imul", Gv
, Ev
, XX
},
2108 { "cmpxchg", Eb
, Gb
, XX
},
2109 { "cmpxchg", Ev
, Gv
, XX
},
2110 { "lss", Gv
, Mp
, XX
},
2111 { "btr", Ev
, Gv
, XX
},
2112 { "lfs", Gv
, Mp
, XX
},
2113 { "lgs", Gv
, Mp
, XX
},
2114 { "movzx", Gv
, Eb
, XX
},
2115 { "movzx", Gv
, Ew
, XX
},
2117 { "(bad)", XX
, XX
, XX
},
2118 { "ud2b", XX
, XX
, XX
},
2120 { "btc", Ev
, Gv
, XX
},
2121 { "bsf", Gv
, Ev
, XX
},
2122 { "bsr", Gv
, Ev
, XX
},
2123 { "movsx", Gv
, Eb
, XX
},
2124 { "movsx", Gv
, Ew
, XX
},
2126 { "xadd", Eb
, Gb
, XX
},
2127 { "xadd", Ev
, Gv
, XX
},
2129 { "movnti", Ev
, Gv
, XX
},
2130 { "pinsrw", MX
, Ev
, Ib
},
2131 { "pextrw", Ev
, MX
, Ib
},
2132 { "shufpX", XM
, EX
, Ib
},
2135 { "bswap", RMeAX
, XX
, XX
}, /* bswap doesn't support 16 bit regs */
2136 { "bswap", RMeCX
, XX
, XX
},
2137 { "bswap", RMeDX
, XX
, XX
},
2138 { "bswap", RMeBX
, XX
, XX
},
2139 { "bswap", RMeSP
, XX
, XX
},
2140 { "bswap", RMeBP
, XX
, XX
},
2141 { "bswap", RMeSI
, XX
, XX
},
2142 { "bswap", RMeDI
, XX
, XX
},
2144 { "(bad)", XX
, XX
, XX
},
2145 { "psrlw", MX
, EM
, XX
},
2146 { "psrld", MX
, EM
, XX
},
2147 { "psrlq", MX
, EM
, XX
},
2148 { "(bad)", XX
, XX
, XX
},
2149 { "pmullw", MX
, EM
, XX
},
2151 { "pmovmskb", Ev
, MX
, XX
},
2153 { "psubusb", MX
, EM
, XX
},
2154 { "psubusw", MX
, EM
, XX
},
2155 { "pminub", MX
, EM
, XX
},
2156 { "pand", MX
, EM
, XX
},
2157 { "paddusb", MX
, EM
, XX
},
2158 { "paddusw", MX
, EM
, XX
},
2159 { "pmaxub", MX
, EM
, XX
},
2160 { "pandn", MX
, EM
, XX
},
2162 { "pavgb", MX
, EM
, XX
},
2163 { "psraw", MX
, EM
, XX
},
2164 { "psrad", MX
, EM
, XX
},
2165 { "pavgw", MX
, EM
, XX
},
2166 { "pmulhuw", MX
, EM
, XX
},
2167 { "pmulhw", MX
, EM
, XX
},
2169 { "movntq", Ev
, MX
, XX
},
2171 { "psubsb", MX
, EM
, XX
},
2172 { "psubsw", MX
, EM
, XX
},
2173 { "pminsw", MX
, EM
, XX
},
2174 { "por", MX
, EM
, XX
},
2175 { "paddsb", MX
, EM
, XX
},
2176 { "paddsw", MX
, EM
, XX
},
2177 { "pmaxsw", MX
, EM
, XX
},
2178 { "pxor", MX
, EM
, XX
},
2180 { "(bad)", XX
, XX
, XX
},
2181 { "psllw", MX
, EM
, XX
},
2182 { "pslld", MX
, EM
, XX
},
2183 { "psllq", MX
, EM
, XX
},
2184 { "pmuludq", MX
, EM
, XX
},
2185 { "pmaddwd", MX
, EM
, XX
},
2186 { "psadbw", MX
, EM
, XX
},
2189 { "psubb", MX
, EM
, XX
},
2190 { "psubw", MX
, EM
, XX
},
2191 { "psubd", MX
, EM
, XX
},
2192 { "(bad)", XX
, XX
, XX
},
2193 { "paddb", MX
, EM
, XX
},
2194 { "paddw", MX
, EM
, XX
},
2195 { "paddd", MX
, EM
, XX
},
2196 { "(bad)", XX
, XX
, XX
}
2199 static const unsigned char onebyte_has_modrm
[256] = {
2200 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2201 /* ------------------------------- */
2202 /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
2203 /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
2204 /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
2205 /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
2206 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
2207 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
2208 /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
2209 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
2210 /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
2211 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
2212 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
2213 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
2214 /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
2215 /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
2216 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
2217 /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 /* f0 */
2218 /* ------------------------------- */
2219 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2222 static const unsigned char twobyte_has_modrm
[256] = {
2223 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2224 /* ------------------------------- */
2225 /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
2226 /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
2227 /* 20 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 2f */
2228 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
2229 /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
2230 /* 50 */ 1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1, /* 5f */
2231 /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1, /* 6f */
2232 /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
2233 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
2234 /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
2235 /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
2236 /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
2237 /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
2238 /* d0 */ 0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1, /* df */
2239 /* e0 */ 1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1, /* ef */
2240 /* f0 */ 0,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0 /* ff */
2241 /* ------------------------------- */
2242 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2245 static const unsigned char twobyte_uses_SSE_prefix
[256] = {
2246 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2247 /* ------------------------------- */
2248 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
2249 /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
2250 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
2251 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
2252 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
2253 /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
2254 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
2255 /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
2256 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
2257 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
2258 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
2259 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
2260 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
2261 /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
2262 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
2263 /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 /* ff */
2264 /* ------------------------------- */
2265 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2268 static char obuf
[100];
2270 static char scratchbuf
[100];
2271 static unsigned char *start_codep
;
2272 static unsigned char *insn_codep
;
2273 static unsigned char *codep
;
2274 static disassemble_info
*the_info
;
2278 static void oappend
PARAMS ((const char *s
));
2280 static const char *names64
[] = {
2281 "%rax","%rcx","%rdx","%rbx", "%rsp","%rbp","%rsi","%rdi",
2282 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
2284 static const char *names32
[] = {
2285 "%eax","%ecx","%edx","%ebx", "%esp","%ebp","%esi","%edi",
2286 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
2288 static const char *names16
[] = {
2289 "%ax","%cx","%dx","%bx","%sp","%bp","%si","%di",
2290 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
2292 static const char *names8
[] = {
2293 "%al","%cl","%dl","%bl","%ah","%ch","%dh","%bh",
2295 static const char *names8rex
[] = {
2296 "%al","%cl","%dl","%bl","%spl", "%bpl", "%sil", "%dil",
2297 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
2299 static const char *names_seg
[] = {
2300 "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
2302 static const char *index16
[] = {
2303 "%bx,%si","%bx,%di","%bp,%si","%bp,%di","%si","%di","%bp","%bx"
2306 static const struct dis386 grps
[][8] = {
2309 { "addA", Eb
, Ib
, XX
},
2310 { "orA", Eb
, Ib
, XX
},
2311 { "adcA", Eb
, Ib
, XX
},
2312 { "sbbA", Eb
, Ib
, XX
},
2313 { "andA", Eb
, Ib
, XX
},
2314 { "subA", Eb
, Ib
, XX
},
2315 { "xorA", Eb
, Ib
, XX
},
2316 { "cmpA", Eb
, Ib
, XX
}
2320 { "addQ", Ev
, Iv
, XX
},
2321 { "orQ", Ev
, Iv
, XX
},
2322 { "adcQ", Ev
, Iv
, XX
},
2323 { "sbbQ", Ev
, Iv
, XX
},
2324 { "andQ", Ev
, Iv
, XX
},
2325 { "subQ", Ev
, Iv
, XX
},
2326 { "xorQ", Ev
, Iv
, XX
},
2327 { "cmpQ", Ev
, Iv
, XX
}
2331 { "addQ", Ev
, sIb
, XX
},
2332 { "orQ", Ev
, sIb
, XX
},
2333 { "adcQ", Ev
, sIb
, XX
},
2334 { "sbbQ", Ev
, sIb
, XX
},
2335 { "andQ", Ev
, sIb
, XX
},
2336 { "subQ", Ev
, sIb
, XX
},
2337 { "xorQ", Ev
, sIb
, XX
},
2338 { "cmpQ", Ev
, sIb
, XX
}
2342 { "rolA", Eb
, Ib
, XX
},
2343 { "rorA", Eb
, Ib
, XX
},
2344 { "rclA", Eb
, Ib
, XX
},
2345 { "rcrA", Eb
, Ib
, XX
},
2346 { "shlA", Eb
, Ib
, XX
},
2347 { "shrA", Eb
, Ib
, XX
},
2348 { "(bad)", XX
, XX
, XX
},
2349 { "sarA", Eb
, Ib
, XX
},
2353 { "rolQ", Ev
, Ib
, XX
},
2354 { "rorQ", Ev
, Ib
, XX
},
2355 { "rclQ", Ev
, Ib
, XX
},
2356 { "rcrQ", Ev
, Ib
, XX
},
2357 { "shlQ", Ev
, Ib
, XX
},
2358 { "shrQ", Ev
, Ib
, XX
},
2359 { "(bad)", XX
, XX
, XX
},
2360 { "sarQ", Ev
, Ib
, XX
},
2364 { "rolA", Eb
, XX
, XX
},
2365 { "rorA", Eb
, XX
, XX
},
2366 { "rclA", Eb
, XX
, XX
},
2367 { "rcrA", Eb
, XX
, XX
},
2368 { "shlA", Eb
, XX
, XX
},
2369 { "shrA", Eb
, XX
, XX
},
2370 { "(bad)", XX
, XX
, XX
},
2371 { "sarA", Eb
, XX
, XX
},
2375 { "rolQ", Ev
, XX
, XX
},
2376 { "rorQ", Ev
, XX
, XX
},
2377 { "rclQ", Ev
, XX
, XX
},
2378 { "rcrQ", Ev
, XX
, XX
},
2379 { "shlQ", Ev
, XX
, XX
},
2380 { "shrQ", Ev
, XX
, XX
},
2381 { "(bad)", XX
, XX
, XX
},
2382 { "sarQ", Ev
, XX
, XX
},
2386 { "rolA", Eb
, CL
, XX
},
2387 { "rorA", Eb
, CL
, XX
},
2388 { "rclA", Eb
, CL
, XX
},
2389 { "rcrA", Eb
, CL
, XX
},
2390 { "shlA", Eb
, CL
, XX
},
2391 { "shrA", Eb
, CL
, XX
},
2392 { "(bad)", XX
, XX
, XX
},
2393 { "sarA", Eb
, CL
, XX
},
2397 { "rolQ", Ev
, CL
, XX
},
2398 { "rorQ", Ev
, CL
, XX
},
2399 { "rclQ", Ev
, CL
, XX
},
2400 { "rcrQ", Ev
, CL
, XX
},
2401 { "shlQ", Ev
, CL
, XX
},
2402 { "shrQ", Ev
, CL
, XX
},
2403 { "(bad)", XX
, XX
, XX
},
2404 { "sarQ", Ev
, CL
, XX
}
2408 { "testA", Eb
, Ib
, XX
},
2409 { "(bad)", Eb
, XX
, XX
},
2410 { "notA", Eb
, XX
, XX
},
2411 { "negA", Eb
, XX
, XX
},
2412 { "mulB", AL
, Eb
, XX
},
2413 { "imulB", AL
, Eb
, XX
},
2414 { "divB", AL
, Eb
, XX
},
2415 { "idivB", AL
, Eb
, XX
}
2419 { "testQ", Ev
, Iv
, XX
},
2420 { "(bad)", XX
, XX
, XX
},
2421 { "notQ", Ev
, XX
, XX
},
2422 { "negQ", Ev
, XX
, XX
},
2423 { "mulS", eAX
, Ev
, XX
},
2424 { "imulS", eAX
, Ev
, XX
},
2425 { "divS", eAX
, Ev
, XX
},
2426 { "idivS", eAX
, Ev
, XX
},
2430 { "incA", Eb
, XX
, XX
},
2431 { "decA", Eb
, XX
, XX
},
2432 { "(bad)", XX
, XX
, XX
},
2433 { "(bad)", XX
, XX
, XX
},
2434 { "(bad)", XX
, XX
, XX
},
2435 { "(bad)", XX
, XX
, XX
},
2436 { "(bad)", XX
, XX
, XX
},
2437 { "(bad)", XX
, XX
, XX
},
2441 { "incQ", Ev
, XX
, XX
},
2442 { "decQ", Ev
, XX
, XX
},
2443 { "callI", indirEv
, XX
, XX
},
2444 { "lcallI", indirEv
, XX
, XX
},
2445 { "jmpI", indirEv
, XX
, XX
},
2446 { "ljmpI", indirEv
, XX
, XX
},
2447 { "pushT", Ev
, XX
, XX
},
2448 { "(bad)", XX
, XX
, XX
},
2452 { "sldt", Ew
, XX
, XX
},
2453 { "str", Ew
, XX
, XX
},
2454 { "lldt", Ew
, XX
, XX
},
2455 { "ltr", Ew
, XX
, XX
},
2456 { "verr", Ew
, XX
, XX
},
2457 { "verw", Ew
, XX
, XX
},
2458 { "(bad)", XX
, XX
, XX
},
2459 { "(bad)", XX
, XX
, XX
}
2463 { "sgdt", Ew
, XX
, XX
},
2464 { "sidt", Ew
, XX
, XX
},
2465 { "lgdt", Ew
, XX
, XX
},
2466 { "lidt", Ew
, XX
, XX
},
2467 { "smsw", Ew
, XX
, XX
},
2468 { "(bad)", XX
, XX
, XX
},
2469 { "lmsw", Ew
, XX
, XX
},
2470 { "invlpg", Ew
, XX
, XX
},
2474 { "(bad)", XX
, XX
, XX
},
2475 { "(bad)", XX
, XX
, XX
},
2476 { "(bad)", XX
, XX
, XX
},
2477 { "(bad)", XX
, XX
, XX
},
2478 { "btQ", Ev
, Ib
, XX
},
2479 { "btsQ", Ev
, Ib
, XX
},
2480 { "btrQ", Ev
, Ib
, XX
},
2481 { "btcQ", Ev
, Ib
, XX
},
2485 { "(bad)", XX
, XX
, XX
},
2486 { "cmpxchg8b", Ev
, XX
, XX
},
2487 { "(bad)", XX
, XX
, XX
},
2488 { "(bad)", XX
, XX
, XX
},
2489 { "(bad)", XX
, XX
, XX
},
2490 { "(bad)", XX
, XX
, XX
},
2491 { "(bad)", XX
, XX
, XX
},
2492 { "(bad)", XX
, XX
, XX
},
2496 { "(bad)", XX
, XX
, XX
},
2497 { "(bad)", XX
, XX
, XX
},
2498 { "psrlw", MS
, Ib
, XX
},
2499 { "(bad)", XX
, XX
, XX
},
2500 { "psraw", MS
, Ib
, XX
},
2501 { "(bad)", XX
, XX
, XX
},
2502 { "psllw", MS
, Ib
, XX
},
2503 { "(bad)", XX
, XX
, XX
},
2507 { "(bad)", XX
, XX
, XX
},
2508 { "(bad)", XX
, XX
, XX
},
2509 { "psrld", MS
, Ib
, XX
},
2510 { "(bad)", XX
, XX
, XX
},
2511 { "psrad", MS
, Ib
, XX
},
2512 { "(bad)", XX
, XX
, XX
},
2513 { "pslld", MS
, Ib
, XX
},
2514 { "(bad)", XX
, XX
, XX
},
2518 { "(bad)", XX
, XX
, XX
},
2519 { "(bad)", XX
, XX
, XX
},
2520 { "psrlq", MS
, Ib
, XX
},
2521 { "psrldq", MS
, Ib
, XX
},
2522 { "(bad)", XX
, XX
, XX
},
2523 { "(bad)", XX
, XX
, XX
},
2524 { "psllq", MS
, Ib
, XX
},
2525 { "pslldq", MS
, Ib
, XX
},
2529 { "fxsave", Ev
, XX
, XX
},
2530 { "fxrstor", Ev
, XX
, XX
},
2531 { "ldmxcsr", Ev
, XX
, XX
},
2532 { "stmxcsr", Ev
, XX
, XX
},
2533 { "(bad)", XX
, XX
, XX
},
2534 { "lfence", None
, XX
, XX
},
2535 { "mfence", None
, XX
, XX
},
2536 { "sfence", None
, XX
, XX
},
2537 /* FIXME: the sfence with memory operand is clflush! */
2541 { "prefetchnta", Ev
, XX
, XX
},
2542 { "prefetcht0", Ev
, XX
, XX
},
2543 { "prefetcht1", Ev
, XX
, XX
},
2544 { "prefetcht2", Ev
, XX
, XX
},
2545 { "(bad)", XX
, XX
, XX
},
2546 { "(bad)", XX
, XX
, XX
},
2547 { "(bad)", XX
, XX
, XX
},
2548 { "(bad)", XX
, XX
, XX
},
2552 { "prefetch", Eb
, XX
, XX
},
2553 { "prefetchw", Eb
, XX
, XX
},
2554 { "(bad)", XX
, XX
, XX
},
2555 { "(bad)", XX
, XX
, XX
},
2556 { "(bad)", XX
, XX
, XX
},
2557 { "(bad)", XX
, XX
, XX
},
2558 { "(bad)", XX
, XX
, XX
},
2559 { "(bad)", XX
, XX
, XX
},
2564 static const struct dis386 prefix_user_table
[][4] = {
2567 { "addps", XM
, EX
, XX
},
2568 { "addss", XM
, EX
, XX
},
2569 { "addpd", XM
, EX
, XX
},
2570 { "addsd", XM
, EX
, XX
},
2574 { "", XM
, EX
, OPSIMD
}, /* See OP_SIMD_SUFFIX */
2575 { "", XM
, EX
, OPSIMD
},
2576 { "", XM
, EX
, OPSIMD
},
2577 { "", XM
, EX
, OPSIMD
},
2581 { "cvtpi2ps", XM
, EM
, XX
},
2582 { "cvtsi2ssY", XM
, Ev
, XX
},
2583 { "cvtpi2pd", XM
, EM
, XX
},
2584 { "cvtsi2sdY", XM
, Ev
, XX
},
2588 { "cvtps2pi", MX
, EX
, XX
},
2589 { "cvtss2siY", Gv
, EX
, XX
},
2590 { "cvtpd2pi", MX
, EX
, XX
},
2591 { "cvtsd2siY", Gv
, EX
, XX
},
2595 { "cvttps2pi", MX
, EX
, XX
},
2596 { "cvttss2siY", Gv
, EX
, XX
},
2597 { "cvttpd2pi", MX
, EX
, XX
},
2598 { "cvttsd2siY", Gv
, EX
, XX
},
2602 { "divps", XM
, EX
, XX
},
2603 { "divss", XM
, EX
, XX
},
2604 { "divpd", XM
, EX
, XX
},
2605 { "divsd", XM
, EX
, XX
},
2609 { "maxps", XM
, EX
, XX
},
2610 { "maxss", XM
, EX
, XX
},
2611 { "maxpd", XM
, EX
, XX
},
2612 { "maxsd", XM
, EX
, XX
},
2616 { "minps", XM
, EX
, XX
},
2617 { "minss", XM
, EX
, XX
},
2618 { "minpd", XM
, EX
, XX
},
2619 { "minsd", XM
, EX
, XX
},
2623 { "movups", XM
, EX
, XX
},
2624 { "movss", XM
, EX
, XX
},
2625 { "movupd", XM
, EX
, XX
},
2626 { "movsd", XM
, EX
, XX
},
2630 { "movups", EX
, XM
, XX
},
2631 { "movss", EX
, XM
, XX
},
2632 { "movupd", EX
, XM
, XX
},
2633 { "movsd", EX
, XM
, XX
},
2637 { "mulps", XM
, EX
, XX
},
2638 { "mulss", XM
, EX
, XX
},
2639 { "mulpd", XM
, EX
, XX
},
2640 { "mulsd", XM
, EX
, XX
},
2644 { "rcpps", XM
, EX
, XX
},
2645 { "rcpss", XM
, EX
, XX
},
2646 { "(bad)", XM
, EX
, XX
},
2647 { "(bad)", XM
, EX
, XX
},
2651 { "rsqrtps", XM
, EX
, XX
},
2652 { "rsqrtss", XM
, EX
, XX
},
2653 { "(bad)", XM
, EX
, XX
},
2654 { "(bad)", XM
, EX
, XX
},
2658 { "sqrtps", XM
, EX
, XX
},
2659 { "sqrtss", XM
, EX
, XX
},
2660 { "sqrtpd", XM
, EX
, XX
},
2661 { "sqrtsd", XM
, EX
, XX
},
2665 { "subps", XM
, EX
, XX
},
2666 { "subss", XM
, EX
, XX
},
2667 { "subpd", XM
, EX
, XX
},
2668 { "subsd", XM
, EX
, XX
},
2672 { "(bad)", XM
, EX
, XX
},
2673 { "cvtdq2pd", XM
, EX
, XX
},
2674 { "cvttpd2dq", XM
, EX
, XX
},
2675 { "cvtpd2dq", XM
, EX
, XX
},
2679 { "cvtdq2ps", XM
, EX
, XX
},
2680 { "cvttps2dq",XM
, EX
, XX
},
2681 { "cvtps2dq",XM
, EX
, XX
},
2682 { "(bad)", XM
, EX
, XX
},
2686 { "cvtps2pd", XM
, EX
, XX
},
2687 { "cvtss2sd", XM
, EX
, XX
},
2688 { "cvtpd2ps", XM
, EX
, XX
},
2689 { "cvtsd2ss", XM
, EX
, XX
},
2693 { "maskmovq", MX
, EM
, XX
},
2694 { "(bad)", XM
, EX
, XX
},
2695 { "maskmovdqu", MX
, EX
, XX
},
2696 { "(bad)", XM
, EX
, XX
},
2700 { "movq", MX
, EM
, XX
},
2701 { "movdqu", XM
, EX
, XX
},
2702 { "movdqa", XM
, EX
, XX
},
2703 { "(bad)", XM
, EX
, XX
},
2707 { "movq", EM
, MX
, XX
},
2708 { "movdqu", EX
, XM
, XX
},
2709 { "movdqa", EX
, XM
, XX
},
2710 { "(bad)", EX
, XM
, XX
},
2714 { "(bad)", EX
, XM
, XX
},
2715 { "movq2dq", EX
, EM
, XX
},
2716 { "movq", EX
, XM
, XX
},
2717 { "movdq2q", EM
, MX
, XX
},
2721 { "pshufw", MX
, EM
, Ib
},
2722 { "pshufhw", XM
, EX
, Ib
},
2723 { "pshufd", XM
, EX
, Ib
},
2724 { "pshuflw", XM
, EX
, Ib
},
2728 { "movd", Ed
, MX
, XX
},
2729 { "movq", Ed
, XM
, XX
},
2730 { "movd", Ed
, XM
, XX
},
2731 { "(bad)", EX
, XM
, XX
},
2735 { "(bad)", EX
, XM
, XX
},
2736 { "(bad)", EX
, XM
, XX
},
2737 { "punpckhqdq", XM
, EX
, XX
},
2738 { "(bad)", EX
, XM
, XX
},
2742 #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
2754 FETCH_DATA (the_info
, codep
+ 1);
2758 /* REX prefixes family. */
2781 prefixes
|= PREFIX_REPZ
;
2784 prefixes
|= PREFIX_REPNZ
;
2787 prefixes
|= PREFIX_LOCK
;
2790 prefixes
|= PREFIX_CS
;
2793 prefixes
|= PREFIX_SS
;
2796 prefixes
|= PREFIX_DS
;
2799 prefixes
|= PREFIX_ES
;
2802 prefixes
|= PREFIX_FS
;
2805 prefixes
|= PREFIX_GS
;
2808 prefixes
|= PREFIX_DATA
;
2811 prefixes
|= PREFIX_ADDR
;
2814 /* fwait is really an instruction. If there are prefixes
2815 before the fwait, they belong to the fwait, *not* to the
2816 following instruction. */
2819 prefixes
|= PREFIX_FWAIT
;
2823 prefixes
= PREFIX_FWAIT
;
2828 /* Rex is ignored when followed by another prefix. */
2831 oappend (prefix_name (rex
, 0));
2839 /* Return the name of the prefix byte PREF, or NULL if PREF is not a
2843 prefix_name (pref
, sizeflag
)
2849 /* REX prefixes family. */
2901 return (sizeflag
& DFLAG
) ? "data16" : "data32";
2903 return (sizeflag
& AFLAG
) ? "addr16" : "addr32";
2911 static char op1out
[100], op2out
[100], op3out
[100];
2912 static int op_ad
, op_index
[3];
2913 static unsigned int op_address
[3];
2914 static unsigned int op_riprel
[3];
2915 static bfd_vma start_pc
;
2919 * On the 386's of 1988, the maximum length of an instruction is 15 bytes.
2920 * (see topic "Redundant prefixes" in the "Differences from 8086"
2921 * section of the "Virtual 8086 Mode" chapter.)
2922 * 'pc' should be the address of this instruction, it will
2923 * be used to print the target address if this is a relative jump or call
2924 * The function returns the length of this instruction in bytes.
2927 static int print_insn_i386
2928 PARAMS ((bfd_vma pc
, disassemble_info
*info
));
2930 static char intel_syntax
;
2931 static char open_char
;
2932 static char close_char
;
2933 static char separator_char
;
2934 static char scale_char
;
2937 print_insn_i386_att (pc
, info
)
2939 disassemble_info
*info
;
2944 separator_char
= ',';
2947 return print_insn_i386 (pc
, info
);
2951 print_insn_i386_intel (pc
, info
)
2953 disassemble_info
*info
;
2958 separator_char
= '+';
2961 return print_insn_i386 (pc
, info
);
2965 print_insn_i386 (pc
, info
)
2967 disassemble_info
*info
;
2969 const struct dis386
*dp
;
2972 char *first
, *second
, *third
;
2974 unsigned char need_modrm
;
2975 unsigned char uses_SSE_prefix
;
2976 VOLATILE
int sizeflag
;
2977 VOLATILE
int orig_sizeflag
;
2979 struct dis_private priv
;
2980 bfd_byte
*inbuf
= priv
.the_buffer
;
2982 mode_64bit
= (info
->mach
== bfd_mach_x86_64_intel_syntax
2983 || info
->mach
== bfd_mach_x86_64
);
2985 if (info
->mach
== bfd_mach_i386_i386
2986 || info
->mach
== bfd_mach_x86_64
2987 || info
->mach
== bfd_mach_i386_i386_intel_syntax
2988 || info
->mach
== bfd_mach_x86_64_intel_syntax
)
2989 sizeflag
= AFLAG
|DFLAG
;
2990 else if (info
->mach
== bfd_mach_i386_i8086
)
2994 orig_sizeflag
= sizeflag
;
2996 /* The output looks better if we put 7 bytes on a line, since that
2997 puts most long word instructions on a single line. */
2998 info
->bytes_per_line
= 7;
3000 info
->private_data
= (PTR
) &priv
;
3001 priv
.max_fetched
= priv
.the_buffer
;
3002 priv
.insn_start
= pc
;
3009 op_index
[0] = op_index
[1] = op_index
[2] = -1;
3013 start_codep
= inbuf
;
3016 if (setjmp (priv
.bailout
) != 0)
3020 /* Getting here means we tried for data but didn't get it. That
3021 means we have an incomplete instruction of some sort. Just
3022 print the first byte as a prefix or a .byte pseudo-op. */
3025 name
= prefix_name (inbuf
[0], orig_sizeflag
);
3027 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3030 /* Just print the first byte as a .byte instruction. */
3031 (*info
->fprintf_func
) (info
->stream
, ".byte 0x%x",
3032 (unsigned int) inbuf
[0]);
3046 FETCH_DATA (info
, codep
+ 1);
3047 two_source_ops
= (*codep
== 0x62) || (*codep
== 0xc8);
3049 if ((prefixes
& PREFIX_FWAIT
)
3050 && ((*codep
< 0xd8) || (*codep
> 0xdf)))
3054 /* fwait not followed by floating point instruction. Print the
3055 first prefix, which is probably fwait itself. */
3056 name
= prefix_name (inbuf
[0], orig_sizeflag
);
3058 name
= INTERNAL_DISASSEMBLER_ERROR
;
3059 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3065 FETCH_DATA (info
, codep
+ 2);
3067 dp
= &dis386_twobyte_intel
[*++codep
];
3069 dp
= &dis386_twobyte_att
[*++codep
];
3070 need_modrm
= twobyte_has_modrm
[*codep
];
3071 uses_SSE_prefix
= twobyte_uses_SSE_prefix
[*codep
];
3077 dp
= &dis386_64_intel
[*codep
];
3079 dp
= &dis386_intel
[*codep
];
3082 dp
= &disx86_64_att
[*codep
];
3084 dp
= &dis386_att
[*codep
];
3085 need_modrm
= onebyte_has_modrm
[*codep
];
3086 uses_SSE_prefix
= 0;
3090 if (!uses_SSE_prefix
&& (prefixes
& PREFIX_REPZ
))
3093 used_prefixes
|= PREFIX_REPZ
;
3095 if (!uses_SSE_prefix
&& (prefixes
& PREFIX_REPNZ
))
3098 used_prefixes
|= PREFIX_REPNZ
;
3100 if (prefixes
& PREFIX_LOCK
)
3103 used_prefixes
|= PREFIX_LOCK
;
3106 if (!uses_SSE_prefix
&& (prefixes
& PREFIX_DATA
))
3109 if (prefixes
& PREFIX_ADDR
)
3112 if (sizeflag
& AFLAG
)
3113 oappend ("addr32 ");
3115 oappend ("addr16 ");
3116 used_prefixes
|= PREFIX_ADDR
;
3121 FETCH_DATA (info
, codep
+ 1);
3122 mod
= (*codep
>> 6) & 3;
3123 reg
= (*codep
>> 3) & 7;
3127 if (dp
->name
== NULL
&& dp
->bytemode1
== FLOATCODE
)
3134 if (dp
->name
== NULL
)
3136 switch(dp
->bytemode2
)
3139 dp
= &grps
[dp
->bytemode1
][reg
];
3141 case USE_PREFIX_USER_TABLE
:
3143 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
3144 if (prefixes
& PREFIX_REPZ
)
3148 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3149 if (prefixes
& PREFIX_DATA
)
3153 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
3154 if (prefixes
& PREFIX_REPNZ
)
3159 dp
= &prefix_user_table
[dp
->bytemode1
][index
];
3162 oappend (INTERNAL_DISASSEMBLER_ERROR
);
3167 putop (dp
->name
, sizeflag
);
3172 (*dp
->op1
)(dp
->bytemode1
, sizeflag
);
3177 (*dp
->op2
)(dp
->bytemode2
, sizeflag
);
3182 (*dp
->op3
)(dp
->bytemode3
, sizeflag
);
3185 /* See if any prefixes were not used. If so, print the first one
3186 separately. If we don't do this, we'll wind up printing an
3187 instruction stream which does not precisely correspond to the
3188 bytes we are disassembling. */
3189 if ((prefixes
& ~used_prefixes
) != 0)
3193 name
= prefix_name (inbuf
[0], orig_sizeflag
);
3195 name
= INTERNAL_DISASSEMBLER_ERROR
;
3196 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3199 if (rex
& ~rex_used
)
3202 name
= prefix_name (rex
| 0x40, orig_sizeflag
);
3204 name
= INTERNAL_DISASSEMBLER_ERROR
;
3205 (*info
->fprintf_func
) (info
->stream
, "%s ", name
);
3208 obufp
= obuf
+ strlen (obuf
);
3209 for (i
= strlen (obuf
); i
< 6; i
++)
3212 (*info
->fprintf_func
) (info
->stream
, "%s", obuf
);
3214 /* The enter and bound instructions are printed with operands in the same
3215 order as the intel book; everything else is printed in reverse order. */
3216 if (intel_syntax
|| two_source_ops
)
3221 op_ad
= op_index
[0];
3222 op_index
[0] = op_index
[2];
3223 op_index
[2] = op_ad
;
3234 if (op_index
[0] != -1 && !op_riprel
[0])
3235 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[0]], info
);
3237 (*info
->fprintf_func
) (info
->stream
, "%s", first
);
3243 (*info
->fprintf_func
) (info
->stream
, ",");
3244 if (op_index
[1] != -1 && !op_riprel
[1])
3245 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[1]], info
);
3247 (*info
->fprintf_func
) (info
->stream
, "%s", second
);
3253 (*info
->fprintf_func
) (info
->stream
, ",");
3254 if (op_index
[2] != -1 && !op_riprel
[2])
3255 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[2]], info
);
3257 (*info
->fprintf_func
) (info
->stream
, "%s", third
);
3259 for (i
= 0; i
< 3; i
++)
3260 if (op_index
[i
] != -1 && op_riprel
[i
])
3262 (*info
->fprintf_func
) (info
->stream
, " # ");
3263 (*info
->print_address_func
) ((bfd_vma
) (start_pc
+ codep
- start_codep
3264 + op_address
[op_index
[i
]]), info
);
3266 return codep
- inbuf
;
3269 static const char *float_mem_att
[] = {
3344 static const char *float_mem_intel
[] = {
3420 #define STi OP_STi, 0
3422 #define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
3423 #define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
3424 #define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
3425 #define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
3426 #define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
3427 #define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
3428 #define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
3429 #define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
3430 #define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
3432 static const struct dis386 float_reg
[][8] = {
3435 { "fadd", ST
, STi
, XX
},
3436 { "fmul", ST
, STi
, XX
},
3437 { "fcom", STi
, XX
, XX
},
3438 { "fcomp", STi
, XX
, XX
},
3439 { "fsub", ST
, STi
, XX
},
3440 { "fsubr", ST
, STi
, XX
},
3441 { "fdiv", ST
, STi
, XX
},
3442 { "fdivr", ST
, STi
, XX
},
3446 { "fld", STi
, XX
, XX
},
3447 { "fxch", STi
, XX
, XX
},
3449 { "(bad)", XX
, XX
, XX
},
3457 { "fcmovb", ST
, STi
, XX
},
3458 { "fcmove", ST
, STi
, XX
},
3459 { "fcmovbe",ST
, STi
, XX
},
3460 { "fcmovu", ST
, STi
, XX
},
3461 { "(bad)", XX
, XX
, XX
},
3463 { "(bad)", XX
, XX
, XX
},
3464 { "(bad)", XX
, XX
, XX
},
3468 { "fcmovnb",ST
, STi
, XX
},
3469 { "fcmovne",ST
, STi
, XX
},
3470 { "fcmovnbe",ST
, STi
, XX
},
3471 { "fcmovnu",ST
, STi
, XX
},
3473 { "fucomi", ST
, STi
, XX
},
3474 { "fcomi", ST
, STi
, XX
},
3475 { "(bad)", XX
, XX
, XX
},
3479 { "fadd", STi
, ST
, XX
},
3480 { "fmul", STi
, ST
, XX
},
3481 { "(bad)", XX
, XX
, XX
},
3482 { "(bad)", XX
, XX
, XX
},
3484 { "fsub", STi
, ST
, XX
},
3485 { "fsubr", STi
, ST
, XX
},
3486 { "fdiv", STi
, ST
, XX
},
3487 { "fdivr", STi
, ST
, XX
},
3489 { "fsubr", STi
, ST
, XX
},
3490 { "fsub", STi
, ST
, XX
},
3491 { "fdivr", STi
, ST
, XX
},
3492 { "fdiv", STi
, ST
, XX
},
3497 { "ffree", STi
, XX
, XX
},
3498 { "(bad)", XX
, XX
, XX
},
3499 { "fst", STi
, XX
, XX
},
3500 { "fstp", STi
, XX
, XX
},
3501 { "fucom", STi
, XX
, XX
},
3502 { "fucomp", STi
, XX
, XX
},
3503 { "(bad)", XX
, XX
, XX
},
3504 { "(bad)", XX
, XX
, XX
},
3508 { "faddp", STi
, ST
, XX
},
3509 { "fmulp", STi
, ST
, XX
},
3510 { "(bad)", XX
, XX
, XX
},
3513 { "fsubp", STi
, ST
, XX
},
3514 { "fsubrp", STi
, ST
, XX
},
3515 { "fdivp", STi
, ST
, XX
},
3516 { "fdivrp", STi
, ST
, XX
},
3518 { "fsubrp", STi
, ST
, XX
},
3519 { "fsubp", STi
, ST
, XX
},
3520 { "fdivrp", STi
, ST
, XX
},
3521 { "fdivp", STi
, ST
, XX
},
3526 { "(bad)", XX
, XX
, XX
},
3527 { "(bad)", XX
, XX
, XX
},
3528 { "(bad)", XX
, XX
, XX
},
3529 { "(bad)", XX
, XX
, XX
},
3531 { "fucomip",ST
, STi
, XX
},
3532 { "fcomip", ST
, STi
, XX
},
3533 { "(bad)", XX
, XX
, XX
},
3538 static char *fgrps
[][8] = {
3541 "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3546 "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
3551 "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
3556 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
3561 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
3566 "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3571 "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
3572 "fNsetpm(287 only)","(bad)","(bad)","(bad)",
3577 "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3582 "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3590 const struct dis386
*dp
;
3591 unsigned char floatop
;
3593 floatop
= codep
[-1];
3598 putop (float_mem_intel
[(floatop
- 0xd8 ) * 8 + reg
], sizeflag
);
3600 putop (float_mem_att
[(floatop
- 0xd8 ) * 8 + reg
], sizeflag
);
3602 if (floatop
== 0xdb)
3603 OP_E (x_mode
, sizeflag
);
3604 else if (floatop
== 0xdd)
3605 OP_E (d_mode
, sizeflag
);
3607 OP_E (v_mode
, sizeflag
);
3612 dp
= &float_reg
[floatop
- 0xd8][reg
];
3613 if (dp
->name
== NULL
)
3615 putop (fgrps
[dp
->bytemode1
][rm
], sizeflag
);
3617 /* instruction fnstsw is only one with strange arg */
3618 if (floatop
== 0xdf && codep
[-1] == 0xe0)
3619 strcpy (op1out
, names16
[0]);
3623 putop (dp
->name
, sizeflag
);
3627 (*dp
->op1
)(dp
->bytemode1
, sizeflag
);
3630 (*dp
->op2
)(dp
->bytemode2
, sizeflag
);
3636 OP_ST (ignore
, sizeflag
)
3637 int ignore ATTRIBUTE_UNUSED
;
3638 int sizeflag ATTRIBUTE_UNUSED
;
3645 OP_STi (ignore
, sizeflag
)
3646 int ignore ATTRIBUTE_UNUSED
;
3647 int sizeflag ATTRIBUTE_UNUSED
;
3649 sprintf (scratchbuf
, "%%st(%d)", rm
);
3650 oappend (scratchbuf
);
3654 /* capital letters in template are macros */
3656 putop (template, sizeflag
)
3657 const char *template;
3662 for (p
= template; *p
; p
++)
3673 #ifdef SUFFIX_ALWAYS
3674 || (sizeflag
& SUFFIX_ALWAYS
)
3682 #ifdef SUFFIX_ALWAYS
3683 if (sizeflag
& SUFFIX_ALWAYS
)
3687 case 'E': /* For jcxz/jecxz */
3688 if (sizeflag
& AFLAG
)
3698 if ((prefixes
& PREFIX_DATA
)
3699 #ifdef SUFFIX_ALWAYS
3700 || (sizeflag
& SUFFIX_ALWAYS
)
3704 if (sizeflag
& DFLAG
)
3708 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3715 #ifdef SUFFIX_ALWAYS
3716 if (sizeflag
& SUFFIX_ALWAYS
)
3721 if ((prefixes
& PREFIX_FWAIT
) == 0)
3724 used_prefixes
|= PREFIX_FWAIT
;
3727 USED_REX (REX_MODE64
);
3728 if (rex
& REX_MODE64
)
3736 if ((prefixes
& PREFIX_DATA
)
3737 || (rex
& REX_MODE64
)
3738 #ifdef SUFFIX_ALWAYS
3739 || (sizeflag
& SUFFIX_ALWAYS
)
3743 USED_REX (REX_MODE64
);
3744 if (rex
& REX_MODE64
)
3748 if (sizeflag
& DFLAG
)
3752 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3759 USED_REX (REX_MODE64
);
3761 #ifdef SUFFIX_ALWAYS
3762 || (sizeflag
& SUFFIX_ALWAYS
)
3766 if (rex
& REX_MODE64
)
3770 if (sizeflag
& DFLAG
)
3774 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3779 USED_REX (REX_MODE64
);
3782 if (rex
& REX_MODE64
)
3787 else if (sizeflag
& DFLAG
)
3800 if (rex
& REX_MODE64
)
3802 else if (sizeflag
& DFLAG
)
3807 if (!(rex
& REX_MODE64
))
3808 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3813 #ifdef SUFFIX_ALWAYS
3814 if (sizeflag
& SUFFIX_ALWAYS
)
3816 if (rex
& REX_MODE64
)
3820 if (sizeflag
& DFLAG
)
3824 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3835 #ifdef SUFFIX_ALWAYS
3836 || (sizeflag
& SUFFIX_ALWAYS
)
3840 if (sizeflag
& DFLAG
)
3844 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3848 if (prefixes
& PREFIX_DATA
)
3852 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3857 if (rex
& REX_MODE64
)
3859 USED_REX (REX_MODE64
);
3863 /* implicit operand size 'l' for i386 or 'q' for x86-64 */
3865 /* operand size flag for cwtl, cbtw */
3869 else if (sizeflag
& DFLAG
)
3880 if (sizeflag
& DFLAG
)
3891 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3903 obufp
+= strlen (s
);
3909 if (prefixes
& PREFIX_CS
)
3912 used_prefixes
|= PREFIX_CS
;
3914 if (prefixes
& PREFIX_DS
)
3917 used_prefixes
|= PREFIX_DS
;
3919 if (prefixes
& PREFIX_SS
)
3922 used_prefixes
|= PREFIX_SS
;
3924 if (prefixes
& PREFIX_ES
)
3927 used_prefixes
|= PREFIX_ES
;
3929 if (prefixes
& PREFIX_FS
)
3932 used_prefixes
|= PREFIX_FS
;
3934 if (prefixes
& PREFIX_GS
)
3937 used_prefixes
|= PREFIX_GS
;
3942 OP_indirE (bytemode
, sizeflag
)
3948 OP_E (bytemode
, sizeflag
);
3952 print_operand_value (buf
, hex
, disp
)
3965 sprintf_vma (tmp
, disp
);
3966 for (i
= 0; tmp
[i
] == '0' && tmp
[i
+1]; i
++);
3967 strcpy (buf
+ 2, tmp
+ i
);
3971 bfd_signed_vma v
= disp
;
3978 /* Check for possible overflow on 0x8000000000000000 */
3981 strcpy (buf
, "9223372036854775808");
3995 tmp
[28-i
] = (v
% 10) + '0';
3999 strcpy (buf
, tmp
+ 29 - i
);
4005 sprintf (buf
, "0x%x", (unsigned int) disp
);
4007 sprintf (buf
, "%d", (int) disp
);
4012 OP_E (bytemode
, sizeflag
)
4019 USED_REX (REX_EXTZ
);
4023 /* skip mod/rm byte */
4033 oappend (names8rex
[rm
+ add
]);
4035 oappend (names8
[rm
+ add
]);
4038 oappend (names16
[rm
+ add
]);
4041 oappend (names32
[rm
+ add
]);
4044 oappend (names64
[rm
+ add
]);
4048 oappend (names64
[rm
+ add
]);
4050 oappend (names32
[rm
+ add
]);
4053 USED_REX (REX_MODE64
);
4054 if (rex
& REX_MODE64
)
4055 oappend (names64
[rm
+ add
]);
4056 else if (sizeflag
& DFLAG
)
4057 oappend (names32
[rm
+ add
]);
4059 oappend (names16
[rm
+ add
]);
4060 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4063 if ( !(codep
[-2] == 0xAE && codep
[-1] == 0xF8 /* sfence */)
4064 && !(codep
[-2] == 0xAE && codep
[-1] == 0xF0 /* mfence */)
4065 && !(codep
[-2] == 0xAE && codep
[-1] == 0xe8 /* lfence */))
4066 BadOp(); /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
4069 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4078 if (sizeflag
& AFLAG
) /* 32 bit address mode */
4093 FETCH_DATA (the_info
, codep
+ 1);
4094 scale
= (*codep
>> 6) & 3;
4095 index
= (*codep
>> 3) & 7;
4097 USED_REX (REX_EXTY
);
4098 USED_REX (REX_EXTZ
);
4109 if ((base
& 7) == 5)
4112 if (mode_64bit
&& !havesib
)
4118 FETCH_DATA (the_info
, codep
+ 1);
4120 if ((disp
& 0x80) != 0)
4129 if (mod
!= 0 || (base
& 7) == 5)
4131 print_operand_value (scratchbuf
, !riprel
, disp
);
4132 oappend (scratchbuf
);
4140 if (havebase
|| (havesib
&& (index
!= 4 || scale
!= 0)))
4147 oappend ("BYTE PTR ");
4150 oappend ("WORD PTR ");
4153 oappend ("DWORD PTR ");
4156 oappend ("QWORD PTR ");
4160 oappend ("DWORD PTR ");
4162 oappend ("QWORD PTR ");
4165 oappend ("XWORD PTR ");
4171 *obufp
++ = open_char
;
4172 if (intel_syntax
&& riprel
)
4175 USED_REX (REX_EXTZ
);
4176 if (!havesib
&& (rex
& REX_EXTZ
))
4179 oappend (mode_64bit
? names64
[base
] : names32
[base
]);
4188 *obufp
++ = separator_char
;
4191 sprintf (scratchbuf
, "%s", mode_64bit
? names64
[index
] : names32
[index
]);
4194 sprintf (scratchbuf
, ",%s", mode_64bit
? names64
[index
] : names32
[index
]);
4195 oappend (scratchbuf
);
4199 && bytemode
!= b_mode
4200 && bytemode
!= w_mode
4201 && bytemode
!= v_mode
))
4203 *obufp
++ = scale_char
;
4205 sprintf (scratchbuf
, "%d", 1 << scale
);
4206 oappend (scratchbuf
);
4210 if (mod
!= 0 || (base
& 7) == 5)
4212 /* Don't print zero displacements */
4215 print_operand_value (scratchbuf
, 0, disp
);
4216 oappend (scratchbuf
);
4220 *obufp
++ = close_char
;
4223 else if (intel_syntax
)
4225 if (mod
!= 0 || (base
& 7) == 5)
4227 if (prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
4228 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
))
4232 oappend (names_seg
[3]);
4235 print_operand_value (scratchbuf
, 1, disp
);
4236 oappend (scratchbuf
);
4241 { /* 16 bit address mode */
4248 if ((disp
& 0x8000) != 0)
4253 FETCH_DATA (the_info
, codep
+ 1);
4255 if ((disp
& 0x80) != 0)
4260 if ((disp
& 0x8000) != 0)
4266 if (mod
!= 0 || (rm
& 7) == 6)
4268 print_operand_value (scratchbuf
, 0, disp
);
4269 oappend (scratchbuf
);
4272 if (mod
!= 0 || (rm
& 7) != 6)
4274 *obufp
++ = open_char
;
4276 oappend (index16
[rm
+ add
]);
4277 *obufp
++ = close_char
;
4284 OP_G (bytemode
, sizeflag
)
4289 USED_REX (REX_EXTX
);
4297 oappend (names8rex
[reg
+ add
]);
4299 oappend (names8
[reg
+ add
]);
4302 oappend (names16
[reg
+ add
]);
4305 oappend (names32
[reg
+ add
]);
4308 oappend (names64
[reg
+ add
]);
4311 USED_REX (REX_MODE64
);
4312 if (rex
& REX_MODE64
)
4313 oappend (names64
[reg
+ add
]);
4314 else if (sizeflag
& DFLAG
)
4315 oappend (names32
[reg
+ add
]);
4317 oappend (names16
[reg
+ add
]);
4318 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4321 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4334 FETCH_DATA (the_info
, codep
+ 8);
4335 a
= *codep
++ & 0xff;
4336 a
|= (*codep
++ & 0xff) << 8;
4337 a
|= (*codep
++ & 0xff) << 16;
4338 a
|= (*codep
++ & 0xff) << 24;
4339 b
|= (*codep
++ & 0xff);
4340 b
|= (*codep
++ & 0xff) << 8;
4341 b
|= (*codep
++ & 0xff) << 16;
4342 b
|= (*codep
++ & 0xff) << 24;
4343 x
= a
+ ((bfd_vma
) b
<< 32);
4350 static bfd_signed_vma
4353 bfd_signed_vma x
= 0;
4355 FETCH_DATA (the_info
, codep
+ 4);
4356 x
= *codep
++ & (bfd_signed_vma
) 0xff;
4357 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
4358 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
4359 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
4363 static bfd_signed_vma
4366 bfd_signed_vma x
= 0;
4368 FETCH_DATA (the_info
, codep
+ 4);
4369 x
= *codep
++ & (bfd_signed_vma
) 0xff;
4370 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
4371 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
4372 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
4374 x
= (x
^ ((bfd_signed_vma
) 1 << 31)) - ((bfd_signed_vma
) 1 << 31);
4384 FETCH_DATA (the_info
, codep
+ 2);
4385 x
= *codep
++ & 0xff;
4386 x
|= (*codep
++ & 0xff) << 8;
4395 op_index
[op_ad
] = op_ad
;
4396 op_address
[op_ad
] = op
;
4397 op_riprel
[op_ad
] = riprel
;
4401 OP_REG (code
, sizeflag
)
4407 USED_REX (REX_EXTZ
);
4416 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
4417 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
4418 s
= names16
[code
- ax_reg
+ add
];
4420 case es_reg
: case ss_reg
: case cs_reg
:
4421 case ds_reg
: case fs_reg
: case gs_reg
:
4422 s
= names_seg
[code
- es_reg
+ add
];
4424 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
4425 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
4428 s
= names8rex
[code
- al_reg
+ add
];
4430 s
= names8
[code
- al_reg
];
4432 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
4433 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
4434 USED_REX (REX_MODE64
);
4435 if (rex
& REX_MODE64
)
4436 s
= names64
[code
- eAX_reg
+ add
];
4437 else if (sizeflag
& DFLAG
)
4438 s
= names32
[code
- eAX_reg
+ add
];
4440 s
= names16
[code
- eAX_reg
+ add
];
4441 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4443 case rAX_reg
: case rCX_reg
: case rDX_reg
: case rBX_reg
:
4444 case rSP_reg
: case rBP_reg
: case rSI_reg
: case rDI_reg
:
4445 s
= names64
[code
- rAX_reg
+ add
];
4448 s
= INTERNAL_DISASSEMBLER_ERROR
;
4455 OP_IMREG (code
, sizeflag
)
4466 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
4467 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
4468 s
= names16
[code
- ax_reg
];
4470 case es_reg
: case ss_reg
: case cs_reg
:
4471 case ds_reg
: case fs_reg
: case gs_reg
:
4472 s
= names_seg
[code
- es_reg
];
4474 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
4475 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
4478 s
= names8rex
[code
- al_reg
];
4480 s
= names8
[code
- al_reg
];
4482 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
4483 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
4484 USED_REX (REX_MODE64
);
4485 if (rex
& REX_MODE64
)
4486 s
= names64
[code
- eAX_reg
];
4487 else if (sizeflag
& DFLAG
)
4488 s
= names32
[code
- eAX_reg
];
4490 s
= names16
[code
- eAX_reg
];
4491 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4494 s
= INTERNAL_DISASSEMBLER_ERROR
;
4501 OP_I (bytemode
, sizeflag
)
4506 bfd_signed_vma mask
= -1;
4511 FETCH_DATA (the_info
, codep
+ 1);
4519 USED_REX (REX_MODE64
);
4520 if (rex
& REX_MODE64
)
4522 else if (sizeflag
& DFLAG
)
4532 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4539 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4544 scratchbuf
[0] = '$';
4545 print_operand_value (scratchbuf
+ !intel_syntax
, 1, op
);
4546 oappend (scratchbuf
);
4547 scratchbuf
[0] = '\0';
4551 OP_I64 (bytemode
, sizeflag
)
4556 bfd_signed_vma mask
= -1;
4561 FETCH_DATA (the_info
, codep
+ 1);
4566 USED_REX (REX_MODE64
);
4567 if (rex
& REX_MODE64
)
4569 else if (sizeflag
& DFLAG
)
4579 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4586 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4591 scratchbuf
[0] = '$';
4592 print_operand_value (scratchbuf
+ !intel_syntax
, 1, op
);
4593 oappend (scratchbuf
);
4594 scratchbuf
[0] = '\0';
4598 OP_sI (bytemode
, sizeflag
)
4603 bfd_signed_vma mask
= -1;
4608 FETCH_DATA (the_info
, codep
+ 1);
4610 if ((op
& 0x80) != 0)
4615 USED_REX (REX_MODE64
);
4616 if (rex
& REX_MODE64
)
4618 else if (sizeflag
& DFLAG
)
4627 if ((op
& 0x8000) != 0)
4630 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4635 if ((op
& 0x8000) != 0)
4639 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4643 scratchbuf
[0] = '$';
4644 print_operand_value (scratchbuf
+ 1, 1, op
);
4645 oappend (scratchbuf
);
4649 OP_J (bytemode
, sizeflag
)
4659 FETCH_DATA (the_info
, codep
+ 1);
4661 if ((disp
& 0x80) != 0)
4665 if (sizeflag
& DFLAG
)
4670 /* for some reason, a data16 prefix on a jump instruction
4671 means that the pc is masked to 16 bits after the
4672 displacement is added! */
4675 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4678 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4681 disp
= (start_pc
+ codep
- start_codep
+ disp
) & mask
;
4683 print_operand_value (scratchbuf
, 1, disp
);
4684 oappend (scratchbuf
);
4689 OP_SEG (dummy
, sizeflag
)
4690 int dummy ATTRIBUTE_UNUSED
;
4691 int sizeflag ATTRIBUTE_UNUSED
;
4693 static char *sreg
[] = {
4694 "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
4697 oappend (sreg
[reg
]);
4702 OP_DIR (dummy
, sizeflag
)
4703 int dummy ATTRIBUTE_UNUSED
;
4708 if (sizeflag
& DFLAG
)
4718 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4719 sprintf (scratchbuf
, "$0x%x,$0x%x", seg
, offset
);
4720 oappend (scratchbuf
);
4725 OP_OFF (ignored
, sizeflag
)
4726 int ignored ATTRIBUTE_UNUSED
;
4733 if (sizeflag
& AFLAG
)
4740 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
4741 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
4743 oappend (names_seg
[3]);
4747 print_operand_value (scratchbuf
, 1, off
);
4748 oappend (scratchbuf
);
4752 OP_OFF64 (ignored
, sizeflag
)
4753 int ignored ATTRIBUTE_UNUSED
;
4754 int sizeflag ATTRIBUTE_UNUSED
;
4764 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
4765 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
4767 oappend (names_seg
[3]);
4771 print_operand_value (scratchbuf
, 1, off
);
4772 oappend (scratchbuf
);
4776 ptr_reg (code
, sizeflag
)
4782 USED_REX (REX_MODE64
);
4783 if (rex
& REX_MODE64
)
4784 s
= names64
[code
- eAX_reg
];
4785 else if (sizeflag
& AFLAG
)
4786 s
= names32
[code
- eAX_reg
];
4788 s
= names16
[code
- eAX_reg
];
4794 OP_ESreg (code
, sizeflag
)
4799 ptr_reg (code
, sizeflag
);
4803 OP_DSreg (code
, sizeflag
)
4814 prefixes
|= PREFIX_DS
;
4816 ptr_reg (code
, sizeflag
);
4821 OP_C (dummy
, sizeflag
)
4822 int dummy ATTRIBUTE_UNUSED
;
4823 int sizeflag ATTRIBUTE_UNUSED
;
4826 USED_REX (REX_EXTX
);
4829 sprintf (scratchbuf
, "%%cr%d", reg
+add
);
4830 oappend (scratchbuf
);
4835 OP_D (dummy
, sizeflag
)
4836 int dummy ATTRIBUTE_UNUSED
;
4837 int sizeflag ATTRIBUTE_UNUSED
;
4840 USED_REX (REX_EXTX
);
4843 sprintf (scratchbuf
, "%%db%d", reg
+add
);
4844 oappend (scratchbuf
);
4849 OP_T (dummy
, sizeflag
)
4850 int dummy ATTRIBUTE_UNUSED
;
4851 int sizeflag ATTRIBUTE_UNUSED
;
4853 sprintf (scratchbuf
, "%%tr%d", reg
);
4854 oappend (scratchbuf
);
4858 OP_Rd (bytemode
, sizeflag
)
4863 OP_E (bytemode
, sizeflag
);
4869 OP_MMX (ignore
, sizeflag
)
4870 int ignore ATTRIBUTE_UNUSED
;
4871 int sizeflag ATTRIBUTE_UNUSED
;
4874 USED_REX (REX_EXTX
);
4877 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4878 if (prefixes
& PREFIX_DATA
)
4879 sprintf (scratchbuf
, "%%xmm%d", reg
+ add
);
4881 sprintf (scratchbuf
, "%%mm%d", reg
+ add
);
4882 oappend (scratchbuf
);
4886 OP_XMM (bytemode
, sizeflag
)
4887 int bytemode ATTRIBUTE_UNUSED
;
4888 int sizeflag ATTRIBUTE_UNUSED
;
4891 USED_REX (REX_EXTX
);
4894 sprintf (scratchbuf
, "%%xmm%d", reg
+ add
);
4895 oappend (scratchbuf
);
4899 OP_EM (bytemode
, sizeflag
)
4906 OP_E (bytemode
, sizeflag
);
4909 USED_REX (REX_EXTZ
);
4914 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4915 if (prefixes
& PREFIX_DATA
)
4916 sprintf (scratchbuf
, "%%xmm%d", rm
+ add
);
4918 sprintf (scratchbuf
, "%%mm%d", rm
+ add
);
4919 oappend (scratchbuf
);
4923 OP_EX (bytemode
, sizeflag
)
4930 OP_E (bytemode
, sizeflag
);
4933 USED_REX (REX_EXTZ
);
4938 sprintf (scratchbuf
, "%%xmm%d", rm
+ add
);
4939 oappend (scratchbuf
);
4943 OP_MS (bytemode
, sizeflag
)
4948 OP_EM (bytemode
, sizeflag
);
4953 static const char *Suffix3DNow
[] = {
4954 /* 00 */ NULL
, NULL
, NULL
, NULL
,
4955 /* 04 */ NULL
, NULL
, NULL
, NULL
,
4956 /* 08 */ NULL
, NULL
, NULL
, NULL
,
4957 /* 0C */ "pi2fw", "pi2fd", NULL
, NULL
,
4958 /* 10 */ NULL
, NULL
, NULL
, NULL
,
4959 /* 14 */ NULL
, NULL
, NULL
, NULL
,
4960 /* 18 */ NULL
, NULL
, NULL
, NULL
,
4961 /* 1C */ "pf2iw", "pf2id", NULL
, NULL
,
4962 /* 20 */ NULL
, NULL
, NULL
, NULL
,
4963 /* 24 */ NULL
, NULL
, NULL
, NULL
,
4964 /* 28 */ NULL
, NULL
, NULL
, NULL
,
4965 /* 2C */ NULL
, NULL
, NULL
, NULL
,
4966 /* 30 */ NULL
, NULL
, NULL
, NULL
,
4967 /* 34 */ NULL
, NULL
, NULL
, NULL
,
4968 /* 38 */ NULL
, NULL
, NULL
, NULL
,
4969 /* 3C */ NULL
, NULL
, NULL
, NULL
,
4970 /* 40 */ NULL
, NULL
, NULL
, NULL
,
4971 /* 44 */ NULL
, NULL
, NULL
, NULL
,
4972 /* 48 */ NULL
, NULL
, NULL
, NULL
,
4973 /* 4C */ NULL
, NULL
, NULL
, NULL
,
4974 /* 50 */ NULL
, NULL
, NULL
, NULL
,
4975 /* 54 */ NULL
, NULL
, NULL
, NULL
,
4976 /* 58 */ NULL
, NULL
, NULL
, NULL
,
4977 /* 5C */ NULL
, NULL
, NULL
, NULL
,
4978 /* 60 */ NULL
, NULL
, NULL
, NULL
,
4979 /* 64 */ NULL
, NULL
, NULL
, NULL
,
4980 /* 68 */ NULL
, NULL
, NULL
, NULL
,
4981 /* 6C */ NULL
, NULL
, NULL
, NULL
,
4982 /* 70 */ NULL
, NULL
, NULL
, NULL
,
4983 /* 74 */ NULL
, NULL
, NULL
, NULL
,
4984 /* 78 */ NULL
, NULL
, NULL
, NULL
,
4985 /* 7C */ NULL
, NULL
, NULL
, NULL
,
4986 /* 80 */ NULL
, NULL
, NULL
, NULL
,
4987 /* 84 */ NULL
, NULL
, NULL
, NULL
,
4988 /* 88 */ NULL
, NULL
, "pfnacc", NULL
,
4989 /* 8C */ NULL
, NULL
, "pfpnacc", NULL
,
4990 /* 90 */ "pfcmpge", NULL
, NULL
, NULL
,
4991 /* 94 */ "pfmin", NULL
, "pfrcp", "pfrsqrt",
4992 /* 98 */ NULL
, NULL
, "pfsub", NULL
,
4993 /* 9C */ NULL
, NULL
, "pfadd", NULL
,
4994 /* A0 */ "pfcmpgt", NULL
, NULL
, NULL
,
4995 /* A4 */ "pfmax", NULL
, "pfrcpit1", "pfrsqit1",
4996 /* A8 */ NULL
, NULL
, "pfsubr", NULL
,
4997 /* AC */ NULL
, NULL
, "pfacc", NULL
,
4998 /* B0 */ "pfcmpeq", NULL
, NULL
, NULL
,
4999 /* B4 */ "pfmul", NULL
, "pfrcpit2", "pfmulhrw",
5000 /* B8 */ NULL
, NULL
, NULL
, "pswapd",
5001 /* BC */ NULL
, NULL
, NULL
, "pavgusb",
5002 /* C0 */ NULL
, NULL
, NULL
, NULL
,
5003 /* C4 */ NULL
, NULL
, NULL
, NULL
,
5004 /* C8 */ NULL
, NULL
, NULL
, NULL
,
5005 /* CC */ NULL
, NULL
, NULL
, NULL
,
5006 /* D0 */ NULL
, NULL
, NULL
, NULL
,
5007 /* D4 */ NULL
, NULL
, NULL
, NULL
,
5008 /* D8 */ NULL
, NULL
, NULL
, NULL
,
5009 /* DC */ NULL
, NULL
, NULL
, NULL
,
5010 /* E0 */ NULL
, NULL
, NULL
, NULL
,
5011 /* E4 */ NULL
, NULL
, NULL
, NULL
,
5012 /* E8 */ NULL
, NULL
, NULL
, NULL
,
5013 /* EC */ NULL
, NULL
, NULL
, NULL
,
5014 /* F0 */ NULL
, NULL
, NULL
, NULL
,
5015 /* F4 */ NULL
, NULL
, NULL
, NULL
,
5016 /* F8 */ NULL
, NULL
, NULL
, NULL
,
5017 /* FC */ NULL
, NULL
, NULL
, NULL
,
5021 OP_3DNowSuffix (bytemode
, sizeflag
)
5022 int bytemode ATTRIBUTE_UNUSED
;
5023 int sizeflag ATTRIBUTE_UNUSED
;
5025 const char *mnemonic
;
5027 FETCH_DATA (the_info
, codep
+ 1);
5028 /* AMD 3DNow! instructions are specified by an opcode suffix in the
5029 place where an 8-bit immediate would normally go. ie. the last
5030 byte of the instruction. */
5031 obufp
= obuf
+ strlen(obuf
);
5032 mnemonic
= Suffix3DNow
[*codep
++ & 0xff];
5037 /* Since a variable sized modrm/sib chunk is between the start
5038 of the opcode (0x0f0f) and the opcode suffix, we need to do
5039 all the modrm processing first, and don't know until now that
5040 we have a bad opcode. This necessitates some cleaning up. */
5048 static const char *simd_cmp_op
[] = {
5060 OP_SIMD_Suffix (bytemode
, sizeflag
)
5061 int bytemode ATTRIBUTE_UNUSED
;
5062 int sizeflag ATTRIBUTE_UNUSED
;
5064 unsigned int cmp_type
;
5066 FETCH_DATA (the_info
, codep
+ 1);
5067 obufp
= obuf
+ strlen(obuf
);
5068 cmp_type
= *codep
++ & 0xff;
5071 char suffix1
= 'p', suffix2
= 's';
5072 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
5073 if (prefixes
& PREFIX_REPZ
)
5077 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5078 if (prefixes
& PREFIX_DATA
)
5082 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
5083 if (prefixes
& PREFIX_REPNZ
)
5084 suffix1
= 's', suffix2
= 'd';
5087 sprintf (scratchbuf
, "cmp%s%c%c",
5088 simd_cmp_op
[cmp_type
], suffix1
, suffix2
);
5089 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
5090 oappend (scratchbuf
);
5094 /* We have a bad extension byte. Clean up. */
5102 SIMD_Fixup (extrachar
, sizeflag
)
5104 int sizeflag ATTRIBUTE_UNUSED
;
5106 /* Change movlps/movhps to movhlps/movlhps for 2 register operand
5107 forms of these instructions. */
5110 char *p
= obuf
+ strlen(obuf
);
5119 static void BadOp (void)
5121 codep
= insn_codep
+ 1; /* throw away prefixes and 1st. opcode byte */