1 /* Print i386 instructions for GDB, the GNU debugger.
2 Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
25 * modified by John Hassey (hassey@dg-rtp.dg.com)
26 * x86-64 support added by Jan Hubicka (jh@suse.cz)
30 * The main tables describing the instructions is essentially a copy
31 * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
32 * Programmers Manual. Usually, there is a capital letter, followed
33 * by a small letter. The capital letter tell the addressing mode,
34 * and the small letter tells about the operand size. Refer to
35 * the Intel manual for details.
46 #ifndef UNIXWARE_COMPAT
47 /* Set non-zero for broken, compatible instructions. Set to zero for
48 non-broken opcodes. */
49 #define UNIXWARE_COMPAT 1
52 static int fetch_data
PARAMS ((struct disassemble_info
*, bfd_byte
*));
56 /* Points to first byte not fetched. */
57 bfd_byte
*max_fetched
;
58 bfd_byte the_buffer
[MAXLEN
];
63 /* The opcode for the fwait instruction, which we treat as a prefix
65 #define FWAIT_OPCODE (0x9b)
67 /* Set to 1 for 64bit mode disassembly. */
68 static int mode_64bit
;
70 /* Flags for the prefixes for the current instruction. See below. */
73 /* REX prefix the current instruction. See below. */
75 /* Bits of REX we've already used. */
81 /* Mark parts used in the REX prefix. When we are testing for
82 empty prefix (for 8bit register REX extension), just mask it
83 out. Otherwise test for REX bit is excuse for existence of REX
84 only in case value is nonzero. */
85 #define USED_REX(value) \
88 rex_used |= (rex & value) ? (value) | 0x40 : 0; \
93 /* Flags for prefixes which we somehow handled when printing the
94 current instruction. */
95 static int used_prefixes
;
97 /* Flags stored in PREFIXES. */
99 #define PREFIX_REPNZ 2
100 #define PREFIX_LOCK 4
102 #define PREFIX_SS 0x10
103 #define PREFIX_DS 0x20
104 #define PREFIX_ES 0x40
105 #define PREFIX_FS 0x80
106 #define PREFIX_GS 0x100
107 #define PREFIX_DATA 0x200
108 #define PREFIX_ADDR 0x400
109 #define PREFIX_FWAIT 0x800
111 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
112 to ADDR (exclusive) are valid. Returns 1 for success, longjmps
114 #define FETCH_DATA(info, addr) \
115 ((addr) <= ((struct dis_private *)(info->private_data))->max_fetched \
116 ? 1 : fetch_data ((info), (addr)))
119 fetch_data (info
, addr
)
120 struct disassemble_info
*info
;
124 struct dis_private
*priv
= (struct dis_private
*)info
->private_data
;
125 bfd_vma start
= priv
->insn_start
+ (priv
->max_fetched
- priv
->the_buffer
);
127 status
= (*info
->read_memory_func
) (start
,
129 addr
- priv
->max_fetched
,
133 /* If we did manage to read at least one byte, then
134 print_insn_i386 will do something sensible. Otherwise, print
135 an error. We do that here because this is where we know
137 if (priv
->max_fetched
== priv
->the_buffer
)
138 (*info
->memory_error_func
) (status
, start
, info
);
139 longjmp (priv
->bailout
, 1);
142 priv
->max_fetched
= addr
;
148 #define Eb OP_E, b_mode
149 #define Ev OP_E, v_mode
150 #define Ed OP_E, d_mode
151 #define indirEb OP_indirE, b_mode
152 #define indirEv OP_indirE, v_mode
153 #define Ew OP_E, w_mode
154 #define Ma OP_E, v_mode
155 #define M OP_E, 0 /* lea */
156 #define Mp OP_E, 0 /* 32 or 48 bit memory operand for LDS, LES etc */
157 #define Gb OP_G, b_mode
158 #define Gv OP_G, v_mode
159 #define Gd OP_G, d_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
248 #define XS OP_XS, v_mode
250 #define OPSUF OP_3DNowSuffix, 0
251 #define OPSIMD OP_SIMD_Suffix, 0
253 #define cond_jump_flag NULL, cond_jump_mode
254 #define loop_jcxz_flag NULL, loop_jcxz_mode
256 /* bits in sizeflag */
257 #if 0 /* leave undefined until someone adds the extra flag to objdump */
258 #define SUFFIX_ALWAYS 4
263 typedef void (*op_rtn
) PARAMS ((int bytemode
, int sizeflag
));
265 static void OP_E
PARAMS ((int, int));
266 static void OP_G
PARAMS ((int, int));
267 static void OP_I
PARAMS ((int, int));
268 static void OP_I64
PARAMS ((int, int));
269 static void OP_OFF
PARAMS ((int, int));
270 static void OP_REG
PARAMS ((int, int));
271 static void OP_IMREG
PARAMS ((int, int));
272 static void OP_OFF64
PARAMS ((int, int));
273 static void OP_indirE
PARAMS ((int, int));
274 static void OP_sI
PARAMS ((int, int));
275 static void OP_REG
PARAMS ((int, int));
276 static void OP_J
PARAMS ((int, int));
277 static void OP_DIR
PARAMS ((int, int));
278 static void OP_OFF
PARAMS ((int, int));
279 static void OP_ESreg
PARAMS ((int, int));
280 static void OP_DSreg
PARAMS ((int, int));
281 static void OP_SEG
PARAMS ((int, int));
282 static void OP_C
PARAMS ((int, int));
283 static void OP_D
PARAMS ((int, int));
284 static void OP_T
PARAMS ((int, int));
285 static void OP_Rd
PARAMS ((int, int));
286 static void OP_ST
PARAMS ((int, int));
287 static void OP_STi
PARAMS ((int, int));
288 static void OP_MMX
PARAMS ((int, int));
289 static void OP_XMM
PARAMS ((int, int));
290 static void OP_EM
PARAMS ((int, int));
291 static void OP_EX
PARAMS ((int, int));
292 static void OP_MS
PARAMS ((int, int));
293 static void OP_XS
PARAMS ((int, int));
294 static void OP_3DNowSuffix
PARAMS ((int, int));
295 static void OP_SIMD_Suffix
PARAMS ((int, int));
296 static void SIMD_Fixup
PARAMS ((int, int));
298 static void append_seg
PARAMS ((void));
299 static void set_op
PARAMS ((unsigned int op
, int));
300 static void putop
PARAMS ((const char *template, int sizeflag
));
301 static void dofloat
PARAMS ((int sizeflag
));
302 static int get16
PARAMS ((void));
303 static bfd_vma get64
PARAMS ((void));
304 static bfd_signed_vma get32
PARAMS ((void));
305 static bfd_signed_vma get32s
PARAMS ((void));
306 static void ckprefix
PARAMS ((void));
307 static const char *prefix_name
PARAMS ((int, int));
308 static void ptr_reg
PARAMS ((int, int));
309 static void BadOp
PARAMS ((void));
311 #define b_mode 1 /* byte operand */
312 #define v_mode 2 /* operand size depends on prefixes */
313 #define w_mode 3 /* word operand */
314 #define d_mode 4 /* double word operand */
315 #define q_mode 5 /* quad word operand */
317 #define m_mode 7 /* d_mode in 32bit, q_mode in 64bit mode. */
318 #define cond_jump_mode 8
319 #define loop_jcxz_mode 9
364 #define indir_dx_reg 150
367 #define USE_PREFIX_USER_TABLE 2
369 #define GRP1b NULL, NULL, 0, NULL, USE_GROUPS, NULL, 0
370 #define GRP1S NULL, NULL, 1, NULL, USE_GROUPS, NULL, 0
371 #define GRP1Ss NULL, NULL, 2, NULL, USE_GROUPS, NULL, 0
372 #define GRP2b NULL, NULL, 3, NULL, USE_GROUPS, NULL, 0
373 #define GRP2S NULL, NULL, 4, NULL, USE_GROUPS, NULL, 0
374 #define GRP2b_one NULL, NULL, 5, NULL, USE_GROUPS, NULL, 0
375 #define GRP2S_one NULL, NULL, 6, NULL, USE_GROUPS, NULL, 0
376 #define GRP2b_cl NULL, NULL, 7, NULL, USE_GROUPS, NULL, 0
377 #define GRP2S_cl NULL, NULL, 8, NULL, USE_GROUPS, NULL, 0
378 #define GRP3b NULL, NULL, 9, NULL, USE_GROUPS, NULL, 0
379 #define GRP3S NULL, NULL, 10, NULL, USE_GROUPS, NULL, 0
380 #define GRP4 NULL, NULL, 11, NULL, USE_GROUPS, NULL, 0
381 #define GRP5 NULL, NULL, 12, NULL, USE_GROUPS, NULL, 0
382 #define GRP6 NULL, NULL, 13, NULL, USE_GROUPS, NULL, 0
383 #define GRP7 NULL, NULL, 14, NULL, USE_GROUPS, NULL, 0
384 #define GRP8 NULL, NULL, 15, NULL, USE_GROUPS, NULL, 0
385 #define GRP9 NULL, NULL, 16, NULL, USE_GROUPS, NULL, 0
386 #define GRP10 NULL, NULL, 17, NULL, USE_GROUPS, NULL, 0
387 #define GRP11 NULL, NULL, 18, NULL, USE_GROUPS, NULL, 0
388 #define GRP12 NULL, NULL, 19, NULL, USE_GROUPS, NULL, 0
389 #define GRP13 NULL, NULL, 20, NULL, USE_GROUPS, NULL, 0
390 #define GRP14 NULL, NULL, 21, NULL, USE_GROUPS, NULL, 0
391 #define GRPAMD NULL, NULL, 22, NULL, USE_GROUPS, NULL, 0
393 #define PREGRP0 NULL, NULL, 0, NULL, USE_PREFIX_USER_TABLE, NULL, 0
394 #define PREGRP1 NULL, NULL, 1, NULL, USE_PREFIX_USER_TABLE, NULL, 0
395 #define PREGRP2 NULL, NULL, 2, NULL, USE_PREFIX_USER_TABLE, NULL, 0
396 #define PREGRP3 NULL, NULL, 3, NULL, USE_PREFIX_USER_TABLE, NULL, 0
397 #define PREGRP4 NULL, NULL, 4, NULL, USE_PREFIX_USER_TABLE, NULL, 0
398 #define PREGRP5 NULL, NULL, 5, NULL, USE_PREFIX_USER_TABLE, NULL, 0
399 #define PREGRP6 NULL, NULL, 6, NULL, USE_PREFIX_USER_TABLE, NULL, 0
400 #define PREGRP7 NULL, NULL, 7, NULL, USE_PREFIX_USER_TABLE, NULL, 0
401 #define PREGRP8 NULL, NULL, 8, NULL, USE_PREFIX_USER_TABLE, NULL, 0
402 #define PREGRP9 NULL, NULL, 9, NULL, USE_PREFIX_USER_TABLE, NULL, 0
403 #define PREGRP10 NULL, NULL, 10, NULL, USE_PREFIX_USER_TABLE, NULL, 0
404 #define PREGRP11 NULL, NULL, 11, NULL, USE_PREFIX_USER_TABLE, NULL, 0
405 #define PREGRP12 NULL, NULL, 12, NULL, USE_PREFIX_USER_TABLE, NULL, 0
406 #define PREGRP13 NULL, NULL, 13, NULL, USE_PREFIX_USER_TABLE, NULL, 0
407 #define PREGRP14 NULL, NULL, 14, NULL, USE_PREFIX_USER_TABLE, NULL, 0
408 #define PREGRP15 NULL, NULL, 15, NULL, USE_PREFIX_USER_TABLE, NULL, 0
409 #define PREGRP16 NULL, NULL, 16, NULL, USE_PREFIX_USER_TABLE, NULL, 0
410 #define PREGRP17 NULL, NULL, 17, NULL, USE_PREFIX_USER_TABLE, NULL, 0
411 #define PREGRP18 NULL, NULL, 18, NULL, USE_PREFIX_USER_TABLE, NULL, 0
412 #define PREGRP19 NULL, NULL, 19, NULL, USE_PREFIX_USER_TABLE, NULL, 0
413 #define PREGRP20 NULL, NULL, 20, NULL, USE_PREFIX_USER_TABLE, NULL, 0
414 #define PREGRP21 NULL, NULL, 21, NULL, USE_PREFIX_USER_TABLE, NULL, 0
415 #define PREGRP22 NULL, NULL, 22, NULL, USE_PREFIX_USER_TABLE, NULL, 0
416 #define PREGRP23 NULL, NULL, 23, NULL, USE_PREFIX_USER_TABLE, NULL, 0
417 #define PREGRP24 NULL, NULL, 24, NULL, USE_PREFIX_USER_TABLE, NULL, 0
418 #define PREGRP25 NULL, NULL, 25, NULL, USE_PREFIX_USER_TABLE, NULL, 0
419 #define PREGRP26 NULL, NULL, 26, NULL, USE_PREFIX_USER_TABLE, NULL, 0
422 #define FLOAT NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
434 /* Upper case letters in the instruction names here are macros.
435 'A' => print 'b' if no register operands or suffix_always is true
436 'B' => print 'b' if suffix_always is true
437 'E' => print 'e' if 32-bit form of jcxz
438 'F' => print 'w' or 'l' depending on address size prefix (loop insns)
439 'L' => print 'l' if suffix_always is true
440 'N' => print 'n' if instruction has no wait "prefix"
441 'O' => print 'd', or 'o'
442 'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
443 or suffix_always is true
444 print 'q' if rex prefix is present.
445 'I' => print 'q' in 64bit mode and behave as 'P' otherwise
446 'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always is true
447 'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
448 'S' => print 'w', 'l' or 'q' if suffix_always is true
449 'T' => print 'q' in 64bit mode and behave as 'I' otherwise
450 'X' => print 's', 'd' depending on data16 prefix (for XMM)
451 'W' => print 'b' or 'w' ("w" or "de" in intel mode)
452 'Y' => 'q' if instruction has an REX 64bit overwrite prefix
455 static const struct dis386 dis386_att
[] = {
457 { "addB", Eb
, Gb
, XX
},
458 { "addS", Ev
, Gv
, XX
},
459 { "addB", Gb
, Eb
, XX
},
460 { "addS", Gv
, Ev
, XX
},
461 { "addB", AL
, Ib
, XX
},
462 { "addS", eAX
, Iv
, XX
},
463 { "pushI", es
, XX
, XX
},
464 { "popI", es
, XX
, XX
},
466 { "orB", Eb
, Gb
, XX
},
467 { "orS", Ev
, Gv
, XX
},
468 { "orB", Gb
, Eb
, XX
},
469 { "orS", Gv
, Ev
, XX
},
470 { "orB", AL
, Ib
, XX
},
471 { "orS", eAX
, Iv
, XX
},
472 { "pushI", cs
, XX
, XX
},
473 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
475 { "adcB", Eb
, Gb
, XX
},
476 { "adcS", Ev
, Gv
, XX
},
477 { "adcB", Gb
, Eb
, XX
},
478 { "adcS", Gv
, Ev
, XX
},
479 { "adcB", AL
, Ib
, XX
},
480 { "adcS", eAX
, Iv
, XX
},
481 { "pushI", ss
, XX
, XX
},
482 { "popI", ss
, XX
, XX
},
484 { "sbbB", Eb
, Gb
, XX
},
485 { "sbbS", Ev
, Gv
, XX
},
486 { "sbbB", Gb
, Eb
, XX
},
487 { "sbbS", Gv
, Ev
, XX
},
488 { "sbbB", AL
, Ib
, XX
},
489 { "sbbS", eAX
, Iv
, XX
},
490 { "pushI", ds
, XX
, XX
},
491 { "popI", ds
, XX
, XX
},
493 { "andB", Eb
, Gb
, XX
},
494 { "andS", Ev
, Gv
, XX
},
495 { "andB", Gb
, Eb
, XX
},
496 { "andS", Gv
, Ev
, XX
},
497 { "andB", AL
, Ib
, XX
},
498 { "andS", eAX
, Iv
, XX
},
499 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
500 { "daa", XX
, XX
, XX
},
502 { "subB", Eb
, Gb
, XX
},
503 { "subS", Ev
, Gv
, XX
},
504 { "subB", Gb
, Eb
, XX
},
505 { "subS", Gv
, Ev
, XX
},
506 { "subB", AL
, Ib
, XX
},
507 { "subS", eAX
, Iv
, XX
},
508 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
509 { "das", XX
, XX
, XX
},
511 { "xorB", Eb
, Gb
, XX
},
512 { "xorS", Ev
, Gv
, XX
},
513 { "xorB", Gb
, Eb
, XX
},
514 { "xorS", Gv
, Ev
, XX
},
515 { "xorB", AL
, Ib
, XX
},
516 { "xorS", eAX
, Iv
, XX
},
517 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
518 { "aaa", XX
, XX
, XX
},
520 { "cmpB", Eb
, Gb
, XX
},
521 { "cmpS", Ev
, Gv
, XX
},
522 { "cmpB", Gb
, Eb
, XX
},
523 { "cmpS", Gv
, Ev
, XX
},
524 { "cmpB", AL
, Ib
, XX
},
525 { "cmpS", eAX
, Iv
, XX
},
526 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
527 { "aas", XX
, XX
, XX
},
529 { "incS", RMeAX
, XX
, XX
},
530 { "incS", RMeCX
, XX
, XX
},
531 { "incS", RMeDX
, XX
, XX
},
532 { "incS", RMeBX
, XX
, XX
},
533 { "incS", RMeSP
, XX
, XX
},
534 { "incS", RMeBP
, XX
, XX
},
535 { "incS", RMeSI
, XX
, XX
},
536 { "incS", RMeDI
, XX
, XX
},
538 { "decS", RMeAX
, XX
, XX
},
539 { "decS", RMeCX
, XX
, XX
},
540 { "decS", RMeDX
, XX
, XX
},
541 { "decS", RMeBX
, XX
, XX
},
542 { "decS", RMeSP
, XX
, XX
},
543 { "decS", RMeBP
, XX
, XX
},
544 { "decS", RMeSI
, XX
, XX
},
545 { "decS", RMeDI
, XX
, XX
},
547 { "pushS", RMeAX
, XX
, XX
},
548 { "pushS", RMeCX
, XX
, XX
},
549 { "pushS", RMeDX
, XX
, XX
},
550 { "pushS", RMeBX
, XX
, XX
},
551 { "pushS", RMeSP
, XX
, XX
},
552 { "pushS", RMeBP
, XX
, XX
},
553 { "pushS", RMeSI
, XX
, XX
},
554 { "pushS", RMeDI
, XX
, XX
},
556 { "popS", RMeAX
, XX
, XX
},
557 { "popS", RMeCX
, XX
, XX
},
558 { "popS", RMeDX
, XX
, XX
},
559 { "popS", RMeBX
, XX
, XX
},
560 { "popS", RMeSP
, XX
, XX
},
561 { "popS", RMeBP
, XX
, XX
},
562 { "popS", RMeSI
, XX
, XX
},
563 { "popS", RMeDI
, XX
, XX
},
565 { "pushaP", XX
, XX
, XX
},
566 { "popaP", XX
, XX
, XX
},
567 { "boundS", Gv
, Ma
, XX
},
568 { "arpl", Ew
, Gw
, XX
},
569 { "(bad)", XX
, XX
, XX
}, /* seg fs */
570 { "(bad)", XX
, XX
, XX
}, /* seg gs */
571 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
572 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
574 { "pushI", Iv
, XX
, XX
}, /* 386 book wrong */
575 { "imulS", Gv
, Ev
, Iv
},
576 { "pushI", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
577 { "imulS", Gv
, Ev
, sIb
},
578 { "insb", Yb
, indirDX
, XX
},
579 { "insR", Yv
, indirDX
, XX
},
580 { "outsb", indirDX
, Xb
, XX
},
581 { "outsR", indirDX
, Xv
, XX
},
583 { "jo", Jb
, cond_jump_flag
, XX
},
584 { "jno", Jb
, cond_jump_flag
, XX
},
585 { "jb", Jb
, cond_jump_flag
, XX
},
586 { "jae", Jb
, cond_jump_flag
, XX
},
587 { "je", Jb
, cond_jump_flag
, XX
},
588 { "jne", Jb
, cond_jump_flag
, XX
},
589 { "jbe", Jb
, cond_jump_flag
, XX
},
590 { "ja", Jb
, cond_jump_flag
, XX
},
592 { "js", Jb
, cond_jump_flag
, XX
},
593 { "jns", Jb
, cond_jump_flag
, XX
},
594 { "jp", Jb
, cond_jump_flag
, XX
},
595 { "jnp", Jb
, cond_jump_flag
, XX
},
596 { "jl", Jb
, cond_jump_flag
, XX
},
597 { "jge", Jb
, cond_jump_flag
, XX
},
598 { "jle", Jb
, cond_jump_flag
, XX
},
599 { "jg", Jb
, cond_jump_flag
, XX
},
603 { "(bad)", XX
, XX
, XX
},
605 { "testB", Eb
, Gb
, XX
},
606 { "testS", Ev
, Gv
, XX
},
607 { "xchgB", Eb
, Gb
, XX
},
608 { "xchgS", Ev
, Gv
, XX
},
610 { "movB", Eb
, Gb
, XX
},
611 { "movS", Ev
, Gv
, XX
},
612 { "movB", Gb
, Eb
, XX
},
613 { "movS", Gv
, Ev
, XX
},
614 { "movQ", Ev
, Sw
, XX
},
615 { "leaS", Gv
, M
, XX
},
616 { "movQ", Sw
, Ev
, XX
},
617 { "popT", Ev
, XX
, XX
},
619 { "nop", XX
, XX
, XX
},
620 /* FIXME: NOP with REPz prefix is called PAUSE. */
621 { "xchgS", RMeCX
, eAX
, XX
},
622 { "xchgS", RMeDX
, eAX
, XX
},
623 { "xchgS", RMeBX
, eAX
, XX
},
624 { "xchgS", RMeSP
, eAX
, XX
},
625 { "xchgS", RMeBP
, eAX
, XX
},
626 { "xchgS", RMeSI
, eAX
, XX
},
627 { "xchgS", RMeDI
, eAX
, XX
},
629 { "cWtR", XX
, XX
, XX
},
630 { "cRtO", XX
, XX
, XX
},
631 { "lcallI", Ap
, XX
, XX
},
632 { "(bad)", XX
, XX
, XX
}, /* fwait */
633 { "pushfI", XX
, XX
, XX
},
634 { "popfI", XX
, XX
, XX
},
635 { "sahf", XX
, XX
, XX
},
636 { "lahf", XX
, XX
, XX
},
638 { "movB", AL
, Ob
, XX
},
639 { "movS", eAX
, Ov
, XX
},
640 { "movB", Ob
, AL
, XX
},
641 { "movS", Ov
, eAX
, XX
},
642 { "movsb", Yb
, Xb
, XX
},
643 { "movsR", Yv
, Xv
, XX
},
644 { "cmpsb", Xb
, Yb
, XX
},
645 { "cmpsR", Xv
, Yv
, XX
},
647 { "testB", AL
, Ib
, XX
},
648 { "testS", eAX
, Iv
, XX
},
649 { "stosB", Yb
, AL
, XX
},
650 { "stosS", Yv
, eAX
, XX
},
651 { "lodsB", AL
, Xb
, XX
},
652 { "lodsS", eAX
, Xv
, XX
},
653 { "scasB", AL
, Yb
, XX
},
654 { "scasS", eAX
, Yv
, XX
},
656 { "movB", RMAL
, Ib
, XX
},
657 { "movB", RMCL
, Ib
, XX
},
658 { "movB", RMDL
, Ib
, XX
},
659 { "movB", RMBL
, Ib
, XX
},
660 { "movB", RMAH
, Ib
, XX
},
661 { "movB", RMCH
, Ib
, XX
},
662 { "movB", RMDH
, Ib
, XX
},
663 { "movB", RMBH
, Ib
, XX
},
665 { "movS", RMeAX
, Iv
, XX
},
666 { "movS", RMeCX
, Iv
, XX
},
667 { "movS", RMeDX
, Iv
, XX
},
668 { "movS", RMeBX
, Iv
, XX
},
669 { "movS", RMeSP
, Iv
, XX
},
670 { "movS", RMeBP
, Iv
, XX
},
671 { "movS", RMeSI
, Iv
, XX
},
672 { "movS", RMeDI
, Iv
, XX
},
676 { "retI", Iw
, XX
, XX
},
677 { "retI", XX
, XX
, XX
},
678 { "lesS", Gv
, Mp
, XX
},
679 { "ldsS", Gv
, Mp
, XX
},
680 { "movA", Eb
, Ib
, XX
},
681 { "movQ", Ev
, Iv
, XX
},
683 { "enterI", Iw
, Ib
, XX
},
684 { "leaveI", XX
, XX
, XX
},
685 { "lretP", Iw
, XX
, XX
},
686 { "lretP", XX
, XX
, XX
},
687 { "int3", XX
, XX
, XX
},
688 { "int", Ib
, XX
, XX
},
689 { "into", XX
, XX
, XX
},
690 { "iretP", XX
, XX
, XX
},
696 { "aam", sIb
, XX
, XX
},
697 { "aad", sIb
, XX
, XX
},
698 { "(bad)", XX
, XX
, XX
},
699 { "xlat", DSBX
, XX
, XX
},
710 { "loopneF", Jb
, loop_jcxz_flag
, XX
},
711 { "loopeF", Jb
, loop_jcxz_flag
, XX
},
712 { "loopF", Jb
, loop_jcxz_flag
, XX
},
713 { "jEcxz", Jb
, loop_jcxz_flag
, XX
},
714 { "inB", AL
, Ib
, XX
},
715 { "inS", eAX
, Ib
, XX
},
716 { "outB", Ib
, AL
, XX
},
717 { "outS", Ib
, eAX
, XX
},
719 { "callI", Jv
, XX
, XX
},
720 { "jmpI", Jv
, XX
, XX
},
721 { "ljmpI", Ap
, XX
, XX
},
722 { "jmp", Jb
, XX
, XX
},
723 { "inB", AL
, indirDX
, XX
},
724 { "inS", eAX
, indirDX
, XX
},
725 { "outB", indirDX
, AL
, XX
},
726 { "outS", indirDX
, eAX
, XX
},
728 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
729 { "(bad)", XX
, XX
, XX
},
730 { "(bad)", XX
, XX
, XX
}, /* repne */
731 { "(bad)", XX
, XX
, XX
}, /* repz */
732 { "hlt", XX
, XX
, XX
},
733 { "cmc", XX
, XX
, XX
},
737 { "clc", XX
, XX
, XX
},
738 { "stc", XX
, XX
, XX
},
739 { "cli", XX
, XX
, XX
},
740 { "sti", XX
, XX
, XX
},
741 { "cld", XX
, XX
, XX
},
742 { "std", XX
, XX
, XX
},
747 static const struct dis386 dis386_intel
[] = {
749 { "add", Eb
, Gb
, XX
},
750 { "add", Ev
, Gv
, XX
},
751 { "add", Gb
, Eb
, XX
},
752 { "add", Gv
, Ev
, XX
},
753 { "add", AL
, Ib
, XX
},
754 { "add", eAX
, Iv
, XX
},
755 { "push", es
, XX
, XX
},
756 { "pop", es
, XX
, XX
},
758 { "or", Eb
, Gb
, XX
},
759 { "or", Ev
, Gv
, XX
},
760 { "or", Gb
, Eb
, XX
},
761 { "or", Gv
, Ev
, XX
},
762 { "or", AL
, Ib
, XX
},
763 { "or", eAX
, Iv
, XX
},
764 { "push", cs
, XX
, XX
},
765 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
767 { "adc", Eb
, Gb
, XX
},
768 { "adc", Ev
, Gv
, XX
},
769 { "adc", Gb
, Eb
, XX
},
770 { "adc", Gv
, Ev
, XX
},
771 { "adc", AL
, Ib
, XX
},
772 { "adc", eAX
, Iv
, XX
},
773 { "push", ss
, XX
, XX
},
774 { "pop", ss
, XX
, XX
},
776 { "sbb", Eb
, Gb
, XX
},
777 { "sbb", Ev
, Gv
, XX
},
778 { "sbb", Gb
, Eb
, XX
},
779 { "sbb", Gv
, Ev
, XX
},
780 { "sbb", AL
, Ib
, XX
},
781 { "sbb", eAX
, Iv
, XX
},
782 { "push", ds
, XX
, XX
},
783 { "pop", ds
, XX
, XX
},
785 { "and", Eb
, Gb
, XX
},
786 { "and", Ev
, Gv
, XX
},
787 { "and", Gb
, Eb
, XX
},
788 { "and", Gv
, Ev
, XX
},
789 { "and", AL
, Ib
, XX
},
790 { "and", eAX
, Iv
, XX
},
791 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
792 { "daa", XX
, XX
, XX
},
794 { "sub", Eb
, Gb
, XX
},
795 { "sub", Ev
, Gv
, XX
},
796 { "sub", Gb
, Eb
, XX
},
797 { "sub", Gv
, Ev
, XX
},
798 { "sub", AL
, Ib
, XX
},
799 { "sub", eAX
, Iv
, XX
},
800 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
801 { "das", XX
, XX
, XX
},
803 { "xor", Eb
, Gb
, XX
},
804 { "xor", Ev
, Gv
, XX
},
805 { "xor", Gb
, Eb
, XX
},
806 { "xor", Gv
, Ev
, XX
},
807 { "xor", AL
, Ib
, XX
},
808 { "xor", eAX
, Iv
, XX
},
809 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
810 { "aaa", XX
, XX
, XX
},
812 { "cmp", Eb
, Gb
, XX
},
813 { "cmp", Ev
, Gv
, XX
},
814 { "cmp", Gb
, Eb
, XX
},
815 { "cmp", Gv
, Ev
, XX
},
816 { "cmp", AL
, Ib
, XX
},
817 { "cmp", eAX
, Iv
, XX
},
818 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
819 { "aas", XX
, XX
, XX
},
821 { "inc", RMeAX
, XX
, XX
},
822 { "inc", RMeCX
, XX
, XX
},
823 { "inc", RMeDX
, XX
, XX
},
824 { "inc", RMeBX
, XX
, XX
},
825 { "inc", RMeSP
, XX
, XX
},
826 { "inc", RMeBP
, XX
, XX
},
827 { "inc", RMeSI
, XX
, XX
},
828 { "inc", RMeDI
, XX
, XX
},
830 { "dec", RMeAX
, XX
, XX
},
831 { "dec", RMeCX
, XX
, XX
},
832 { "dec", RMeDX
, XX
, XX
},
833 { "dec", RMeBX
, XX
, XX
},
834 { "dec", RMeSP
, XX
, XX
},
835 { "dec", RMeBP
, XX
, XX
},
836 { "dec", RMeSI
, XX
, XX
},
837 { "dec", RMeDI
, XX
, XX
},
839 { "push", RMeAX
, XX
, XX
},
840 { "push", RMeCX
, XX
, XX
},
841 { "push", RMeDX
, XX
, XX
},
842 { "push", RMeBX
, XX
, XX
},
843 { "push", RMeSP
, XX
, XX
},
844 { "push", RMeBP
, XX
, XX
},
845 { "push", RMeSI
, XX
, XX
},
846 { "push", RMeDI
, XX
, XX
},
848 { "pop", RMeAX
, XX
, XX
},
849 { "pop", RMeCX
, XX
, XX
},
850 { "pop", RMeDX
, XX
, XX
},
851 { "pop", RMeBX
, XX
, XX
},
852 { "pop", RMeSP
, XX
, XX
},
853 { "pop", RMeBP
, XX
, XX
},
854 { "pop", RMeSI
, XX
, XX
},
855 { "pop", RMeDI
, XX
, XX
},
857 { "pusha", XX
, XX
, XX
},
858 { "popa", XX
, XX
, XX
},
859 { "bound", Gv
, Ma
, XX
},
860 { "arpl", Ew
, Gw
, XX
},
861 { "(bad)", XX
, XX
, XX
}, /* seg fs */
862 { "(bad)", XX
, XX
, XX
}, /* seg gs */
863 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
864 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
866 { "push", Iv
, XX
, XX
}, /* 386 book wrong */
867 { "imul", Gv
, Ev
, Iv
},
868 { "push", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
869 { "imul", Gv
, Ev
, sIb
},
870 { "ins", Yb
, indirDX
, XX
},
871 { "ins", Yv
, indirDX
, XX
},
872 { "outs", indirDX
, Xb
, XX
},
873 { "outs", indirDX
, Xv
, XX
},
875 { "jo", Jb
, XX
, XX
},
876 { "jno", Jb
, XX
, XX
},
877 { "jb", Jb
, XX
, XX
},
878 { "jae", Jb
, XX
, XX
},
879 { "je", Jb
, XX
, XX
},
880 { "jne", Jb
, XX
, XX
},
881 { "jbe", Jb
, XX
, XX
},
882 { "ja", Jb
, XX
, XX
},
884 { "js", Jb
, XX
, XX
},
885 { "jns", Jb
, XX
, XX
},
886 { "jp", Jb
, XX
, XX
},
887 { "jnp", Jb
, XX
, XX
},
888 { "jl", Jb
, XX
, XX
},
889 { "jge", Jb
, XX
, XX
},
890 { "jle", Jb
, XX
, XX
},
891 { "jg", Jb
, XX
, XX
},
895 { "(bad)", XX
, XX
, XX
},
897 { "test", Eb
, Gb
, XX
},
898 { "test", Ev
, Gv
, XX
},
899 { "xchg", Eb
, Gb
, XX
},
900 { "xchg", Ev
, Gv
, XX
},
902 { "mov", Eb
, Gb
, XX
},
903 { "mov", Ev
, Gv
, XX
},
904 { "mov", Gb
, Eb
, XX
},
905 { "mov", Gv
, Ev
, XX
},
906 { "mov", Ev
, Sw
, XX
},
907 { "lea", Gv
, M
, XX
},
908 { "mov", Sw
, Ev
, XX
},
909 { "pop", Ev
, XX
, XX
},
911 { "nop", XX
, XX
, XX
},
912 /* FIXME: NOP with REPz prefix is called PAUSE. */
913 { "xchg", RMeCX
, eAX
, XX
},
914 { "xchg", RMeDX
, eAX
, XX
},
915 { "xchg", RMeBX
, eAX
, XX
},
916 { "xchg", RMeSP
, eAX
, XX
},
917 { "xchg", RMeBP
, eAX
, XX
},
918 { "xchg", RMeSI
, eAX
, XX
},
919 { "xchg", RMeDI
, eAX
, XX
},
921 { "cW", XX
, XX
, XX
}, /* cwde and cbw */
922 { "cR", XX
, XX
, XX
}, /* cdq and cwd */
923 { "lcall", Ap
, XX
, XX
},
924 { "(bad)", XX
, XX
, XX
}, /* fwait */
925 { "pushf", XX
, XX
, XX
},
926 { "popf", XX
, XX
, XX
},
927 { "sahf", XX
, XX
, XX
},
928 { "lahf", XX
, XX
, XX
},
930 { "mov", AL
, Ob
, XX
},
931 { "mov", eAX
, Ov
, XX
},
932 { "mov", Ob
, AL
, XX
},
933 { "mov", Ov
, eAX
, XX
},
934 { "movs", Yb
, Xb
, XX
},
935 { "movs", Yv
, Xv
, XX
},
936 { "cmps", Xb
, Yb
, XX
},
937 { "cmps", Xv
, Yv
, XX
},
939 { "test", AL
, Ib
, XX
},
940 { "test", eAX
, Iv
, XX
},
941 { "stos", Yb
, AL
, XX
},
942 { "stos", Yv
, eAX
, XX
},
943 { "lods", AL
, Xb
, XX
},
944 { "lods", eAX
, Xv
, XX
},
945 { "scas", AL
, Yb
, XX
},
946 { "scas", eAX
, Yv
, XX
},
948 { "mov", RMAL
, Ib
, XX
},
949 { "mov", RMCL
, Ib
, XX
},
950 { "mov", RMDL
, Ib
, XX
},
951 { "mov", RMBL
, Ib
, XX
},
952 { "mov", RMAH
, Ib
, XX
},
953 { "mov", RMCH
, Ib
, XX
},
954 { "mov", RMDH
, Ib
, XX
},
955 { "mov", RMBH
, Ib
, XX
},
957 { "mov", RMeAX
, Iv
, XX
},
958 { "mov", RMeCX
, Iv
, XX
},
959 { "mov", RMeDX
, Iv
, XX
},
960 { "mov", RMeBX
, Iv
, XX
},
961 { "mov", RMeSP
, Iv
, XX
},
962 { "mov", RMeBP
, Iv
, XX
},
963 { "mov", RMeSI
, Iv
, XX
},
964 { "mov", RMeDI
, Iv
, XX
},
968 { "ret", Iw
, XX
, XX
},
969 { "ret", XX
, XX
, XX
},
970 { "les", Gv
, Mp
, XX
},
971 { "lds", Gv
, Mp
, XX
},
972 { "mov", Eb
, Ib
, XX
},
973 { "mov", Ev
, Iv
, XX
},
975 { "enter", Iw
, Ib
, XX
},
976 { "leave", XX
, XX
, XX
},
977 { "lret", Iw
, XX
, XX
},
978 { "lret", XX
, XX
, XX
},
979 { "int3", XX
, XX
, XX
},
980 { "int", Ib
, XX
, XX
},
981 { "into", XX
, XX
, XX
},
982 { "iret", XX
, XX
, XX
},
988 { "aam", sIb
, XX
, XX
},
989 { "aad", sIb
, XX
, XX
},
990 { "(bad)", XX
, XX
, XX
},
991 { "xlat", DSBX
, XX
, XX
},
1002 { "loopne", Jb
, XX
, XX
},
1003 { "loope", Jb
, XX
, XX
},
1004 { "loop", Jb
, XX
, XX
},
1005 { "jEcxz", Jb
, XX
, XX
},
1006 { "in", AL
, Ib
, XX
},
1007 { "in", eAX
, Ib
, XX
},
1008 { "out", Ib
, AL
, XX
},
1009 { "out", Ib
, eAX
, XX
},
1011 { "call", Jv
, XX
, XX
},
1012 { "jmp", Jv
, XX
, XX
},
1013 { "ljmp", Ap
, XX
, XX
},
1014 { "jmp", Jb
, XX
, XX
},
1015 { "in", AL
, indirDX
, XX
},
1016 { "in", eAX
, indirDX
, XX
},
1017 { "out", indirDX
, AL
, XX
},
1018 { "out", indirDX
, eAX
, XX
},
1020 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
1021 { "(bad)", XX
, XX
, XX
},
1022 { "(bad)", XX
, XX
, XX
}, /* repne */
1023 { "(bad)", XX
, XX
, XX
}, /* repz */
1024 { "hlt", XX
, XX
, XX
},
1025 { "cmc", XX
, XX
, XX
},
1029 { "clc", XX
, XX
, XX
},
1030 { "stc", XX
, XX
, XX
},
1031 { "cli", XX
, XX
, XX
},
1032 { "sti", XX
, XX
, XX
},
1033 { "cld", XX
, XX
, XX
},
1034 { "std", XX
, XX
, XX
},
1039 /* 64bit mode is having some instruction set differences, so separate table is
1041 static const struct dis386 disx86_64_att
[] = {
1043 { "addB", Eb
, Gb
, XX
},
1044 { "addS", Ev
, Gv
, XX
},
1045 { "addB", Gb
, Eb
, XX
},
1046 { "addS", Gv
, Ev
, XX
},
1047 { "addB", AL
, Ib
, XX
},
1048 { "addS", eAX
, Iv
, XX
},
1049 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1050 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1052 { "orB", Eb
, Gb
, XX
},
1053 { "orS", Ev
, Gv
, XX
},
1054 { "orB", Gb
, Eb
, XX
},
1055 { "orS", Gv
, Ev
, XX
},
1056 { "orB", AL
, Ib
, XX
},
1057 { "orS", eAX
, Iv
, XX
},
1058 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1059 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
1061 { "adcB", Eb
, Gb
, XX
},
1062 { "adcS", Ev
, Gv
, XX
},
1063 { "adcB", Gb
, Eb
, XX
},
1064 { "adcS", Gv
, Ev
, XX
},
1065 { "adcB", AL
, Ib
, XX
},
1066 { "adcS", eAX
, Iv
, XX
},
1067 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1068 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1070 { "sbbB", Eb
, Gb
, XX
},
1071 { "sbbS", Ev
, Gv
, XX
},
1072 { "sbbB", Gb
, Eb
, XX
},
1073 { "sbbS", Gv
, Ev
, XX
},
1074 { "sbbB", AL
, Ib
, XX
},
1075 { "sbbS", eAX
, Iv
, XX
},
1076 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1077 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1079 { "andB", Eb
, Gb
, XX
},
1080 { "andS", Ev
, Gv
, XX
},
1081 { "andB", Gb
, Eb
, XX
},
1082 { "andS", Gv
, Ev
, XX
},
1083 { "andB", AL
, Ib
, XX
},
1084 { "andS", eAX
, Iv
, XX
},
1085 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
1086 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1088 { "subB", Eb
, Gb
, XX
},
1089 { "subS", Ev
, Gv
, XX
},
1090 { "subB", Gb
, Eb
, XX
},
1091 { "subS", Gv
, Ev
, XX
},
1092 { "subB", AL
, Ib
, XX
},
1093 { "subS", eAX
, Iv
, XX
},
1094 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
1095 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1097 { "xorB", Eb
, Gb
, XX
},
1098 { "xorS", Ev
, Gv
, XX
},
1099 { "xorB", Gb
, Eb
, XX
},
1100 { "xorS", Gv
, Ev
, XX
},
1101 { "xorB", AL
, Ib
, XX
},
1102 { "xorS", eAX
, Iv
, XX
},
1103 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
1104 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1106 { "cmpB", Eb
, Gb
, XX
},
1107 { "cmpS", Ev
, Gv
, XX
},
1108 { "cmpB", Gb
, Eb
, XX
},
1109 { "cmpS", Gv
, Ev
, XX
},
1110 { "cmpB", AL
, Ib
, XX
},
1111 { "cmpS", eAX
, Iv
, XX
},
1112 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
1113 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1115 { "(bad)", XX
, XX
, XX
}, /* REX prefix area. */
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
},
1122 { "(bad)", XX
, XX
, XX
},
1124 { "(bad)", XX
, XX
, XX
},
1125 { "(bad)", XX
, XX
, XX
},
1126 { "(bad)", XX
, XX
, XX
},
1127 { "(bad)", XX
, XX
, XX
},
1128 { "(bad)", XX
, XX
, XX
},
1129 { "(bad)", XX
, XX
, XX
},
1130 { "(bad)", XX
, XX
, XX
},
1131 { "(bad)", XX
, XX
, XX
},
1133 { "pushI", RMrAX
, XX
, XX
},
1134 { "pushI", RMrCX
, XX
, XX
},
1135 { "pushI", RMrDX
, XX
, XX
},
1136 { "pushI", RMrBX
, XX
, XX
},
1137 { "pushI", RMrSP
, XX
, XX
},
1138 { "pushI", RMrBP
, XX
, XX
},
1139 { "pushI", RMrSI
, XX
, XX
},
1140 { "pushI", RMrDI
, XX
, XX
},
1142 { "popI", RMrAX
, XX
, XX
},
1143 { "popI", RMrCX
, XX
, XX
},
1144 { "popI", RMrDX
, XX
, XX
},
1145 { "popI", RMrBX
, XX
, XX
},
1146 { "popI", RMrSP
, XX
, XX
},
1147 { "popI", RMrBP
, XX
, XX
},
1148 { "popI", RMrSI
, XX
, XX
},
1149 { "popI", RMrDI
, XX
, XX
},
1151 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1152 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1153 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1154 { "movslR", Gv
, Ed
, XX
},
1155 { "(bad)", XX
, XX
, XX
}, /* seg fs */
1156 { "(bad)", XX
, XX
, XX
}, /* seg gs */
1157 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
1158 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
1160 { "pushI", Iq
, XX
, XX
}, /* 386 book wrong */
1161 { "imulS", Gv
, Ev
, Iv
},
1162 { "pushI", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
1163 { "imulS", Gv
, Ev
, sIb
},
1164 { "insb", Yb
, indirDX
, XX
},
1165 { "insR", Yv
, indirDX
, XX
},
1166 { "outsb", indirDX
, Xb
, XX
},
1167 { "outsR", indirDX
, Xv
, XX
},
1169 { "jo", Jb
, cond_jump_flag
, XX
},
1170 { "jno", Jb
, cond_jump_flag
, XX
},
1171 { "jb", Jb
, cond_jump_flag
, XX
},
1172 { "jae", Jb
, cond_jump_flag
, XX
},
1173 { "je", Jb
, cond_jump_flag
, XX
},
1174 { "jne", Jb
, cond_jump_flag
, XX
},
1175 { "jbe", Jb
, cond_jump_flag
, XX
},
1176 { "ja", Jb
, cond_jump_flag
, XX
},
1178 { "js", Jb
, cond_jump_flag
, XX
},
1179 { "jns", Jb
, cond_jump_flag
, XX
},
1180 { "jp", Jb
, cond_jump_flag
, XX
},
1181 { "jnp", Jb
, cond_jump_flag
, XX
},
1182 { "jl", Jb
, cond_jump_flag
, XX
},
1183 { "jge", Jb
, cond_jump_flag
, XX
},
1184 { "jle", Jb
, cond_jump_flag
, XX
},
1185 { "jg", Jb
, cond_jump_flag
, XX
},
1189 { "(bad)", XX
, XX
, XX
},
1191 { "testB", Eb
, Gb
, XX
},
1192 { "testS", Ev
, Gv
, XX
},
1193 { "xchgB", Eb
, Gb
, XX
},
1194 { "xchgS", Ev
, Gv
, XX
},
1196 { "movB", Eb
, Gb
, XX
},
1197 { "movS", Ev
, Gv
, XX
},
1198 { "movB", Gb
, Eb
, XX
},
1199 { "movS", Gv
, Ev
, XX
},
1200 { "movQ", Ev
, Sw
, XX
},
1201 { "leaS", Gv
, M
, XX
},
1202 { "movQ", Sw
, Ev
, XX
},
1203 { "popI", Ev
, XX
, XX
},
1205 { "nop", XX
, XX
, XX
},
1206 /* FIXME: NOP with REPz prefix is called PAUSE. */
1207 { "xchgS", RMeCX
, eAX
, XX
},
1208 { "xchgS", RMeDX
, eAX
, XX
},
1209 { "xchgS", RMeBX
, eAX
, XX
},
1210 { "xchgS", RMeSP
, eAX
, XX
},
1211 { "xchgS", RMeBP
, eAX
, XX
},
1212 { "xchgS", RMeSI
, eAX
, XX
},
1213 { "xchgS", RMeDI
, eAX
, XX
},
1215 { "cWtR", XX
, XX
, XX
},
1216 { "cRtO", XX
, XX
, XX
},
1217 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1218 { "(bad)", XX
, XX
, XX
}, /* fwait */
1219 { "pushfI", XX
, XX
, XX
},
1220 { "popfI", XX
, XX
, XX
},
1221 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1222 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1224 { "movB", AL
, Ob64
, XX
},
1225 { "movS", eAX
, Ov64
, XX
},
1226 { "movB", Ob64
, AL
, XX
},
1227 { "movS", Ov64
, eAX
, XX
},
1228 { "movsb", Yb
, Xb
, XX
},
1229 { "movsR", Yv
, Xv
, XX
},
1230 { "cmpsb", Xb
, Yb
, XX
},
1231 { "cmpsR", Xv
, Yv
, XX
},
1233 { "testB", AL
, Ib
, XX
},
1234 { "testS", eAX
, Iv
, XX
},
1235 { "stosB", Yb
, AL
, XX
},
1236 { "stosS", Yv
, eAX
, XX
},
1237 { "lodsB", AL
, Xb
, XX
},
1238 { "lodsS", eAX
, Xv
, XX
},
1239 { "scasB", AL
, Yb
, XX
},
1240 { "scasS", eAX
, Yv
, XX
},
1242 { "movB", RMAL
, Ib
, XX
},
1243 { "movB", RMCL
, Ib
, XX
},
1244 { "movB", RMDL
, Ib
, XX
},
1245 { "movB", RMBL
, Ib
, XX
},
1246 { "movB", RMAH
, Ib
, XX
},
1247 { "movB", RMCH
, Ib
, XX
},
1248 { "movB", RMDH
, Ib
, XX
},
1249 { "movB", RMBH
, Ib
, XX
},
1251 { "movS", RMeAX
, Iv64
, XX
},
1252 { "movS", RMeCX
, Iv64
, XX
},
1253 { "movS", RMeDX
, Iv64
, XX
},
1254 { "movS", RMeBX
, Iv64
, XX
},
1255 { "movS", RMeSP
, Iv64
, XX
},
1256 { "movS", RMeBP
, Iv64
, XX
},
1257 { "movS", RMeSI
, Iv64
, XX
},
1258 { "movS", RMeDI
, Iv64
, XX
},
1262 { "retI", Iw
, XX
, XX
},
1263 { "retI", XX
, XX
, XX
},
1264 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1265 { "ldsS", Gv
, Mp
, XX
},
1266 { "movA", Eb
, Ib
, XX
},
1267 { "movQ", Ev
, Iv
, XX
},
1269 { "enterI", Iw
, Ib
, XX
},
1270 { "leaveI", XX
, XX
, XX
},
1271 { "lretP", Iw
, XX
, XX
},
1272 { "lretP", XX
, XX
, XX
},
1273 { "int3", XX
, XX
, XX
},
1274 { "int", Ib
, XX
, XX
},
1275 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1276 { "iretP", XX
, XX
, XX
},
1282 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1283 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1284 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1285 { "xlat", DSBX
, XX
, XX
},
1296 { "loopneF", Jb
, loop_jcxz_flag
, XX
},
1297 { "loopeF", Jb
, loop_jcxz_flag
, XX
},
1298 { "loopF", Jb
, loop_jcxz_flag
, XX
},
1299 { "jEcxz", Jb
, loop_jcxz_flag
, XX
},
1300 { "inB", AL
, Ib
, XX
},
1301 { "inS", eAX
, Ib
, XX
},
1302 { "outB", Ib
, AL
, XX
},
1303 { "outS", Ib
, eAX
, XX
},
1305 { "callI", Jv
, XX
, XX
},
1306 { "jmpI", Jv
, XX
, XX
},
1307 { "(bad)", XX
, XX
, XX
}, /* reserved. */
1308 { "jmp", Jb
, XX
, XX
},
1309 { "inB", AL
, indirDX
, XX
},
1310 { "inS", eAX
, indirDX
, XX
},
1311 { "outB", indirDX
, AL
, XX
},
1312 { "outS", indirDX
, eAX
, XX
},
1314 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
1315 { "(bad)", XX
, XX
, XX
},
1316 { "(bad)", XX
, XX
, XX
}, /* repne */
1317 { "(bad)", XX
, XX
, XX
}, /* repz */
1318 { "hlt", XX
, XX
, XX
},
1319 { "cmc", XX
, XX
, XX
},
1323 { "clc", XX
, XX
, XX
},
1324 { "stc", XX
, XX
, XX
},
1325 { "cli", XX
, XX
, XX
},
1326 { "sti", XX
, XX
, XX
},
1327 { "cld", XX
, XX
, XX
},
1328 { "std", XX
, XX
, XX
},
1333 static const struct dis386 dis386_64_intel
[] = {
1335 { "add", Eb
, Gb
, XX
},
1336 { "add", Ev
, Gv
, XX
},
1337 { "add", Gb
, Eb
, XX
},
1338 { "add", Gv
, Ev
, XX
},
1339 { "add", AL
, Ib
, XX
},
1340 { "add", eAX
, Iv
, XX
},
1341 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1342 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1344 { "or", Eb
, Gb
, XX
},
1345 { "or", Ev
, Gv
, XX
},
1346 { "or", Gb
, Eb
, XX
},
1347 { "or", Gv
, Ev
, XX
},
1348 { "or", AL
, Ib
, XX
},
1349 { "or", eAX
, Iv
, XX
},
1350 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1351 { "(bad)", XX
, XX
, XX
}, /* 0x0f extended opcode escape */
1353 { "adc", Eb
, Gb
, XX
},
1354 { "adc", Ev
, Gv
, XX
},
1355 { "adc", Gb
, Eb
, XX
},
1356 { "adc", Gv
, Ev
, XX
},
1357 { "adc", AL
, Ib
, XX
},
1358 { "adc", eAX
, Iv
, XX
},
1359 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1360 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1362 { "sbb", Eb
, Gb
, XX
},
1363 { "sbb", Ev
, Gv
, XX
},
1364 { "sbb", Gb
, Eb
, XX
},
1365 { "sbb", Gv
, Ev
, XX
},
1366 { "sbb", AL
, Ib
, XX
},
1367 { "sbb", eAX
, Iv
, XX
},
1368 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1369 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1371 { "and", Eb
, Gb
, XX
},
1372 { "and", Ev
, Gv
, XX
},
1373 { "and", Gb
, Eb
, XX
},
1374 { "and", Gv
, Ev
, XX
},
1375 { "and", AL
, Ib
, XX
},
1376 { "and", eAX
, Iv
, XX
},
1377 { "(bad)", XX
, XX
, XX
}, /* SEG ES prefix */
1378 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1380 { "sub", Eb
, Gb
, XX
},
1381 { "sub", Ev
, Gv
, XX
},
1382 { "sub", Gb
, Eb
, XX
},
1383 { "sub", Gv
, Ev
, XX
},
1384 { "sub", AL
, Ib
, XX
},
1385 { "sub", eAX
, Iv
, XX
},
1386 { "(bad)", XX
, XX
, XX
}, /* SEG CS prefix */
1387 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1389 { "xor", Eb
, Gb
, XX
},
1390 { "xor", Ev
, Gv
, XX
},
1391 { "xor", Gb
, Eb
, XX
},
1392 { "xor", Gv
, Ev
, XX
},
1393 { "xor", AL
, Ib
, XX
},
1394 { "xor", eAX
, Iv
, XX
},
1395 { "(bad)", XX
, XX
, XX
}, /* SEG SS prefix */
1396 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1398 { "cmp", Eb
, Gb
, XX
},
1399 { "cmp", Ev
, Gv
, XX
},
1400 { "cmp", Gb
, Eb
, XX
},
1401 { "cmp", Gv
, Ev
, XX
},
1402 { "cmp", AL
, Ib
, XX
},
1403 { "cmp", eAX
, Iv
, XX
},
1404 { "(bad)", XX
, XX
, XX
}, /* SEG DS prefix */
1405 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1407 { "(bad)", XX
, XX
, XX
}, /* REX prefix area. */
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
},
1414 { "(bad)", XX
, XX
, XX
},
1416 { "(bad)", XX
, XX
, XX
},
1417 { "(bad)", XX
, XX
, XX
},
1418 { "(bad)", XX
, XX
, XX
},
1419 { "(bad)", XX
, XX
, XX
},
1420 { "(bad)", XX
, XX
, XX
},
1421 { "(bad)", XX
, XX
, XX
},
1422 { "(bad)", XX
, XX
, XX
},
1423 { "(bad)", XX
, XX
, XX
},
1425 { "push", RMrAX
, XX
, XX
},
1426 { "push", RMrCX
, XX
, XX
},
1427 { "push", RMrDX
, XX
, XX
},
1428 { "push", RMrBX
, XX
, XX
},
1429 { "push", RMrSP
, XX
, XX
},
1430 { "push", RMrBP
, XX
, XX
},
1431 { "push", RMrSI
, XX
, XX
},
1432 { "push", RMrDI
, XX
, XX
},
1434 { "pop", RMrAX
, XX
, XX
},
1435 { "pop", RMrCX
, XX
, XX
},
1436 { "pop", RMrDX
, XX
, XX
},
1437 { "pop", RMrBX
, XX
, XX
},
1438 { "pop", RMrSP
, XX
, XX
},
1439 { "pop", RMrBP
, XX
, XX
},
1440 { "pop", RMrSI
, XX
, XX
},
1441 { "pop", RMrDI
, XX
, XX
},
1443 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1444 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1445 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1446 { "movsx", Gv
, Ed
, XX
},
1447 { "(bad)", XX
, XX
, XX
}, /* seg fs */
1448 { "(bad)", XX
, XX
, XX
}, /* seg gs */
1449 { "(bad)", XX
, XX
, XX
}, /* op size prefix */
1450 { "(bad)", XX
, XX
, XX
}, /* adr size prefix */
1452 { "push", Iq
, XX
, XX
}, /* 386 book wrong */
1453 { "imul", Gv
, Ev
, Iv
},
1454 { "push", sIb
, XX
, XX
}, /* push of byte really pushes 2 or 4 bytes */
1455 { "imul", Gv
, Ev
, sIb
},
1456 { "ins", Yb
, indirDX
, XX
},
1457 { "ins", Yv
, indirDX
, XX
},
1458 { "outs", indirDX
, Xb
, XX
},
1459 { "outs", indirDX
, Xv
, XX
},
1461 { "jo", Jb
, XX
, XX
},
1462 { "jno", Jb
, XX
, XX
},
1463 { "jb", Jb
, XX
, XX
},
1464 { "jae", Jb
, XX
, XX
},
1465 { "je", Jb
, XX
, XX
},
1466 { "jne", Jb
, XX
, XX
},
1467 { "jbe", Jb
, XX
, XX
},
1468 { "ja", Jb
, XX
, XX
},
1470 { "js", Jb
, XX
, XX
},
1471 { "jns", Jb
, XX
, XX
},
1472 { "jp", Jb
, XX
, XX
},
1473 { "jnp", Jb
, XX
, XX
},
1474 { "jl", Jb
, XX
, XX
},
1475 { "jge", Jb
, XX
, XX
},
1476 { "jle", Jb
, XX
, XX
},
1477 { "jg", Jb
, XX
, XX
},
1481 { "(bad)", XX
, XX
, XX
},
1483 { "test", Eb
, Gb
, XX
},
1484 { "test", Ev
, Gv
, XX
},
1485 { "xchg", Eb
, Gb
, XX
},
1486 { "xchg", Ev
, Gv
, XX
},
1488 { "mov", Eb
, Gb
, XX
},
1489 { "mov", Ev
, Gv
, XX
},
1490 { "mov", Gb
, Eb
, XX
},
1491 { "mov", Gv
, Ev
, XX
},
1492 { "mov", Ev
, Sw
, XX
},
1493 { "lea", Gv
, M
, XX
},
1494 { "mov", Sw
, Ev
, XX
},
1495 { "pop", Ev
, XX
, XX
},
1497 { "nop", XX
, XX
, XX
},
1498 /* FIXME: NOP with REPz prefix is called PAUSE. */
1499 { "xchg", RMeCX
, eAX
, XX
},
1500 { "xchg", RMeDX
, eAX
, XX
},
1501 { "xchg", RMeBX
, eAX
, XX
},
1502 { "xchg", RMeSP
, eAX
, XX
},
1503 { "xchg", RMeBP
, eAX
, XX
},
1504 { "xchg", RMeSI
, eAX
, XX
},
1505 { "xchg", RMeDI
, eAX
, XX
},
1507 { "cW", XX
, XX
, XX
}, /* cwde and cbw */
1508 { "cR", XX
, XX
, XX
}, /* cdq and cwd */
1509 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1510 { "(bad)", XX
, XX
, XX
}, /* fwait */
1511 { "pushf", XX
, XX
, XX
},
1512 { "popf", XX
, XX
, XX
},
1513 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1514 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1516 { "mov", AL
, Ob
, XX
},
1517 { "mov", eAX
, Ov
, XX
},
1518 { "mov", Ob
, AL
, XX
},
1519 { "mov", Ov
, eAX
, XX
},
1520 { "movs", Yb
, Xb
, XX
},
1521 { "movs", Yv
, Xv
, XX
},
1522 { "cmps", Xb
, Yb
, XX
},
1523 { "cmps", Xv
, Yv
, XX
},
1525 { "test", AL
, Ib
, XX
},
1526 { "test", eAX
, Iv
, XX
},
1527 { "stos", Yb
, AL
, XX
},
1528 { "stos", Yv
, eAX
, XX
},
1529 { "lods", AL
, Xb
, XX
},
1530 { "lods", eAX
, Xv
, XX
},
1531 { "scas", AL
, Yb
, XX
},
1532 { "scas", eAX
, Yv
, XX
},
1534 { "mov", RMAL
, Ib
, XX
},
1535 { "mov", RMCL
, Ib
, XX
},
1536 { "mov", RMDL
, Ib
, XX
},
1537 { "mov", RMBL
, Ib
, XX
},
1538 { "mov", RMAH
, Ib
, XX
},
1539 { "mov", RMCH
, Ib
, XX
},
1540 { "mov", RMDH
, Ib
, XX
},
1541 { "mov", RMBH
, Ib
, XX
},
1543 { "mov", RMeAX
, Iv
, XX
},
1544 { "mov", RMeCX
, Iv
, XX
},
1545 { "mov", RMeDX
, Iv
, XX
},
1546 { "mov", RMeBX
, Iv
, XX
},
1547 { "mov", RMeSP
, Iv
, XX
},
1548 { "mov", RMeBP
, Iv
, XX
},
1549 { "mov", RMeSI
, Iv
, XX
},
1550 { "mov", RMeDI
, Iv
, XX
},
1554 { "ret", Iw
, XX
, XX
},
1555 { "ret", XX
, XX
, XX
},
1556 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1557 { "lds", Gv
, Mp
, XX
},
1558 { "mov", Eb
, Ib
, XX
},
1559 { "mov", Ev
, Iv
, XX
},
1561 { "enter", Iw
, Ib
, XX
},
1562 { "leave", XX
, XX
, XX
},
1563 { "lret", Iw
, XX
, XX
},
1564 { "lret", XX
, XX
, XX
},
1565 { "int3", XX
, XX
, XX
},
1566 { "int", Ib
, XX
, XX
},
1567 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1568 { "iret", XX
, XX
, XX
},
1574 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1575 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1576 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1577 { "xlat", DSBX
, XX
, XX
},
1588 { "loopne", Jb
, XX
, XX
},
1589 { "loope", Jb
, XX
, XX
},
1590 { "loop", Jb
, XX
, XX
},
1591 { "jEcxz", Jb
, XX
, XX
},
1592 { "in", AL
, Ib
, XX
},
1593 { "in", eAX
, Ib
, XX
},
1594 { "out", Ib
, AL
, XX
},
1595 { "out", Ib
, eAX
, XX
},
1597 { "call", Jv
, XX
, XX
},
1598 { "jmp", Jv
, XX
, XX
},
1599 { "(bad)", XX
, XX
, XX
}, /* Reserved. */
1600 { "jmp", Jb
, XX
, XX
},
1601 { "in", AL
, indirDX
, XX
},
1602 { "in", eAX
, indirDX
, XX
},
1603 { "out", indirDX
, AL
, XX
},
1604 { "out", indirDX
, eAX
, XX
},
1606 { "(bad)", XX
, XX
, XX
}, /* lock prefix */
1607 { "(bad)", XX
, XX
, XX
},
1608 { "(bad)", XX
, XX
, XX
}, /* repne */
1609 { "(bad)", XX
, XX
, XX
}, /* repz */
1610 { "hlt", XX
, XX
, XX
},
1611 { "cmc", XX
, XX
, XX
},
1615 { "clc", XX
, XX
, XX
},
1616 { "stc", XX
, XX
, XX
},
1617 { "cli", XX
, XX
, XX
},
1618 { "sti", XX
, XX
, XX
},
1619 { "cld", XX
, XX
, XX
},
1620 { "std", XX
, XX
, XX
},
1625 static const struct dis386 dis386_twobyte_att
[] = {
1629 { "larS", Gv
, Ew
, XX
},
1630 { "lslS", Gv
, Ew
, XX
},
1631 { "(bad)", XX
, XX
, XX
},
1632 { "syscall", XX
, XX
, XX
},
1633 { "clts", XX
, XX
, XX
},
1634 { "sysretP", XX
, XX
, XX
},
1636 { "invd", XX
, XX
, XX
},
1637 { "wbinvd", XX
, XX
, XX
},
1638 { "(bad)", XX
, XX
, XX
},
1639 { "ud2a", XX
, XX
, XX
},
1640 { "(bad)", XX
, XX
, XX
},
1642 { "femms", XX
, XX
, XX
},
1643 { "", MX
, EM
, OPSUF
}, /* See OP_3DNowSuffix */
1647 { "movlpX", XM
, EX
, SIMD_Fixup
, 'h' }, /* really only 2 operands */
1648 { "movlpX", EX
, XM
, SIMD_Fixup
, 'h' },
1649 { "unpcklpX", XM
, EX
, XX
},
1650 { "unpckhpX", XM
, EX
, XX
},
1651 { "movhpX", XM
, EX
, SIMD_Fixup
, 'l' },
1652 { "movhpX", EX
, XM
, SIMD_Fixup
, 'l' },
1655 { "(bad)", XX
, XX
, XX
},
1656 { "(bad)", XX
, XX
, XX
},
1657 { "(bad)", XX
, XX
, XX
},
1658 { "(bad)", XX
, XX
, XX
},
1659 { "(bad)", XX
, XX
, XX
},
1660 { "(bad)", XX
, XX
, XX
},
1661 { "(bad)", XX
, XX
, XX
},
1663 /* these are all backward in appendix A of the intel book */
1664 { "movL", Rm
, Cm
, XX
},
1665 { "movL", Rm
, Dm
, XX
},
1666 { "movL", Cm
, Rm
, XX
},
1667 { "movL", Dm
, Rm
, XX
},
1668 { "movL", Rd
, Td
, XX
},
1669 { "(bad)", XX
, XX
, XX
},
1670 { "movL", Td
, Rd
, XX
},
1671 { "(bad)", XX
, XX
, XX
},
1673 { "movapX", XM
, EX
, XX
},
1674 { "movapX", EX
, XM
, XX
},
1676 { "movntpX", Ev
, XM
, XX
},
1679 { "ucomisX", XM
,EX
, XX
},
1680 { "comisX", XM
,EX
, XX
},
1682 { "wrmsr", XX
, XX
, XX
},
1683 { "rdtsc", XX
, XX
, XX
},
1684 { "rdmsr", XX
, XX
, XX
},
1685 { "rdpmc", XX
, XX
, XX
},
1686 { "sysenter", XX
, XX
, XX
},
1687 { "sysexit", XX
, XX
, XX
},
1688 { "(bad)", XX
, XX
, XX
},
1689 { "(bad)", XX
, XX
, XX
},
1691 { "(bad)", XX
, XX
, XX
},
1692 { "(bad)", XX
, XX
, XX
},
1693 { "(bad)", XX
, XX
, XX
},
1694 { "(bad)", XX
, XX
, XX
},
1695 { "(bad)", XX
, XX
, XX
},
1696 { "(bad)", XX
, XX
, XX
},
1697 { "(bad)", XX
, XX
, XX
},
1698 { "(bad)", XX
, XX
, XX
},
1700 { "cmovo", Gv
, Ev
, XX
},
1701 { "cmovno", Gv
, Ev
, XX
},
1702 { "cmovb", Gv
, Ev
, XX
},
1703 { "cmovae", Gv
, Ev
, XX
},
1704 { "cmove", Gv
, Ev
, XX
},
1705 { "cmovne", Gv
, Ev
, XX
},
1706 { "cmovbe", Gv
, Ev
, XX
},
1707 { "cmova", Gv
, Ev
, XX
},
1709 { "cmovs", Gv
, Ev
, XX
},
1710 { "cmovns", Gv
, Ev
, XX
},
1711 { "cmovp", Gv
, Ev
, XX
},
1712 { "cmovnp", Gv
, Ev
, XX
},
1713 { "cmovl", Gv
, Ev
, XX
},
1714 { "cmovge", Gv
, Ev
, XX
},
1715 { "cmovle", Gv
, Ev
, XX
},
1716 { "cmovg", Gv
, Ev
, XX
},
1718 { "movmskpX", Gd
, XS
, XX
},
1722 { "andpX", XM
, EX
, XX
},
1723 { "andnpX", XM
, EX
, XX
},
1724 { "orpX", XM
, EX
, XX
},
1725 { "xorpX", XM
, EX
, XX
},
1736 { "punpcklbw", MX
, EM
, XX
},
1737 { "punpcklwd", MX
, EM
, XX
},
1738 { "punpckldq", MX
, EM
, XX
},
1739 { "packsswb", MX
, EM
, XX
},
1740 { "pcmpgtb", MX
, EM
, XX
},
1741 { "pcmpgtw", MX
, EM
, XX
},
1742 { "pcmpgtd", MX
, EM
, XX
},
1743 { "packuswb", MX
, EM
, XX
},
1745 { "punpckhbw", MX
, EM
, XX
},
1746 { "punpckhwd", MX
, EM
, XX
},
1747 { "punpckhdq", MX
, EM
, XX
},
1748 { "packssdw", MX
, EM
, XX
},
1751 { "movd", MX
, Ed
, XX
},
1758 { "pcmpeqb", MX
, EM
, XX
},
1759 { "pcmpeqw", MX
, EM
, XX
},
1760 { "pcmpeqd", MX
, EM
, XX
},
1761 { "emms", XX
, XX
, XX
},
1763 { "(bad)", XX
, XX
, XX
},
1764 { "(bad)", XX
, XX
, XX
},
1765 { "(bad)", XX
, XX
, XX
},
1766 { "(bad)", XX
, XX
, XX
},
1767 { "(bad)", XX
, XX
, XX
},
1768 { "(bad)", XX
, XX
, XX
},
1772 { "jo", Jv
, cond_jump_flag
, XX
},
1773 { "jno", Jv
, cond_jump_flag
, XX
},
1774 { "jb", Jv
, cond_jump_flag
, XX
},
1775 { "jae", Jv
, cond_jump_flag
, XX
},
1776 { "je", Jv
, cond_jump_flag
, XX
},
1777 { "jne", Jv
, cond_jump_flag
, XX
},
1778 { "jbe", Jv
, cond_jump_flag
, XX
},
1779 { "ja", Jv
, cond_jump_flag
, XX
},
1781 { "js", Jv
, cond_jump_flag
, XX
},
1782 { "jns", Jv
, cond_jump_flag
, XX
},
1783 { "jp", Jv
, cond_jump_flag
, XX
},
1784 { "jnp", Jv
, cond_jump_flag
, XX
},
1785 { "jl", Jv
, cond_jump_flag
, XX
},
1786 { "jge", Jv
, cond_jump_flag
, XX
},
1787 { "jle", Jv
, cond_jump_flag
, XX
},
1788 { "jg", Jv
, cond_jump_flag
, XX
},
1790 { "seto", Eb
, XX
, XX
},
1791 { "setno", Eb
, XX
, XX
},
1792 { "setb", Eb
, XX
, XX
},
1793 { "setae", Eb
, XX
, XX
},
1794 { "sete", Eb
, XX
, XX
},
1795 { "setne", Eb
, XX
, XX
},
1796 { "setbe", Eb
, XX
, XX
},
1797 { "seta", Eb
, XX
, XX
},
1799 { "sets", Eb
, XX
, XX
},
1800 { "setns", Eb
, XX
, XX
},
1801 { "setp", Eb
, XX
, XX
},
1802 { "setnp", Eb
, XX
, XX
},
1803 { "setl", Eb
, XX
, XX
},
1804 { "setge", Eb
, XX
, XX
},
1805 { "setle", Eb
, XX
, XX
},
1806 { "setg", Eb
, XX
, XX
},
1808 { "pushI", fs
, XX
, XX
},
1809 { "popI", fs
, XX
, XX
},
1810 { "cpuid", XX
, XX
, XX
},
1811 { "btS", Ev
, Gv
, XX
},
1812 { "shldS", Ev
, Gv
, Ib
},
1813 { "shldS", Ev
, Gv
, CL
},
1814 { "(bad)", XX
, XX
, XX
},
1815 { "(bad)", XX
, XX
, XX
},
1817 { "pushI", gs
, XX
, XX
},
1818 { "popI", gs
, XX
, XX
},
1819 { "rsm", XX
, XX
, XX
},
1820 { "btsS", Ev
, Gv
, XX
},
1821 { "shrdS", Ev
, Gv
, Ib
},
1822 { "shrdS", Ev
, Gv
, CL
},
1824 { "imulS", Gv
, Ev
, XX
},
1826 { "cmpxchgB", Eb
, Gb
, XX
},
1827 { "cmpxchgS", Ev
, Gv
, XX
},
1828 { "lssS", Gv
, Mp
, XX
},
1829 { "btrS", Ev
, Gv
, XX
},
1830 { "lfsS", Gv
, Mp
, XX
},
1831 { "lgsS", Gv
, Mp
, XX
},
1832 { "movzbR", Gv
, Eb
, XX
},
1833 { "movzwR", Gv
, Ew
, XX
}, /* yes, there really is movzww ! */
1835 { "(bad)", XX
, XX
, XX
},
1836 { "ud2b", XX
, XX
, XX
},
1838 { "btcS", Ev
, Gv
, XX
},
1839 { "bsfS", Gv
, Ev
, XX
},
1840 { "bsrS", Gv
, Ev
, XX
},
1841 { "movsbR", Gv
, Eb
, XX
},
1842 { "movswR", Gv
, Ew
, XX
}, /* yes, there really is movsww ! */
1844 { "xaddB", Eb
, Gb
, XX
},
1845 { "xaddS", Ev
, Gv
, XX
},
1847 { "movntiS", Ev
, Gv
, XX
},
1848 { "pinsrw", MX
, Ed
, Ib
},
1849 { "pextrw", Gd
, MS
, Ib
},
1850 { "shufpX", XM
, EX
, Ib
},
1853 { "bswap", RMeAX
, XX
, XX
}, /* bswap doesn't support 16 bit regs */
1854 { "bswap", RMeCX
, XX
, XX
},
1855 { "bswap", RMeDX
, XX
, XX
},
1856 { "bswap", RMeBX
, XX
, XX
},
1857 { "bswap", RMeSP
, XX
, XX
},
1858 { "bswap", RMeBP
, XX
, XX
},
1859 { "bswap", RMeSI
, XX
, XX
},
1860 { "bswap", RMeDI
, XX
, XX
},
1862 { "(bad)", XX
, XX
, XX
},
1863 { "psrlw", MX
, EM
, XX
},
1864 { "psrld", MX
, EM
, XX
},
1865 { "psrlq", MX
, EM
, XX
},
1866 { "paddq", MX
, EM
, XX
},
1867 { "pmullw", MX
, EM
, XX
},
1869 { "pmovmskb", Gd
, MS
, XX
},
1871 { "psubusb", MX
, EM
, XX
},
1872 { "psubusw", MX
, EM
, XX
},
1873 { "pminub", MX
, EM
, XX
},
1874 { "pand", MX
, EM
, XX
},
1875 { "paddusb", MX
, EM
, XX
},
1876 { "paddusw", MX
, EM
, XX
},
1877 { "pmaxub", MX
, EM
, XX
},
1878 { "pandn", MX
, EM
, XX
},
1880 { "pavgb", MX
, EM
, XX
},
1881 { "psraw", MX
, EM
, XX
},
1882 { "psrad", MX
, EM
, XX
},
1883 { "pavgw", MX
, EM
, XX
},
1884 { "pmulhuw", MX
, EM
, XX
},
1885 { "pmulhw", MX
, EM
, XX
},
1889 { "psubsb", MX
, EM
, XX
},
1890 { "psubsw", MX
, EM
, XX
},
1891 { "pminsw", MX
, EM
, XX
},
1892 { "por", MX
, EM
, XX
},
1893 { "paddsb", MX
, EM
, XX
},
1894 { "paddsw", MX
, EM
, XX
},
1895 { "pmaxsw", MX
, EM
, XX
},
1896 { "pxor", MX
, EM
, XX
},
1898 { "(bad)", XX
, XX
, XX
},
1899 { "psllw", MX
, EM
, XX
},
1900 { "pslld", MX
, EM
, XX
},
1901 { "psllq", MX
, EM
, XX
},
1902 { "pmuludq", MX
, EM
, XX
},
1903 { "pmaddwd", MX
, EM
, XX
},
1904 { "psadbw", MX
, EM
, XX
},
1907 { "psubb", MX
, EM
, XX
},
1908 { "psubw", MX
, EM
, XX
},
1909 { "psubd", MX
, EM
, XX
},
1910 { "psubq", MX
, EM
, XX
},
1911 { "paddb", MX
, EM
, XX
},
1912 { "paddw", MX
, EM
, XX
},
1913 { "paddd", MX
, EM
, XX
},
1914 { "(bad)", XX
, XX
, XX
}
1917 static const struct dis386 dis386_twobyte_intel
[] = {
1921 { "lar", Gv
, Ew
, XX
},
1922 { "lsl", Gv
, Ew
, XX
},
1923 { "(bad)", XX
, XX
, XX
},
1924 { "syscall", XX
, XX
, XX
},
1925 { "clts", XX
, XX
, XX
},
1926 { "sysretP", XX
, XX
, XX
},
1928 { "invd", XX
, XX
, XX
},
1929 { "wbinvd", XX
, XX
, XX
},
1930 { "(bad)", XX
, XX
, XX
},
1931 { "ud2a", XX
, XX
, XX
},
1932 { "(bad)", XX
, XX
, XX
},
1934 { "femms" , XX
, XX
, XX
},
1935 { "", MX
, EM
, OPSUF
}, /* See OP_3DNowSuffix */
1939 { "movlpX", XM
, EX
, SIMD_Fixup
, 'h' }, /* really only 2 operands */
1940 { "movlpX", EX
, XM
, SIMD_Fixup
, 'h' },
1941 { "unpcklpX", XM
, EX
, XX
},
1942 { "unpckhpX", XM
, EX
, XX
},
1943 { "movhpX", XM
, EX
, SIMD_Fixup
, 'l' },
1944 { "movhpX", EX
, XM
, SIMD_Fixup
, 'l' },
1947 { "(bad)", XX
, XX
, XX
},
1948 { "(bad)", XX
, XX
, XX
},
1949 { "(bad)", XX
, XX
, XX
},
1950 { "(bad)", XX
, XX
, XX
},
1951 { "(bad)", XX
, XX
, XX
},
1952 { "(bad)", XX
, XX
, XX
},
1953 { "(bad)", XX
, XX
, XX
},
1955 /* these are all backward in appendix A of the intel book */
1956 { "mov", Rm
, Cm
, XX
},
1957 { "mov", Rm
, Dm
, XX
},
1958 { "mov", Cm
, Rm
, XX
},
1959 { "mov", Dm
, Rm
, XX
},
1960 { "mov", Rd
, Td
, XX
},
1961 { "(bad)", XX
, XX
, XX
},
1962 { "mov", Td
, Rd
, XX
},
1963 { "(bad)", XX
, XX
, XX
},
1965 { "movapX", XM
, EX
, XX
},
1966 { "movapX", EX
, XM
, XX
},
1968 { "movntpX", Ev
, XM
, XX
},
1971 { "ucomisX", XM
,EX
, XX
},
1972 { "comisX", XM
,EX
, XX
},
1974 { "wrmsr", XX
, XX
, XX
},
1975 { "rdtsc", XX
, XX
, XX
},
1976 { "rdmsr", XX
, XX
, XX
},
1977 { "rdpmc", XX
, XX
, XX
},
1978 { "sysenter", XX
, XX
, XX
},
1979 { "sysexit", XX
, XX
, XX
},
1980 { "(bad)", XX
, XX
, XX
},
1981 { "(bad)", XX
, XX
, XX
},
1983 { "(bad)", XX
, XX
, XX
},
1984 { "(bad)", XX
, XX
, XX
},
1985 { "(bad)", XX
, XX
, XX
},
1986 { "(bad)", XX
, XX
, XX
},
1987 { "(bad)", XX
, XX
, XX
},
1988 { "(bad)", XX
, XX
, XX
},
1989 { "(bad)", XX
, XX
, XX
},
1990 { "(bad)", XX
, XX
, XX
},
1992 { "cmovo", Gv
, Ev
, XX
},
1993 { "cmovno", Gv
, Ev
, XX
},
1994 { "cmovb", Gv
, Ev
, XX
},
1995 { "cmovae", Gv
, Ev
, XX
},
1996 { "cmove", Gv
, Ev
, XX
},
1997 { "cmovne", Gv
, Ev
, XX
},
1998 { "cmovbe", Gv
, Ev
, XX
},
1999 { "cmova", Gv
, Ev
, XX
},
2001 { "cmovs", Gv
, Ev
, XX
},
2002 { "cmovns", Gv
, Ev
, XX
},
2003 { "cmovp", Gv
, Ev
, XX
},
2004 { "cmovnp", Gv
, Ev
, XX
},
2005 { "cmovl", Gv
, Ev
, XX
},
2006 { "cmovge", Gv
, Ev
, XX
},
2007 { "cmovle", Gv
, Ev
, XX
},
2008 { "cmovg", Gv
, Ev
, XX
},
2010 { "movmskpX", Gd
, XS
, XX
},
2014 { "andpX", XM
, EX
, XX
},
2015 { "andnpX", XM
, EX
, XX
},
2016 { "orpX", XM
, EX
, XX
},
2017 { "xorpX", XM
, EX
, XX
},
2028 { "punpcklbw", MX
, EM
, XX
},
2029 { "punpcklwd", MX
, EM
, XX
},
2030 { "punpckldq", MX
, EM
, XX
},
2031 { "packsswb", MX
, EM
, XX
},
2032 { "pcmpgtb", MX
, EM
, XX
},
2033 { "pcmpgtw", MX
, EM
, XX
},
2034 { "pcmpgtd", MX
, EM
, XX
},
2035 { "packuswb", MX
, EM
, XX
},
2037 { "punpckhbw", MX
, EM
, XX
},
2038 { "punpckhwd", MX
, EM
, XX
},
2039 { "punpckhdq", MX
, EM
, XX
},
2040 { "packssdw", MX
, EM
, XX
},
2043 { "movd", MX
, Ed
, XX
},
2050 { "pcmpeqb", MX
, EM
, XX
},
2051 { "pcmpeqw", MX
, EM
, XX
},
2052 { "pcmpeqd", MX
, EM
, XX
},
2053 { "emms", XX
, XX
, XX
},
2055 { "(bad)", XX
, XX
, XX
},
2056 { "(bad)", XX
, XX
, XX
},
2057 { "(bad)", XX
, XX
, XX
},
2058 { "(bad)", XX
, XX
, XX
},
2059 { "(bad)", XX
, XX
, XX
},
2060 { "(bad)", XX
, XX
, XX
},
2064 { "jo", Jv
, XX
, XX
},
2065 { "jno", Jv
, XX
, XX
},
2066 { "jb", Jv
, XX
, XX
},
2067 { "jae", Jv
, XX
, XX
},
2068 { "je", Jv
, XX
, XX
},
2069 { "jne", Jv
, XX
, XX
},
2070 { "jbe", Jv
, XX
, XX
},
2071 { "ja", Jv
, XX
, XX
},
2073 { "js", Jv
, XX
, XX
},
2074 { "jns", Jv
, XX
, XX
},
2075 { "jp", Jv
, XX
, XX
},
2076 { "jnp", Jv
, XX
, XX
},
2077 { "jl", Jv
, XX
, XX
},
2078 { "jge", Jv
, XX
, XX
},
2079 { "jle", Jv
, XX
, XX
},
2080 { "jg", Jv
, XX
, XX
},
2082 { "seto", Eb
, XX
, XX
},
2083 { "setno", Eb
, XX
, XX
},
2084 { "setb", Eb
, XX
, XX
},
2085 { "setae", Eb
, XX
, XX
},
2086 { "sete", Eb
, XX
, XX
},
2087 { "setne", Eb
, XX
, XX
},
2088 { "setbe", Eb
, XX
, XX
},
2089 { "seta", Eb
, XX
, XX
},
2091 { "sets", Eb
, XX
, XX
},
2092 { "setns", Eb
, XX
, XX
},
2093 { "setp", Eb
, XX
, XX
},
2094 { "setnp", Eb
, XX
, XX
},
2095 { "setl", Eb
, XX
, XX
},
2096 { "setge", Eb
, XX
, XX
},
2097 { "setle", Eb
, XX
, XX
},
2098 { "setg", Eb
, XX
, XX
},
2100 { "push", fs
, XX
, XX
},
2101 { "pop", fs
, XX
, XX
},
2102 { "cpuid", XX
, XX
, XX
},
2103 { "bt", Ev
, Gv
, XX
},
2104 { "shld", Ev
, Gv
, Ib
},
2105 { "shld", Ev
, Gv
, CL
},
2106 { "(bad)", XX
, XX
, XX
},
2107 { "(bad)", XX
, XX
, XX
},
2109 { "push", gs
, XX
, XX
},
2110 { "pop", gs
, XX
, XX
},
2111 { "rsm" , XX
, XX
, XX
},
2112 { "bts", Ev
, Gv
, XX
},
2113 { "shrd", Ev
, Gv
, Ib
},
2114 { "shrd", Ev
, Gv
, CL
},
2116 { "imul", Gv
, Ev
, XX
},
2118 { "cmpxchg", Eb
, Gb
, XX
},
2119 { "cmpxchg", Ev
, Gv
, XX
},
2120 { "lss", Gv
, Mp
, XX
},
2121 { "btr", Ev
, Gv
, XX
},
2122 { "lfs", Gv
, Mp
, XX
},
2123 { "lgs", Gv
, Mp
, XX
},
2124 { "movzx", Gv
, Eb
, XX
},
2125 { "movzx", Gv
, Ew
, XX
},
2127 { "(bad)", XX
, XX
, XX
},
2128 { "ud2b", XX
, XX
, XX
},
2130 { "btc", Ev
, Gv
, XX
},
2131 { "bsf", Gv
, Ev
, XX
},
2132 { "bsr", Gv
, Ev
, XX
},
2133 { "movsx", Gv
, Eb
, XX
},
2134 { "movsx", Gv
, Ew
, XX
},
2136 { "xadd", Eb
, Gb
, XX
},
2137 { "xadd", Ev
, Gv
, XX
},
2139 { "movnti", Ev
, Gv
, XX
},
2140 { "pinsrw", MX
, Ed
, Ib
},
2141 { "pextrw", Gd
, MS
, Ib
},
2142 { "shufpX", XM
, EX
, Ib
},
2145 { "bswap", RMeAX
, XX
, XX
}, /* bswap doesn't support 16 bit regs */
2146 { "bswap", RMeCX
, XX
, XX
},
2147 { "bswap", RMeDX
, XX
, XX
},
2148 { "bswap", RMeBX
, XX
, XX
},
2149 { "bswap", RMeSP
, XX
, XX
},
2150 { "bswap", RMeBP
, XX
, XX
},
2151 { "bswap", RMeSI
, XX
, XX
},
2152 { "bswap", RMeDI
, XX
, XX
},
2154 { "(bad)", XX
, XX
, XX
},
2155 { "psrlw", MX
, EM
, XX
},
2156 { "psrld", MX
, EM
, XX
},
2157 { "psrlq", MX
, EM
, XX
},
2158 { "paddq", MX
, EM
, XX
},
2159 { "pmullw", MX
, EM
, XX
},
2161 { "pmovmskb", Gd
, MS
, XX
},
2163 { "psubusb", MX
, EM
, XX
},
2164 { "psubusw", MX
, EM
, XX
},
2165 { "pminub", MX
, EM
, XX
},
2166 { "pand", MX
, EM
, XX
},
2167 { "paddusb", MX
, EM
, XX
},
2168 { "paddusw", MX
, EM
, XX
},
2169 { "pmaxub", MX
, EM
, XX
},
2170 { "pandn", MX
, EM
, XX
},
2172 { "pavgb", MX
, EM
, XX
},
2173 { "psraw", MX
, EM
, XX
},
2174 { "psrad", MX
, EM
, XX
},
2175 { "pavgw", MX
, EM
, XX
},
2176 { "pmulhuw", MX
, EM
, XX
},
2177 { "pmulhw", MX
, EM
, XX
},
2181 { "psubsb", MX
, EM
, XX
},
2182 { "psubsw", MX
, EM
, XX
},
2183 { "pminsw", MX
, EM
, XX
},
2184 { "por", MX
, EM
, XX
},
2185 { "paddsb", MX
, EM
, XX
},
2186 { "paddsw", MX
, EM
, XX
},
2187 { "pmaxsw", MX
, EM
, XX
},
2188 { "pxor", MX
, EM
, XX
},
2190 { "(bad)", XX
, XX
, XX
},
2191 { "psllw", MX
, EM
, XX
},
2192 { "pslld", MX
, EM
, XX
},
2193 { "psllq", MX
, EM
, XX
},
2194 { "pmuludq", MX
, EM
, XX
},
2195 { "pmaddwd", MX
, EM
, XX
},
2196 { "psadbw", MX
, EM
, XX
},
2199 { "psubb", MX
, EM
, XX
},
2200 { "psubw", MX
, EM
, XX
},
2201 { "psubd", MX
, EM
, XX
},
2202 { "psubq", MX
, EM
, XX
},
2203 { "paddb", MX
, EM
, XX
},
2204 { "paddw", MX
, EM
, XX
},
2205 { "paddd", MX
, EM
, XX
},
2206 { "(bad)", XX
, XX
, XX
}
2209 static const unsigned char onebyte_has_modrm
[256] = {
2210 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2211 /* ------------------------------- */
2212 /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
2213 /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
2214 /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
2215 /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
2216 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
2217 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
2218 /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
2219 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
2220 /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
2221 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
2222 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
2223 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
2224 /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
2225 /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
2226 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
2227 /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 /* f0 */
2228 /* ------------------------------- */
2229 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2232 static const unsigned char twobyte_has_modrm
[256] = {
2233 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2234 /* ------------------------------- */
2235 /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
2236 /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
2237 /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
2238 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
2239 /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
2240 /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
2241 /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
2242 /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
2243 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
2244 /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
2245 /* a0 */ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* af */
2246 /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
2247 /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
2248 /* d0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
2249 /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
2250 /* f0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 /* ff */
2251 /* ------------------------------- */
2252 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2255 static const unsigned char twobyte_uses_SSE_prefix
[256] = {
2256 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2257 /* ------------------------------- */
2258 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
2259 /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
2260 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
2261 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
2262 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
2263 /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
2264 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
2265 /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
2266 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
2267 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
2268 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
2269 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
2270 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
2271 /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
2272 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
2273 /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 /* ff */
2274 /* ------------------------------- */
2275 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
2278 static char obuf
[100];
2280 static char scratchbuf
[100];
2281 static unsigned char *start_codep
;
2282 static unsigned char *insn_codep
;
2283 static unsigned char *codep
;
2284 static disassemble_info
*the_info
;
2288 static unsigned char need_modrm
;
2289 static void oappend
PARAMS ((const char *s
));
2291 /* If we are accessing mod/rm/reg without need_modrm set, then the
2292 values are stale. Hitting this abort likely indicates that you
2293 need to update onebyte_has_modrm or twobyte_has_modrm. */
2294 #define MODRM_CHECK if (!need_modrm) abort ()
2296 static const char *names64
[] = {
2297 "%rax","%rcx","%rdx","%rbx", "%rsp","%rbp","%rsi","%rdi",
2298 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
2300 static const char *names32
[] = {
2301 "%eax","%ecx","%edx","%ebx", "%esp","%ebp","%esi","%edi",
2302 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
2304 static const char *names16
[] = {
2305 "%ax","%cx","%dx","%bx","%sp","%bp","%si","%di",
2306 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
2308 static const char *names8
[] = {
2309 "%al","%cl","%dl","%bl","%ah","%ch","%dh","%bh",
2311 static const char *names8rex
[] = {
2312 "%al","%cl","%dl","%bl","%spl", "%bpl", "%sil", "%dil",
2313 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
2315 static const char *names_seg
[] = {
2316 "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
2318 static const char *index16
[] = {
2319 "%bx,%si","%bx,%di","%bp,%si","%bp,%di","%si","%di","%bp","%bx"
2322 static const struct dis386 grps
[][8] = {
2325 { "addA", Eb
, Ib
, XX
},
2326 { "orA", Eb
, Ib
, XX
},
2327 { "adcA", Eb
, Ib
, XX
},
2328 { "sbbA", Eb
, Ib
, XX
},
2329 { "andA", Eb
, Ib
, XX
},
2330 { "subA", Eb
, Ib
, XX
},
2331 { "xorA", Eb
, Ib
, XX
},
2332 { "cmpA", Eb
, Ib
, XX
}
2336 { "addQ", Ev
, Iv
, XX
},
2337 { "orQ", Ev
, Iv
, XX
},
2338 { "adcQ", Ev
, Iv
, XX
},
2339 { "sbbQ", Ev
, Iv
, XX
},
2340 { "andQ", Ev
, Iv
, XX
},
2341 { "subQ", Ev
, Iv
, XX
},
2342 { "xorQ", Ev
, Iv
, XX
},
2343 { "cmpQ", Ev
, Iv
, XX
}
2347 { "addQ", Ev
, sIb
, XX
},
2348 { "orQ", Ev
, sIb
, XX
},
2349 { "adcQ", Ev
, sIb
, XX
},
2350 { "sbbQ", Ev
, sIb
, XX
},
2351 { "andQ", Ev
, sIb
, XX
},
2352 { "subQ", Ev
, sIb
, XX
},
2353 { "xorQ", Ev
, sIb
, XX
},
2354 { "cmpQ", Ev
, sIb
, XX
}
2358 { "rolA", Eb
, Ib
, XX
},
2359 { "rorA", Eb
, Ib
, XX
},
2360 { "rclA", Eb
, Ib
, XX
},
2361 { "rcrA", Eb
, Ib
, XX
},
2362 { "shlA", Eb
, Ib
, XX
},
2363 { "shrA", Eb
, Ib
, XX
},
2364 { "(bad)", XX
, XX
, XX
},
2365 { "sarA", Eb
, Ib
, XX
},
2369 { "rolQ", Ev
, Ib
, XX
},
2370 { "rorQ", Ev
, Ib
, XX
},
2371 { "rclQ", Ev
, Ib
, XX
},
2372 { "rcrQ", Ev
, Ib
, XX
},
2373 { "shlQ", Ev
, Ib
, XX
},
2374 { "shrQ", Ev
, Ib
, XX
},
2375 { "(bad)", XX
, XX
, XX
},
2376 { "sarQ", Ev
, Ib
, XX
},
2380 { "rolA", Eb
, XX
, XX
},
2381 { "rorA", Eb
, XX
, XX
},
2382 { "rclA", Eb
, XX
, XX
},
2383 { "rcrA", Eb
, XX
, XX
},
2384 { "shlA", Eb
, XX
, XX
},
2385 { "shrA", Eb
, XX
, XX
},
2386 { "(bad)", XX
, XX
, XX
},
2387 { "sarA", Eb
, XX
, XX
},
2391 { "rolQ", Ev
, XX
, XX
},
2392 { "rorQ", Ev
, XX
, XX
},
2393 { "rclQ", Ev
, XX
, XX
},
2394 { "rcrQ", Ev
, XX
, XX
},
2395 { "shlQ", Ev
, XX
, XX
},
2396 { "shrQ", Ev
, XX
, XX
},
2397 { "(bad)", XX
, XX
, XX
},
2398 { "sarQ", Ev
, XX
, XX
},
2402 { "rolA", Eb
, CL
, XX
},
2403 { "rorA", Eb
, CL
, XX
},
2404 { "rclA", Eb
, CL
, XX
},
2405 { "rcrA", Eb
, CL
, XX
},
2406 { "shlA", Eb
, CL
, XX
},
2407 { "shrA", Eb
, CL
, XX
},
2408 { "(bad)", XX
, XX
, XX
},
2409 { "sarA", Eb
, CL
, XX
},
2413 { "rolQ", Ev
, CL
, XX
},
2414 { "rorQ", Ev
, CL
, XX
},
2415 { "rclQ", Ev
, CL
, XX
},
2416 { "rcrQ", Ev
, CL
, XX
},
2417 { "shlQ", Ev
, CL
, XX
},
2418 { "shrQ", Ev
, CL
, XX
},
2419 { "(bad)", XX
, XX
, XX
},
2420 { "sarQ", Ev
, CL
, XX
}
2424 { "testA", Eb
, Ib
, XX
},
2425 { "(bad)", Eb
, XX
, XX
},
2426 { "notA", Eb
, XX
, XX
},
2427 { "negA", Eb
, XX
, XX
},
2428 { "mulB", AL
, Eb
, XX
},
2429 { "imulB", AL
, Eb
, XX
},
2430 { "divB", AL
, Eb
, XX
},
2431 { "idivB", AL
, Eb
, XX
}
2435 { "testQ", Ev
, Iv
, XX
},
2436 { "(bad)", XX
, XX
, XX
},
2437 { "notQ", Ev
, XX
, XX
},
2438 { "negQ", Ev
, XX
, XX
},
2439 { "mulS", eAX
, Ev
, XX
},
2440 { "imulS", eAX
, Ev
, XX
},
2441 { "divS", eAX
, Ev
, XX
},
2442 { "idivS", eAX
, Ev
, XX
},
2446 { "incA", Eb
, XX
, XX
},
2447 { "decA", Eb
, XX
, XX
},
2448 { "(bad)", XX
, XX
, XX
},
2449 { "(bad)", XX
, XX
, XX
},
2450 { "(bad)", XX
, XX
, XX
},
2451 { "(bad)", XX
, XX
, XX
},
2452 { "(bad)", XX
, XX
, XX
},
2453 { "(bad)", XX
, XX
, XX
},
2457 { "incQ", Ev
, XX
, XX
},
2458 { "decQ", Ev
, XX
, XX
},
2459 { "callI", indirEv
, XX
, XX
},
2460 { "lcallI", indirEv
, XX
, XX
},
2461 { "jmpI", indirEv
, XX
, XX
},
2462 { "ljmpI", indirEv
, XX
, XX
},
2463 { "pushT", Ev
, XX
, XX
},
2464 { "(bad)", XX
, XX
, XX
},
2468 { "sldt", Ew
, XX
, XX
},
2469 { "str", Ew
, XX
, XX
},
2470 { "lldt", Ew
, XX
, XX
},
2471 { "ltr", Ew
, XX
, XX
},
2472 { "verr", Ew
, XX
, XX
},
2473 { "verw", Ew
, XX
, XX
},
2474 { "(bad)", XX
, XX
, XX
},
2475 { "(bad)", XX
, XX
, XX
}
2479 { "sgdt", Ew
, XX
, XX
},
2480 { "sidt", Ew
, XX
, XX
},
2481 { "lgdt", Ew
, XX
, XX
},
2482 { "lidt", Ew
, XX
, XX
},
2483 { "smsw", Ew
, XX
, XX
},
2484 { "(bad)", XX
, XX
, XX
},
2485 { "lmsw", Ew
, XX
, XX
},
2486 { "invlpg", Ew
, XX
, XX
},
2490 { "(bad)", XX
, XX
, XX
},
2491 { "(bad)", XX
, XX
, XX
},
2492 { "(bad)", XX
, XX
, XX
},
2493 { "(bad)", XX
, XX
, XX
},
2494 { "btQ", Ev
, Ib
, XX
},
2495 { "btsQ", Ev
, Ib
, XX
},
2496 { "btrQ", Ev
, Ib
, XX
},
2497 { "btcQ", Ev
, Ib
, XX
},
2501 { "(bad)", XX
, XX
, XX
},
2502 { "cmpxchg8b", Ev
, XX
, XX
},
2503 { "(bad)", XX
, XX
, XX
},
2504 { "(bad)", XX
, XX
, XX
},
2505 { "(bad)", XX
, XX
, XX
},
2506 { "(bad)", XX
, XX
, XX
},
2507 { "(bad)", XX
, XX
, XX
},
2508 { "(bad)", XX
, XX
, XX
},
2512 { "(bad)", XX
, XX
, XX
},
2513 { "(bad)", XX
, XX
, XX
},
2514 { "psrlw", MS
, Ib
, XX
},
2515 { "(bad)", XX
, XX
, XX
},
2516 { "psraw", MS
, Ib
, XX
},
2517 { "(bad)", XX
, XX
, XX
},
2518 { "psllw", MS
, Ib
, XX
},
2519 { "(bad)", XX
, XX
, XX
},
2523 { "(bad)", XX
, XX
, XX
},
2524 { "(bad)", XX
, XX
, XX
},
2525 { "psrld", MS
, Ib
, XX
},
2526 { "(bad)", XX
, XX
, XX
},
2527 { "psrad", MS
, Ib
, XX
},
2528 { "(bad)", XX
, XX
, XX
},
2529 { "pslld", MS
, Ib
, XX
},
2530 { "(bad)", XX
, XX
, XX
},
2534 { "(bad)", XX
, XX
, XX
},
2535 { "(bad)", XX
, XX
, XX
},
2536 { "psrlq", MS
, Ib
, XX
},
2537 { "psrldq", MS
, Ib
, XX
},
2538 { "(bad)", XX
, XX
, XX
},
2539 { "(bad)", XX
, XX
, XX
},
2540 { "psllq", MS
, Ib
, XX
},
2541 { "pslldq", MS
, Ib
, XX
},
2545 { "fxsave", Ev
, XX
, XX
},
2546 { "fxrstor", Ev
, XX
, XX
},
2547 { "ldmxcsr", Ev
, XX
, XX
},
2548 { "stmxcsr", Ev
, XX
, XX
},
2549 { "(bad)", XX
, XX
, XX
},
2550 { "lfence", None
, XX
, XX
},
2551 { "mfence", None
, XX
, XX
},
2552 { "sfence", None
, XX
, XX
},
2553 /* FIXME: the sfence with memory operand is clflush! */
2557 { "prefetchnta", Ev
, XX
, XX
},
2558 { "prefetcht0", Ev
, XX
, XX
},
2559 { "prefetcht1", Ev
, XX
, XX
},
2560 { "prefetcht2", Ev
, XX
, XX
},
2561 { "(bad)", XX
, XX
, XX
},
2562 { "(bad)", XX
, XX
, XX
},
2563 { "(bad)", XX
, XX
, XX
},
2564 { "(bad)", XX
, XX
, XX
},
2568 { "prefetch", Eb
, XX
, XX
},
2569 { "prefetchw", Eb
, XX
, XX
},
2570 { "(bad)", XX
, XX
, XX
},
2571 { "(bad)", XX
, XX
, XX
},
2572 { "(bad)", XX
, XX
, XX
},
2573 { "(bad)", XX
, XX
, XX
},
2574 { "(bad)", XX
, XX
, XX
},
2575 { "(bad)", XX
, XX
, XX
},
2580 static const struct dis386 prefix_user_table
[][4] = {
2583 { "addps", XM
, EX
, XX
},
2584 { "addss", XM
, EX
, XX
},
2585 { "addpd", XM
, EX
, XX
},
2586 { "addsd", XM
, EX
, XX
},
2590 { "", XM
, EX
, OPSIMD
}, /* See OP_SIMD_SUFFIX */
2591 { "", XM
, EX
, OPSIMD
},
2592 { "", XM
, EX
, OPSIMD
},
2593 { "", XM
, EX
, OPSIMD
},
2597 { "cvtpi2ps", XM
, EM
, XX
},
2598 { "cvtsi2ssY", XM
, Ev
, XX
},
2599 { "cvtpi2pd", XM
, EM
, XX
},
2600 { "cvtsi2sdY", XM
, Ev
, XX
},
2604 { "cvtps2pi", MX
, EX
, XX
},
2605 { "cvtss2siY", Gv
, EX
, XX
},
2606 { "cvtpd2pi", MX
, EX
, XX
},
2607 { "cvtsd2siY", Gv
, EX
, XX
},
2611 { "cvttps2pi", MX
, EX
, XX
},
2612 { "cvttss2siY", Gv
, EX
, XX
},
2613 { "cvttpd2pi", MX
, EX
, XX
},
2614 { "cvttsd2siY", Gv
, EX
, XX
},
2618 { "divps", XM
, EX
, XX
},
2619 { "divss", XM
, EX
, XX
},
2620 { "divpd", XM
, EX
, XX
},
2621 { "divsd", XM
, EX
, XX
},
2625 { "maxps", XM
, EX
, XX
},
2626 { "maxss", XM
, EX
, XX
},
2627 { "maxpd", XM
, EX
, XX
},
2628 { "maxsd", XM
, EX
, XX
},
2632 { "minps", XM
, EX
, XX
},
2633 { "minss", XM
, EX
, XX
},
2634 { "minpd", XM
, EX
, XX
},
2635 { "minsd", XM
, EX
, XX
},
2639 { "movups", XM
, EX
, XX
},
2640 { "movss", XM
, EX
, XX
},
2641 { "movupd", XM
, EX
, XX
},
2642 { "movsd", XM
, EX
, XX
},
2646 { "movups", EX
, XM
, XX
},
2647 { "movss", EX
, XM
, XX
},
2648 { "movupd", EX
, XM
, XX
},
2649 { "movsd", EX
, XM
, XX
},
2653 { "mulps", XM
, EX
, XX
},
2654 { "mulss", XM
, EX
, XX
},
2655 { "mulpd", XM
, EX
, XX
},
2656 { "mulsd", XM
, EX
, XX
},
2660 { "rcpps", XM
, EX
, XX
},
2661 { "rcpss", XM
, EX
, XX
},
2662 { "(bad)", XM
, EX
, XX
},
2663 { "(bad)", XM
, EX
, XX
},
2667 { "rsqrtps", XM
, EX
, XX
},
2668 { "rsqrtss", XM
, EX
, XX
},
2669 { "(bad)", XM
, EX
, XX
},
2670 { "(bad)", XM
, EX
, XX
},
2674 { "sqrtps", XM
, EX
, XX
},
2675 { "sqrtss", XM
, EX
, XX
},
2676 { "sqrtpd", XM
, EX
, XX
},
2677 { "sqrtsd", XM
, EX
, XX
},
2681 { "subps", XM
, EX
, XX
},
2682 { "subss", XM
, EX
, XX
},
2683 { "subpd", XM
, EX
, XX
},
2684 { "subsd", XM
, EX
, XX
},
2688 { "(bad)", XM
, EX
, XX
},
2689 { "cvtdq2pd", XM
, EX
, XX
},
2690 { "cvttpd2dq", XM
, EX
, XX
},
2691 { "cvtpd2dq", XM
, EX
, XX
},
2695 { "cvtdq2ps", XM
, EX
, XX
},
2696 { "cvttps2dq",XM
, EX
, XX
},
2697 { "cvtps2dq",XM
, EX
, XX
},
2698 { "(bad)", XM
, EX
, XX
},
2702 { "cvtps2pd", XM
, EX
, XX
},
2703 { "cvtss2sd", XM
, EX
, XX
},
2704 { "cvtpd2ps", XM
, EX
, XX
},
2705 { "cvtsd2ss", XM
, EX
, XX
},
2709 { "maskmovq", MX
, MS
, XX
},
2710 { "(bad)", XM
, EX
, XX
},
2711 { "maskmovdqu", XM
, EX
, XX
},
2712 { "(bad)", XM
, EX
, XX
},
2716 { "movq", MX
, EM
, XX
},
2717 { "movdqu", XM
, EX
, XX
},
2718 { "movdqa", XM
, EX
, XX
},
2719 { "(bad)", XM
, EX
, XX
},
2723 { "movq", EM
, MX
, XX
},
2724 { "movdqu", EX
, XM
, XX
},
2725 { "movdqa", EX
, XM
, XX
},
2726 { "(bad)", EX
, XM
, XX
},
2730 { "(bad)", EX
, XM
, XX
},
2731 { "movq2dq", XM
, MS
, XX
},
2732 { "movq", EX
, XM
, XX
},
2733 { "movdq2q", MX
, XS
, XX
},
2737 { "pshufw", MX
, EM
, Ib
},
2738 { "pshufhw", XM
, EX
, Ib
},
2739 { "pshufd", XM
, EX
, Ib
},
2740 { "pshuflw", XM
, EX
, Ib
},
2744 { "movd", Ed
, MX
, XX
},
2745 { "movq", XM
, EX
, XX
},
2746 { "movd", Ed
, XM
, XX
},
2747 { "(bad)", Ed
, XM
, XX
},
2751 { "(bad)", MX
, EX
, XX
},
2752 { "(bad)", XM
, EX
, XX
},
2753 { "punpckhqdq", XM
, EX
, XX
},
2754 { "(bad)", XM
, EX
, XX
},
2758 { "movntq", Ev
, MX
, XX
},
2759 { "(bad)", Ev
, XM
, XX
},
2760 { "movntdq", Ev
, XM
, XX
},
2761 { "(bad)", Ev
, XM
, XX
},
2765 { "(bad)", MX
, EX
, XX
},
2766 { "(bad)", XM
, EX
, XX
},
2767 { "punpcklqdq", XM
, EX
, XX
},
2768 { "(bad)", XM
, EX
, XX
},
2772 #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
2784 FETCH_DATA (the_info
, codep
+ 1);
2788 /* REX prefixes family. */
2811 prefixes
|= PREFIX_REPZ
;
2814 prefixes
|= PREFIX_REPNZ
;
2817 prefixes
|= PREFIX_LOCK
;
2820 prefixes
|= PREFIX_CS
;
2823 prefixes
|= PREFIX_SS
;
2826 prefixes
|= PREFIX_DS
;
2829 prefixes
|= PREFIX_ES
;
2832 prefixes
|= PREFIX_FS
;
2835 prefixes
|= PREFIX_GS
;
2838 prefixes
|= PREFIX_DATA
;
2841 prefixes
|= PREFIX_ADDR
;
2844 /* fwait is really an instruction. If there are prefixes
2845 before the fwait, they belong to the fwait, *not* to the
2846 following instruction. */
2849 prefixes
|= PREFIX_FWAIT
;
2853 prefixes
= PREFIX_FWAIT
;
2858 /* Rex is ignored when followed by another prefix. */
2861 oappend (prefix_name (rex
, 0));
2869 /* Return the name of the prefix byte PREF, or NULL if PREF is not a
2873 prefix_name (pref
, sizeflag
)
2879 /* REX prefixes family. */
2931 return (sizeflag
& DFLAG
) ? "data16" : "data32";
2933 return (sizeflag
& AFLAG
) ? "addr16" : "addr32";
2941 static char op1out
[100], op2out
[100], op3out
[100];
2942 static int op_ad
, op_index
[3];
2943 static unsigned int op_address
[3];
2944 static unsigned int op_riprel
[3];
2945 static bfd_vma start_pc
;
2949 * On the 386's of 1988, the maximum length of an instruction is 15 bytes.
2950 * (see topic "Redundant prefixes" in the "Differences from 8086"
2951 * section of the "Virtual 8086 Mode" chapter.)
2952 * 'pc' should be the address of this instruction, it will
2953 * be used to print the target address if this is a relative jump or call
2954 * The function returns the length of this instruction in bytes.
2957 static int print_insn_i386
2958 PARAMS ((bfd_vma pc
, disassemble_info
*info
));
2960 static char intel_syntax
;
2961 static char open_char
;
2962 static char close_char
;
2963 static char separator_char
;
2964 static char scale_char
;
2967 print_insn_i386_att (pc
, info
)
2969 disassemble_info
*info
;
2974 separator_char
= ',';
2977 return print_insn_i386 (pc
, info
);
2981 print_insn_i386_intel (pc
, info
)
2983 disassemble_info
*info
;
2988 separator_char
= '+';
2991 return print_insn_i386 (pc
, info
);
2995 print_insn_i386 (pc
, info
)
2997 disassemble_info
*info
;
2999 const struct dis386
*dp
;
3002 char *first
, *second
, *third
;
3004 unsigned char uses_SSE_prefix
;
3005 VOLATILE
int sizeflag
;
3006 VOLATILE
int orig_sizeflag
;
3008 struct dis_private priv
;
3009 bfd_byte
*inbuf
= priv
.the_buffer
;
3011 mode_64bit
= (info
->mach
== bfd_mach_x86_64_intel_syntax
3012 || info
->mach
== bfd_mach_x86_64
);
3014 if (info
->mach
== bfd_mach_i386_i386
3015 || info
->mach
== bfd_mach_x86_64
3016 || info
->mach
== bfd_mach_i386_i386_intel_syntax
3017 || info
->mach
== bfd_mach_x86_64_intel_syntax
)
3018 sizeflag
= AFLAG
|DFLAG
;
3019 else if (info
->mach
== bfd_mach_i386_i8086
)
3023 orig_sizeflag
= sizeflag
;
3025 /* The output looks better if we put 7 bytes on a line, since that
3026 puts most long word instructions on a single line. */
3027 info
->bytes_per_line
= 7;
3029 info
->private_data
= (PTR
) &priv
;
3030 priv
.max_fetched
= priv
.the_buffer
;
3031 priv
.insn_start
= pc
;
3038 op_index
[0] = op_index
[1] = op_index
[2] = -1;
3042 start_codep
= inbuf
;
3045 if (setjmp (priv
.bailout
) != 0)
3049 /* Getting here means we tried for data but didn't get it. That
3050 means we have an incomplete instruction of some sort. Just
3051 print the first byte as a prefix or a .byte pseudo-op. */
3054 name
= prefix_name (inbuf
[0], orig_sizeflag
);
3056 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3059 /* Just print the first byte as a .byte instruction. */
3060 (*info
->fprintf_func
) (info
->stream
, ".byte 0x%x",
3061 (unsigned int) inbuf
[0]);
3075 FETCH_DATA (info
, codep
+ 1);
3076 two_source_ops
= (*codep
== 0x62) || (*codep
== 0xc8);
3078 if ((prefixes
& PREFIX_FWAIT
)
3079 && ((*codep
< 0xd8) || (*codep
> 0xdf)))
3083 /* fwait not followed by floating point instruction. Print the
3084 first prefix, which is probably fwait itself. */
3085 name
= prefix_name (inbuf
[0], orig_sizeflag
);
3087 name
= INTERNAL_DISASSEMBLER_ERROR
;
3088 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3094 FETCH_DATA (info
, codep
+ 2);
3096 dp
= &dis386_twobyte_intel
[*++codep
];
3098 dp
= &dis386_twobyte_att
[*++codep
];
3099 need_modrm
= twobyte_has_modrm
[*codep
];
3100 uses_SSE_prefix
= twobyte_uses_SSE_prefix
[*codep
];
3106 dp
= &dis386_64_intel
[*codep
];
3108 dp
= &dis386_intel
[*codep
];
3111 dp
= &disx86_64_att
[*codep
];
3113 dp
= &dis386_att
[*codep
];
3114 need_modrm
= onebyte_has_modrm
[*codep
];
3115 uses_SSE_prefix
= 0;
3119 if (!uses_SSE_prefix
&& (prefixes
& PREFIX_REPZ
))
3122 used_prefixes
|= PREFIX_REPZ
;
3124 if (!uses_SSE_prefix
&& (prefixes
& PREFIX_REPNZ
))
3127 used_prefixes
|= PREFIX_REPNZ
;
3129 if (prefixes
& PREFIX_LOCK
)
3132 used_prefixes
|= PREFIX_LOCK
;
3135 if (prefixes
& PREFIX_ADDR
)
3138 if (dp
->bytemode2
!= loop_jcxz_mode
)
3140 if (sizeflag
& AFLAG
)
3141 oappend ("addr32 ");
3143 oappend ("addr16 ");
3144 used_prefixes
|= PREFIX_ADDR
;
3148 if (!uses_SSE_prefix
&& (prefixes
& PREFIX_DATA
))
3151 if (dp
->bytemode2
== cond_jump_mode
&& dp
->bytemode1
== v_mode
)
3153 if (sizeflag
& DFLAG
)
3154 oappend ("data32 ");
3156 oappend ("data16 ");
3157 used_prefixes
|= PREFIX_DATA
;
3161 if (dp
->bytemode2
== cond_jump_mode
|| dp
->bytemode2
== loop_jcxz_mode
)
3163 if ((prefixes
& (PREFIX_CS
| PREFIX_DS
)) == PREFIX_CS
)
3166 used_prefixes
|= PREFIX_CS
;
3168 if ((prefixes
& (PREFIX_CS
| PREFIX_DS
)) == PREFIX_DS
)
3171 used_prefixes
|= PREFIX_DS
;
3177 FETCH_DATA (info
, codep
+ 1);
3178 mod
= (*codep
>> 6) & 3;
3179 reg
= (*codep
>> 3) & 7;
3189 if (dp
->name
== NULL
&& dp
->bytemode1
== FLOATCODE
)
3196 if (dp
->name
== NULL
)
3198 switch(dp
->bytemode2
)
3201 dp
= &grps
[dp
->bytemode1
][reg
];
3203 case USE_PREFIX_USER_TABLE
:
3205 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
3206 if (prefixes
& PREFIX_REPZ
)
3210 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3211 if (prefixes
& PREFIX_DATA
)
3215 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
3216 if (prefixes
& PREFIX_REPNZ
)
3220 dp
= &prefix_user_table
[dp
->bytemode1
][index
];
3223 oappend (INTERNAL_DISASSEMBLER_ERROR
);
3228 putop (dp
->name
, sizeflag
);
3233 (*dp
->op1
)(dp
->bytemode1
, sizeflag
);
3238 (*dp
->op2
)(dp
->bytemode2
, sizeflag
);
3243 (*dp
->op3
)(dp
->bytemode3
, sizeflag
);
3246 /* See if any prefixes were not used. If so, print the first one
3247 separately. If we don't do this, we'll wind up printing an
3248 instruction stream which does not precisely correspond to the
3249 bytes we are disassembling. */
3250 if ((prefixes
& ~used_prefixes
) != 0)
3254 name
= prefix_name (inbuf
[0], orig_sizeflag
);
3256 name
= INTERNAL_DISASSEMBLER_ERROR
;
3257 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3260 if (rex
& ~rex_used
)
3263 name
= prefix_name (rex
| 0x40, orig_sizeflag
);
3265 name
= INTERNAL_DISASSEMBLER_ERROR
;
3266 (*info
->fprintf_func
) (info
->stream
, "%s ", name
);
3269 obufp
= obuf
+ strlen (obuf
);
3270 for (i
= strlen (obuf
); i
< 6; i
++)
3273 (*info
->fprintf_func
) (info
->stream
, "%s", obuf
);
3275 /* The enter and bound instructions are printed with operands in the same
3276 order as the intel book; everything else is printed in reverse order. */
3277 if (intel_syntax
|| two_source_ops
)
3282 op_ad
= op_index
[0];
3283 op_index
[0] = op_index
[2];
3284 op_index
[2] = op_ad
;
3295 if (op_index
[0] != -1 && !op_riprel
[0])
3296 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[0]], info
);
3298 (*info
->fprintf_func
) (info
->stream
, "%s", first
);
3304 (*info
->fprintf_func
) (info
->stream
, ",");
3305 if (op_index
[1] != -1 && !op_riprel
[1])
3306 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[1]], info
);
3308 (*info
->fprintf_func
) (info
->stream
, "%s", second
);
3314 (*info
->fprintf_func
) (info
->stream
, ",");
3315 if (op_index
[2] != -1 && !op_riprel
[2])
3316 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[2]], info
);
3318 (*info
->fprintf_func
) (info
->stream
, "%s", third
);
3320 for (i
= 0; i
< 3; i
++)
3321 if (op_index
[i
] != -1 && op_riprel
[i
])
3323 (*info
->fprintf_func
) (info
->stream
, " # ");
3324 (*info
->print_address_func
) ((bfd_vma
) (start_pc
+ codep
- start_codep
3325 + op_address
[op_index
[i
]]), info
);
3327 return codep
- inbuf
;
3330 static const char *float_mem_att
[] = {
3405 static const char *float_mem_intel
[] = {
3481 #define STi OP_STi, 0
3483 #define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
3484 #define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
3485 #define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
3486 #define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
3487 #define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
3488 #define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
3489 #define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
3490 #define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
3491 #define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
3493 static const struct dis386 float_reg
[][8] = {
3496 { "fadd", ST
, STi
, XX
},
3497 { "fmul", ST
, STi
, XX
},
3498 { "fcom", STi
, XX
, XX
},
3499 { "fcomp", STi
, XX
, XX
},
3500 { "fsub", ST
, STi
, XX
},
3501 { "fsubr", ST
, STi
, XX
},
3502 { "fdiv", ST
, STi
, XX
},
3503 { "fdivr", ST
, STi
, XX
},
3507 { "fld", STi
, XX
, XX
},
3508 { "fxch", STi
, XX
, XX
},
3510 { "(bad)", XX
, XX
, XX
},
3518 { "fcmovb", ST
, STi
, XX
},
3519 { "fcmove", ST
, STi
, XX
},
3520 { "fcmovbe",ST
, STi
, XX
},
3521 { "fcmovu", ST
, STi
, XX
},
3522 { "(bad)", XX
, XX
, XX
},
3524 { "(bad)", XX
, XX
, XX
},
3525 { "(bad)", XX
, XX
, XX
},
3529 { "fcmovnb",ST
, STi
, XX
},
3530 { "fcmovne",ST
, STi
, XX
},
3531 { "fcmovnbe",ST
, STi
, XX
},
3532 { "fcmovnu",ST
, STi
, XX
},
3534 { "fucomi", ST
, STi
, XX
},
3535 { "fcomi", ST
, STi
, XX
},
3536 { "(bad)", XX
, XX
, XX
},
3540 { "fadd", STi
, ST
, XX
},
3541 { "fmul", STi
, ST
, XX
},
3542 { "(bad)", XX
, XX
, XX
},
3543 { "(bad)", XX
, XX
, XX
},
3545 { "fsub", STi
, ST
, XX
},
3546 { "fsubr", STi
, ST
, XX
},
3547 { "fdiv", STi
, ST
, XX
},
3548 { "fdivr", STi
, ST
, XX
},
3550 { "fsubr", STi
, ST
, XX
},
3551 { "fsub", STi
, ST
, XX
},
3552 { "fdivr", STi
, ST
, XX
},
3553 { "fdiv", STi
, ST
, XX
},
3558 { "ffree", STi
, XX
, XX
},
3559 { "(bad)", XX
, XX
, XX
},
3560 { "fst", STi
, XX
, XX
},
3561 { "fstp", STi
, XX
, XX
},
3562 { "fucom", STi
, XX
, XX
},
3563 { "fucomp", STi
, XX
, XX
},
3564 { "(bad)", XX
, XX
, XX
},
3565 { "(bad)", XX
, XX
, XX
},
3569 { "faddp", STi
, ST
, XX
},
3570 { "fmulp", STi
, ST
, XX
},
3571 { "(bad)", XX
, XX
, XX
},
3574 { "fsubp", STi
, ST
, XX
},
3575 { "fsubrp", STi
, ST
, XX
},
3576 { "fdivp", STi
, ST
, XX
},
3577 { "fdivrp", STi
, ST
, XX
},
3579 { "fsubrp", STi
, ST
, XX
},
3580 { "fsubp", STi
, ST
, XX
},
3581 { "fdivrp", STi
, ST
, XX
},
3582 { "fdivp", STi
, ST
, XX
},
3587 { "ffreep", STi
, XX
, XX
},
3588 { "(bad)", XX
, XX
, XX
},
3589 { "(bad)", XX
, XX
, XX
},
3590 { "(bad)", XX
, XX
, XX
},
3592 { "fucomip",ST
, STi
, XX
},
3593 { "fcomip", ST
, STi
, XX
},
3594 { "(bad)", XX
, XX
, XX
},
3599 static char *fgrps
[][8] = {
3602 "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3607 "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
3612 "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
3617 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
3622 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
3627 "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3632 "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
3633 "fNsetpm(287 only)","(bad)","(bad)","(bad)",
3638 "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3643 "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
3651 const struct dis386
*dp
;
3652 unsigned char floatop
;
3654 floatop
= codep
[-1];
3659 putop (float_mem_intel
[(floatop
- 0xd8 ) * 8 + reg
], sizeflag
);
3661 putop (float_mem_att
[(floatop
- 0xd8 ) * 8 + reg
], sizeflag
);
3663 if (floatop
== 0xdb)
3664 OP_E (x_mode
, sizeflag
);
3665 else if (floatop
== 0xdd)
3666 OP_E (d_mode
, sizeflag
);
3668 OP_E (v_mode
, sizeflag
);
3671 /* skip mod/rm byte */
3675 dp
= &float_reg
[floatop
- 0xd8][reg
];
3676 if (dp
->name
== NULL
)
3678 putop (fgrps
[dp
->bytemode1
][rm
], sizeflag
);
3680 /* instruction fnstsw is only one with strange arg */
3681 if (floatop
== 0xdf && codep
[-1] == 0xe0)
3682 strcpy (op1out
, names16
[0]);
3686 putop (dp
->name
, sizeflag
);
3690 (*dp
->op1
)(dp
->bytemode1
, sizeflag
);
3693 (*dp
->op2
)(dp
->bytemode2
, sizeflag
);
3699 OP_ST (ignore
, sizeflag
)
3700 int ignore ATTRIBUTE_UNUSED
;
3701 int sizeflag ATTRIBUTE_UNUSED
;
3708 OP_STi (ignore
, sizeflag
)
3709 int ignore ATTRIBUTE_UNUSED
;
3710 int sizeflag ATTRIBUTE_UNUSED
;
3712 sprintf (scratchbuf
, "%%st(%d)", rm
);
3713 oappend (scratchbuf
);
3717 /* capital letters in template are macros */
3719 putop (template, sizeflag
)
3720 const char *template;
3725 for (p
= template; *p
; p
++)
3736 #ifdef SUFFIX_ALWAYS
3737 || (sizeflag
& SUFFIX_ALWAYS
)
3745 #ifdef SUFFIX_ALWAYS
3746 if (sizeflag
& SUFFIX_ALWAYS
)
3750 case 'E': /* For jcxz/jecxz */
3751 if (sizeflag
& AFLAG
)
3753 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
3756 if ((prefixes
& PREFIX_ADDR
)
3757 #ifdef SUFFIX_ALWAYS
3758 || (sizeflag
& SUFFIX_ALWAYS
)
3762 if (sizeflag
& AFLAG
)
3766 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
3776 if ((prefixes
& PREFIX_DATA
)
3777 #ifdef SUFFIX_ALWAYS
3778 || (sizeflag
& SUFFIX_ALWAYS
)
3782 if (sizeflag
& DFLAG
)
3786 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3793 #ifdef SUFFIX_ALWAYS
3794 if (sizeflag
& SUFFIX_ALWAYS
)
3799 if ((prefixes
& PREFIX_FWAIT
) == 0)
3802 used_prefixes
|= PREFIX_FWAIT
;
3805 USED_REX (REX_MODE64
);
3806 if (rex
& REX_MODE64
)
3814 if ((prefixes
& PREFIX_DATA
)
3815 || (rex
& REX_MODE64
)
3816 #ifdef SUFFIX_ALWAYS
3817 || (sizeflag
& SUFFIX_ALWAYS
)
3821 USED_REX (REX_MODE64
);
3822 if (rex
& REX_MODE64
)
3826 if (sizeflag
& DFLAG
)
3830 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3837 USED_REX (REX_MODE64
);
3839 #ifdef SUFFIX_ALWAYS
3840 || (sizeflag
& SUFFIX_ALWAYS
)
3844 if (rex
& REX_MODE64
)
3848 if (sizeflag
& DFLAG
)
3852 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3857 USED_REX (REX_MODE64
);
3860 if (rex
& REX_MODE64
)
3865 else if (sizeflag
& DFLAG
)
3878 if (rex
& REX_MODE64
)
3880 else if (sizeflag
& DFLAG
)
3885 if (!(rex
& REX_MODE64
))
3886 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3891 #ifdef SUFFIX_ALWAYS
3892 if (sizeflag
& SUFFIX_ALWAYS
)
3894 if (rex
& REX_MODE64
)
3898 if (sizeflag
& DFLAG
)
3902 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3913 #ifdef SUFFIX_ALWAYS
3914 || (sizeflag
& SUFFIX_ALWAYS
)
3918 if (sizeflag
& DFLAG
)
3922 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3926 if (prefixes
& PREFIX_DATA
)
3930 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3935 if (rex
& REX_MODE64
)
3937 USED_REX (REX_MODE64
);
3941 /* implicit operand size 'l' for i386 or 'q' for x86-64 */
3943 /* operand size flag for cwtl, cbtw */
3947 else if (sizeflag
& DFLAG
)
3958 if (sizeflag
& DFLAG
)
3969 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3981 obufp
+= strlen (s
);
3987 if (prefixes
& PREFIX_CS
)
3990 used_prefixes
|= PREFIX_CS
;
3992 if (prefixes
& PREFIX_DS
)
3995 used_prefixes
|= PREFIX_DS
;
3997 if (prefixes
& PREFIX_SS
)
4000 used_prefixes
|= PREFIX_SS
;
4002 if (prefixes
& PREFIX_ES
)
4005 used_prefixes
|= PREFIX_ES
;
4007 if (prefixes
& PREFIX_FS
)
4010 used_prefixes
|= PREFIX_FS
;
4012 if (prefixes
& PREFIX_GS
)
4015 used_prefixes
|= PREFIX_GS
;
4020 OP_indirE (bytemode
, sizeflag
)
4026 OP_E (bytemode
, sizeflag
);
4030 print_operand_value (buf
, hex
, disp
)
4043 sprintf_vma (tmp
, disp
);
4044 for (i
= 0; tmp
[i
] == '0' && tmp
[i
+1]; i
++);
4045 strcpy (buf
+ 2, tmp
+ i
);
4049 bfd_signed_vma v
= disp
;
4056 /* Check for possible overflow on 0x8000000000000000 */
4059 strcpy (buf
, "9223372036854775808");
4073 tmp
[28-i
] = (v
% 10) + '0';
4077 strcpy (buf
, tmp
+ 29 - i
);
4083 sprintf (buf
, "0x%x", (unsigned int) disp
);
4085 sprintf (buf
, "%d", (int) disp
);
4090 OP_E (bytemode
, sizeflag
)
4097 USED_REX (REX_EXTZ
);
4101 /* skip mod/rm byte */
4112 oappend (names8rex
[rm
+ add
]);
4114 oappend (names8
[rm
+ add
]);
4117 oappend (names16
[rm
+ add
]);
4120 oappend (names32
[rm
+ add
]);
4123 oappend (names64
[rm
+ add
]);
4127 oappend (names64
[rm
+ add
]);
4129 oappend (names32
[rm
+ add
]);
4132 USED_REX (REX_MODE64
);
4133 if (rex
& REX_MODE64
)
4134 oappend (names64
[rm
+ add
]);
4135 else if (sizeflag
& DFLAG
)
4136 oappend (names32
[rm
+ add
]);
4138 oappend (names16
[rm
+ add
]);
4139 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4142 if ( !(codep
[-2] == 0xAE && codep
[-1] == 0xF8 /* sfence */)
4143 && !(codep
[-2] == 0xAE && codep
[-1] == 0xF0 /* mfence */)
4144 && !(codep
[-2] == 0xAE && codep
[-1] == 0xe8 /* lfence */))
4145 BadOp(); /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
4148 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4157 if (sizeflag
& AFLAG
) /* 32 bit address mode */
4172 FETCH_DATA (the_info
, codep
+ 1);
4173 scale
= (*codep
>> 6) & 3;
4174 index
= (*codep
>> 3) & 7;
4176 USED_REX (REX_EXTY
);
4177 USED_REX (REX_EXTZ
);
4188 if ((base
& 7) == 5)
4191 if (mode_64bit
&& !havesib
)
4197 FETCH_DATA (the_info
, codep
+ 1);
4199 if ((disp
& 0x80) != 0)
4208 if (mod
!= 0 || (base
& 7) == 5)
4210 print_operand_value (scratchbuf
, !riprel
, disp
);
4211 oappend (scratchbuf
);
4219 if (havebase
|| (havesib
&& (index
!= 4 || scale
!= 0)))
4226 oappend ("BYTE PTR ");
4229 oappend ("WORD PTR ");
4232 oappend ("DWORD PTR ");
4235 oappend ("QWORD PTR ");
4239 oappend ("DWORD PTR ");
4241 oappend ("QWORD PTR ");
4244 oappend ("XWORD PTR ");
4250 *obufp
++ = open_char
;
4251 if (intel_syntax
&& riprel
)
4254 USED_REX (REX_EXTZ
);
4255 if (!havesib
&& (rex
& REX_EXTZ
))
4258 oappend (mode_64bit
? names64
[base
] : names32
[base
]);
4267 *obufp
++ = separator_char
;
4270 sprintf (scratchbuf
, "%s", mode_64bit
? names64
[index
] : names32
[index
]);
4273 sprintf (scratchbuf
, ",%s", mode_64bit
? names64
[index
] : names32
[index
]);
4274 oappend (scratchbuf
);
4278 && bytemode
!= b_mode
4279 && bytemode
!= w_mode
4280 && bytemode
!= v_mode
))
4282 *obufp
++ = scale_char
;
4284 sprintf (scratchbuf
, "%d", 1 << scale
);
4285 oappend (scratchbuf
);
4289 if (mod
!= 0 || (base
& 7) == 5)
4291 /* Don't print zero displacements */
4294 print_operand_value (scratchbuf
, 0, disp
);
4295 oappend (scratchbuf
);
4299 *obufp
++ = close_char
;
4302 else if (intel_syntax
)
4304 if (mod
!= 0 || (base
& 7) == 5)
4306 if (prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
4307 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
))
4311 oappend (names_seg
[3]);
4314 print_operand_value (scratchbuf
, 1, disp
);
4315 oappend (scratchbuf
);
4320 { /* 16 bit address mode */
4327 if ((disp
& 0x8000) != 0)
4332 FETCH_DATA (the_info
, codep
+ 1);
4334 if ((disp
& 0x80) != 0)
4339 if ((disp
& 0x8000) != 0)
4345 if (mod
!= 0 || (rm
& 7) == 6)
4347 print_operand_value (scratchbuf
, 0, disp
);
4348 oappend (scratchbuf
);
4351 if (mod
!= 0 || (rm
& 7) != 6)
4353 *obufp
++ = open_char
;
4355 oappend (index16
[rm
+ add
]);
4356 *obufp
++ = close_char
;
4363 OP_G (bytemode
, sizeflag
)
4368 USED_REX (REX_EXTX
);
4376 oappend (names8rex
[reg
+ add
]);
4378 oappend (names8
[reg
+ add
]);
4381 oappend (names16
[reg
+ add
]);
4384 oappend (names32
[reg
+ add
]);
4387 oappend (names64
[reg
+ add
]);
4390 USED_REX (REX_MODE64
);
4391 if (rex
& REX_MODE64
)
4392 oappend (names64
[reg
+ add
]);
4393 else if (sizeflag
& DFLAG
)
4394 oappend (names32
[reg
+ add
]);
4396 oappend (names16
[reg
+ add
]);
4397 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4400 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4413 FETCH_DATA (the_info
, codep
+ 8);
4414 a
= *codep
++ & 0xff;
4415 a
|= (*codep
++ & 0xff) << 8;
4416 a
|= (*codep
++ & 0xff) << 16;
4417 a
|= (*codep
++ & 0xff) << 24;
4418 b
|= (*codep
++ & 0xff);
4419 b
|= (*codep
++ & 0xff) << 8;
4420 b
|= (*codep
++ & 0xff) << 16;
4421 b
|= (*codep
++ & 0xff) << 24;
4422 x
= a
+ ((bfd_vma
) b
<< 32);
4429 static bfd_signed_vma
4432 bfd_signed_vma x
= 0;
4434 FETCH_DATA (the_info
, codep
+ 4);
4435 x
= *codep
++ & (bfd_signed_vma
) 0xff;
4436 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
4437 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
4438 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
4442 static bfd_signed_vma
4445 bfd_signed_vma x
= 0;
4447 FETCH_DATA (the_info
, codep
+ 4);
4448 x
= *codep
++ & (bfd_signed_vma
) 0xff;
4449 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
4450 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
4451 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
4453 x
= (x
^ ((bfd_signed_vma
) 1 << 31)) - ((bfd_signed_vma
) 1 << 31);
4463 FETCH_DATA (the_info
, codep
+ 2);
4464 x
= *codep
++ & 0xff;
4465 x
|= (*codep
++ & 0xff) << 8;
4474 op_index
[op_ad
] = op_ad
;
4475 op_address
[op_ad
] = op
;
4476 op_riprel
[op_ad
] = riprel
;
4480 OP_REG (code
, sizeflag
)
4486 USED_REX (REX_EXTZ
);
4495 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
4496 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
4497 s
= names16
[code
- ax_reg
+ add
];
4499 case es_reg
: case ss_reg
: case cs_reg
:
4500 case ds_reg
: case fs_reg
: case gs_reg
:
4501 s
= names_seg
[code
- es_reg
+ add
];
4503 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
4504 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
4507 s
= names8rex
[code
- al_reg
+ add
];
4509 s
= names8
[code
- al_reg
];
4511 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
4512 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
4513 USED_REX (REX_MODE64
);
4514 if (rex
& REX_MODE64
)
4515 s
= names64
[code
- eAX_reg
+ add
];
4516 else if (sizeflag
& DFLAG
)
4517 s
= names32
[code
- eAX_reg
+ add
];
4519 s
= names16
[code
- eAX_reg
+ add
];
4520 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4522 case rAX_reg
: case rCX_reg
: case rDX_reg
: case rBX_reg
:
4523 case rSP_reg
: case rBP_reg
: case rSI_reg
: case rDI_reg
:
4524 s
= names64
[code
- rAX_reg
+ add
];
4527 s
= INTERNAL_DISASSEMBLER_ERROR
;
4534 OP_IMREG (code
, sizeflag
)
4545 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
4546 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
4547 s
= names16
[code
- ax_reg
];
4549 case es_reg
: case ss_reg
: case cs_reg
:
4550 case ds_reg
: case fs_reg
: case gs_reg
:
4551 s
= names_seg
[code
- es_reg
];
4553 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
4554 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
4557 s
= names8rex
[code
- al_reg
];
4559 s
= names8
[code
- al_reg
];
4561 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
4562 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
4563 USED_REX (REX_MODE64
);
4564 if (rex
& REX_MODE64
)
4565 s
= names64
[code
- eAX_reg
];
4566 else if (sizeflag
& DFLAG
)
4567 s
= names32
[code
- eAX_reg
];
4569 s
= names16
[code
- eAX_reg
];
4570 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4573 s
= INTERNAL_DISASSEMBLER_ERROR
;
4580 OP_I (bytemode
, sizeflag
)
4585 bfd_signed_vma mask
= -1;
4590 FETCH_DATA (the_info
, codep
+ 1);
4598 USED_REX (REX_MODE64
);
4599 if (rex
& REX_MODE64
)
4601 else if (sizeflag
& DFLAG
)
4611 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4618 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4623 scratchbuf
[0] = '$';
4624 print_operand_value (scratchbuf
+ !intel_syntax
, 1, op
);
4625 oappend (scratchbuf
);
4626 scratchbuf
[0] = '\0';
4630 OP_I64 (bytemode
, sizeflag
)
4635 bfd_signed_vma mask
= -1;
4640 FETCH_DATA (the_info
, codep
+ 1);
4645 USED_REX (REX_MODE64
);
4646 if (rex
& REX_MODE64
)
4648 else if (sizeflag
& DFLAG
)
4658 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4665 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4670 scratchbuf
[0] = '$';
4671 print_operand_value (scratchbuf
+ !intel_syntax
, 1, op
);
4672 oappend (scratchbuf
);
4673 scratchbuf
[0] = '\0';
4677 OP_sI (bytemode
, sizeflag
)
4682 bfd_signed_vma mask
= -1;
4687 FETCH_DATA (the_info
, codep
+ 1);
4689 if ((op
& 0x80) != 0)
4694 USED_REX (REX_MODE64
);
4695 if (rex
& REX_MODE64
)
4697 else if (sizeflag
& DFLAG
)
4706 if ((op
& 0x8000) != 0)
4709 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4714 if ((op
& 0x8000) != 0)
4718 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4722 scratchbuf
[0] = '$';
4723 print_operand_value (scratchbuf
+ 1, 1, op
);
4724 oappend (scratchbuf
);
4728 OP_J (bytemode
, sizeflag
)
4738 FETCH_DATA (the_info
, codep
+ 1);
4740 if ((disp
& 0x80) != 0)
4744 if (sizeflag
& DFLAG
)
4749 /* for some reason, a data16 prefix on a jump instruction
4750 means that the pc is masked to 16 bits after the
4751 displacement is added! */
4756 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4759 disp
= (start_pc
+ codep
- start_codep
+ disp
) & mask
;
4761 print_operand_value (scratchbuf
, 1, disp
);
4762 oappend (scratchbuf
);
4767 OP_SEG (dummy
, sizeflag
)
4768 int dummy ATTRIBUTE_UNUSED
;
4769 int sizeflag ATTRIBUTE_UNUSED
;
4771 static char *sreg
[] = {
4772 "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
4775 oappend (sreg
[reg
]);
4780 OP_DIR (dummy
, sizeflag
)
4781 int dummy ATTRIBUTE_UNUSED
;
4786 if (sizeflag
& DFLAG
)
4796 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4797 sprintf (scratchbuf
, "$0x%x,$0x%x", seg
, offset
);
4798 oappend (scratchbuf
);
4803 OP_OFF (ignored
, sizeflag
)
4804 int ignored ATTRIBUTE_UNUSED
;
4811 if (sizeflag
& AFLAG
)
4818 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
4819 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
4821 oappend (names_seg
[3]);
4825 print_operand_value (scratchbuf
, 1, off
);
4826 oappend (scratchbuf
);
4830 OP_OFF64 (ignored
, sizeflag
)
4831 int ignored ATTRIBUTE_UNUSED
;
4832 int sizeflag ATTRIBUTE_UNUSED
;
4842 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
4843 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
4845 oappend (names_seg
[3]);
4849 print_operand_value (scratchbuf
, 1, off
);
4850 oappend (scratchbuf
);
4854 ptr_reg (code
, sizeflag
)
4860 USED_REX (REX_MODE64
);
4861 if (rex
& REX_MODE64
)
4862 s
= names64
[code
- eAX_reg
];
4863 else if (sizeflag
& AFLAG
)
4864 s
= names32
[code
- eAX_reg
];
4866 s
= names16
[code
- eAX_reg
];
4872 OP_ESreg (code
, sizeflag
)
4877 ptr_reg (code
, sizeflag
);
4881 OP_DSreg (code
, sizeflag
)
4892 prefixes
|= PREFIX_DS
;
4894 ptr_reg (code
, sizeflag
);
4899 OP_C (dummy
, sizeflag
)
4900 int dummy ATTRIBUTE_UNUSED
;
4901 int sizeflag ATTRIBUTE_UNUSED
;
4904 USED_REX (REX_EXTX
);
4907 sprintf (scratchbuf
, "%%cr%d", reg
+add
);
4908 oappend (scratchbuf
);
4913 OP_D (dummy
, sizeflag
)
4914 int dummy ATTRIBUTE_UNUSED
;
4915 int sizeflag ATTRIBUTE_UNUSED
;
4918 USED_REX (REX_EXTX
);
4921 sprintf (scratchbuf
, "%%db%d", reg
+add
);
4922 oappend (scratchbuf
);
4927 OP_T (dummy
, sizeflag
)
4928 int dummy ATTRIBUTE_UNUSED
;
4929 int sizeflag ATTRIBUTE_UNUSED
;
4931 sprintf (scratchbuf
, "%%tr%d", reg
);
4932 oappend (scratchbuf
);
4936 OP_Rd (bytemode
, sizeflag
)
4941 OP_E (bytemode
, sizeflag
);
4947 OP_MMX (ignore
, sizeflag
)
4948 int ignore ATTRIBUTE_UNUSED
;
4949 int sizeflag ATTRIBUTE_UNUSED
;
4952 USED_REX (REX_EXTX
);
4955 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4956 if (prefixes
& PREFIX_DATA
)
4957 sprintf (scratchbuf
, "%%xmm%d", reg
+ add
);
4959 sprintf (scratchbuf
, "%%mm%d", reg
+ add
);
4960 oappend (scratchbuf
);
4964 OP_XMM (bytemode
, sizeflag
)
4965 int bytemode ATTRIBUTE_UNUSED
;
4966 int sizeflag ATTRIBUTE_UNUSED
;
4969 USED_REX (REX_EXTX
);
4972 sprintf (scratchbuf
, "%%xmm%d", reg
+ add
);
4973 oappend (scratchbuf
);
4977 OP_EM (bytemode
, sizeflag
)
4984 OP_E (bytemode
, sizeflag
);
4987 USED_REX (REX_EXTZ
);
4991 /* skip mod/rm byte */
4994 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4995 if (prefixes
& PREFIX_DATA
)
4996 sprintf (scratchbuf
, "%%xmm%d", rm
+ add
);
4998 sprintf (scratchbuf
, "%%mm%d", rm
+ add
);
4999 oappend (scratchbuf
);
5003 OP_EX (bytemode
, sizeflag
)
5010 OP_E (bytemode
, sizeflag
);
5013 USED_REX (REX_EXTZ
);
5017 /* skip mod/rm byte */
5020 sprintf (scratchbuf
, "%%xmm%d", rm
+ add
);
5021 oappend (scratchbuf
);
5025 OP_MS (bytemode
, sizeflag
)
5030 OP_EM (bytemode
, sizeflag
);
5036 OP_XS (bytemode
, sizeflag
)
5041 OP_EX (bytemode
, sizeflag
);
5046 static const char *Suffix3DNow
[] = {
5047 /* 00 */ NULL
, NULL
, NULL
, NULL
,
5048 /* 04 */ NULL
, NULL
, NULL
, NULL
,
5049 /* 08 */ NULL
, NULL
, NULL
, NULL
,
5050 /* 0C */ "pi2fw", "pi2fd", NULL
, NULL
,
5051 /* 10 */ NULL
, NULL
, NULL
, NULL
,
5052 /* 14 */ NULL
, NULL
, NULL
, NULL
,
5053 /* 18 */ NULL
, NULL
, NULL
, NULL
,
5054 /* 1C */ "pf2iw", "pf2id", NULL
, NULL
,
5055 /* 20 */ NULL
, NULL
, NULL
, NULL
,
5056 /* 24 */ NULL
, NULL
, NULL
, NULL
,
5057 /* 28 */ NULL
, NULL
, NULL
, NULL
,
5058 /* 2C */ NULL
, NULL
, NULL
, NULL
,
5059 /* 30 */ NULL
, NULL
, NULL
, NULL
,
5060 /* 34 */ NULL
, NULL
, NULL
, NULL
,
5061 /* 38 */ NULL
, NULL
, NULL
, NULL
,
5062 /* 3C */ NULL
, NULL
, NULL
, NULL
,
5063 /* 40 */ NULL
, NULL
, NULL
, NULL
,
5064 /* 44 */ NULL
, NULL
, NULL
, NULL
,
5065 /* 48 */ NULL
, NULL
, NULL
, NULL
,
5066 /* 4C */ NULL
, NULL
, NULL
, NULL
,
5067 /* 50 */ NULL
, NULL
, NULL
, NULL
,
5068 /* 54 */ NULL
, NULL
, NULL
, NULL
,
5069 /* 58 */ NULL
, NULL
, NULL
, NULL
,
5070 /* 5C */ NULL
, NULL
, NULL
, NULL
,
5071 /* 60 */ NULL
, NULL
, NULL
, NULL
,
5072 /* 64 */ NULL
, NULL
, NULL
, NULL
,
5073 /* 68 */ NULL
, NULL
, NULL
, NULL
,
5074 /* 6C */ NULL
, NULL
, NULL
, NULL
,
5075 /* 70 */ NULL
, NULL
, NULL
, NULL
,
5076 /* 74 */ NULL
, NULL
, NULL
, NULL
,
5077 /* 78 */ NULL
, NULL
, NULL
, NULL
,
5078 /* 7C */ NULL
, NULL
, NULL
, NULL
,
5079 /* 80 */ NULL
, NULL
, NULL
, NULL
,
5080 /* 84 */ NULL
, NULL
, NULL
, NULL
,
5081 /* 88 */ NULL
, NULL
, "pfnacc", NULL
,
5082 /* 8C */ NULL
, NULL
, "pfpnacc", NULL
,
5083 /* 90 */ "pfcmpge", NULL
, NULL
, NULL
,
5084 /* 94 */ "pfmin", NULL
, "pfrcp", "pfrsqrt",
5085 /* 98 */ NULL
, NULL
, "pfsub", NULL
,
5086 /* 9C */ NULL
, NULL
, "pfadd", NULL
,
5087 /* A0 */ "pfcmpgt", NULL
, NULL
, NULL
,
5088 /* A4 */ "pfmax", NULL
, "pfrcpit1", "pfrsqit1",
5089 /* A8 */ NULL
, NULL
, "pfsubr", NULL
,
5090 /* AC */ NULL
, NULL
, "pfacc", NULL
,
5091 /* B0 */ "pfcmpeq", NULL
, NULL
, NULL
,
5092 /* B4 */ "pfmul", NULL
, "pfrcpit2", "pfmulhrw",
5093 /* B8 */ NULL
, NULL
, NULL
, "pswapd",
5094 /* BC */ NULL
, NULL
, NULL
, "pavgusb",
5095 /* C0 */ NULL
, NULL
, NULL
, NULL
,
5096 /* C4 */ NULL
, NULL
, NULL
, NULL
,
5097 /* C8 */ NULL
, NULL
, NULL
, NULL
,
5098 /* CC */ NULL
, NULL
, NULL
, NULL
,
5099 /* D0 */ NULL
, NULL
, NULL
, NULL
,
5100 /* D4 */ NULL
, NULL
, NULL
, NULL
,
5101 /* D8 */ NULL
, NULL
, NULL
, NULL
,
5102 /* DC */ NULL
, NULL
, NULL
, NULL
,
5103 /* E0 */ NULL
, NULL
, NULL
, NULL
,
5104 /* E4 */ NULL
, NULL
, NULL
, NULL
,
5105 /* E8 */ NULL
, NULL
, NULL
, NULL
,
5106 /* EC */ NULL
, NULL
, NULL
, NULL
,
5107 /* F0 */ NULL
, NULL
, NULL
, NULL
,
5108 /* F4 */ NULL
, NULL
, NULL
, NULL
,
5109 /* F8 */ NULL
, NULL
, NULL
, NULL
,
5110 /* FC */ NULL
, NULL
, NULL
, NULL
,
5114 OP_3DNowSuffix (bytemode
, sizeflag
)
5115 int bytemode ATTRIBUTE_UNUSED
;
5116 int sizeflag ATTRIBUTE_UNUSED
;
5118 const char *mnemonic
;
5120 FETCH_DATA (the_info
, codep
+ 1);
5121 /* AMD 3DNow! instructions are specified by an opcode suffix in the
5122 place where an 8-bit immediate would normally go. ie. the last
5123 byte of the instruction. */
5124 obufp
= obuf
+ strlen(obuf
);
5125 mnemonic
= Suffix3DNow
[*codep
++ & 0xff];
5130 /* Since a variable sized modrm/sib chunk is between the start
5131 of the opcode (0x0f0f) and the opcode suffix, we need to do
5132 all the modrm processing first, and don't know until now that
5133 we have a bad opcode. This necessitates some cleaning up. */
5141 static const char *simd_cmp_op
[] = {
5153 OP_SIMD_Suffix (bytemode
, sizeflag
)
5154 int bytemode ATTRIBUTE_UNUSED
;
5155 int sizeflag ATTRIBUTE_UNUSED
;
5157 unsigned int cmp_type
;
5159 FETCH_DATA (the_info
, codep
+ 1);
5160 obufp
= obuf
+ strlen(obuf
);
5161 cmp_type
= *codep
++ & 0xff;
5164 char suffix1
= 'p', suffix2
= 's';
5165 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
5166 if (prefixes
& PREFIX_REPZ
)
5170 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5171 if (prefixes
& PREFIX_DATA
)
5175 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
5176 if (prefixes
& PREFIX_REPNZ
)
5177 suffix1
= 's', suffix2
= 'd';
5180 sprintf (scratchbuf
, "cmp%s%c%c",
5181 simd_cmp_op
[cmp_type
], suffix1
, suffix2
);
5182 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
5183 oappend (scratchbuf
);
5187 /* We have a bad extension byte. Clean up. */
5195 SIMD_Fixup (extrachar
, sizeflag
)
5197 int sizeflag ATTRIBUTE_UNUSED
;
5199 /* Change movlps/movhps to movhlps/movlhps for 2 register operand
5200 forms of these instructions. */
5203 char *p
= obuf
+ strlen(obuf
);
5212 static void BadOp (void)
5214 codep
= insn_codep
+ 1; /* throw away prefixes and 1st. opcode byte */