1 /* opcodes/i386-dis.c r1.126 */
2 /* Print i386 instructions for GDB, the GNU debugger.
3 Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 2001, 2002, 2003, 2004, 2005, 2006 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
22 /* 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
24 modified by John Hassey (hassey@dg-rtp.dg.com)
25 x86-64 support added by Jan Hubicka (jh@suse.cz)
26 VIA PadLock support by Michal Ludvig (mludvig@suse.cz). */
28 /* The main tables describing the instructions is essentially a copy
29 of the "Opcode Map" chapter (Appendix A) of the Intel 80386
30 Programmers Manual. Usually, there is a capital letter, followed
31 by a small letter. The capital letter tell the addressing mode,
32 and the small letter tells about the operand size. Refer to
33 the Intel manual for details. */
37 /* include/opcode/i386.h r1.78 */
39 /* opcode/i386.h -- Intel 80386 opcode macros
40 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
41 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
42 Free Software Foundation, Inc.
44 This file is part of GAS, the GNU Assembler, and GDB, the GNU Debugger.
46 This program is free software; you can redistribute it and/or modify
47 it under the terms of the GNU General Public License as published by
48 the Free Software Foundation; either version 2 of the License, or
49 (at your option) any later version.
51 This program is distributed in the hope that it will be useful,
52 but WITHOUT ANY WARRANTY; without even the implied warranty of
53 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54 GNU General Public License for more details.
56 You should have received a copy of the GNU General Public License
57 along with this program; if not, write to the Free Software
58 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
60 /* The SystemV/386 SVR3.2 assembler, and probably all AT&T derived
61 ix86 Unix assemblers, generate floating point instructions with
62 reversed source and destination registers in certain cases.
63 Unfortunately, gcc and possibly many other programs use this
64 reversed syntax, so we're stuck with it.
66 eg. `fsub %st(3),%st' results in st = st - st(3) as expected, but
67 `fsub %st,%st(3)' results in st(3) = st - st(3), rather than
68 the expected st(3) = st(3) - st
70 This happens with all the non-commutative arithmetic floating point
71 operations with two register operands, where the source register is
72 %st, and destination register is %st(i).
74 The affected opcode map is dceX, dcfX, deeX, defX. */
76 #ifndef SYSV386_COMPAT
77 /* Set non-zero for broken, compatible instructions. Set to zero for
78 non-broken opcodes at your peril. gcc generates SystemV/386
79 compatible instructions. */
80 #define SYSV386_COMPAT 1
83 /* Set non-zero to cater for old (<= 2.8.1) versions of gcc that could
84 generate nonsense fsubp, fsubrp, fdivp and fdivrp with operands
86 #define OLDGCC_COMPAT SYSV386_COMPAT
89 #define MOV_AX_DISP32 0xa0
90 #define POP_SEG_SHORT 0x07
91 #define JUMP_PC_RELATIVE 0xeb
92 #define INT_OPCODE 0xcd
93 #define INT3_OPCODE 0xcc
94 /* The opcode for the fwait instruction, which disassembler treats as a
95 prefix when it can. */
96 #define FWAIT_OPCODE 0x9b
97 #define ADDR_PREFIX_OPCODE 0x67
98 #define DATA_PREFIX_OPCODE 0x66
99 #define LOCK_PREFIX_OPCODE 0xf0
100 #define CS_PREFIX_OPCODE 0x2e
101 #define DS_PREFIX_OPCODE 0x3e
102 #define ES_PREFIX_OPCODE 0x26
103 #define FS_PREFIX_OPCODE 0x64
104 #define GS_PREFIX_OPCODE 0x65
105 #define SS_PREFIX_OPCODE 0x36
106 #define REPNE_PREFIX_OPCODE 0xf2
107 #define REPE_PREFIX_OPCODE 0xf3
109 #define TWO_BYTE_OPCODE_ESCAPE 0x0f
110 #define NOP_OPCODE (char) 0x90
112 /* register numbers */
113 #define EBP_REG_NUM 5
114 #define ESP_REG_NUM 4
116 /* modrm_byte.regmem for twobyte escape */
117 #define ESCAPE_TO_TWO_BYTE_ADDRESSING ESP_REG_NUM
118 /* index_base_byte.index for no index register addressing */
119 #define NO_INDEX_REGISTER ESP_REG_NUM
120 /* index_base_byte.base for no base register addressing */
121 #define NO_BASE_REGISTER EBP_REG_NUM
122 #define NO_BASE_REGISTER_16 6
124 /* modrm.mode = REGMEM_FIELD_HAS_REG when a register is in there */
125 #define REGMEM_FIELD_HAS_REG 0x3/* always = 0x3 */
126 #define REGMEM_FIELD_HAS_MEM (~REGMEM_FIELD_HAS_REG)
128 /* x86-64 extension prefix. */
129 #define REX_OPCODE 0x40
131 /* Indicates 64 bit operand size. */
133 /* High extension to reg field of modrm byte. */
135 /* High extension to SIB index field. */
137 /* High extension to base field of modrm or SIB, or reg field of opcode. */
140 /* max operands per insn */
141 #define MAX_OPERANDS 4
143 /* max immediates per insn (lcall, ljmp, insertq, extrq) */
144 #define MAX_IMMEDIATE_OPERANDS 2
146 /* max memory refs per insn (string ops) */
147 #define MAX_MEMORY_OPERANDS 2
149 /* max size of insn mnemonics. */
150 #define MAX_MNEM_SIZE 16
152 /* max size of register name in insn mnemonics. */
153 #define MAX_REG_NAME_SIZE 8
155 /* opcodes/i386-dis.c r1.126 */
156 #include "qemu-common.h"
160 static int fetch_data (struct disassemble_info
*, bfd_byte
*);
161 static void ckprefix (void);
162 static const char *prefix_name (int, int);
163 static int print_insn (bfd_vma
, disassemble_info
*);
164 static void dofloat (int);
165 static void OP_ST (int, int);
166 static void OP_STi (int, int);
167 static int putop (const char *, int);
168 static void oappend (const char *);
169 static void append_seg (void);
170 static void OP_indirE (int, int);
171 static void print_operand_value (char *buf
, size_t bufsize
, int hex
, bfd_vma disp
);
172 static void print_displacement (char *, bfd_vma
);
173 static void OP_E (int, int);
174 static void OP_G (int, int);
175 static bfd_vma
get64 (void);
176 static bfd_signed_vma
get32 (void);
177 static bfd_signed_vma
get32s (void);
178 static int get16 (void);
179 static void set_op (bfd_vma
, int);
180 static void OP_REG (int, int);
181 static void OP_IMREG (int, int);
182 static void OP_I (int, int);
183 static void OP_I64 (int, int);
184 static void OP_sI (int, int);
185 static void OP_J (int, int);
186 static void OP_SEG (int, int);
187 static void OP_DIR (int, int);
188 static void OP_OFF (int, int);
189 static void OP_OFF64 (int, int);
190 static void ptr_reg (int, int);
191 static void OP_ESreg (int, int);
192 static void OP_DSreg (int, int);
193 static void OP_C (int, int);
194 static void OP_D (int, int);
195 static void OP_T (int, int);
196 static void OP_R (int, int);
197 static void OP_MMX (int, int);
198 static void OP_XMM (int, int);
199 static void OP_EM (int, int);
200 static void OP_EX (int, int);
201 static void OP_EMC (int,int);
202 static void OP_MXC (int,int);
203 static void OP_MS (int, int);
204 static void OP_XS (int, int);
205 static void OP_M (int, int);
206 static void OP_VMX (int, int);
207 static void OP_0fae (int, int);
208 static void OP_0f07 (int, int);
209 static void NOP_Fixup1 (int, int);
210 static void NOP_Fixup2 (int, int);
211 static void OP_3DNowSuffix (int, int);
212 static void OP_SIMD_Suffix (int, int);
213 static void SIMD_Fixup (int, int);
214 static void PNI_Fixup (int, int);
215 static void SVME_Fixup (int, int);
216 static void INVLPG_Fixup (int, int);
217 static void BadOp (void);
218 static void VMX_Fixup (int, int);
219 static void REP_Fixup (int, int);
220 static void CMPXCHG8B_Fixup (int, int);
221 static void XMM_Fixup (int, int);
222 static void CRC32_Fixup (int, int);
225 /* Points to first byte not fetched. */
226 bfd_byte
*max_fetched
;
227 bfd_byte the_buffer
[MAX_MNEM_SIZE
];
240 static enum address_mode address_mode
;
242 /* Flags for the prefixes for the current instruction. See below. */
245 /* REX prefix the current instruction. See below. */
247 /* Bits of REX we've already used. */
249 /* Mark parts used in the REX prefix. When we are testing for
250 empty prefix (for 8bit register REX extension), just mask it
251 out. Otherwise test for REX bit is excuse for existence of REX
252 only in case value is nonzero. */
253 #define USED_REX(value) \
258 rex_used |= (value) | REX_OPCODE; \
261 rex_used |= REX_OPCODE; \
264 /* Flags for prefixes which we somehow handled when printing the
265 current instruction. */
266 static int used_prefixes
;
268 /* Flags stored in PREFIXES. */
269 #define PREFIX_REPZ 1
270 #define PREFIX_REPNZ 2
271 #define PREFIX_LOCK 4
273 #define PREFIX_SS 0x10
274 #define PREFIX_DS 0x20
275 #define PREFIX_ES 0x40
276 #define PREFIX_FS 0x80
277 #define PREFIX_GS 0x100
278 #define PREFIX_DATA 0x200
279 #define PREFIX_ADDR 0x400
280 #define PREFIX_FWAIT 0x800
282 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
283 to ADDR (exclusive) are valid. Returns 1 for success, longjmps
285 #define FETCH_DATA(info, addr) \
286 ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
287 ? 1 : fetch_data ((info), (addr)))
290 fetch_data (struct disassemble_info
*info
, bfd_byte
*addr
)
293 struct dis_private
*priv
= (struct dis_private
*) info
->private_data
;
294 bfd_vma start
= priv
->insn_start
+ (priv
->max_fetched
- priv
->the_buffer
);
296 if (addr
<= priv
->the_buffer
+ MAX_MNEM_SIZE
)
297 status
= (*info
->read_memory_func
) (start
,
299 addr
- priv
->max_fetched
,
305 /* If we did manage to read at least one byte, then
306 print_insn_i386 will do something sensible. Otherwise, print
307 an error. We do that here because this is where we know
309 if (priv
->max_fetched
== priv
->the_buffer
)
310 (*info
->memory_error_func
) (status
, start
, info
);
311 longjmp (priv
->bailout
, 1);
314 priv
->max_fetched
= addr
;
318 #define XX { NULL, 0 }
320 #define Eb { OP_E, b_mode }
321 #define Ev { OP_E, v_mode }
322 #define Ed { OP_E, d_mode }
323 #define Edq { OP_E, dq_mode }
324 #define Edqw { OP_E, dqw_mode }
325 #define Edqb { OP_E, dqb_mode }
326 #define Edqd { OP_E, dqd_mode }
327 #define indirEv { OP_indirE, stack_v_mode }
328 #define indirEp { OP_indirE, f_mode }
329 #define stackEv { OP_E, stack_v_mode }
330 #define Em { OP_E, m_mode }
331 #define Ew { OP_E, w_mode }
332 #define M { OP_M, 0 } /* lea, lgdt, etc. */
333 #define Ma { OP_M, v_mode }
334 #define Mp { OP_M, f_mode } /* 32 or 48 bit memory operand for LDS, LES etc */
335 #define Mq { OP_M, q_mode }
336 #define Gb { OP_G, b_mode }
337 #define Gv { OP_G, v_mode }
338 #define Gd { OP_G, d_mode }
339 #define Gdq { OP_G, dq_mode }
340 #define Gm { OP_G, m_mode }
341 #define Gw { OP_G, w_mode }
342 #define Rd { OP_R, d_mode }
343 #define Rm { OP_R, m_mode }
344 #define Ib { OP_I, b_mode }
345 #define sIb { OP_sI, b_mode } /* sign extened byte */
346 #define Iv { OP_I, v_mode }
347 #define Iq { OP_I, q_mode }
348 #define Iv64 { OP_I64, v_mode }
349 #define Iw { OP_I, w_mode }
350 #define I1 { OP_I, const_1_mode }
351 #define Jb { OP_J, b_mode }
352 #define Jv { OP_J, v_mode }
353 #define Cm { OP_C, m_mode }
354 #define Dm { OP_D, m_mode }
355 #define Td { OP_T, d_mode }
357 #define RMeAX { OP_REG, eAX_reg }
358 #define RMeBX { OP_REG, eBX_reg }
359 #define RMeCX { OP_REG, eCX_reg }
360 #define RMeDX { OP_REG, eDX_reg }
361 #define RMeSP { OP_REG, eSP_reg }
362 #define RMeBP { OP_REG, eBP_reg }
363 #define RMeSI { OP_REG, eSI_reg }
364 #define RMeDI { OP_REG, eDI_reg }
365 #define RMrAX { OP_REG, rAX_reg }
366 #define RMrBX { OP_REG, rBX_reg }
367 #define RMrCX { OP_REG, rCX_reg }
368 #define RMrDX { OP_REG, rDX_reg }
369 #define RMrSP { OP_REG, rSP_reg }
370 #define RMrBP { OP_REG, rBP_reg }
371 #define RMrSI { OP_REG, rSI_reg }
372 #define RMrDI { OP_REG, rDI_reg }
373 #define RMAL { OP_REG, al_reg }
374 #define RMAL { OP_REG, al_reg }
375 #define RMCL { OP_REG, cl_reg }
376 #define RMDL { OP_REG, dl_reg }
377 #define RMBL { OP_REG, bl_reg }
378 #define RMAH { OP_REG, ah_reg }
379 #define RMCH { OP_REG, ch_reg }
380 #define RMDH { OP_REG, dh_reg }
381 #define RMBH { OP_REG, bh_reg }
382 #define RMAX { OP_REG, ax_reg }
383 #define RMDX { OP_REG, dx_reg }
385 #define eAX { OP_IMREG, eAX_reg }
386 #define eBX { OP_IMREG, eBX_reg }
387 #define eCX { OP_IMREG, eCX_reg }
388 #define eDX { OP_IMREG, eDX_reg }
389 #define eSP { OP_IMREG, eSP_reg }
390 #define eBP { OP_IMREG, eBP_reg }
391 #define eSI { OP_IMREG, eSI_reg }
392 #define eDI { OP_IMREG, eDI_reg }
393 #define AL { OP_IMREG, al_reg }
394 #define CL { OP_IMREG, cl_reg }
395 #define DL { OP_IMREG, dl_reg }
396 #define BL { OP_IMREG, bl_reg }
397 #define AH { OP_IMREG, ah_reg }
398 #define CH { OP_IMREG, ch_reg }
399 #define DH { OP_IMREG, dh_reg }
400 #define BH { OP_IMREG, bh_reg }
401 #define AX { OP_IMREG, ax_reg }
402 #define DX { OP_IMREG, dx_reg }
403 #define zAX { OP_IMREG, z_mode_ax_reg }
404 #define indirDX { OP_IMREG, indir_dx_reg }
406 #define Sw { OP_SEG, w_mode }
407 #define Sv { OP_SEG, v_mode }
408 #define Ap { OP_DIR, 0 }
409 #define Ob { OP_OFF64, b_mode }
410 #define Ov { OP_OFF64, v_mode }
411 #define Xb { OP_DSreg, eSI_reg }
412 #define Xv { OP_DSreg, eSI_reg }
413 #define Xz { OP_DSreg, eSI_reg }
414 #define Yb { OP_ESreg, eDI_reg }
415 #define Yv { OP_ESreg, eDI_reg }
416 #define DSBX { OP_DSreg, eBX_reg }
418 #define es { OP_REG, es_reg }
419 #define ss { OP_REG, ss_reg }
420 #define cs { OP_REG, cs_reg }
421 #define ds { OP_REG, ds_reg }
422 #define fs { OP_REG, fs_reg }
423 #define gs { OP_REG, gs_reg }
425 #define MX { OP_MMX, 0 }
426 #define XM { OP_XMM, 0 }
427 #define EM { OP_EM, v_mode }
428 #define EMd { OP_EM, d_mode }
429 #define EMq { OP_EM, q_mode }
430 #define EXd { OP_EX, d_mode }
431 #define EXq { OP_EX, q_mode }
432 #define EXx { OP_EX, x_mode }
433 #define MS { OP_MS, v_mode }
434 #define XS { OP_XS, v_mode }
435 #define EMC { OP_EMC, v_mode }
436 #define MXC { OP_MXC, 0 }
437 #define VM { OP_VMX, q_mode }
438 #define OPSUF { OP_3DNowSuffix, 0 }
439 #define OPSIMD { OP_SIMD_Suffix, 0 }
440 #define XMM0 { XMM_Fixup, 0 }
442 /* Used handle "rep" prefix for string instructions. */
443 #define Xbr { REP_Fixup, eSI_reg }
444 #define Xvr { REP_Fixup, eSI_reg }
445 #define Ybr { REP_Fixup, eDI_reg }
446 #define Yvr { REP_Fixup, eDI_reg }
447 #define Yzr { REP_Fixup, eDI_reg }
448 #define indirDXr { REP_Fixup, indir_dx_reg }
449 #define ALr { REP_Fixup, al_reg }
450 #define eAXr { REP_Fixup, eAX_reg }
452 #define cond_jump_flag { NULL, cond_jump_mode }
453 #define loop_jcxz_flag { NULL, loop_jcxz_mode }
455 /* bits in sizeflag */
456 #define SUFFIX_ALWAYS 4
460 #define b_mode 1 /* byte operand */
461 #define v_mode 2 /* operand size depends on prefixes */
462 #define w_mode 3 /* word operand */
463 #define d_mode 4 /* double word operand */
464 #define q_mode 5 /* quad word operand */
465 #define t_mode 6 /* ten-byte operand */
466 #define x_mode 7 /* 16-byte XMM operand */
467 #define m_mode 8 /* d_mode in 32bit, q_mode in 64bit mode. */
468 #define cond_jump_mode 9
469 #define loop_jcxz_mode 10
470 #define dq_mode 11 /* operand size depends on REX prefixes. */
471 #define dqw_mode 12 /* registers like dq_mode, memory like w_mode. */
472 #define f_mode 13 /* 4- or 6-byte pointer operand */
473 #define const_1_mode 14
474 #define stack_v_mode 15 /* v_mode for stack-related opcodes. */
475 #define z_mode 16 /* non-quad operand size depends on prefixes */
476 #define o_mode 17 /* 16-byte operand */
477 #define dqb_mode 18 /* registers like dq_mode, memory like b_mode. */
478 #define dqd_mode 19 /* registers like dq_mode, memory like d_mode. */
523 #define z_mode_ax_reg 149
524 #define indir_dx_reg 150
528 #define USE_PREFIX_USER_TABLE 3
529 #define X86_64_SPECIAL 4
530 #define IS_3BYTE_OPCODE 5
532 #define FLOAT NULL, { { NULL, FLOATCODE } }
534 #define GRP1a NULL, { { NULL, USE_GROUPS }, { NULL, 0 } }
535 #define GRP1b NULL, { { NULL, USE_GROUPS }, { NULL, 1 } }
536 #define GRP1S NULL, { { NULL, USE_GROUPS }, { NULL, 2 } }
537 #define GRP1Ss NULL, { { NULL, USE_GROUPS }, { NULL, 3 } }
538 #define GRP2b NULL, { { NULL, USE_GROUPS }, { NULL, 4 } }
539 #define GRP2S NULL, { { NULL, USE_GROUPS }, { NULL, 5 } }
540 #define GRP2b_one NULL, { { NULL, USE_GROUPS }, { NULL, 6 } }
541 #define GRP2S_one NULL, { { NULL, USE_GROUPS }, { NULL, 7 } }
542 #define GRP2b_cl NULL, { { NULL, USE_GROUPS }, { NULL, 8 } }
543 #define GRP2S_cl NULL, { { NULL, USE_GROUPS }, { NULL, 9 } }
544 #define GRP3b NULL, { { NULL, USE_GROUPS }, { NULL, 10 } }
545 #define GRP3S NULL, { { NULL, USE_GROUPS }, { NULL, 11 } }
546 #define GRP4 NULL, { { NULL, USE_GROUPS }, { NULL, 12 } }
547 #define GRP5 NULL, { { NULL, USE_GROUPS }, { NULL, 13 } }
548 #define GRP6 NULL, { { NULL, USE_GROUPS }, { NULL, 14 } }
549 #define GRP7 NULL, { { NULL, USE_GROUPS }, { NULL, 15 } }
550 #define GRP8 NULL, { { NULL, USE_GROUPS }, { NULL, 16 } }
551 #define GRP9 NULL, { { NULL, USE_GROUPS }, { NULL, 17 } }
552 #define GRP11_C6 NULL, { { NULL, USE_GROUPS }, { NULL, 18 } }
553 #define GRP11_C7 NULL, { { NULL, USE_GROUPS }, { NULL, 19 } }
554 #define GRP12 NULL, { { NULL, USE_GROUPS }, { NULL, 20 } }
555 #define GRP13 NULL, { { NULL, USE_GROUPS }, { NULL, 21 } }
556 #define GRP14 NULL, { { NULL, USE_GROUPS }, { NULL, 22 } }
557 #define GRP15 NULL, { { NULL, USE_GROUPS }, { NULL, 23 } }
558 #define GRP16 NULL, { { NULL, USE_GROUPS }, { NULL, 24 } }
559 #define GRPAMD NULL, { { NULL, USE_GROUPS }, { NULL, 25 } }
560 #define GRPPADLCK1 NULL, { { NULL, USE_GROUPS }, { NULL, 26 } }
561 #define GRPPADLCK2 NULL, { { NULL, USE_GROUPS }, { NULL, 27 } }
563 #define PREGRP0 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 0 } }
564 #define PREGRP1 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 1 } }
565 #define PREGRP2 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 2 } }
566 #define PREGRP3 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 3 } }
567 #define PREGRP4 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 4 } }
568 #define PREGRP5 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 5 } }
569 #define PREGRP6 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 6 } }
570 #define PREGRP7 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 7 } }
571 #define PREGRP8 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 8 } }
572 #define PREGRP9 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 9 } }
573 #define PREGRP10 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 10 } }
574 #define PREGRP11 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 11 } }
575 #define PREGRP12 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 12 } }
576 #define PREGRP13 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 13 } }
577 #define PREGRP14 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 14 } }
578 #define PREGRP15 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 15 } }
579 #define PREGRP16 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 16 } }
580 #define PREGRP17 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 17 } }
581 #define PREGRP18 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 18 } }
582 #define PREGRP19 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 19 } }
583 #define PREGRP20 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 20 } }
584 #define PREGRP21 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 21 } }
585 #define PREGRP22 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 22 } }
586 #define PREGRP23 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 23 } }
587 #define PREGRP24 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 24 } }
588 #define PREGRP25 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 25 } }
589 #define PREGRP26 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 26 } }
590 #define PREGRP27 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 27 } }
591 #define PREGRP28 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 28 } }
592 #define PREGRP29 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 29 } }
593 #define PREGRP30 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 30 } }
594 #define PREGRP31 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 31 } }
595 #define PREGRP32 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 32 } }
596 #define PREGRP33 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 33 } }
597 #define PREGRP34 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 34 } }
598 #define PREGRP35 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 35 } }
599 #define PREGRP36 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 36 } }
600 #define PREGRP37 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 37 } }
601 #define PREGRP38 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 38 } }
602 #define PREGRP39 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 39 } }
603 #define PREGRP40 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 40 } }
604 #define PREGRP41 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 41 } }
605 #define PREGRP42 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 42 } }
606 #define PREGRP43 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 43 } }
607 #define PREGRP44 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 44 } }
608 #define PREGRP45 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 45 } }
609 #define PREGRP46 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 46 } }
610 #define PREGRP47 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 47 } }
611 #define PREGRP48 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 48 } }
612 #define PREGRP49 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 49 } }
613 #define PREGRP50 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 50 } }
614 #define PREGRP51 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 51 } }
615 #define PREGRP52 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 52 } }
616 #define PREGRP53 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 53 } }
617 #define PREGRP54 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 54 } }
618 #define PREGRP55 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 55 } }
619 #define PREGRP56 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 56 } }
620 #define PREGRP57 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 57 } }
621 #define PREGRP58 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 58 } }
622 #define PREGRP59 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 59 } }
623 #define PREGRP60 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 60 } }
624 #define PREGRP61 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 61 } }
625 #define PREGRP62 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 62 } }
626 #define PREGRP63 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 63 } }
627 #define PREGRP64 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 64 } }
628 #define PREGRP65 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 65 } }
629 #define PREGRP66 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 66 } }
630 #define PREGRP67 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 67 } }
631 #define PREGRP68 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 68 } }
632 #define PREGRP69 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 69 } }
633 #define PREGRP70 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 70 } }
634 #define PREGRP71 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 71 } }
635 #define PREGRP72 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 72 } }
636 #define PREGRP73 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 73 } }
637 #define PREGRP74 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 74 } }
638 #define PREGRP75 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 75 } }
639 #define PREGRP76 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 76 } }
640 #define PREGRP77 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 77 } }
641 #define PREGRP78 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 78 } }
642 #define PREGRP79 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 79 } }
643 #define PREGRP80 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 80 } }
644 #define PREGRP81 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 81 } }
645 #define PREGRP82 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 82 } }
646 #define PREGRP83 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 83 } }
647 #define PREGRP84 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 84 } }
648 #define PREGRP85 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 85 } }
649 #define PREGRP86 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 86 } }
650 #define PREGRP87 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 87 } }
651 #define PREGRP88 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 88 } }
652 #define PREGRP89 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 89 } }
653 #define PREGRP90 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 90 } }
654 #define PREGRP91 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 91 } }
655 #define PREGRP92 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 92 } }
656 #define PREGRP93 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 93 } }
657 #define PREGRP94 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 94 } }
658 #define PREGRP95 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 95 } }
659 #define PREGRP96 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 96 } }
660 #define PREGRP97 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 97 } }
663 #define X86_64_0 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 0 } }
664 #define X86_64_1 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 1 } }
665 #define X86_64_2 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 2 } }
666 #define X86_64_3 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 3 } }
668 #define THREE_BYTE_0 NULL, { { NULL, IS_3BYTE_OPCODE }, { NULL, 0 } }
669 #define THREE_BYTE_1 NULL, { { NULL, IS_3BYTE_OPCODE }, { NULL, 1 } }
671 typedef void (*op_rtn
) (int bytemode
, int sizeflag
);
682 /* Upper case letters in the instruction names here are macros.
683 'A' => print 'b' if no register operands or suffix_always is true
684 'B' => print 'b' if suffix_always is true
685 'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand
687 'D' => print 'w' if no register operands or 'w', 'l' or 'q', if
688 . suffix_always is true
689 'E' => print 'e' if 32-bit form of jcxz
690 'F' => print 'w' or 'l' depending on address size prefix (loop insns)
691 'G' => print 'w' or 'l' depending on operand size prefix (i/o insns)
692 'H' => print ",pt" or ",pn" branch hint
693 'I' => honor following macro letter even in Intel mode (implemented only
694 . for some of the macro letters)
696 'K' => print 'd' or 'q' if rex prefix is present.
697 'L' => print 'l' if suffix_always is true
698 'N' => print 'n' if instruction has no wait "prefix"
699 'O' => print 'd' or 'o' (or 'q' in Intel mode)
700 'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
701 . or suffix_always is true. print 'q' if rex prefix is present.
702 'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
704 'R' => print 'w', 'l' or 'q' ('d' for 'l' and 'e' in Intel mode)
705 'S' => print 'w', 'l' or 'q' if suffix_always is true
706 'T' => print 'q' in 64bit mode and behave as 'P' otherwise
707 'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
708 'V' => print 'q' in 64bit mode and behave as 'S' otherwise
709 'W' => print 'b', 'w' or 'l' ('d' in Intel mode)
710 'X' => print 's', 'd' depending on data16 prefix (for XMM)
711 'Y' => 'q' if instruction has an REX 64bit overwrite prefix
712 'Z' => print 'q' in 64bit mode and behave as 'L' otherwise
714 Many of the above letters print nothing in Intel mode. See "putop"
717 Braces '{' and '}', and vertical bars '|', indicate alternative
718 mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel
719 modes. In cases where there are only two alternatives, the X86_64
720 instruction is reserved, and "(bad)" is printed.
723 static const struct dis386 dis386
[] = {
725 { "addB", { Eb
, Gb
} },
726 { "addS", { Ev
, Gv
} },
727 { "addB", { Gb
, Eb
} },
728 { "addS", { Gv
, Ev
} },
729 { "addB", { AL
, Ib
} },
730 { "addS", { eAX
, Iv
} },
731 { "push{T|}", { es
} },
732 { "pop{T|}", { es
} },
734 { "orB", { Eb
, Gb
} },
735 { "orS", { Ev
, Gv
} },
736 { "orB", { Gb
, Eb
} },
737 { "orS", { Gv
, Ev
} },
738 { "orB", { AL
, Ib
} },
739 { "orS", { eAX
, Iv
} },
740 { "push{T|}", { cs
} },
741 { "(bad)", { XX
} }, /* 0x0f extended opcode escape */
743 { "adcB", { Eb
, Gb
} },
744 { "adcS", { Ev
, Gv
} },
745 { "adcB", { Gb
, Eb
} },
746 { "adcS", { Gv
, Ev
} },
747 { "adcB", { AL
, Ib
} },
748 { "adcS", { eAX
, Iv
} },
749 { "push{T|}", { ss
} },
750 { "pop{T|}", { ss
} },
752 { "sbbB", { Eb
, Gb
} },
753 { "sbbS", { Ev
, Gv
} },
754 { "sbbB", { Gb
, Eb
} },
755 { "sbbS", { Gv
, Ev
} },
756 { "sbbB", { AL
, Ib
} },
757 { "sbbS", { eAX
, Iv
} },
758 { "push{T|}", { ds
} },
759 { "pop{T|}", { ds
} },
761 { "andB", { Eb
, Gb
} },
762 { "andS", { Ev
, Gv
} },
763 { "andB", { Gb
, Eb
} },
764 { "andS", { Gv
, Ev
} },
765 { "andB", { AL
, Ib
} },
766 { "andS", { eAX
, Iv
} },
767 { "(bad)", { XX
} }, /* SEG ES prefix */
768 { "daa{|}", { XX
} },
770 { "subB", { Eb
, Gb
} },
771 { "subS", { Ev
, Gv
} },
772 { "subB", { Gb
, Eb
} },
773 { "subS", { Gv
, Ev
} },
774 { "subB", { AL
, Ib
} },
775 { "subS", { eAX
, Iv
} },
776 { "(bad)", { XX
} }, /* SEG CS prefix */
777 { "das{|}", { XX
} },
779 { "xorB", { Eb
, Gb
} },
780 { "xorS", { Ev
, Gv
} },
781 { "xorB", { Gb
, Eb
} },
782 { "xorS", { Gv
, Ev
} },
783 { "xorB", { AL
, Ib
} },
784 { "xorS", { eAX
, Iv
} },
785 { "(bad)", { XX
} }, /* SEG SS prefix */
786 { "aaa{|}", { XX
} },
788 { "cmpB", { Eb
, Gb
} },
789 { "cmpS", { Ev
, Gv
} },
790 { "cmpB", { Gb
, Eb
} },
791 { "cmpS", { Gv
, Ev
} },
792 { "cmpB", { AL
, Ib
} },
793 { "cmpS", { eAX
, Iv
} },
794 { "(bad)", { XX
} }, /* SEG DS prefix */
795 { "aas{|}", { XX
} },
797 { "inc{S|}", { RMeAX
} },
798 { "inc{S|}", { RMeCX
} },
799 { "inc{S|}", { RMeDX
} },
800 { "inc{S|}", { RMeBX
} },
801 { "inc{S|}", { RMeSP
} },
802 { "inc{S|}", { RMeBP
} },
803 { "inc{S|}", { RMeSI
} },
804 { "inc{S|}", { RMeDI
} },
806 { "dec{S|}", { RMeAX
} },
807 { "dec{S|}", { RMeCX
} },
808 { "dec{S|}", { RMeDX
} },
809 { "dec{S|}", { RMeBX
} },
810 { "dec{S|}", { RMeSP
} },
811 { "dec{S|}", { RMeBP
} },
812 { "dec{S|}", { RMeSI
} },
813 { "dec{S|}", { RMeDI
} },
815 { "pushV", { RMrAX
} },
816 { "pushV", { RMrCX
} },
817 { "pushV", { RMrDX
} },
818 { "pushV", { RMrBX
} },
819 { "pushV", { RMrSP
} },
820 { "pushV", { RMrBP
} },
821 { "pushV", { RMrSI
} },
822 { "pushV", { RMrDI
} },
824 { "popV", { RMrAX
} },
825 { "popV", { RMrCX
} },
826 { "popV", { RMrDX
} },
827 { "popV", { RMrBX
} },
828 { "popV", { RMrSP
} },
829 { "popV", { RMrBP
} },
830 { "popV", { RMrSI
} },
831 { "popV", { RMrDI
} },
837 { "(bad)", { XX
} }, /* seg fs */
838 { "(bad)", { XX
} }, /* seg gs */
839 { "(bad)", { XX
} }, /* op size prefix */
840 { "(bad)", { XX
} }, /* adr size prefix */
843 { "imulS", { Gv
, Ev
, Iv
} },
844 { "pushT", { sIb
} },
845 { "imulS", { Gv
, Ev
, sIb
} },
846 { "ins{b||b|}", { Ybr
, indirDX
} },
847 { "ins{R||G|}", { Yzr
, indirDX
} },
848 { "outs{b||b|}", { indirDXr
, Xb
} },
849 { "outs{R||G|}", { indirDXr
, Xz
} },
851 { "joH", { Jb
, XX
, cond_jump_flag
} },
852 { "jnoH", { Jb
, XX
, cond_jump_flag
} },
853 { "jbH", { Jb
, XX
, cond_jump_flag
} },
854 { "jaeH", { Jb
, XX
, cond_jump_flag
} },
855 { "jeH", { Jb
, XX
, cond_jump_flag
} },
856 { "jneH", { Jb
, XX
, cond_jump_flag
} },
857 { "jbeH", { Jb
, XX
, cond_jump_flag
} },
858 { "jaH", { Jb
, XX
, cond_jump_flag
} },
860 { "jsH", { Jb
, XX
, cond_jump_flag
} },
861 { "jnsH", { Jb
, XX
, cond_jump_flag
} },
862 { "jpH", { Jb
, XX
, cond_jump_flag
} },
863 { "jnpH", { Jb
, XX
, cond_jump_flag
} },
864 { "jlH", { Jb
, XX
, cond_jump_flag
} },
865 { "jgeH", { Jb
, XX
, cond_jump_flag
} },
866 { "jleH", { Jb
, XX
, cond_jump_flag
} },
867 { "jgH", { Jb
, XX
, cond_jump_flag
} },
873 { "testB", { Eb
, Gb
} },
874 { "testS", { Ev
, Gv
} },
875 { "xchgB", { Eb
, Gb
} },
876 { "xchgS", { Ev
, Gv
} },
878 { "movB", { Eb
, Gb
} },
879 { "movS", { Ev
, Gv
} },
880 { "movB", { Gb
, Eb
} },
881 { "movS", { Gv
, Ev
} },
882 { "movD", { Sv
, Sw
} },
883 { "leaS", { Gv
, M
} },
884 { "movD", { Sw
, Sv
} },
888 { "xchgS", { RMeCX
, eAX
} },
889 { "xchgS", { RMeDX
, eAX
} },
890 { "xchgS", { RMeBX
, eAX
} },
891 { "xchgS", { RMeSP
, eAX
} },
892 { "xchgS", { RMeBP
, eAX
} },
893 { "xchgS", { RMeSI
, eAX
} },
894 { "xchgS", { RMeDI
, eAX
} },
896 { "cW{t||t|}R", { XX
} },
897 { "cR{t||t|}O", { XX
} },
898 { "Jcall{T|}", { Ap
} },
899 { "(bad)", { XX
} }, /* fwait */
900 { "pushfT", { XX
} },
902 { "sahf{|}", { XX
} },
903 { "lahf{|}", { XX
} },
905 { "movB", { AL
, Ob
} },
906 { "movS", { eAX
, Ov
} },
907 { "movB", { Ob
, AL
} },
908 { "movS", { Ov
, eAX
} },
909 { "movs{b||b|}", { Ybr
, Xb
} },
910 { "movs{R||R|}", { Yvr
, Xv
} },
911 { "cmps{b||b|}", { Xb
, Yb
} },
912 { "cmps{R||R|}", { Xv
, Yv
} },
914 { "testB", { AL
, Ib
} },
915 { "testS", { eAX
, Iv
} },
916 { "stosB", { Ybr
, AL
} },
917 { "stosS", { Yvr
, eAX
} },
918 { "lodsB", { ALr
, Xb
} },
919 { "lodsS", { eAXr
, Xv
} },
920 { "scasB", { AL
, Yb
} },
921 { "scasS", { eAX
, Yv
} },
923 { "movB", { RMAL
, Ib
} },
924 { "movB", { RMCL
, Ib
} },
925 { "movB", { RMDL
, Ib
} },
926 { "movB", { RMBL
, Ib
} },
927 { "movB", { RMAH
, Ib
} },
928 { "movB", { RMCH
, Ib
} },
929 { "movB", { RMDH
, Ib
} },
930 { "movB", { RMBH
, Ib
} },
932 { "movS", { RMeAX
, Iv64
} },
933 { "movS", { RMeCX
, Iv64
} },
934 { "movS", { RMeDX
, Iv64
} },
935 { "movS", { RMeBX
, Iv64
} },
936 { "movS", { RMeSP
, Iv64
} },
937 { "movS", { RMeBP
, Iv64
} },
938 { "movS", { RMeSI
, Iv64
} },
939 { "movS", { RMeDI
, Iv64
} },
945 { "les{S|}", { Gv
, Mp
} },
946 { "ldsS", { Gv
, Mp
} },
950 { "enterT", { Iw
, Ib
} },
951 { "leaveT", { XX
} },
956 { "into{|}", { XX
} },
963 { "aam{|}", { sIb
} },
964 { "aad{|}", { sIb
} },
966 { "xlat", { DSBX
} },
977 { "loopneFH", { Jb
, XX
, loop_jcxz_flag
} },
978 { "loopeFH", { Jb
, XX
, loop_jcxz_flag
} },
979 { "loopFH", { Jb
, XX
, loop_jcxz_flag
} },
980 { "jEcxzH", { Jb
, XX
, loop_jcxz_flag
} },
981 { "inB", { AL
, Ib
} },
982 { "inG", { zAX
, Ib
} },
983 { "outB", { Ib
, AL
} },
984 { "outG", { Ib
, zAX
} },
988 { "Jjmp{T|}", { Ap
} },
990 { "inB", { AL
, indirDX
} },
991 { "inG", { zAX
, indirDX
} },
992 { "outB", { indirDX
, AL
} },
993 { "outG", { indirDX
, zAX
} },
995 { "(bad)", { XX
} }, /* lock prefix */
997 { "(bad)", { XX
} }, /* repne */
998 { "(bad)", { XX
} }, /* repz */
1014 static const struct dis386 dis386_twobyte
[] = {
1018 { "larS", { Gv
, Ew
} },
1019 { "lslS", { Gv
, Ew
} },
1020 { "(bad)", { XX
} },
1021 { "syscall", { XX
} },
1023 { "sysretP", { XX
} },
1026 { "wbinvd", { XX
} },
1027 { "(bad)", { XX
} },
1029 { "(bad)", { XX
} },
1031 { "femms", { XX
} },
1032 { "", { MX
, EM
, OPSUF
} }, /* See OP_3DNowSuffix. */
1037 { "movlpX", { EXq
, XM
, { SIMD_Fixup
, 'h' } } },
1038 { "unpcklpX", { XM
, EXq
} },
1039 { "unpckhpX", { XM
, EXq
} },
1041 { "movhpX", { EXq
, XM
, { SIMD_Fixup
, 'l' } } },
1044 { "(bad)", { XX
} },
1045 { "(bad)", { XX
} },
1046 { "(bad)", { XX
} },
1047 { "(bad)", { XX
} },
1048 { "(bad)", { XX
} },
1049 { "(bad)", { XX
} },
1052 { "movZ", { Rm
, Cm
} },
1053 { "movZ", { Rm
, Dm
} },
1054 { "movZ", { Cm
, Rm
} },
1055 { "movZ", { Dm
, Rm
} },
1056 { "movL", { Rd
, Td
} },
1057 { "(bad)", { XX
} },
1058 { "movL", { Td
, Rd
} },
1059 { "(bad)", { XX
} },
1061 { "movapX", { XM
, EXx
} },
1062 { "movapX", { EXx
, XM
} },
1070 { "wrmsr", { XX
} },
1071 { "rdtsc", { XX
} },
1072 { "rdmsr", { XX
} },
1073 { "rdpmc", { XX
} },
1074 { "sysenter", { XX
} },
1075 { "sysexit", { XX
} },
1076 { "(bad)", { XX
} },
1077 { "(bad)", { XX
} },
1080 { "(bad)", { XX
} },
1082 { "(bad)", { XX
} },
1083 { "(bad)", { XX
} },
1084 { "(bad)", { XX
} },
1085 { "(bad)", { XX
} },
1086 { "(bad)", { XX
} },
1088 { "cmovo", { Gv
, Ev
} },
1089 { "cmovno", { Gv
, Ev
} },
1090 { "cmovb", { Gv
, Ev
} },
1091 { "cmovae", { Gv
, Ev
} },
1092 { "cmove", { Gv
, Ev
} },
1093 { "cmovne", { Gv
, Ev
} },
1094 { "cmovbe", { Gv
, Ev
} },
1095 { "cmova", { Gv
, Ev
} },
1097 { "cmovs", { Gv
, Ev
} },
1098 { "cmovns", { Gv
, Ev
} },
1099 { "cmovp", { Gv
, Ev
} },
1100 { "cmovnp", { Gv
, Ev
} },
1101 { "cmovl", { Gv
, Ev
} },
1102 { "cmovge", { Gv
, Ev
} },
1103 { "cmovle", { Gv
, Ev
} },
1104 { "cmovg", { Gv
, Ev
} },
1106 { "movmskpX", { Gdq
, XS
} },
1110 { "andpX", { XM
, EXx
} },
1111 { "andnpX", { XM
, EXx
} },
1112 { "orpX", { XM
, EXx
} },
1113 { "xorpX", { XM
, EXx
} },
1127 { "packsswb", { MX
, EM
} },
1128 { "pcmpgtb", { MX
, EM
} },
1129 { "pcmpgtw", { MX
, EM
} },
1130 { "pcmpgtd", { MX
, EM
} },
1131 { "packuswb", { MX
, EM
} },
1133 { "punpckhbw", { MX
, EM
} },
1134 { "punpckhwd", { MX
, EM
} },
1135 { "punpckhdq", { MX
, EM
} },
1136 { "packssdw", { MX
, EM
} },
1139 { "movd", { MX
, Edq
} },
1146 { "pcmpeqb", { MX
, EM
} },
1147 { "pcmpeqw", { MX
, EM
} },
1148 { "pcmpeqd", { MX
, EM
} },
1153 { "(bad)", { XX
} },
1154 { "(bad)", { XX
} },
1160 { "joH", { Jv
, XX
, cond_jump_flag
} },
1161 { "jnoH", { Jv
, XX
, cond_jump_flag
} },
1162 { "jbH", { Jv
, XX
, cond_jump_flag
} },
1163 { "jaeH", { Jv
, XX
, cond_jump_flag
} },
1164 { "jeH", { Jv
, XX
, cond_jump_flag
} },
1165 { "jneH", { Jv
, XX
, cond_jump_flag
} },
1166 { "jbeH", { Jv
, XX
, cond_jump_flag
} },
1167 { "jaH", { Jv
, XX
, cond_jump_flag
} },
1169 { "jsH", { Jv
, XX
, cond_jump_flag
} },
1170 { "jnsH", { Jv
, XX
, cond_jump_flag
} },
1171 { "jpH", { Jv
, XX
, cond_jump_flag
} },
1172 { "jnpH", { Jv
, XX
, cond_jump_flag
} },
1173 { "jlH", { Jv
, XX
, cond_jump_flag
} },
1174 { "jgeH", { Jv
, XX
, cond_jump_flag
} },
1175 { "jleH", { Jv
, XX
, cond_jump_flag
} },
1176 { "jgH", { Jv
, XX
, cond_jump_flag
} },
1179 { "setno", { Eb
} },
1181 { "setae", { Eb
} },
1183 { "setne", { Eb
} },
1184 { "setbe", { Eb
} },
1188 { "setns", { Eb
} },
1190 { "setnp", { Eb
} },
1192 { "setge", { Eb
} },
1193 { "setle", { Eb
} },
1196 { "pushT", { fs
} },
1198 { "cpuid", { XX
} },
1199 { "btS", { Ev
, Gv
} },
1200 { "shldS", { Ev
, Gv
, Ib
} },
1201 { "shldS", { Ev
, Gv
, CL
} },
1205 { "pushT", { gs
} },
1208 { "btsS", { Ev
, Gv
} },
1209 { "shrdS", { Ev
, Gv
, Ib
} },
1210 { "shrdS", { Ev
, Gv
, CL
} },
1212 { "imulS", { Gv
, Ev
} },
1214 { "cmpxchgB", { Eb
, Gb
} },
1215 { "cmpxchgS", { Ev
, Gv
} },
1216 { "lssS", { Gv
, Mp
} },
1217 { "btrS", { Ev
, Gv
} },
1218 { "lfsS", { Gv
, Mp
} },
1219 { "lgsS", { Gv
, Mp
} },
1220 { "movz{bR|x|bR|x}", { Gv
, Eb
} },
1221 { "movz{wR|x|wR|x}", { Gv
, Ew
} }, /* yes, there really is movzww ! */
1226 { "btcS", { Ev
, Gv
} },
1227 { "bsfS", { Gv
, Ev
} },
1229 { "movs{bR|x|bR|x}", { Gv
, Eb
} },
1230 { "movs{wR|x|wR|x}", { Gv
, Ew
} }, /* yes, there really is movsww ! */
1232 { "xaddB", { Eb
, Gb
} },
1233 { "xaddS", { Ev
, Gv
} },
1235 { "movntiS", { Ev
, Gv
} },
1236 { "pinsrw", { MX
, Edqw
, Ib
} },
1237 { "pextrw", { Gdq
, MS
, Ib
} },
1238 { "shufpX", { XM
, EXx
, Ib
} },
1241 { "bswap", { RMeAX
} },
1242 { "bswap", { RMeCX
} },
1243 { "bswap", { RMeDX
} },
1244 { "bswap", { RMeBX
} },
1245 { "bswap", { RMeSP
} },
1246 { "bswap", { RMeBP
} },
1247 { "bswap", { RMeSI
} },
1248 { "bswap", { RMeDI
} },
1251 { "psrlw", { MX
, EM
} },
1252 { "psrld", { MX
, EM
} },
1253 { "psrlq", { MX
, EM
} },
1254 { "paddq", { MX
, EM
} },
1255 { "pmullw", { MX
, EM
} },
1257 { "pmovmskb", { Gdq
, MS
} },
1259 { "psubusb", { MX
, EM
} },
1260 { "psubusw", { MX
, EM
} },
1261 { "pminub", { MX
, EM
} },
1262 { "pand", { MX
, EM
} },
1263 { "paddusb", { MX
, EM
} },
1264 { "paddusw", { MX
, EM
} },
1265 { "pmaxub", { MX
, EM
} },
1266 { "pandn", { MX
, EM
} },
1268 { "pavgb", { MX
, EM
} },
1269 { "psraw", { MX
, EM
} },
1270 { "psrad", { MX
, EM
} },
1271 { "pavgw", { MX
, EM
} },
1272 { "pmulhuw", { MX
, EM
} },
1273 { "pmulhw", { MX
, EM
} },
1277 { "psubsb", { MX
, EM
} },
1278 { "psubsw", { MX
, EM
} },
1279 { "pminsw", { MX
, EM
} },
1280 { "por", { MX
, EM
} },
1281 { "paddsb", { MX
, EM
} },
1282 { "paddsw", { MX
, EM
} },
1283 { "pmaxsw", { MX
, EM
} },
1284 { "pxor", { MX
, EM
} },
1287 { "psllw", { MX
, EM
} },
1288 { "pslld", { MX
, EM
} },
1289 { "psllq", { MX
, EM
} },
1290 { "pmuludq", { MX
, EM
} },
1291 { "pmaddwd", { MX
, EM
} },
1292 { "psadbw", { MX
, EM
} },
1295 { "psubb", { MX
, EM
} },
1296 { "psubw", { MX
, EM
} },
1297 { "psubd", { MX
, EM
} },
1298 { "psubq", { MX
, EM
} },
1299 { "paddb", { MX
, EM
} },
1300 { "paddw", { MX
, EM
} },
1301 { "paddd", { MX
, EM
} },
1302 { "(bad)", { XX
} },
1305 static const unsigned char onebyte_has_modrm
[256] = {
1306 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1307 /* ------------------------------- */
1308 /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
1309 /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
1310 /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
1311 /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
1312 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
1313 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
1314 /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
1315 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
1316 /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
1317 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
1318 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
1319 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
1320 /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
1321 /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
1322 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
1323 /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 /* f0 */
1324 /* ------------------------------- */
1325 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1328 static const unsigned char twobyte_has_modrm
[256] = {
1329 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1330 /* ------------------------------- */
1331 /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
1332 /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1, /* 1f */
1333 /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
1334 /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
1335 /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
1336 /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
1337 /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
1338 /* 70 */ 1,1,1,1,1,1,1,0,1,1,0,0,1,1,1,1, /* 7f */
1339 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1340 /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
1341 /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
1342 /* b0 */ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, /* bf */
1343 /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
1344 /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
1345 /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
1346 /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 /* ff */
1347 /* ------------------------------- */
1348 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1351 static const unsigned char twobyte_uses_DATA_prefix
[256] = {
1352 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1353 /* ------------------------------- */
1354 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1355 /* 10 */ 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0, /* 1f */
1356 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1357 /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
1358 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1359 /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
1360 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
1361 /* 70 */ 1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1, /* 7f */
1362 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1363 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1364 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1365 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1366 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1367 /* d0 */ 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1368 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1369 /* f0 */ 1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 /* ff */
1370 /* ------------------------------- */
1371 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1374 static const unsigned char twobyte_uses_REPNZ_prefix
[256] = {
1375 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1376 /* ------------------------------- */
1377 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1378 /* 10 */ 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1379 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1380 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1381 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1382 /* 50 */ 0,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1, /* 5f */
1383 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1384 /* 70 */ 1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0, /* 7f */
1385 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1386 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1387 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1388 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1389 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1390 /* d0 */ 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1391 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1392 /* f0 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1393 /* ------------------------------- */
1394 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1397 static const unsigned char twobyte_uses_REPZ_prefix
[256] = {
1398 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1399 /* ------------------------------- */
1400 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1401 /* 10 */ 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0, /* 1f */
1402 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1403 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1404 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1405 /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
1406 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, /* 6f */
1407 /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
1408 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1409 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1410 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1411 /* b0 */ 0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, /* bf */
1412 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1413 /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1414 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1415 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1416 /* ------------------------------- */
1417 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1420 /* This is used to determine if opcode 0f 38 XX uses DATA prefix. */
1421 static const unsigned char threebyte_0x38_uses_DATA_prefix
[256] = {
1422 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1423 /* ------------------------------- */
1424 /* 00 */ 1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, /* 0f */
1425 /* 10 */ 1,0,0,0,1,1,0,1,0,0,0,0,1,1,1,0, /* 1f */
1426 /* 20 */ 1,1,1,1,1,1,0,0,1,1,1,1,0,0,0,0, /* 2f */
1427 /* 30 */ 1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1, /* 3f */
1428 /* 40 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1429 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1430 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1431 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1432 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1433 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1434 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1435 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1436 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1437 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1438 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1439 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1440 /* ------------------------------- */
1441 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1444 /* This is used to determine if opcode 0f 38 XX uses REPNZ prefix. */
1445 static const unsigned char threebyte_0x38_uses_REPNZ_prefix
[256] = {
1446 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1447 /* ------------------------------- */
1448 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1449 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1450 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1451 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1452 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1453 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1454 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1455 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1456 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1457 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1458 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1459 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1460 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1461 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1462 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1463 /* f0 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1464 /* ------------------------------- */
1465 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1468 /* This is used to determine if opcode 0f 38 XX uses REPZ prefix. */
1469 static const unsigned char threebyte_0x38_uses_REPZ_prefix
[256] = {
1470 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1471 /* ------------------------------- */
1472 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1473 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1474 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1475 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1476 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1477 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1478 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1479 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1480 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1481 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1482 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1483 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1484 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1485 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1486 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1487 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1488 /* ------------------------------- */
1489 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1492 /* This is used to determine if opcode 0f 3a XX uses DATA prefix. */
1493 static const unsigned char threebyte_0x3a_uses_DATA_prefix
[256] = {
1494 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1495 /* ------------------------------- */
1496 /* 00 */ 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, /* 0f */
1497 /* 10 */ 0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* 1f */
1498 /* 20 */ 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1499 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1500 /* 40 */ 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1501 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1502 /* 60 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1503 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1504 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1505 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1506 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1507 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1508 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1509 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1510 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1511 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1512 /* ------------------------------- */
1513 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1516 /* This is used to determine if opcode 0f 3a XX uses REPNZ prefix. */
1517 static const unsigned char threebyte_0x3a_uses_REPNZ_prefix
[256] = {
1518 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1519 /* ------------------------------- */
1520 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1521 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1522 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1523 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1524 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1525 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1526 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1527 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1528 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1529 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1530 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1531 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1532 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1533 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1534 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1535 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1536 /* ------------------------------- */
1537 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1540 /* This is used to determine if opcode 0f 3a XX uses REPZ prefix. */
1541 static const unsigned char threebyte_0x3a_uses_REPZ_prefix
[256] = {
1542 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1543 /* ------------------------------- */
1544 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1545 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1546 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1547 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1548 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1549 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1550 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1551 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1552 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1553 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1554 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1555 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1556 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1557 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1558 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1559 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1560 /* ------------------------------- */
1561 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1564 static char obuf
[100];
1566 static char scratchbuf
[100];
1567 static unsigned char *start_codep
;
1568 static unsigned char *insn_codep
;
1569 static unsigned char *codep
;
1570 static disassemble_info
*the_info
;
1578 static unsigned char need_modrm
;
1580 /* If we are accessing mod/rm/reg without need_modrm set, then the
1581 values are stale. Hitting this abort likely indicates that you
1582 need to update onebyte_has_modrm or twobyte_has_modrm. */
1583 #define MODRM_CHECK if (!need_modrm) abort ()
1585 static const char * const *names64
;
1586 static const char * const *names32
;
1587 static const char * const *names16
;
1588 static const char * const *names8
;
1589 static const char * const *names8rex
;
1590 static const char * const *names_seg
;
1591 static const char * const *index16
;
1593 static const char * const intel_names64
[] = {
1594 "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
1595 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
1597 static const char * const intel_names32
[] = {
1598 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
1599 "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
1601 static const char * const intel_names16
[] = {
1602 "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
1603 "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
1605 static const char * const intel_names8
[] = {
1606 "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
1608 static const char * const intel_names8rex
[] = {
1609 "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
1610 "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
1612 static const char * const intel_names_seg
[] = {
1613 "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
1615 static const char * const intel_index16
[] = {
1616 "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
1619 static const char * const att_names64
[] = {
1620 "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
1621 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
1623 static const char * const att_names32
[] = {
1624 "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
1625 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
1627 static const char * const att_names16
[] = {
1628 "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
1629 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
1631 static const char * const att_names8
[] = {
1632 "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
1634 static const char * const att_names8rex
[] = {
1635 "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
1636 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
1638 static const char * const att_names_seg
[] = {
1639 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
1641 static const char * const att_index16
[] = {
1642 "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
1645 static const struct dis386 grps
[][8] = {
1648 { "popU", { stackEv
} },
1649 { "(bad)", { XX
} },
1650 { "(bad)", { XX
} },
1651 { "(bad)", { XX
} },
1652 { "(bad)", { XX
} },
1653 { "(bad)", { XX
} },
1654 { "(bad)", { XX
} },
1655 { "(bad)", { XX
} },
1659 { "addA", { Eb
, Ib
} },
1660 { "orA", { Eb
, Ib
} },
1661 { "adcA", { Eb
, Ib
} },
1662 { "sbbA", { Eb
, Ib
} },
1663 { "andA", { Eb
, Ib
} },
1664 { "subA", { Eb
, Ib
} },
1665 { "xorA", { Eb
, Ib
} },
1666 { "cmpA", { Eb
, Ib
} },
1670 { "addQ", { Ev
, Iv
} },
1671 { "orQ", { Ev
, Iv
} },
1672 { "adcQ", { Ev
, Iv
} },
1673 { "sbbQ", { Ev
, Iv
} },
1674 { "andQ", { Ev
, Iv
} },
1675 { "subQ", { Ev
, Iv
} },
1676 { "xorQ", { Ev
, Iv
} },
1677 { "cmpQ", { Ev
, Iv
} },
1681 { "addQ", { Ev
, sIb
} },
1682 { "orQ", { Ev
, sIb
} },
1683 { "adcQ", { Ev
, sIb
} },
1684 { "sbbQ", { Ev
, sIb
} },
1685 { "andQ", { Ev
, sIb
} },
1686 { "subQ", { Ev
, sIb
} },
1687 { "xorQ", { Ev
, sIb
} },
1688 { "cmpQ", { Ev
, sIb
} },
1692 { "rolA", { Eb
, Ib
} },
1693 { "rorA", { Eb
, Ib
} },
1694 { "rclA", { Eb
, Ib
} },
1695 { "rcrA", { Eb
, Ib
} },
1696 { "shlA", { Eb
, Ib
} },
1697 { "shrA", { Eb
, Ib
} },
1698 { "(bad)", { XX
} },
1699 { "sarA", { Eb
, Ib
} },
1703 { "rolQ", { Ev
, Ib
} },
1704 { "rorQ", { Ev
, Ib
} },
1705 { "rclQ", { Ev
, Ib
} },
1706 { "rcrQ", { Ev
, Ib
} },
1707 { "shlQ", { Ev
, Ib
} },
1708 { "shrQ", { Ev
, Ib
} },
1709 { "(bad)", { XX
} },
1710 { "sarQ", { Ev
, Ib
} },
1714 { "rolA", { Eb
, I1
} },
1715 { "rorA", { Eb
, I1
} },
1716 { "rclA", { Eb
, I1
} },
1717 { "rcrA", { Eb
, I1
} },
1718 { "shlA", { Eb
, I1
} },
1719 { "shrA", { Eb
, I1
} },
1720 { "(bad)", { XX
} },
1721 { "sarA", { Eb
, I1
} },
1725 { "rolQ", { Ev
, I1
} },
1726 { "rorQ", { Ev
, I1
} },
1727 { "rclQ", { Ev
, I1
} },
1728 { "rcrQ", { Ev
, I1
} },
1729 { "shlQ", { Ev
, I1
} },
1730 { "shrQ", { Ev
, I1
} },
1731 { "(bad)", { XX
} },
1732 { "sarQ", { Ev
, I1
} },
1736 { "rolA", { Eb
, CL
} },
1737 { "rorA", { Eb
, CL
} },
1738 { "rclA", { Eb
, CL
} },
1739 { "rcrA", { Eb
, CL
} },
1740 { "shlA", { Eb
, CL
} },
1741 { "shrA", { Eb
, CL
} },
1742 { "(bad)", { XX
} },
1743 { "sarA", { Eb
, CL
} },
1747 { "rolQ", { Ev
, CL
} },
1748 { "rorQ", { Ev
, CL
} },
1749 { "rclQ", { Ev
, CL
} },
1750 { "rcrQ", { Ev
, CL
} },
1751 { "shlQ", { Ev
, CL
} },
1752 { "shrQ", { Ev
, CL
} },
1753 { "(bad)", { XX
} },
1754 { "sarQ", { Ev
, CL
} },
1758 { "testA", { Eb
, Ib
} },
1759 { "(bad)", { Eb
} },
1762 { "mulA", { Eb
} }, /* Don't print the implicit %al register, */
1763 { "imulA", { Eb
} }, /* to distinguish these opcodes from other */
1764 { "divA", { Eb
} }, /* mul/imul opcodes. Do the same for div */
1765 { "idivA", { Eb
} }, /* and idiv for consistency. */
1769 { "testQ", { Ev
, Iv
} },
1770 { "(bad)", { XX
} },
1773 { "mulQ", { Ev
} }, /* Don't print the implicit register. */
1774 { "imulQ", { Ev
} },
1776 { "idivQ", { Ev
} },
1782 { "(bad)", { XX
} },
1783 { "(bad)", { XX
} },
1784 { "(bad)", { XX
} },
1785 { "(bad)", { XX
} },
1786 { "(bad)", { XX
} },
1787 { "(bad)", { XX
} },
1793 { "callT", { indirEv
} },
1794 { "JcallT", { indirEp
} },
1795 { "jmpT", { indirEv
} },
1796 { "JjmpT", { indirEp
} },
1797 { "pushU", { stackEv
} },
1798 { "(bad)", { XX
} },
1802 { "sldtD", { Sv
} },
1808 { "(bad)", { XX
} },
1809 { "(bad)", { XX
} },
1813 { "sgdt{Q|IQ||}", { { VMX_Fixup
, 0 } } },
1814 { "sidt{Q|IQ||}", { { PNI_Fixup
, 0 } } },
1815 { "lgdt{Q|Q||}", { M
} },
1816 { "lidt{Q|Q||}", { { SVME_Fixup
, 0 } } },
1817 { "smswD", { Sv
} },
1818 { "(bad)", { XX
} },
1820 { "invlpg", { { INVLPG_Fixup
, w_mode
} } },
1824 { "(bad)", { XX
} },
1825 { "(bad)", { XX
} },
1826 { "(bad)", { XX
} },
1827 { "(bad)", { XX
} },
1828 { "btQ", { Ev
, Ib
} },
1829 { "btsQ", { Ev
, Ib
} },
1830 { "btrQ", { Ev
, Ib
} },
1831 { "btcQ", { Ev
, Ib
} },
1835 { "(bad)", { XX
} },
1836 { "cmpxchg8b", { { CMPXCHG8B_Fixup
, q_mode
} } },
1837 { "(bad)", { XX
} },
1838 { "(bad)", { XX
} },
1839 { "(bad)", { XX
} },
1840 { "(bad)", { XX
} },
1841 { "", { VM
} }, /* See OP_VMX. */
1842 { "vmptrst", { Mq
} },
1846 { "movA", { Eb
, Ib
} },
1847 { "(bad)", { XX
} },
1848 { "(bad)", { XX
} },
1849 { "(bad)", { XX
} },
1850 { "(bad)", { XX
} },
1851 { "(bad)", { XX
} },
1852 { "(bad)", { XX
} },
1853 { "(bad)", { XX
} },
1857 { "movQ", { Ev
, Iv
} },
1858 { "(bad)", { XX
} },
1859 { "(bad)", { XX
} },
1860 { "(bad)", { XX
} },
1861 { "(bad)", { XX
} },
1862 { "(bad)", { XX
} },
1863 { "(bad)", { XX
} },
1864 { "(bad)", { XX
} },
1868 { "(bad)", { XX
} },
1869 { "(bad)", { XX
} },
1870 { "psrlw", { MS
, Ib
} },
1871 { "(bad)", { XX
} },
1872 { "psraw", { MS
, Ib
} },
1873 { "(bad)", { XX
} },
1874 { "psllw", { MS
, Ib
} },
1875 { "(bad)", { XX
} },
1879 { "(bad)", { XX
} },
1880 { "(bad)", { XX
} },
1881 { "psrld", { MS
, Ib
} },
1882 { "(bad)", { XX
} },
1883 { "psrad", { MS
, Ib
} },
1884 { "(bad)", { XX
} },
1885 { "pslld", { MS
, Ib
} },
1886 { "(bad)", { XX
} },
1890 { "(bad)", { XX
} },
1891 { "(bad)", { XX
} },
1892 { "psrlq", { MS
, Ib
} },
1893 { "psrldq", { MS
, Ib
} },
1894 { "(bad)", { XX
} },
1895 { "(bad)", { XX
} },
1896 { "psllq", { MS
, Ib
} },
1897 { "pslldq", { MS
, Ib
} },
1901 { "fxsave", { Ev
} },
1902 { "fxrstor", { Ev
} },
1903 { "ldmxcsr", { Ev
} },
1904 { "stmxcsr", { Ev
} },
1905 { "(bad)", { XX
} },
1906 { "lfence", { { OP_0fae
, 0 } } },
1907 { "mfence", { { OP_0fae
, 0 } } },
1908 { "clflush", { { OP_0fae
, 0 } } },
1912 { "prefetchnta", { Ev
} },
1913 { "prefetcht0", { Ev
} },
1914 { "prefetcht1", { Ev
} },
1915 { "prefetcht2", { Ev
} },
1916 { "(bad)", { XX
} },
1917 { "(bad)", { XX
} },
1918 { "(bad)", { XX
} },
1919 { "(bad)", { XX
} },
1923 { "prefetch", { Eb
} },
1924 { "prefetchw", { Eb
} },
1925 { "(bad)", { XX
} },
1926 { "(bad)", { XX
} },
1927 { "(bad)", { XX
} },
1928 { "(bad)", { XX
} },
1929 { "(bad)", { XX
} },
1930 { "(bad)", { XX
} },
1934 { "xstore-rng", { { OP_0f07
, 0 } } },
1935 { "xcrypt-ecb", { { OP_0f07
, 0 } } },
1936 { "xcrypt-cbc", { { OP_0f07
, 0 } } },
1937 { "xcrypt-ctr", { { OP_0f07
, 0 } } },
1938 { "xcrypt-cfb", { { OP_0f07
, 0 } } },
1939 { "xcrypt-ofb", { { OP_0f07
, 0 } } },
1940 { "(bad)", { { OP_0f07
, 0 } } },
1941 { "(bad)", { { OP_0f07
, 0 } } },
1945 { "montmul", { { OP_0f07
, 0 } } },
1946 { "xsha1", { { OP_0f07
, 0 } } },
1947 { "xsha256", { { OP_0f07
, 0 } } },
1948 { "(bad)", { { OP_0f07
, 0 } } },
1949 { "(bad)", { { OP_0f07
, 0 } } },
1950 { "(bad)", { { OP_0f07
, 0 } } },
1951 { "(bad)", { { OP_0f07
, 0 } } },
1952 { "(bad)", { { OP_0f07
, 0 } } },
1956 static const struct dis386 prefix_user_table
[][4] = {
1959 { "addps", { XM
, EXx
} },
1960 { "addss", { XM
, EXd
} },
1961 { "addpd", { XM
, EXx
} },
1962 { "addsd", { XM
, EXq
} },
1966 { "", { XM
, EXx
, OPSIMD
} }, /* See OP_SIMD_SUFFIX. */
1967 { "", { XM
, EXx
, OPSIMD
} },
1968 { "", { XM
, EXx
, OPSIMD
} },
1969 { "", { XM
, EXx
, OPSIMD
} },
1973 { "cvtpi2ps", { XM
, EMC
} },
1974 { "cvtsi2ssY", { XM
, Ev
} },
1975 { "cvtpi2pd", { XM
, EMC
} },
1976 { "cvtsi2sdY", { XM
, Ev
} },
1980 { "cvtps2pi", { MXC
, EXx
} },
1981 { "cvtss2siY", { Gv
, EXx
} },
1982 { "cvtpd2pi", { MXC
, EXx
} },
1983 { "cvtsd2siY", { Gv
, EXx
} },
1987 { "cvttps2pi", { MXC
, EXx
} },
1988 { "cvttss2siY", { Gv
, EXx
} },
1989 { "cvttpd2pi", { MXC
, EXx
} },
1990 { "cvttsd2siY", { Gv
, EXx
} },
1994 { "divps", { XM
, EXx
} },
1995 { "divss", { XM
, EXx
} },
1996 { "divpd", { XM
, EXx
} },
1997 { "divsd", { XM
, EXx
} },
2001 { "maxps", { XM
, EXx
} },
2002 { "maxss", { XM
, EXx
} },
2003 { "maxpd", { XM
, EXx
} },
2004 { "maxsd", { XM
, EXx
} },
2008 { "minps", { XM
, EXx
} },
2009 { "minss", { XM
, EXx
} },
2010 { "minpd", { XM
, EXx
} },
2011 { "minsd", { XM
, EXx
} },
2015 { "movups", { XM
, EXx
} },
2016 { "movss", { XM
, EXx
} },
2017 { "movupd", { XM
, EXx
} },
2018 { "movsd", { XM
, EXx
} },
2022 { "movups", { EXx
, XM
} },
2023 { "movss", { EXx
, XM
} },
2024 { "movupd", { EXx
, XM
} },
2025 { "movsd", { EXx
, XM
} },
2029 { "mulps", { XM
, EXx
} },
2030 { "mulss", { XM
, EXx
} },
2031 { "mulpd", { XM
, EXx
} },
2032 { "mulsd", { XM
, EXx
} },
2036 { "rcpps", { XM
, EXx
} },
2037 { "rcpss", { XM
, EXx
} },
2038 { "(bad)", { XM
, EXx
} },
2039 { "(bad)", { XM
, EXx
} },
2043 { "rsqrtps",{ XM
, EXx
} },
2044 { "rsqrtss",{ XM
, EXx
} },
2045 { "(bad)", { XM
, EXx
} },
2046 { "(bad)", { XM
, EXx
} },
2050 { "sqrtps", { XM
, EXx
} },
2051 { "sqrtss", { XM
, EXx
} },
2052 { "sqrtpd", { XM
, EXx
} },
2053 { "sqrtsd", { XM
, EXx
} },
2057 { "subps", { XM
, EXx
} },
2058 { "subss", { XM
, EXx
} },
2059 { "subpd", { XM
, EXx
} },
2060 { "subsd", { XM
, EXx
} },
2064 { "(bad)", { XM
, EXx
} },
2065 { "cvtdq2pd", { XM
, EXq
} },
2066 { "cvttpd2dq", { XM
, EXx
} },
2067 { "cvtpd2dq", { XM
, EXx
} },
2071 { "cvtdq2ps", { XM
, EXx
} },
2072 { "cvttps2dq", { XM
, EXx
} },
2073 { "cvtps2dq", { XM
, EXx
} },
2074 { "(bad)", { XM
, EXx
} },
2078 { "cvtps2pd", { XM
, EXq
} },
2079 { "cvtss2sd", { XM
, EXx
} },
2080 { "cvtpd2ps", { XM
, EXx
} },
2081 { "cvtsd2ss", { XM
, EXx
} },
2085 { "maskmovq", { MX
, MS
} },
2086 { "(bad)", { XM
, EXx
} },
2087 { "maskmovdqu", { XM
, XS
} },
2088 { "(bad)", { XM
, EXx
} },
2092 { "movq", { MX
, EM
} },
2093 { "movdqu", { XM
, EXx
} },
2094 { "movdqa", { XM
, EXx
} },
2095 { "(bad)", { XM
, EXx
} },
2099 { "movq", { EM
, MX
} },
2100 { "movdqu", { EXx
, XM
} },
2101 { "movdqa", { EXx
, XM
} },
2102 { "(bad)", { EXx
, XM
} },
2106 { "(bad)", { EXx
, XM
} },
2107 { "movq2dq",{ XM
, MS
} },
2108 { "movq", { EXx
, XM
} },
2109 { "movdq2q",{ MX
, XS
} },
2113 { "pshufw", { MX
, EM
, Ib
} },
2114 { "pshufhw",{ XM
, EXx
, Ib
} },
2115 { "pshufd", { XM
, EXx
, Ib
} },
2116 { "pshuflw",{ XM
, EXx
, Ib
} },
2120 { "movd", { Edq
, MX
} },
2121 { "movq", { XM
, EXx
} },
2122 { "movd", { Edq
, XM
} },
2123 { "(bad)", { Ed
, XM
} },
2127 { "(bad)", { MX
, EXx
} },
2128 { "(bad)", { XM
, EXx
} },
2129 { "punpckhqdq", { XM
, EXx
} },
2130 { "(bad)", { XM
, EXx
} },
2134 { "movntq", { EM
, MX
} },
2135 { "(bad)", { EM
, XM
} },
2136 { "movntdq",{ EM
, XM
} },
2137 { "(bad)", { EM
, XM
} },
2141 { "(bad)", { MX
, EXx
} },
2142 { "(bad)", { XM
, EXx
} },
2143 { "punpcklqdq", { XM
, EXx
} },
2144 { "(bad)", { XM
, EXx
} },
2148 { "(bad)", { MX
, EXx
} },
2149 { "(bad)", { XM
, EXx
} },
2150 { "addsubpd", { XM
, EXx
} },
2151 { "addsubps", { XM
, EXx
} },
2155 { "(bad)", { MX
, EXx
} },
2156 { "(bad)", { XM
, EXx
} },
2157 { "haddpd", { XM
, EXx
} },
2158 { "haddps", { XM
, EXx
} },
2162 { "(bad)", { MX
, EXx
} },
2163 { "(bad)", { XM
, EXx
} },
2164 { "hsubpd", { XM
, EXx
} },
2165 { "hsubps", { XM
, EXx
} },
2169 { "movlpX", { XM
, EXq
, { SIMD_Fixup
, 'h' } } }, /* really only 2 operands */
2170 { "movsldup", { XM
, EXx
} },
2171 { "movlpd", { XM
, EXq
} },
2172 { "movddup", { XM
, EXq
} },
2176 { "movhpX", { XM
, EXq
, { SIMD_Fixup
, 'l' } } },
2177 { "movshdup", { XM
, EXx
} },
2178 { "movhpd", { XM
, EXq
} },
2179 { "(bad)", { XM
, EXq
} },
2183 { "(bad)", { XM
, EXx
} },
2184 { "(bad)", { XM
, EXx
} },
2185 { "(bad)", { XM
, EXx
} },
2186 { "lddqu", { XM
, M
} },
2190 {"movntps", { Ev
, XM
} },
2191 {"movntss", { Ev
, XM
} },
2192 {"movntpd", { Ev
, XM
} },
2193 {"movntsd", { Ev
, XM
} },
2198 {"vmread", { Em
, Gm
} },
2200 {"extrq", { XS
, Ib
, Ib
} },
2201 {"insertq", { XM
, XS
, Ib
, Ib
} },
2206 {"vmwrite", { Gm
, Em
} },
2208 {"extrq", { XM
, XS
} },
2209 {"insertq", { XM
, XS
} },
2214 { "bsrS", { Gv
, Ev
} },
2215 { "lzcntS", { Gv
, Ev
} },
2216 { "bsrS", { Gv
, Ev
} },
2217 { "(bad)", { XX
} },
2222 { "(bad)", { XX
} },
2223 { "popcntS", { Gv
, Ev
} },
2224 { "(bad)", { XX
} },
2225 { "(bad)", { XX
} },
2230 { "xchgS", { { NOP_Fixup1
, eAX_reg
}, { NOP_Fixup2
, eAX_reg
} } },
2231 { "pause", { XX
} },
2232 { "xchgS", { { NOP_Fixup1
, eAX_reg
}, { NOP_Fixup2
, eAX_reg
} } },
2233 { "(bad)", { XX
} },
2238 { "(bad)", { XX
} },
2239 { "(bad)", { XX
} },
2240 { "pblendvb", {XM
, EXx
, XMM0
} },
2241 { "(bad)", { XX
} },
2246 { "(bad)", { XX
} },
2247 { "(bad)", { XX
} },
2248 { "blendvps", {XM
, EXx
, XMM0
} },
2249 { "(bad)", { XX
} },
2254 { "(bad)", { XX
} },
2255 { "(bad)", { XX
} },
2256 { "blendvpd", { XM
, EXx
, XMM0
} },
2257 { "(bad)", { XX
} },
2262 { "(bad)", { XX
} },
2263 { "(bad)", { XX
} },
2264 { "ptest", { XM
, EXx
} },
2265 { "(bad)", { XX
} },
2270 { "(bad)", { XX
} },
2271 { "(bad)", { XX
} },
2272 { "pmovsxbw", { XM
, EXx
} },
2273 { "(bad)", { XX
} },
2278 { "(bad)", { XX
} },
2279 { "(bad)", { XX
} },
2280 { "pmovsxbd", { XM
, EXx
} },
2281 { "(bad)", { XX
} },
2286 { "(bad)", { XX
} },
2287 { "(bad)", { XX
} },
2288 { "pmovsxbq", { XM
, EXx
} },
2289 { "(bad)", { XX
} },
2294 { "(bad)", { XX
} },
2295 { "(bad)", { XX
} },
2296 { "pmovsxwd", { XM
, EXx
} },
2297 { "(bad)", { XX
} },
2302 { "(bad)", { XX
} },
2303 { "(bad)", { XX
} },
2304 { "pmovsxwq", { XM
, EXx
} },
2305 { "(bad)", { XX
} },
2310 { "(bad)", { XX
} },
2311 { "(bad)", { XX
} },
2312 { "pmovsxdq", { XM
, EXx
} },
2313 { "(bad)", { XX
} },
2318 { "(bad)", { XX
} },
2319 { "(bad)", { XX
} },
2320 { "pmuldq", { XM
, EXx
} },
2321 { "(bad)", { XX
} },
2326 { "(bad)", { XX
} },
2327 { "(bad)", { XX
} },
2328 { "pcmpeqq", { XM
, EXx
} },
2329 { "(bad)", { XX
} },
2334 { "(bad)", { XX
} },
2335 { "(bad)", { XX
} },
2336 { "movntdqa", { XM
, EM
} },
2337 { "(bad)", { XX
} },
2342 { "(bad)", { XX
} },
2343 { "(bad)", { XX
} },
2344 { "packusdw", { XM
, EXx
} },
2345 { "(bad)", { XX
} },
2350 { "(bad)", { XX
} },
2351 { "(bad)", { XX
} },
2352 { "pmovzxbw", { XM
, EXx
} },
2353 { "(bad)", { XX
} },
2358 { "(bad)", { XX
} },
2359 { "(bad)", { XX
} },
2360 { "pmovzxbd", { XM
, EXx
} },
2361 { "(bad)", { XX
} },
2366 { "(bad)", { XX
} },
2367 { "(bad)", { XX
} },
2368 { "pmovzxbq", { XM
, EXx
} },
2369 { "(bad)", { XX
} },
2374 { "(bad)", { XX
} },
2375 { "(bad)", { XX
} },
2376 { "pmovzxwd", { XM
, EXx
} },
2377 { "(bad)", { XX
} },
2382 { "(bad)", { XX
} },
2383 { "(bad)", { XX
} },
2384 { "pmovzxwq", { XM
, EXx
} },
2385 { "(bad)", { XX
} },
2390 { "(bad)", { XX
} },
2391 { "(bad)", { XX
} },
2392 { "pmovzxdq", { XM
, EXx
} },
2393 { "(bad)", { XX
} },
2398 { "(bad)", { XX
} },
2399 { "(bad)", { XX
} },
2400 { "pminsb", { XM
, EXx
} },
2401 { "(bad)", { XX
} },
2406 { "(bad)", { XX
} },
2407 { "(bad)", { XX
} },
2408 { "pminsd", { XM
, EXx
} },
2409 { "(bad)", { XX
} },
2414 { "(bad)", { XX
} },
2415 { "(bad)", { XX
} },
2416 { "pminuw", { XM
, EXx
} },
2417 { "(bad)", { XX
} },
2422 { "(bad)", { XX
} },
2423 { "(bad)", { XX
} },
2424 { "pminud", { XM
, EXx
} },
2425 { "(bad)", { XX
} },
2430 { "(bad)", { XX
} },
2431 { "(bad)", { XX
} },
2432 { "pmaxsb", { XM
, EXx
} },
2433 { "(bad)", { XX
} },
2438 { "(bad)", { XX
} },
2439 { "(bad)", { XX
} },
2440 { "pmaxsd", { XM
, EXx
} },
2441 { "(bad)", { XX
} },
2446 { "(bad)", { XX
} },
2447 { "(bad)", { XX
} },
2448 { "pmaxuw", { XM
, EXx
} },
2449 { "(bad)", { XX
} },
2454 { "(bad)", { XX
} },
2455 { "(bad)", { XX
} },
2456 { "pmaxud", { XM
, EXx
} },
2457 { "(bad)", { XX
} },
2462 { "(bad)", { XX
} },
2463 { "(bad)", { XX
} },
2464 { "pmulld", { XM
, EXx
} },
2465 { "(bad)", { XX
} },
2470 { "(bad)", { XX
} },
2471 { "(bad)", { XX
} },
2472 { "phminposuw", { XM
, EXx
} },
2473 { "(bad)", { XX
} },
2478 { "(bad)", { XX
} },
2479 { "(bad)", { XX
} },
2480 { "roundps", { XM
, EXx
, Ib
} },
2481 { "(bad)", { XX
} },
2486 { "(bad)", { XX
} },
2487 { "(bad)", { XX
} },
2488 { "roundpd", { XM
, EXx
, Ib
} },
2489 { "(bad)", { XX
} },
2494 { "(bad)", { XX
} },
2495 { "(bad)", { XX
} },
2496 { "roundss", { XM
, EXx
, Ib
} },
2497 { "(bad)", { XX
} },
2502 { "(bad)", { XX
} },
2503 { "(bad)", { XX
} },
2504 { "roundsd", { XM
, EXx
, Ib
} },
2505 { "(bad)", { XX
} },
2510 { "(bad)", { XX
} },
2511 { "(bad)", { XX
} },
2512 { "blendps", { XM
, EXx
, Ib
} },
2513 { "(bad)", { XX
} },
2518 { "(bad)", { XX
} },
2519 { "(bad)", { XX
} },
2520 { "blendpd", { XM
, EXx
, Ib
} },
2521 { "(bad)", { XX
} },
2526 { "(bad)", { XX
} },
2527 { "(bad)", { XX
} },
2528 { "pblendw", { XM
, EXx
, Ib
} },
2529 { "(bad)", { XX
} },
2534 { "(bad)", { XX
} },
2535 { "(bad)", { XX
} },
2536 { "pextrb", { Edqb
, XM
, Ib
} },
2537 { "(bad)", { XX
} },
2542 { "(bad)", { XX
} },
2543 { "(bad)", { XX
} },
2544 { "pextrw", { Edqw
, XM
, Ib
} },
2545 { "(bad)", { XX
} },
2550 { "(bad)", { XX
} },
2551 { "(bad)", { XX
} },
2552 { "pextrK", { Edq
, XM
, Ib
} },
2553 { "(bad)", { XX
} },
2558 { "(bad)", { XX
} },
2559 { "(bad)", { XX
} },
2560 { "extractps", { Edqd
, XM
, Ib
} },
2561 { "(bad)", { XX
} },
2566 { "(bad)", { XX
} },
2567 { "(bad)", { XX
} },
2568 { "pinsrb", { XM
, Edqb
, Ib
} },
2569 { "(bad)", { XX
} },
2574 { "(bad)", { XX
} },
2575 { "(bad)", { XX
} },
2576 { "insertps", { XM
, EXx
, Ib
} },
2577 { "(bad)", { XX
} },
2582 { "(bad)", { XX
} },
2583 { "(bad)", { XX
} },
2584 { "pinsrK", { XM
, Edq
, Ib
} },
2585 { "(bad)", { XX
} },
2590 { "(bad)", { XX
} },
2591 { "(bad)", { XX
} },
2592 { "dpps", { XM
, EXx
, Ib
} },
2593 { "(bad)", { XX
} },
2598 { "(bad)", { XX
} },
2599 { "(bad)", { XX
} },
2600 { "dppd", { XM
, EXx
, Ib
} },
2601 { "(bad)", { XX
} },
2606 { "(bad)", { XX
} },
2607 { "(bad)", { XX
} },
2608 { "mpsadbw", { XM
, EXx
, Ib
} },
2609 { "(bad)", { XX
} },
2614 { "(bad)", { XX
} },
2615 { "(bad)", { XX
} },
2616 { "pcmpgtq", { XM
, EXx
} },
2617 { "(bad)", { XX
} },
2622 { "(bad)", { XX
} },
2623 { "(bad)", { XX
} },
2624 { "(bad)", { XX
} },
2625 { "crc32", { Gdq
, { CRC32_Fixup
, b_mode
} } },
2630 { "(bad)", { XX
} },
2631 { "(bad)", { XX
} },
2632 { "(bad)", { XX
} },
2633 { "crc32", { Gdq
, { CRC32_Fixup
, v_mode
} } },
2638 { "(bad)", { XX
} },
2639 { "(bad)", { XX
} },
2640 { "pcmpestrm", { XM
, EXx
, Ib
} },
2641 { "(bad)", { XX
} },
2646 { "(bad)", { XX
} },
2647 { "(bad)", { XX
} },
2648 { "pcmpestri", { XM
, EXx
, Ib
} },
2649 { "(bad)", { XX
} },
2654 { "(bad)", { XX
} },
2655 { "(bad)", { XX
} },
2656 { "pcmpistrm", { XM
, EXx
, Ib
} },
2657 { "(bad)", { XX
} },
2662 { "(bad)", { XX
} },
2663 { "(bad)", { XX
} },
2664 { "pcmpistri", { XM
, EXx
, Ib
} },
2665 { "(bad)", { XX
} },
2670 { "ucomiss",{ XM
, EXd
} },
2671 { "(bad)", { XX
} },
2672 { "ucomisd",{ XM
, EXq
} },
2673 { "(bad)", { XX
} },
2678 { "comiss", { XM
, EXd
} },
2679 { "(bad)", { XX
} },
2680 { "comisd", { XM
, EXq
} },
2681 { "(bad)", { XX
} },
2686 { "punpcklbw",{ MX
, EMd
} },
2687 { "(bad)", { XX
} },
2688 { "punpcklbw",{ MX
, EMq
} },
2689 { "(bad)", { XX
} },
2694 { "punpcklwd",{ MX
, EMd
} },
2695 { "(bad)", { XX
} },
2696 { "punpcklwd",{ MX
, EMq
} },
2697 { "(bad)", { XX
} },
2702 { "punpckldq",{ MX
, EMd
} },
2703 { "(bad)", { XX
} },
2704 { "punpckldq",{ MX
, EMq
} },
2705 { "(bad)", { XX
} },
2709 static const struct dis386 x86_64_table
[][2] = {
2711 { "pusha{P|}", { XX
} },
2712 { "(bad)", { XX
} },
2715 { "popa{P|}", { XX
} },
2716 { "(bad)", { XX
} },
2719 { "bound{S|}", { Gv
, Ma
} },
2720 { "(bad)", { XX
} },
2723 { "arpl", { Ew
, Gw
} },
2724 { "movs{||lq|xd}", { Gv
, Ed
} },
2728 static const struct dis386 three_byte_table
[][256] = {
2732 { "pshufb", { MX
, EM
} },
2733 { "phaddw", { MX
, EM
} },
2734 { "phaddd", { MX
, EM
} },
2735 { "phaddsw", { MX
, EM
} },
2736 { "pmaddubsw", { MX
, EM
} },
2737 { "phsubw", { MX
, EM
} },
2738 { "phsubd", { MX
, EM
} },
2739 { "phsubsw", { MX
, EM
} },
2741 { "psignb", { MX
, EM
} },
2742 { "psignw", { MX
, EM
} },
2743 { "psignd", { MX
, EM
} },
2744 { "pmulhrsw", { MX
, EM
} },
2745 { "(bad)", { XX
} },
2746 { "(bad)", { XX
} },
2747 { "(bad)", { XX
} },
2748 { "(bad)", { XX
} },
2751 { "(bad)", { XX
} },
2752 { "(bad)", { XX
} },
2753 { "(bad)", { XX
} },
2756 { "(bad)", { XX
} },
2759 { "(bad)", { XX
} },
2760 { "(bad)", { XX
} },
2761 { "(bad)", { XX
} },
2762 { "(bad)", { XX
} },
2763 { "pabsb", { MX
, EM
} },
2764 { "pabsw", { MX
, EM
} },
2765 { "pabsd", { MX
, EM
} },
2766 { "(bad)", { XX
} },
2774 { "(bad)", { XX
} },
2775 { "(bad)", { XX
} },
2781 { "(bad)", { XX
} },
2782 { "(bad)", { XX
} },
2783 { "(bad)", { XX
} },
2784 { "(bad)", { XX
} },
2792 { "(bad)", { XX
} },
2806 { "(bad)", { XX
} },
2807 { "(bad)", { XX
} },
2808 { "(bad)", { XX
} },
2809 { "(bad)", { XX
} },
2810 { "(bad)", { XX
} },
2811 { "(bad)", { XX
} },
2813 { "(bad)", { XX
} },
2814 { "(bad)", { XX
} },
2815 { "(bad)", { XX
} },
2816 { "(bad)", { XX
} },
2817 { "(bad)", { XX
} },
2818 { "(bad)", { XX
} },
2819 { "(bad)", { XX
} },
2820 { "(bad)", { XX
} },
2822 { "(bad)", { XX
} },
2823 { "(bad)", { XX
} },
2824 { "(bad)", { XX
} },
2825 { "(bad)", { XX
} },
2826 { "(bad)", { XX
} },
2827 { "(bad)", { XX
} },
2828 { "(bad)", { XX
} },
2829 { "(bad)", { XX
} },
2831 { "(bad)", { XX
} },
2832 { "(bad)", { XX
} },
2833 { "(bad)", { XX
} },
2834 { "(bad)", { XX
} },
2835 { "(bad)", { XX
} },
2836 { "(bad)", { XX
} },
2837 { "(bad)", { XX
} },
2838 { "(bad)", { XX
} },
2840 { "(bad)", { XX
} },
2841 { "(bad)", { XX
} },
2842 { "(bad)", { XX
} },
2843 { "(bad)", { XX
} },
2844 { "(bad)", { XX
} },
2845 { "(bad)", { XX
} },
2846 { "(bad)", { XX
} },
2847 { "(bad)", { XX
} },
2849 { "(bad)", { XX
} },
2850 { "(bad)", { XX
} },
2851 { "(bad)", { XX
} },
2852 { "(bad)", { XX
} },
2853 { "(bad)", { XX
} },
2854 { "(bad)", { XX
} },
2855 { "(bad)", { XX
} },
2856 { "(bad)", { XX
} },
2858 { "(bad)", { XX
} },
2859 { "(bad)", { XX
} },
2860 { "(bad)", { XX
} },
2861 { "(bad)", { XX
} },
2862 { "(bad)", { XX
} },
2863 { "(bad)", { XX
} },
2864 { "(bad)", { XX
} },
2865 { "(bad)", { XX
} },
2867 { "(bad)", { XX
} },
2868 { "(bad)", { XX
} },
2869 { "(bad)", { XX
} },
2870 { "(bad)", { XX
} },
2871 { "(bad)", { XX
} },
2872 { "(bad)", { XX
} },
2873 { "(bad)", { XX
} },
2874 { "(bad)", { XX
} },
2876 { "(bad)", { XX
} },
2877 { "(bad)", { XX
} },
2878 { "(bad)", { XX
} },
2879 { "(bad)", { XX
} },
2880 { "(bad)", { XX
} },
2881 { "(bad)", { XX
} },
2882 { "(bad)", { XX
} },
2883 { "(bad)", { XX
} },
2885 { "(bad)", { XX
} },
2886 { "(bad)", { XX
} },
2887 { "(bad)", { XX
} },
2888 { "(bad)", { XX
} },
2889 { "(bad)", { XX
} },
2890 { "(bad)", { XX
} },
2891 { "(bad)", { XX
} },
2892 { "(bad)", { XX
} },
2894 { "(bad)", { XX
} },
2895 { "(bad)", { XX
} },
2896 { "(bad)", { XX
} },
2897 { "(bad)", { XX
} },
2898 { "(bad)", { XX
} },
2899 { "(bad)", { XX
} },
2900 { "(bad)", { XX
} },
2901 { "(bad)", { XX
} },
2903 { "(bad)", { XX
} },
2904 { "(bad)", { XX
} },
2905 { "(bad)", { XX
} },
2906 { "(bad)", { XX
} },
2907 { "(bad)", { XX
} },
2908 { "(bad)", { XX
} },
2909 { "(bad)", { XX
} },
2910 { "(bad)", { XX
} },
2912 { "(bad)", { XX
} },
2913 { "(bad)", { XX
} },
2914 { "(bad)", { XX
} },
2915 { "(bad)", { XX
} },
2916 { "(bad)", { XX
} },
2917 { "(bad)", { XX
} },
2918 { "(bad)", { XX
} },
2919 { "(bad)", { XX
} },
2921 { "(bad)", { XX
} },
2922 { "(bad)", { XX
} },
2923 { "(bad)", { XX
} },
2924 { "(bad)", { XX
} },
2925 { "(bad)", { XX
} },
2926 { "(bad)", { XX
} },
2927 { "(bad)", { XX
} },
2928 { "(bad)", { XX
} },
2930 { "(bad)", { XX
} },
2931 { "(bad)", { XX
} },
2932 { "(bad)", { XX
} },
2933 { "(bad)", { XX
} },
2934 { "(bad)", { XX
} },
2935 { "(bad)", { XX
} },
2936 { "(bad)", { XX
} },
2937 { "(bad)", { XX
} },
2939 { "(bad)", { XX
} },
2940 { "(bad)", { XX
} },
2941 { "(bad)", { XX
} },
2942 { "(bad)", { XX
} },
2943 { "(bad)", { XX
} },
2944 { "(bad)", { XX
} },
2945 { "(bad)", { XX
} },
2946 { "(bad)", { XX
} },
2948 { "(bad)", { XX
} },
2949 { "(bad)", { XX
} },
2950 { "(bad)", { XX
} },
2951 { "(bad)", { XX
} },
2952 { "(bad)", { XX
} },
2953 { "(bad)", { XX
} },
2954 { "(bad)", { XX
} },
2955 { "(bad)", { XX
} },
2957 { "(bad)", { XX
} },
2958 { "(bad)", { XX
} },
2959 { "(bad)", { XX
} },
2960 { "(bad)", { XX
} },
2961 { "(bad)", { XX
} },
2962 { "(bad)", { XX
} },
2963 { "(bad)", { XX
} },
2964 { "(bad)", { XX
} },
2966 { "(bad)", { XX
} },
2967 { "(bad)", { XX
} },
2968 { "(bad)", { XX
} },
2969 { "(bad)", { XX
} },
2970 { "(bad)", { XX
} },
2971 { "(bad)", { XX
} },
2972 { "(bad)", { XX
} },
2973 { "(bad)", { XX
} },
2975 { "(bad)", { XX
} },
2976 { "(bad)", { XX
} },
2977 { "(bad)", { XX
} },
2978 { "(bad)", { XX
} },
2979 { "(bad)", { XX
} },
2980 { "(bad)", { XX
} },
2981 { "(bad)", { XX
} },
2982 { "(bad)", { XX
} },
2984 { "(bad)", { XX
} },
2985 { "(bad)", { XX
} },
2986 { "(bad)", { XX
} },
2987 { "(bad)", { XX
} },
2988 { "(bad)", { XX
} },
2989 { "(bad)", { XX
} },
2990 { "(bad)", { XX
} },
2991 { "(bad)", { XX
} },
2993 { "(bad)", { XX
} },
2994 { "(bad)", { XX
} },
2995 { "(bad)", { XX
} },
2996 { "(bad)", { XX
} },
2997 { "(bad)", { XX
} },
2998 { "(bad)", { XX
} },
2999 { "(bad)", { XX
} },
3000 { "(bad)", { XX
} },
3004 { "(bad)", { XX
} },
3005 { "(bad)", { XX
} },
3006 { "(bad)", { XX
} },
3007 { "(bad)", { XX
} },
3008 { "(bad)", { XX
} },
3009 { "(bad)", { XX
} },
3011 { "(bad)", { XX
} },
3012 { "(bad)", { XX
} },
3013 { "(bad)", { XX
} },
3014 { "(bad)", { XX
} },
3015 { "(bad)", { XX
} },
3016 { "(bad)", { XX
} },
3017 { "(bad)", { XX
} },
3018 { "(bad)", { XX
} },
3023 { "(bad)", { XX
} },
3024 { "(bad)", { XX
} },
3025 { "(bad)", { XX
} },
3026 { "(bad)", { XX
} },
3027 { "(bad)", { XX
} },
3028 { "(bad)", { XX
} },
3029 { "(bad)", { XX
} },
3030 { "(bad)", { XX
} },
3039 { "palignr", { MX
, EM
, Ib
} },
3041 { "(bad)", { XX
} },
3042 { "(bad)", { XX
} },
3043 { "(bad)", { XX
} },
3044 { "(bad)", { XX
} },
3050 { "(bad)", { XX
} },
3051 { "(bad)", { XX
} },
3052 { "(bad)", { XX
} },
3053 { "(bad)", { XX
} },
3054 { "(bad)", { XX
} },
3055 { "(bad)", { XX
} },
3056 { "(bad)", { XX
} },
3057 { "(bad)", { XX
} },
3062 { "(bad)", { XX
} },
3063 { "(bad)", { XX
} },
3064 { "(bad)", { XX
} },
3065 { "(bad)", { XX
} },
3066 { "(bad)", { XX
} },
3068 { "(bad)", { XX
} },
3069 { "(bad)", { XX
} },
3070 { "(bad)", { XX
} },
3071 { "(bad)", { XX
} },
3072 { "(bad)", { XX
} },
3073 { "(bad)", { XX
} },
3074 { "(bad)", { XX
} },
3075 { "(bad)", { XX
} },
3077 { "(bad)", { XX
} },
3078 { "(bad)", { XX
} },
3079 { "(bad)", { XX
} },
3080 { "(bad)", { XX
} },
3081 { "(bad)", { XX
} },
3082 { "(bad)", { XX
} },
3083 { "(bad)", { XX
} },
3084 { "(bad)", { XX
} },
3086 { "(bad)", { XX
} },
3087 { "(bad)", { XX
} },
3088 { "(bad)", { XX
} },
3089 { "(bad)", { XX
} },
3090 { "(bad)", { XX
} },
3091 { "(bad)", { XX
} },
3092 { "(bad)", { XX
} },
3093 { "(bad)", { XX
} },
3098 { "(bad)", { XX
} },
3099 { "(bad)", { XX
} },
3100 { "(bad)", { XX
} },
3101 { "(bad)", { XX
} },
3102 { "(bad)", { XX
} },
3104 { "(bad)", { XX
} },
3105 { "(bad)", { XX
} },
3106 { "(bad)", { XX
} },
3107 { "(bad)", { XX
} },
3108 { "(bad)", { XX
} },
3109 { "(bad)", { XX
} },
3110 { "(bad)", { XX
} },
3111 { "(bad)", { XX
} },
3113 { "(bad)", { XX
} },
3114 { "(bad)", { XX
} },
3115 { "(bad)", { XX
} },
3116 { "(bad)", { XX
} },
3117 { "(bad)", { XX
} },
3118 { "(bad)", { XX
} },
3119 { "(bad)", { XX
} },
3120 { "(bad)", { XX
} },
3122 { "(bad)", { XX
} },
3123 { "(bad)", { XX
} },
3124 { "(bad)", { XX
} },
3125 { "(bad)", { XX
} },
3126 { "(bad)", { XX
} },
3127 { "(bad)", { XX
} },
3128 { "(bad)", { XX
} },
3129 { "(bad)", { XX
} },
3135 { "(bad)", { XX
} },
3136 { "(bad)", { XX
} },
3137 { "(bad)", { XX
} },
3138 { "(bad)", { XX
} },
3140 { "(bad)", { XX
} },
3141 { "(bad)", { XX
} },
3142 { "(bad)", { XX
} },
3143 { "(bad)", { XX
} },
3144 { "(bad)", { XX
} },
3145 { "(bad)", { XX
} },
3146 { "(bad)", { XX
} },
3147 { "(bad)", { XX
} },
3149 { "(bad)", { XX
} },
3150 { "(bad)", { XX
} },
3151 { "(bad)", { XX
} },
3152 { "(bad)", { XX
} },
3153 { "(bad)", { XX
} },
3154 { "(bad)", { XX
} },
3155 { "(bad)", { XX
} },
3156 { "(bad)", { XX
} },
3158 { "(bad)", { XX
} },
3159 { "(bad)", { XX
} },
3160 { "(bad)", { XX
} },
3161 { "(bad)", { XX
} },
3162 { "(bad)", { XX
} },
3163 { "(bad)", { XX
} },
3164 { "(bad)", { XX
} },
3165 { "(bad)", { XX
} },
3167 { "(bad)", { XX
} },
3168 { "(bad)", { XX
} },
3169 { "(bad)", { XX
} },
3170 { "(bad)", { XX
} },
3171 { "(bad)", { XX
} },
3172 { "(bad)", { XX
} },
3173 { "(bad)", { XX
} },
3174 { "(bad)", { XX
} },
3176 { "(bad)", { XX
} },
3177 { "(bad)", { XX
} },
3178 { "(bad)", { XX
} },
3179 { "(bad)", { XX
} },
3180 { "(bad)", { XX
} },
3181 { "(bad)", { XX
} },
3182 { "(bad)", { XX
} },
3183 { "(bad)", { XX
} },
3185 { "(bad)", { XX
} },
3186 { "(bad)", { XX
} },
3187 { "(bad)", { XX
} },
3188 { "(bad)", { XX
} },
3189 { "(bad)", { XX
} },
3190 { "(bad)", { XX
} },
3191 { "(bad)", { XX
} },
3192 { "(bad)", { XX
} },
3194 { "(bad)", { XX
} },
3195 { "(bad)", { XX
} },
3196 { "(bad)", { XX
} },
3197 { "(bad)", { XX
} },
3198 { "(bad)", { XX
} },
3199 { "(bad)", { XX
} },
3200 { "(bad)", { XX
} },
3201 { "(bad)", { XX
} },
3203 { "(bad)", { XX
} },
3204 { "(bad)", { XX
} },
3205 { "(bad)", { XX
} },
3206 { "(bad)", { XX
} },
3207 { "(bad)", { XX
} },
3208 { "(bad)", { XX
} },
3209 { "(bad)", { XX
} },
3210 { "(bad)", { XX
} },
3212 { "(bad)", { XX
} },
3213 { "(bad)", { XX
} },
3214 { "(bad)", { XX
} },
3215 { "(bad)", { XX
} },
3216 { "(bad)", { XX
} },
3217 { "(bad)", { XX
} },
3218 { "(bad)", { XX
} },
3219 { "(bad)", { XX
} },
3221 { "(bad)", { XX
} },
3222 { "(bad)", { XX
} },
3223 { "(bad)", { XX
} },
3224 { "(bad)", { XX
} },
3225 { "(bad)", { XX
} },
3226 { "(bad)", { XX
} },
3227 { "(bad)", { XX
} },
3228 { "(bad)", { XX
} },
3230 { "(bad)", { XX
} },
3231 { "(bad)", { XX
} },
3232 { "(bad)", { XX
} },
3233 { "(bad)", { XX
} },
3234 { "(bad)", { XX
} },
3235 { "(bad)", { XX
} },
3236 { "(bad)", { XX
} },
3237 { "(bad)", { XX
} },
3239 { "(bad)", { XX
} },
3240 { "(bad)", { XX
} },
3241 { "(bad)", { XX
} },
3242 { "(bad)", { XX
} },
3243 { "(bad)", { XX
} },
3244 { "(bad)", { XX
} },
3245 { "(bad)", { XX
} },
3246 { "(bad)", { XX
} },
3248 { "(bad)", { XX
} },
3249 { "(bad)", { XX
} },
3250 { "(bad)", { XX
} },
3251 { "(bad)", { XX
} },
3252 { "(bad)", { XX
} },
3253 { "(bad)", { XX
} },
3254 { "(bad)", { XX
} },
3255 { "(bad)", { XX
} },
3257 { "(bad)", { XX
} },
3258 { "(bad)", { XX
} },
3259 { "(bad)", { XX
} },
3260 { "(bad)", { XX
} },
3261 { "(bad)", { XX
} },
3262 { "(bad)", { XX
} },
3263 { "(bad)", { XX
} },
3264 { "(bad)", { XX
} },
3266 { "(bad)", { XX
} },
3267 { "(bad)", { XX
} },
3268 { "(bad)", { XX
} },
3269 { "(bad)", { XX
} },
3270 { "(bad)", { XX
} },
3271 { "(bad)", { XX
} },
3272 { "(bad)", { XX
} },
3273 { "(bad)", { XX
} },
3275 { "(bad)", { XX
} },
3276 { "(bad)", { XX
} },
3277 { "(bad)", { XX
} },
3278 { "(bad)", { XX
} },
3279 { "(bad)", { XX
} },
3280 { "(bad)", { XX
} },
3281 { "(bad)", { XX
} },
3282 { "(bad)", { XX
} },
3284 { "(bad)", { XX
} },
3285 { "(bad)", { XX
} },
3286 { "(bad)", { XX
} },
3287 { "(bad)", { XX
} },
3288 { "(bad)", { XX
} },
3289 { "(bad)", { XX
} },
3290 { "(bad)", { XX
} },
3291 { "(bad)", { XX
} },
3293 { "(bad)", { XX
} },
3294 { "(bad)", { XX
} },
3295 { "(bad)", { XX
} },
3296 { "(bad)", { XX
} },
3297 { "(bad)", { XX
} },
3298 { "(bad)", { XX
} },
3299 { "(bad)", { XX
} },
3300 { "(bad)", { XX
} },
3302 { "(bad)", { XX
} },
3303 { "(bad)", { XX
} },
3304 { "(bad)", { XX
} },
3305 { "(bad)", { XX
} },
3306 { "(bad)", { XX
} },
3307 { "(bad)", { XX
} },
3308 { "(bad)", { XX
} },
3309 { "(bad)", { XX
} },
3313 #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
3325 FETCH_DATA (the_info
, codep
+ 1);
3329 /* REX prefixes family. */
3346 if (address_mode
== mode_64bit
)
3352 prefixes
|= PREFIX_REPZ
;
3355 prefixes
|= PREFIX_REPNZ
;
3358 prefixes
|= PREFIX_LOCK
;
3361 prefixes
|= PREFIX_CS
;
3364 prefixes
|= PREFIX_SS
;
3367 prefixes
|= PREFIX_DS
;
3370 prefixes
|= PREFIX_ES
;
3373 prefixes
|= PREFIX_FS
;
3376 prefixes
|= PREFIX_GS
;
3379 prefixes
|= PREFIX_DATA
;
3382 prefixes
|= PREFIX_ADDR
;
3385 /* fwait is really an instruction. If there are prefixes
3386 before the fwait, they belong to the fwait, *not* to the
3387 following instruction. */
3388 if (prefixes
|| rex
)
3390 prefixes
|= PREFIX_FWAIT
;
3394 prefixes
= PREFIX_FWAIT
;
3399 /* Rex is ignored when followed by another prefix. */
3410 /* Return the name of the prefix byte PREF, or NULL if PREF is not a
3414 prefix_name (int pref
, int sizeflag
)
3416 static const char * const rexes
[16] =
3421 "rex.XB", /* 0x43 */
3423 "rex.RB", /* 0x45 */
3424 "rex.RX", /* 0x46 */
3425 "rex.RXB", /* 0x47 */
3427 "rex.WB", /* 0x49 */
3428 "rex.WX", /* 0x4a */
3429 "rex.WXB", /* 0x4b */
3430 "rex.WR", /* 0x4c */
3431 "rex.WRB", /* 0x4d */
3432 "rex.WRX", /* 0x4e */
3433 "rex.WRXB", /* 0x4f */
3438 /* REX prefixes family. */
3455 return rexes
[pref
- 0x40];
3475 return (sizeflag
& DFLAG
) ? "data16" : "data32";
3477 if (address_mode
== mode_64bit
)
3478 return (sizeflag
& AFLAG
) ? "addr32" : "addr64";
3480 return (sizeflag
& AFLAG
) ? "addr16" : "addr32";
3488 static char op_out
[MAX_OPERANDS
][100];
3489 static int op_ad
, op_index
[MAX_OPERANDS
];
3490 static int two_source_ops
;
3491 static bfd_vma op_address
[MAX_OPERANDS
];
3492 static bfd_vma op_riprel
[MAX_OPERANDS
];
3493 static bfd_vma start_pc
;
3496 * On the 386's of 1988, the maximum length of an instruction is 15 bytes.
3497 * (see topic "Redundant prefixes" in the "Differences from 8086"
3498 * section of the "Virtual 8086 Mode" chapter.)
3499 * 'pc' should be the address of this instruction, it will
3500 * be used to print the target address if this is a relative jump or call
3501 * The function returns the length of this instruction in bytes.
3504 static char intel_syntax
;
3505 static char open_char
;
3506 static char close_char
;
3507 static char separator_char
;
3508 static char scale_char
;
3511 print_insn_i386 (bfd_vma pc
, disassemble_info
*info
)
3515 return print_insn (pc
, info
);
3519 print_insn (bfd_vma pc
, disassemble_info
*info
)
3521 const struct dis386
*dp
;
3523 char *op_txt
[MAX_OPERANDS
];
3525 unsigned char uses_DATA_prefix
, uses_LOCK_prefix
;
3526 unsigned char uses_REPNZ_prefix
, uses_REPZ_prefix
;
3529 struct dis_private priv
;
3532 if (info
->mach
== bfd_mach_x86_64_intel_syntax
3533 || info
->mach
== bfd_mach_x86_64
)
3534 address_mode
= mode_64bit
;
3536 address_mode
= mode_32bit
;
3538 if (intel_syntax
== (char) -1)
3539 intel_syntax
= (info
->mach
== bfd_mach_i386_i386_intel_syntax
3540 || info
->mach
== bfd_mach_x86_64_intel_syntax
);
3542 if (info
->mach
== bfd_mach_i386_i386
3543 || info
->mach
== bfd_mach_x86_64
3544 || info
->mach
== bfd_mach_i386_i386_intel_syntax
3545 || info
->mach
== bfd_mach_x86_64_intel_syntax
)
3546 priv
.orig_sizeflag
= AFLAG
| DFLAG
;
3547 else if (info
->mach
== bfd_mach_i386_i8086
)
3548 priv
.orig_sizeflag
= 0;
3552 for (p
= info
->disassembler_options
; p
!= NULL
; )
3554 if (strncmp (p
, "x86-64", 6) == 0)
3556 address_mode
= mode_64bit
;
3557 priv
.orig_sizeflag
= AFLAG
| DFLAG
;
3559 else if (strncmp (p
, "i386", 4) == 0)
3561 address_mode
= mode_32bit
;
3562 priv
.orig_sizeflag
= AFLAG
| DFLAG
;
3564 else if (strncmp (p
, "i8086", 5) == 0)
3566 address_mode
= mode_16bit
;
3567 priv
.orig_sizeflag
= 0;
3569 else if (strncmp (p
, "intel", 5) == 0)
3573 else if (strncmp (p
, "att", 3) == 0)
3577 else if (strncmp (p
, "addr", 4) == 0)
3579 if (address_mode
== mode_64bit
)
3581 if (p
[4] == '3' && p
[5] == '2')
3582 priv
.orig_sizeflag
&= ~AFLAG
;
3583 else if (p
[4] == '6' && p
[5] == '4')
3584 priv
.orig_sizeflag
|= AFLAG
;
3588 if (p
[4] == '1' && p
[5] == '6')
3589 priv
.orig_sizeflag
&= ~AFLAG
;
3590 else if (p
[4] == '3' && p
[5] == '2')
3591 priv
.orig_sizeflag
|= AFLAG
;
3594 else if (strncmp (p
, "data", 4) == 0)
3596 if (p
[4] == '1' && p
[5] == '6')
3597 priv
.orig_sizeflag
&= ~DFLAG
;
3598 else if (p
[4] == '3' && p
[5] == '2')
3599 priv
.orig_sizeflag
|= DFLAG
;
3601 else if (strncmp (p
, "suffix", 6) == 0)
3602 priv
.orig_sizeflag
|= SUFFIX_ALWAYS
;
3604 p
= strchr (p
, ',');
3611 names64
= intel_names64
;
3612 names32
= intel_names32
;
3613 names16
= intel_names16
;
3614 names8
= intel_names8
;
3615 names8rex
= intel_names8rex
;
3616 names_seg
= intel_names_seg
;
3617 index16
= intel_index16
;
3620 separator_char
= '+';
3625 names64
= att_names64
;
3626 names32
= att_names32
;
3627 names16
= att_names16
;
3628 names8
= att_names8
;
3629 names8rex
= att_names8rex
;
3630 names_seg
= att_names_seg
;
3631 index16
= att_index16
;
3634 separator_char
= ',';
3638 /* The output looks better if we put 7 bytes on a line, since that
3639 puts most long word instructions on a single line. */
3640 info
->bytes_per_line
= 7;
3642 info
->private_data
= &priv
;
3643 priv
.max_fetched
= priv
.the_buffer
;
3644 priv
.insn_start
= pc
;
3647 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3655 start_codep
= priv
.the_buffer
;
3656 codep
= priv
.the_buffer
;
3658 if (setjmp (priv
.bailout
) != 0)
3662 /* Getting here means we tried for data but didn't get it. That
3663 means we have an incomplete instruction of some sort. Just
3664 print the first byte as a prefix or a .byte pseudo-op. */
3665 if (codep
> priv
.the_buffer
)
3667 name
= prefix_name (priv
.the_buffer
[0], priv
.orig_sizeflag
);
3669 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3672 /* Just print the first byte as a .byte instruction. */
3673 (*info
->fprintf_func
) (info
->stream
, ".byte 0x%x",
3674 (unsigned int) priv
.the_buffer
[0]);
3687 sizeflag
= priv
.orig_sizeflag
;
3689 FETCH_DATA (info
, codep
+ 1);
3690 two_source_ops
= (*codep
== 0x62) || (*codep
== 0xc8);
3692 if (((prefixes
& PREFIX_FWAIT
)
3693 && ((*codep
< 0xd8) || (*codep
> 0xdf)))
3694 || (rex
&& rex_used
))
3698 /* fwait not followed by floating point instruction, or rex followed
3699 by other prefixes. Print the first prefix. */
3700 name
= prefix_name (priv
.the_buffer
[0], priv
.orig_sizeflag
);
3702 name
= INTERNAL_DISASSEMBLER_ERROR
;
3703 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3710 unsigned char threebyte
;
3711 FETCH_DATA (info
, codep
+ 2);
3712 threebyte
= *++codep
;
3713 dp
= &dis386_twobyte
[threebyte
];
3714 need_modrm
= twobyte_has_modrm
[*codep
];
3715 uses_DATA_prefix
= twobyte_uses_DATA_prefix
[*codep
];
3716 uses_REPNZ_prefix
= twobyte_uses_REPNZ_prefix
[*codep
];
3717 uses_REPZ_prefix
= twobyte_uses_REPZ_prefix
[*codep
];
3718 uses_LOCK_prefix
= (*codep
& ~0x02) == 0x20;
3720 if (dp
->name
== NULL
&& dp
->op
[0].bytemode
== IS_3BYTE_OPCODE
)
3722 FETCH_DATA (info
, codep
+ 2);
3727 uses_DATA_prefix
= threebyte_0x38_uses_DATA_prefix
[op
];
3728 uses_REPNZ_prefix
= threebyte_0x38_uses_REPNZ_prefix
[op
];
3729 uses_REPZ_prefix
= threebyte_0x38_uses_REPZ_prefix
[op
];
3732 uses_DATA_prefix
= threebyte_0x3a_uses_DATA_prefix
[op
];
3733 uses_REPNZ_prefix
= threebyte_0x3a_uses_REPNZ_prefix
[op
];
3734 uses_REPZ_prefix
= threebyte_0x3a_uses_REPZ_prefix
[op
];
3743 dp
= &dis386
[*codep
];
3744 need_modrm
= onebyte_has_modrm
[*codep
];
3745 uses_DATA_prefix
= 0;
3746 uses_REPNZ_prefix
= 0;
3747 /* pause is 0xf3 0x90. */
3748 uses_REPZ_prefix
= *codep
== 0x90;
3749 uses_LOCK_prefix
= 0;
3753 if (!uses_REPZ_prefix
&& (prefixes
& PREFIX_REPZ
))
3756 used_prefixes
|= PREFIX_REPZ
;
3758 if (!uses_REPNZ_prefix
&& (prefixes
& PREFIX_REPNZ
))
3761 used_prefixes
|= PREFIX_REPNZ
;
3764 if (!uses_LOCK_prefix
&& (prefixes
& PREFIX_LOCK
))
3767 used_prefixes
|= PREFIX_LOCK
;
3770 if (prefixes
& PREFIX_ADDR
)
3773 if (dp
->op
[2].bytemode
!= loop_jcxz_mode
|| intel_syntax
)
3775 if ((sizeflag
& AFLAG
) || address_mode
== mode_64bit
)
3776 oappend ("addr32 ");
3778 oappend ("addr16 ");
3779 used_prefixes
|= PREFIX_ADDR
;
3783 if (!uses_DATA_prefix
&& (prefixes
& PREFIX_DATA
))
3786 if (dp
->op
[2].bytemode
== cond_jump_mode
3787 && dp
->op
[0].bytemode
== v_mode
3790 if (sizeflag
& DFLAG
)
3791 oappend ("data32 ");
3793 oappend ("data16 ");
3794 used_prefixes
|= PREFIX_DATA
;
3798 if (dp
->name
== NULL
&& dp
->op
[0].bytemode
== IS_3BYTE_OPCODE
)
3800 dp
= &three_byte_table
[dp
->op
[1].bytemode
][op
];
3801 modrm
.mod
= (*codep
>> 6) & 3;
3802 modrm
.reg
= (*codep
>> 3) & 7;
3803 modrm
.rm
= *codep
& 7;
3805 else if (need_modrm
)
3807 FETCH_DATA (info
, codep
+ 1);
3808 modrm
.mod
= (*codep
>> 6) & 3;
3809 modrm
.reg
= (*codep
>> 3) & 7;
3810 modrm
.rm
= *codep
& 7;
3813 if (dp
->name
== NULL
&& dp
->op
[0].bytemode
== FLOATCODE
)
3820 if (dp
->name
== NULL
)
3822 switch (dp
->op
[0].bytemode
)
3825 dp
= &grps
[dp
->op
[1].bytemode
][modrm
.reg
];
3828 case USE_PREFIX_USER_TABLE
:
3830 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
3831 if (prefixes
& PREFIX_REPZ
)
3835 /* We should check PREFIX_REPNZ and PREFIX_REPZ
3836 before PREFIX_DATA. */
3837 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
3838 if (prefixes
& PREFIX_REPNZ
)
3842 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3843 if (prefixes
& PREFIX_DATA
)
3847 dp
= &prefix_user_table
[dp
->op
[1].bytemode
][index
];
3850 case X86_64_SPECIAL
:
3851 index
= address_mode
== mode_64bit
? 1 : 0;
3852 dp
= &x86_64_table
[dp
->op
[1].bytemode
][index
];
3856 oappend (INTERNAL_DISASSEMBLER_ERROR
);
3861 if (putop (dp
->name
, sizeflag
) == 0)
3863 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3866 op_ad
= MAX_OPERANDS
- 1 - i
;
3868 (*dp
->op
[i
].rtn
) (dp
->op
[i
].bytemode
, sizeflag
);
3873 /* See if any prefixes were not used. If so, print the first one
3874 separately. If we don't do this, we'll wind up printing an
3875 instruction stream which does not precisely correspond to the
3876 bytes we are disassembling. */
3877 if ((prefixes
& ~used_prefixes
) != 0)
3881 name
= prefix_name (priv
.the_buffer
[0], priv
.orig_sizeflag
);
3883 name
= INTERNAL_DISASSEMBLER_ERROR
;
3884 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3887 if (rex
& ~rex_used
)
3890 name
= prefix_name (rex
| 0x40, priv
.orig_sizeflag
);
3892 name
= INTERNAL_DISASSEMBLER_ERROR
;
3893 (*info
->fprintf_func
) (info
->stream
, "%s ", name
);
3896 obufp
= obuf
+ strlen (obuf
);
3897 for (i
= strlen (obuf
); i
< 6; i
++)
3900 (*info
->fprintf_func
) (info
->stream
, "%s", obuf
);
3902 /* The enter and bound instructions are printed with operands in the same
3903 order as the intel book; everything else is printed in reverse order. */
3904 if (intel_syntax
|| two_source_ops
)
3908 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3909 op_txt
[i
] = op_out
[i
];
3911 for (i
= 0; i
< (MAX_OPERANDS
>> 1); ++i
)
3913 op_ad
= op_index
[i
];
3914 op_index
[i
] = op_index
[MAX_OPERANDS
- 1 - i
];
3915 op_index
[MAX_OPERANDS
- 1 - i
] = op_ad
;
3916 riprel
= op_riprel
[i
];
3917 op_riprel
[i
] = op_riprel
[MAX_OPERANDS
- 1 - i
];
3918 op_riprel
[MAX_OPERANDS
- 1 - i
] = riprel
;
3923 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3924 op_txt
[MAX_OPERANDS
- 1 - i
] = op_out
[i
];
3928 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3932 (*info
->fprintf_func
) (info
->stream
, ",");
3933 if (op_index
[i
] != -1 && !op_riprel
[i
])
3934 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[i
]], info
);
3936 (*info
->fprintf_func
) (info
->stream
, "%s", op_txt
[i
]);
3940 for (i
= 0; i
< MAX_OPERANDS
; i
++)
3941 if (op_index
[i
] != -1 && op_riprel
[i
])
3943 (*info
->fprintf_func
) (info
->stream
, " # ");
3944 (*info
->print_address_func
) ((bfd_vma
) (start_pc
+ codep
- start_codep
3945 + op_address
[op_index
[i
]]), info
);
3948 return codep
- priv
.the_buffer
;
3951 static const char *float_mem
[] = {
4026 static const unsigned char float_mem_mode
[] = {
4101 #define ST { OP_ST, 0 }
4102 #define STi { OP_STi, 0 }
4104 #define FGRPd9_2 NULL, { { NULL, 0 } }
4105 #define FGRPd9_4 NULL, { { NULL, 1 } }
4106 #define FGRPd9_5 NULL, { { NULL, 2 } }
4107 #define FGRPd9_6 NULL, { { NULL, 3 } }
4108 #define FGRPd9_7 NULL, { { NULL, 4 } }
4109 #define FGRPda_5 NULL, { { NULL, 5 } }
4110 #define FGRPdb_4 NULL, { { NULL, 6 } }
4111 #define FGRPde_3 NULL, { { NULL, 7 } }
4112 #define FGRPdf_4 NULL, { { NULL, 8 } }
4114 static const struct dis386 float_reg
[][8] = {
4117 { "fadd", { ST
, STi
} },
4118 { "fmul", { ST
, STi
} },
4119 { "fcom", { STi
} },
4120 { "fcomp", { STi
} },
4121 { "fsub", { ST
, STi
} },
4122 { "fsubr", { ST
, STi
} },
4123 { "fdiv", { ST
, STi
} },
4124 { "fdivr", { ST
, STi
} },
4129 { "fxch", { STi
} },
4131 { "(bad)", { XX
} },
4139 { "fcmovb", { ST
, STi
} },
4140 { "fcmove", { ST
, STi
} },
4141 { "fcmovbe",{ ST
, STi
} },
4142 { "fcmovu", { ST
, STi
} },
4143 { "(bad)", { XX
} },
4145 { "(bad)", { XX
} },
4146 { "(bad)", { XX
} },
4150 { "fcmovnb",{ ST
, STi
} },
4151 { "fcmovne",{ ST
, STi
} },
4152 { "fcmovnbe",{ ST
, STi
} },
4153 { "fcmovnu",{ ST
, STi
} },
4155 { "fucomi", { ST
, STi
} },
4156 { "fcomi", { ST
, STi
} },
4157 { "(bad)", { XX
} },
4161 { "fadd", { STi
, ST
} },
4162 { "fmul", { STi
, ST
} },
4163 { "(bad)", { XX
} },
4164 { "(bad)", { XX
} },
4166 { "fsub", { STi
, ST
} },
4167 { "fsubr", { STi
, ST
} },
4168 { "fdiv", { STi
, ST
} },
4169 { "fdivr", { STi
, ST
} },
4171 { "fsubr", { STi
, ST
} },
4172 { "fsub", { STi
, ST
} },
4173 { "fdivr", { STi
, ST
} },
4174 { "fdiv", { STi
, ST
} },
4179 { "ffree", { STi
} },
4180 { "(bad)", { XX
} },
4182 { "fstp", { STi
} },
4183 { "fucom", { STi
} },
4184 { "fucomp", { STi
} },
4185 { "(bad)", { XX
} },
4186 { "(bad)", { XX
} },
4190 { "faddp", { STi
, ST
} },
4191 { "fmulp", { STi
, ST
} },
4192 { "(bad)", { XX
} },
4195 { "fsubp", { STi
, ST
} },
4196 { "fsubrp", { STi
, ST
} },
4197 { "fdivp", { STi
, ST
} },
4198 { "fdivrp", { STi
, ST
} },
4200 { "fsubrp", { STi
, ST
} },
4201 { "fsubp", { STi
, ST
} },
4202 { "fdivrp", { STi
, ST
} },
4203 { "fdivp", { STi
, ST
} },
4208 { "ffreep", { STi
} },
4209 { "(bad)", { XX
} },
4210 { "(bad)", { XX
} },
4211 { "(bad)", { XX
} },
4213 { "fucomip", { ST
, STi
} },
4214 { "fcomip", { ST
, STi
} },
4215 { "(bad)", { XX
} },
4219 static const char *fgrps
[][8] = {
4222 "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4227 "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
4232 "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
4237 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
4242 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
4247 "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4252 "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
4253 "fNsetpm(287 only)","(bad)","(bad)","(bad)",
4258 "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4263 "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4268 dofloat (int sizeflag
)
4270 const struct dis386
*dp
;
4271 unsigned char floatop
;
4273 floatop
= codep
[-1];
4277 int fp_indx
= (floatop
- 0xd8) * 8 + modrm
.reg
;
4279 putop (float_mem
[fp_indx
], sizeflag
);
4282 OP_E (float_mem_mode
[fp_indx
], sizeflag
);
4285 /* Skip mod/rm byte. */
4289 dp
= &float_reg
[floatop
- 0xd8][modrm
.reg
];
4290 if (dp
->name
== NULL
)
4292 putop (fgrps
[dp
->op
[0].bytemode
][modrm
.rm
], sizeflag
);
4294 /* Instruction fnstsw is only one with strange arg. */
4295 if (floatop
== 0xdf && codep
[-1] == 0xe0)
4296 pstrcpy (op_out
[0], sizeof(op_out
[0]), names16
[0]);
4300 putop (dp
->name
, sizeflag
);
4305 (*dp
->op
[0].rtn
) (dp
->op
[0].bytemode
, sizeflag
);
4310 (*dp
->op
[1].rtn
) (dp
->op
[1].bytemode
, sizeflag
);
4315 OP_ST (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
4317 oappend ("%st" + intel_syntax
);
4321 OP_STi (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
4323 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%st(%d)", modrm
.rm
);
4324 oappend (scratchbuf
+ intel_syntax
);
4327 /* Capital letters in template are macros. */
4329 putop (const char *template, int sizeflag
)
4334 for (p
= template; *p
; p
++)
4345 if (address_mode
== mode_64bit
)
4353 /* Alternative not valid. */
4354 pstrcpy (obuf
, sizeof(obuf
), "(bad)");
4358 else if (*p
== '\0')
4379 if (modrm
.mod
!= 3 || (sizeflag
& SUFFIX_ALWAYS
))
4385 if (sizeflag
& SUFFIX_ALWAYS
)
4389 if (intel_syntax
&& !alt
)
4391 if ((prefixes
& PREFIX_DATA
) || (sizeflag
& SUFFIX_ALWAYS
))
4393 if (sizeflag
& DFLAG
)
4394 *obufp
++ = intel_syntax
? 'd' : 'l';
4396 *obufp
++ = intel_syntax
? 'w' : 's';
4397 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4401 if (intel_syntax
|| !(sizeflag
& SUFFIX_ALWAYS
))
4408 else if (sizeflag
& DFLAG
)
4409 *obufp
++ = intel_syntax
? 'd' : 'l';
4412 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4417 case 'E': /* For jcxz/jecxz */
4418 if (address_mode
== mode_64bit
)
4420 if (sizeflag
& AFLAG
)
4426 if (sizeflag
& AFLAG
)
4428 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
4433 if ((prefixes
& PREFIX_ADDR
) || (sizeflag
& SUFFIX_ALWAYS
))
4435 if (sizeflag
& AFLAG
)
4436 *obufp
++ = address_mode
== mode_64bit
? 'q' : 'l';
4438 *obufp
++ = address_mode
== mode_64bit
? 'l' : 'w';
4439 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
4443 if (intel_syntax
|| (obufp
[-1] != 's' && !(sizeflag
& SUFFIX_ALWAYS
)))
4445 if ((rex
& REX_W
) || (sizeflag
& DFLAG
))
4450 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4455 if ((prefixes
& (PREFIX_CS
| PREFIX_DS
)) == PREFIX_CS
4456 || (prefixes
& (PREFIX_CS
| PREFIX_DS
)) == PREFIX_DS
)
4458 used_prefixes
|= prefixes
& (PREFIX_CS
| PREFIX_DS
);
4461 if (prefixes
& PREFIX_DS
)
4482 if (address_mode
== mode_64bit
&& (sizeflag
& SUFFIX_ALWAYS
))
4491 if (sizeflag
& SUFFIX_ALWAYS
)
4495 if ((prefixes
& PREFIX_FWAIT
) == 0)
4498 used_prefixes
|= PREFIX_FWAIT
;
4504 else if (intel_syntax
&& (sizeflag
& DFLAG
))
4509 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4514 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4523 if ((prefixes
& PREFIX_DATA
)
4525 || (sizeflag
& SUFFIX_ALWAYS
))
4532 if (sizeflag
& DFLAG
)
4537 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4543 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4545 if (modrm
.mod
!= 3 || (sizeflag
& SUFFIX_ALWAYS
))
4551 if (intel_syntax
&& !alt
)
4554 if (modrm
.mod
!= 3 || (sizeflag
& SUFFIX_ALWAYS
))
4560 if (sizeflag
& DFLAG
)
4561 *obufp
++ = intel_syntax
? 'd' : 'l';
4565 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4572 else if (sizeflag
& DFLAG
)
4581 if (intel_syntax
&& !p
[1]
4582 && ((rex
& REX_W
) || (sizeflag
& DFLAG
)))
4585 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4590 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4592 if (sizeflag
& SUFFIX_ALWAYS
)
4600 if (sizeflag
& SUFFIX_ALWAYS
)
4606 if (sizeflag
& DFLAG
)
4610 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4615 if (prefixes
& PREFIX_DATA
)
4619 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4630 /* implicit operand size 'l' for i386 or 'q' for x86-64 */
4632 /* operand size flag for cwtl, cbtw */
4641 else if (sizeflag
& DFLAG
)
4646 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4656 oappend (const char *s
)
4659 obufp
+= strlen (s
);
4665 if (prefixes
& PREFIX_CS
)
4667 used_prefixes
|= PREFIX_CS
;
4668 oappend ("%cs:" + intel_syntax
);
4670 if (prefixes
& PREFIX_DS
)
4672 used_prefixes
|= PREFIX_DS
;
4673 oappend ("%ds:" + intel_syntax
);
4675 if (prefixes
& PREFIX_SS
)
4677 used_prefixes
|= PREFIX_SS
;
4678 oappend ("%ss:" + intel_syntax
);
4680 if (prefixes
& PREFIX_ES
)
4682 used_prefixes
|= PREFIX_ES
;
4683 oappend ("%es:" + intel_syntax
);
4685 if (prefixes
& PREFIX_FS
)
4687 used_prefixes
|= PREFIX_FS
;
4688 oappend ("%fs:" + intel_syntax
);
4690 if (prefixes
& PREFIX_GS
)
4692 used_prefixes
|= PREFIX_GS
;
4693 oappend ("%gs:" + intel_syntax
);
4698 OP_indirE (int bytemode
, int sizeflag
)
4702 OP_E (bytemode
, sizeflag
);
4706 print_operand_value (char *buf
, size_t bufsize
, int hex
, bfd_vma disp
)
4708 if (address_mode
== mode_64bit
)
4716 snprintf_vma (tmp
, sizeof(tmp
), disp
);
4717 for (i
= 0; tmp
[i
] == '0' && tmp
[i
+ 1]; i
++);
4718 pstrcpy (buf
+ 2, bufsize
- 2, tmp
+ i
);
4722 bfd_signed_vma v
= disp
;
4729 /* Check for possible overflow on 0x8000000000000000. */
4732 pstrcpy (buf
, bufsize
, "9223372036854775808");
4738 pstrcpy (buf
, bufsize
, "0");
4746 tmp
[28 - i
] = (v
% 10) + '0';
4750 pstrcpy (buf
, bufsize
, tmp
+ 29 - i
);
4756 snprintf (buf
, bufsize
, "0x%x", (unsigned int) disp
);
4758 snprintf (buf
, bufsize
, "%d", (int) disp
);
4762 /* Put DISP in BUF as signed hex number. */
4765 print_displacement (char *buf
, bfd_vma disp
)
4767 bfd_signed_vma val
= disp
;
4776 /* Check for possible overflow. */
4779 switch (address_mode
)
4782 strcpy (buf
+ j
, "0x8000000000000000");
4785 strcpy (buf
+ j
, "0x80000000");
4788 strcpy (buf
+ j
, "0x8000");
4798 snprintf_vma (tmp
, sizeof(tmp
), val
);
4799 for (i
= 0; tmp
[i
] == '0'; i
++)
4803 strcpy (buf
+ j
, tmp
+ i
);
4807 intel_operand_size (int bytemode
, int sizeflag
)
4813 oappend ("BYTE PTR ");
4817 oappend ("WORD PTR ");
4820 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4822 oappend ("QWORD PTR ");
4823 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4831 oappend ("QWORD PTR ");
4832 else if ((sizeflag
& DFLAG
) || bytemode
== dq_mode
)
4833 oappend ("DWORD PTR ");
4835 oappend ("WORD PTR ");
4836 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4839 if ((rex
& REX_W
) || (sizeflag
& DFLAG
))
4841 oappend ("WORD PTR ");
4843 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4847 oappend ("DWORD PTR ");
4850 oappend ("QWORD PTR ");
4853 if (address_mode
== mode_64bit
)
4854 oappend ("QWORD PTR ");
4856 oappend ("DWORD PTR ");
4859 if (sizeflag
& DFLAG
)
4860 oappend ("FWORD PTR ");
4862 oappend ("DWORD PTR ");
4863 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4866 oappend ("TBYTE PTR ");
4869 oappend ("XMMWORD PTR ");
4872 oappend ("OWORD PTR ");
4880 OP_E (int bytemode
, int sizeflag
)
4889 /* Skip mod/rm byte. */
4900 oappend (names8rex
[modrm
.rm
+ add
]);
4902 oappend (names8
[modrm
.rm
+ add
]);
4905 oappend (names16
[modrm
.rm
+ add
]);
4908 oappend (names32
[modrm
.rm
+ add
]);
4911 oappend (names64
[modrm
.rm
+ add
]);
4914 if (address_mode
== mode_64bit
)
4915 oappend (names64
[modrm
.rm
+ add
]);
4917 oappend (names32
[modrm
.rm
+ add
]);
4920 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4922 oappend (names64
[modrm
.rm
+ add
]);
4923 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4935 oappend (names64
[modrm
.rm
+ add
]);
4936 else if ((sizeflag
& DFLAG
) || bytemode
!= v_mode
)
4937 oappend (names32
[modrm
.rm
+ add
]);
4939 oappend (names16
[modrm
.rm
+ add
]);
4940 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4945 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4953 intel_operand_size (bytemode
, sizeflag
);
4956 if ((sizeflag
& AFLAG
) || address_mode
== mode_64bit
)
4958 /* 32/64 bit address mode */
4973 FETCH_DATA (the_info
, codep
+ 1);
4974 index
= (*codep
>> 3) & 7;
4975 if (address_mode
== mode_64bit
|| index
!= 0x4)
4976 /* When INDEX == 0x4 in 32 bit mode, SCALE is ignored. */
4977 scale
= (*codep
>> 6) & 3;
4989 if ((base
& 7) == 5)
4992 if (address_mode
== mode_64bit
&& !havesib
)
4998 FETCH_DATA (the_info
, codep
+ 1);
5000 if ((disp
& 0x80) != 0)
5008 havedisp
= havebase
|| (havesib
&& (index
!= 4 || scale
!= 0));
5011 if (modrm
.mod
!= 0 || (base
& 7) == 5)
5013 if (havedisp
|| riprel
)
5014 print_displacement (scratchbuf
, disp
);
5016 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, disp
);
5017 oappend (scratchbuf
);
5025 if (havedisp
|| (intel_syntax
&& riprel
))
5027 *obufp
++ = open_char
;
5028 if (intel_syntax
&& riprel
)
5035 oappend (address_mode
== mode_64bit
&& (sizeflag
& AFLAG
)
5036 ? names64
[base
] : names32
[base
]);
5041 if (!intel_syntax
|| havebase
)
5043 *obufp
++ = separator_char
;
5046 oappend (address_mode
== mode_64bit
&& (sizeflag
& AFLAG
)
5047 ? names64
[index
] : names32
[index
]);
5049 if (scale
!= 0 || (!intel_syntax
&& index
!= 4))
5051 *obufp
++ = scale_char
;
5053 snprintf (scratchbuf
, sizeof(scratchbuf
), "%d", 1 << scale
);
5054 oappend (scratchbuf
);
5058 && (disp
|| modrm
.mod
!= 0 || (base
& 7) == 5))
5060 if ((bfd_signed_vma
) disp
>= 0)
5065 else if (modrm
.mod
!= 1)
5069 disp
= - (bfd_signed_vma
) disp
;
5072 print_displacement (scratchbuf
, disp
);
5073 oappend (scratchbuf
);
5076 *obufp
++ = close_char
;
5079 else if (intel_syntax
)
5081 if (modrm
.mod
!= 0 || (base
& 7) == 5)
5083 if (prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5084 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
))
5088 oappend (names_seg
[ds_reg
- es_reg
]);
5091 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, disp
);
5092 oappend (scratchbuf
);
5097 { /* 16 bit address mode */
5104 if ((disp
& 0x8000) != 0)
5109 FETCH_DATA (the_info
, codep
+ 1);
5111 if ((disp
& 0x80) != 0)
5116 if ((disp
& 0x8000) != 0)
5122 if (modrm
.mod
!= 0 || modrm
.rm
== 6)
5124 print_displacement (scratchbuf
, disp
);
5125 oappend (scratchbuf
);
5128 if (modrm
.mod
!= 0 || modrm
.rm
!= 6)
5130 *obufp
++ = open_char
;
5132 oappend (index16
[modrm
.rm
]);
5134 && (disp
|| modrm
.mod
!= 0 || modrm
.rm
== 6))
5136 if ((bfd_signed_vma
) disp
>= 0)
5141 else if (modrm
.mod
!= 1)
5145 disp
= - (bfd_signed_vma
) disp
;
5148 print_displacement (scratchbuf
, disp
);
5149 oappend (scratchbuf
);
5152 *obufp
++ = close_char
;
5155 else if (intel_syntax
)
5157 if (prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5158 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
))
5162 oappend (names_seg
[ds_reg
- es_reg
]);
5165 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1,
5167 oappend (scratchbuf
);
5173 OP_G (int bytemode
, int sizeflag
)
5184 oappend (names8rex
[modrm
.reg
+ add
]);
5186 oappend (names8
[modrm
.reg
+ add
]);
5189 oappend (names16
[modrm
.reg
+ add
]);
5192 oappend (names32
[modrm
.reg
+ add
]);
5195 oappend (names64
[modrm
.reg
+ add
]);
5204 oappend (names64
[modrm
.reg
+ add
]);
5205 else if ((sizeflag
& DFLAG
) || bytemode
!= v_mode
)
5206 oappend (names32
[modrm
.reg
+ add
]);
5208 oappend (names16
[modrm
.reg
+ add
]);
5209 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5212 if (address_mode
== mode_64bit
)
5213 oappend (names64
[modrm
.reg
+ add
]);
5215 oappend (names32
[modrm
.reg
+ add
]);
5218 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5231 FETCH_DATA (the_info
, codep
+ 8);
5232 a
= *codep
++ & 0xff;
5233 a
|= (*codep
++ & 0xff) << 8;
5234 a
|= (*codep
++ & 0xff) << 16;
5235 a
|= (*codep
++ & 0xff) << 24;
5236 b
= *codep
++ & 0xff;
5237 b
|= (*codep
++ & 0xff) << 8;
5238 b
|= (*codep
++ & 0xff) << 16;
5239 b
|= (*codep
++ & 0xff) << 24;
5240 x
= a
+ ((bfd_vma
) b
<< 32);
5248 static bfd_signed_vma
5251 bfd_signed_vma x
= 0;
5253 FETCH_DATA (the_info
, codep
+ 4);
5254 x
= *codep
++ & (bfd_signed_vma
) 0xff;
5255 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
5256 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
5257 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
5261 static bfd_signed_vma
5264 bfd_signed_vma x
= 0;
5266 FETCH_DATA (the_info
, codep
+ 4);
5267 x
= *codep
++ & (bfd_signed_vma
) 0xff;
5268 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
5269 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
5270 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
5272 x
= (x
^ ((bfd_signed_vma
) 1 << 31)) - ((bfd_signed_vma
) 1 << 31);
5282 FETCH_DATA (the_info
, codep
+ 2);
5283 x
= *codep
++ & 0xff;
5284 x
|= (*codep
++ & 0xff) << 8;
5289 set_op (bfd_vma op
, int riprel
)
5291 op_index
[op_ad
] = op_ad
;
5292 if (address_mode
== mode_64bit
)
5294 op_address
[op_ad
] = op
;
5295 op_riprel
[op_ad
] = riprel
;
5299 /* Mask to get a 32-bit address. */
5300 op_address
[op_ad
] = op
& 0xffffffff;
5301 op_riprel
[op_ad
] = riprel
& 0xffffffff;
5306 OP_REG (int code
, int sizeflag
)
5316 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
5317 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
5318 s
= names16
[code
- ax_reg
+ add
];
5320 case es_reg
: case ss_reg
: case cs_reg
:
5321 case ds_reg
: case fs_reg
: case gs_reg
:
5322 s
= names_seg
[code
- es_reg
+ add
];
5324 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
5325 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
5328 s
= names8rex
[code
- al_reg
+ add
];
5330 s
= names8
[code
- al_reg
];
5332 case rAX_reg
: case rCX_reg
: case rDX_reg
: case rBX_reg
:
5333 case rSP_reg
: case rBP_reg
: case rSI_reg
: case rDI_reg
:
5334 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
5336 s
= names64
[code
- rAX_reg
+ add
];
5339 code
+= eAX_reg
- rAX_reg
;
5341 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
5342 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
5345 s
= names64
[code
- eAX_reg
+ add
];
5346 else if (sizeflag
& DFLAG
)
5347 s
= names32
[code
- eAX_reg
+ add
];
5349 s
= names16
[code
- eAX_reg
+ add
];
5350 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5353 s
= INTERNAL_DISASSEMBLER_ERROR
;
5360 OP_IMREG (int code
, int sizeflag
)
5372 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
5373 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
5374 s
= names16
[code
- ax_reg
];
5376 case es_reg
: case ss_reg
: case cs_reg
:
5377 case ds_reg
: case fs_reg
: case gs_reg
:
5378 s
= names_seg
[code
- es_reg
];
5380 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
5381 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
5384 s
= names8rex
[code
- al_reg
];
5386 s
= names8
[code
- al_reg
];
5388 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
5389 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
5392 s
= names64
[code
- eAX_reg
];
5393 else if (sizeflag
& DFLAG
)
5394 s
= names32
[code
- eAX_reg
];
5396 s
= names16
[code
- eAX_reg
];
5397 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5400 if ((rex
& REX_W
) || (sizeflag
& DFLAG
))
5405 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5408 s
= INTERNAL_DISASSEMBLER_ERROR
;
5415 OP_I (int bytemode
, int sizeflag
)
5418 bfd_signed_vma mask
= -1;
5423 FETCH_DATA (the_info
, codep
+ 1);
5428 if (address_mode
== mode_64bit
)
5438 else if (sizeflag
& DFLAG
)
5448 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5459 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5464 scratchbuf
[0] = '$';
5465 print_operand_value (scratchbuf
+ 1, sizeof(scratchbuf
) - 1, 1, op
);
5466 oappend (scratchbuf
+ intel_syntax
);
5467 scratchbuf
[0] = '\0';
5471 OP_I64 (int bytemode
, int sizeflag
)
5474 bfd_signed_vma mask
= -1;
5476 if (address_mode
!= mode_64bit
)
5478 OP_I (bytemode
, sizeflag
);
5485 FETCH_DATA (the_info
, codep
+ 1);
5493 else if (sizeflag
& DFLAG
)
5503 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5510 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5515 scratchbuf
[0] = '$';
5516 print_operand_value (scratchbuf
+ 1, sizeof(scratchbuf
) - 1, 1, op
);
5517 oappend (scratchbuf
+ intel_syntax
);
5518 scratchbuf
[0] = '\0';
5522 OP_sI (int bytemode
, int sizeflag
)
5525 bfd_signed_vma mask
= -1;
5530 FETCH_DATA (the_info
, codep
+ 1);
5532 if ((op
& 0x80) != 0)
5540 else if (sizeflag
& DFLAG
)
5549 if ((op
& 0x8000) != 0)
5552 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5557 if ((op
& 0x8000) != 0)
5561 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5565 scratchbuf
[0] = '$';
5566 print_operand_value (scratchbuf
+ 1, sizeof(scratchbuf
) - 1, 1, op
);
5567 oappend (scratchbuf
+ intel_syntax
);
5571 OP_J (int bytemode
, int sizeflag
)
5575 bfd_vma segment
= 0;
5580 FETCH_DATA (the_info
, codep
+ 1);
5582 if ((disp
& 0x80) != 0)
5586 if ((sizeflag
& DFLAG
) || (rex
& REX_W
))
5591 if ((disp
& 0x8000) != 0)
5593 /* In 16bit mode, address is wrapped around at 64k within
5594 the same segment. Otherwise, a data16 prefix on a jump
5595 instruction means that the pc is masked to 16 bits after
5596 the displacement is added! */
5598 if ((prefixes
& PREFIX_DATA
) == 0)
5599 segment
= ((start_pc
+ codep
- start_codep
)
5600 & ~((bfd_vma
) 0xffff));
5602 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5605 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5608 disp
= ((start_pc
+ codep
- start_codep
+ disp
) & mask
) | segment
;
5610 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, disp
);
5611 oappend (scratchbuf
);
5615 OP_SEG (int bytemode
, int sizeflag
)
5617 if (bytemode
== w_mode
)
5618 oappend (names_seg
[modrm
.reg
]);
5620 OP_E (modrm
.mod
== 3 ? bytemode
: w_mode
, sizeflag
);
5624 OP_DIR (int dummy ATTRIBUTE_UNUSED
, int sizeflag
)
5628 if (sizeflag
& DFLAG
)
5638 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5640 snprintf (scratchbuf
, sizeof(scratchbuf
), "0x%x:0x%x", seg
, offset
);
5642 snprintf (scratchbuf
, sizeof(scratchbuf
), "$0x%x,$0x%x", seg
, offset
);
5643 oappend (scratchbuf
);
5647 OP_OFF (int bytemode
, int sizeflag
)
5651 if (intel_syntax
&& (sizeflag
& SUFFIX_ALWAYS
))
5652 intel_operand_size (bytemode
, sizeflag
);
5655 if ((sizeflag
& AFLAG
) || address_mode
== mode_64bit
)
5662 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5663 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
5665 oappend (names_seg
[ds_reg
- es_reg
]);
5669 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, off
);
5670 oappend (scratchbuf
);
5674 OP_OFF64 (int bytemode
, int sizeflag
)
5678 if (address_mode
!= mode_64bit
5679 || (prefixes
& PREFIX_ADDR
))
5681 OP_OFF (bytemode
, sizeflag
);
5685 if (intel_syntax
&& (sizeflag
& SUFFIX_ALWAYS
))
5686 intel_operand_size (bytemode
, sizeflag
);
5693 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5694 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
5696 oappend (names_seg
[ds_reg
- es_reg
]);
5700 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, off
);
5701 oappend (scratchbuf
);
5705 ptr_reg (int code
, int sizeflag
)
5709 *obufp
++ = open_char
;
5710 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
5711 if (address_mode
== mode_64bit
)
5713 if (!(sizeflag
& AFLAG
))
5714 s
= names32
[code
- eAX_reg
];
5716 s
= names64
[code
- eAX_reg
];
5718 else if (sizeflag
& AFLAG
)
5719 s
= names32
[code
- eAX_reg
];
5721 s
= names16
[code
- eAX_reg
];
5723 *obufp
++ = close_char
;
5728 OP_ESreg (int code
, int sizeflag
)
5734 case 0x6d: /* insw/insl */
5735 intel_operand_size (z_mode
, sizeflag
);
5737 case 0xa5: /* movsw/movsl/movsq */
5738 case 0xa7: /* cmpsw/cmpsl/cmpsq */
5739 case 0xab: /* stosw/stosl */
5740 case 0xaf: /* scasw/scasl */
5741 intel_operand_size (v_mode
, sizeflag
);
5744 intel_operand_size (b_mode
, sizeflag
);
5747 oappend ("%es:" + intel_syntax
);
5748 ptr_reg (code
, sizeflag
);
5752 OP_DSreg (int code
, int sizeflag
)
5758 case 0x6f: /* outsw/outsl */
5759 intel_operand_size (z_mode
, sizeflag
);
5761 case 0xa5: /* movsw/movsl/movsq */
5762 case 0xa7: /* cmpsw/cmpsl/cmpsq */
5763 case 0xad: /* lodsw/lodsl/lodsq */
5764 intel_operand_size (v_mode
, sizeflag
);
5767 intel_operand_size (b_mode
, sizeflag
);
5777 prefixes
|= PREFIX_DS
;
5779 ptr_reg (code
, sizeflag
);
5783 OP_C (int dummy ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5791 else if (address_mode
!= mode_64bit
&& (prefixes
& PREFIX_LOCK
))
5793 used_prefixes
|= PREFIX_LOCK
;
5796 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%cr%d", modrm
.reg
+ add
);
5797 oappend (scratchbuf
+ intel_syntax
);
5801 OP_D (int dummy ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5808 snprintf (scratchbuf
, sizeof(scratchbuf
), "db%d", modrm
.reg
+ add
);
5810 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%db%d", modrm
.reg
+ add
);
5811 oappend (scratchbuf
);
5815 OP_T (int dummy ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5817 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%tr%d", modrm
.reg
);
5818 oappend (scratchbuf
+ intel_syntax
);
5822 OP_R (int bytemode
, int sizeflag
)
5825 OP_E (bytemode
, sizeflag
);
5831 OP_MMX (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5833 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5834 if (prefixes
& PREFIX_DATA
)
5840 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.reg
+ add
);
5843 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.reg
);
5844 oappend (scratchbuf
+ intel_syntax
);
5848 OP_XMM (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5854 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.reg
+ add
);
5855 oappend (scratchbuf
+ intel_syntax
);
5859 OP_EM (int bytemode
, int sizeflag
)
5863 if (intel_syntax
&& bytemode
== v_mode
)
5865 bytemode
= (prefixes
& PREFIX_DATA
) ? x_mode
: q_mode
;
5866 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5868 OP_E (bytemode
, sizeflag
);
5872 /* Skip mod/rm byte. */
5875 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5876 if (prefixes
& PREFIX_DATA
)
5883 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.rm
+ add
);
5886 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.rm
);
5887 oappend (scratchbuf
+ intel_syntax
);
5890 /* cvt* are the only instructions in sse2 which have
5891 both SSE and MMX operands and also have 0x66 prefix
5892 in their opcode. 0x66 was originally used to differentiate
5893 between SSE and MMX instruction(operands). So we have to handle the
5894 cvt* separately using OP_EMC and OP_MXC */
5896 OP_EMC (int bytemode
, int sizeflag
)
5900 if (intel_syntax
&& bytemode
== v_mode
)
5902 bytemode
= (prefixes
& PREFIX_DATA
) ? x_mode
: q_mode
;
5903 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5905 OP_E (bytemode
, sizeflag
);
5909 /* Skip mod/rm byte. */
5912 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5913 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.rm
);
5914 oappend (scratchbuf
+ intel_syntax
);
5918 OP_MXC (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5920 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5921 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.reg
);
5922 oappend (scratchbuf
+ intel_syntax
);
5926 OP_EX (int bytemode
, int sizeflag
)
5931 OP_E (bytemode
, sizeflag
);
5938 /* Skip mod/rm byte. */
5941 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.rm
+ add
);
5942 oappend (scratchbuf
+ intel_syntax
);
5946 OP_MS (int bytemode
, int sizeflag
)
5949 OP_EM (bytemode
, sizeflag
);
5955 OP_XS (int bytemode
, int sizeflag
)
5958 OP_EX (bytemode
, sizeflag
);
5964 OP_M (int bytemode
, int sizeflag
)
5967 /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
5970 OP_E (bytemode
, sizeflag
);
5974 OP_0f07 (int bytemode
, int sizeflag
)
5976 if (modrm
.mod
!= 3 || modrm
.rm
!= 0)
5979 OP_E (bytemode
, sizeflag
);
5983 OP_0fae (int bytemode
, int sizeflag
)
5988 strcpy (obuf
+ strlen (obuf
) - sizeof ("clflush") + 1, "sfence");
5990 if (modrm
.reg
< 5 || modrm
.rm
!= 0)
5992 BadOp (); /* bad sfence, mfence, or lfence */
5996 else if (modrm
.reg
!= 7)
5998 BadOp (); /* bad clflush */
6002 OP_E (bytemode
, sizeflag
);
6005 /* NOP is an alias of "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in
6006 32bit mode and "xchg %rax,%rax" in 64bit mode. */
6009 NOP_Fixup1 (int bytemode
, int sizeflag
)
6011 if ((prefixes
& PREFIX_DATA
) != 0
6014 && address_mode
== mode_64bit
))
6015 OP_REG (bytemode
, sizeflag
);
6017 strcpy (obuf
, "nop");
6021 NOP_Fixup2 (int bytemode
, int sizeflag
)
6023 if ((prefixes
& PREFIX_DATA
) != 0
6026 && address_mode
== mode_64bit
))
6027 OP_IMREG (bytemode
, sizeflag
);
6030 static const char *Suffix3DNow
[] = {
6031 /* 00 */ NULL
, NULL
, NULL
, NULL
,
6032 /* 04 */ NULL
, NULL
, NULL
, NULL
,
6033 /* 08 */ NULL
, NULL
, NULL
, NULL
,
6034 /* 0C */ "pi2fw", "pi2fd", NULL
, NULL
,
6035 /* 10 */ NULL
, NULL
, NULL
, NULL
,
6036 /* 14 */ NULL
, NULL
, NULL
, NULL
,
6037 /* 18 */ NULL
, NULL
, NULL
, NULL
,
6038 /* 1C */ "pf2iw", "pf2id", NULL
, NULL
,
6039 /* 20 */ NULL
, NULL
, NULL
, NULL
,
6040 /* 24 */ NULL
, NULL
, NULL
, NULL
,
6041 /* 28 */ NULL
, NULL
, NULL
, NULL
,
6042 /* 2C */ NULL
, NULL
, NULL
, NULL
,
6043 /* 30 */ NULL
, NULL
, NULL
, NULL
,
6044 /* 34 */ NULL
, NULL
, NULL
, NULL
,
6045 /* 38 */ NULL
, NULL
, NULL
, NULL
,
6046 /* 3C */ NULL
, NULL
, NULL
, NULL
,
6047 /* 40 */ NULL
, NULL
, NULL
, NULL
,
6048 /* 44 */ NULL
, NULL
, NULL
, NULL
,
6049 /* 48 */ NULL
, NULL
, NULL
, NULL
,
6050 /* 4C */ NULL
, NULL
, NULL
, NULL
,
6051 /* 50 */ NULL
, NULL
, NULL
, NULL
,
6052 /* 54 */ NULL
, NULL
, NULL
, NULL
,
6053 /* 58 */ NULL
, NULL
, NULL
, NULL
,
6054 /* 5C */ NULL
, NULL
, NULL
, NULL
,
6055 /* 60 */ NULL
, NULL
, NULL
, NULL
,
6056 /* 64 */ NULL
, NULL
, NULL
, NULL
,
6057 /* 68 */ NULL
, NULL
, NULL
, NULL
,
6058 /* 6C */ NULL
, NULL
, NULL
, NULL
,
6059 /* 70 */ NULL
, NULL
, NULL
, NULL
,
6060 /* 74 */ NULL
, NULL
, NULL
, NULL
,
6061 /* 78 */ NULL
, NULL
, NULL
, NULL
,
6062 /* 7C */ NULL
, NULL
, NULL
, NULL
,
6063 /* 80 */ NULL
, NULL
, NULL
, NULL
,
6064 /* 84 */ NULL
, NULL
, NULL
, NULL
,
6065 /* 88 */ NULL
, NULL
, "pfnacc", NULL
,
6066 /* 8C */ NULL
, NULL
, "pfpnacc", NULL
,
6067 /* 90 */ "pfcmpge", NULL
, NULL
, NULL
,
6068 /* 94 */ "pfmin", NULL
, "pfrcp", "pfrsqrt",
6069 /* 98 */ NULL
, NULL
, "pfsub", NULL
,
6070 /* 9C */ NULL
, NULL
, "pfadd", NULL
,
6071 /* A0 */ "pfcmpgt", NULL
, NULL
, NULL
,
6072 /* A4 */ "pfmax", NULL
, "pfrcpit1", "pfrsqit1",
6073 /* A8 */ NULL
, NULL
, "pfsubr", NULL
,
6074 /* AC */ NULL
, NULL
, "pfacc", NULL
,
6075 /* B0 */ "pfcmpeq", NULL
, NULL
, NULL
,
6076 /* B4 */ "pfmul", NULL
, "pfrcpit2", "pmulhrw",
6077 /* B8 */ NULL
, NULL
, NULL
, "pswapd",
6078 /* BC */ NULL
, NULL
, NULL
, "pavgusb",
6079 /* C0 */ NULL
, NULL
, NULL
, NULL
,
6080 /* C4 */ NULL
, NULL
, NULL
, NULL
,
6081 /* C8 */ NULL
, NULL
, NULL
, NULL
,
6082 /* CC */ NULL
, NULL
, NULL
, NULL
,
6083 /* D0 */ NULL
, NULL
, NULL
, NULL
,
6084 /* D4 */ NULL
, NULL
, NULL
, NULL
,
6085 /* D8 */ NULL
, NULL
, NULL
, NULL
,
6086 /* DC */ NULL
, NULL
, NULL
, NULL
,
6087 /* E0 */ NULL
, NULL
, NULL
, NULL
,
6088 /* E4 */ NULL
, NULL
, NULL
, NULL
,
6089 /* E8 */ NULL
, NULL
, NULL
, NULL
,
6090 /* EC */ NULL
, NULL
, NULL
, NULL
,
6091 /* F0 */ NULL
, NULL
, NULL
, NULL
,
6092 /* F4 */ NULL
, NULL
, NULL
, NULL
,
6093 /* F8 */ NULL
, NULL
, NULL
, NULL
,
6094 /* FC */ NULL
, NULL
, NULL
, NULL
,
6098 OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
6100 const char *mnemonic
;
6102 FETCH_DATA (the_info
, codep
+ 1);
6103 /* AMD 3DNow! instructions are specified by an opcode suffix in the
6104 place where an 8-bit immediate would normally go. ie. the last
6105 byte of the instruction. */
6106 obufp
= obuf
+ strlen (obuf
);
6107 mnemonic
= Suffix3DNow
[*codep
++ & 0xff];
6112 /* Since a variable sized modrm/sib chunk is between the start
6113 of the opcode (0x0f0f) and the opcode suffix, we need to do
6114 all the modrm processing first, and don't know until now that
6115 we have a bad opcode. This necessitates some cleaning up. */
6116 op_out
[0][0] = '\0';
6117 op_out
[1][0] = '\0';
6122 static const char *simd_cmp_op
[] = {
6134 OP_SIMD_Suffix (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
6136 unsigned int cmp_type
;
6138 FETCH_DATA (the_info
, codep
+ 1);
6139 obufp
= obuf
+ strlen (obuf
);
6140 cmp_type
= *codep
++ & 0xff;
6143 char suffix1
= 'p', suffix2
= 's';
6144 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
6145 if (prefixes
& PREFIX_REPZ
)
6149 used_prefixes
|= (prefixes
& PREFIX_DATA
);
6150 if (prefixes
& PREFIX_DATA
)
6154 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
6155 if (prefixes
& PREFIX_REPNZ
)
6156 suffix1
= 's', suffix2
= 'd';
6159 snprintf (scratchbuf
, sizeof(scratchbuf
), "cmp%s%c%c",
6160 simd_cmp_op
[cmp_type
], suffix1
, suffix2
);
6161 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
6162 oappend (scratchbuf
);
6166 /* We have a bad extension byte. Clean up. */
6167 op_out
[0][0] = '\0';
6168 op_out
[1][0] = '\0';
6174 SIMD_Fixup (int extrachar
, int sizeflag ATTRIBUTE_UNUSED
)
6176 /* Change movlps/movhps to movhlps/movlhps for 2 register operand
6177 forms of these instructions. */
6180 char *p
= obuf
+ strlen (obuf
);
6183 *(p
- 1) = *(p
- 2);
6184 *(p
- 2) = *(p
- 3);
6185 *(p
- 3) = extrachar
;
6190 PNI_Fixup (int extrachar ATTRIBUTE_UNUSED
, int sizeflag
)
6192 if (modrm
.mod
== 3 && modrm
.reg
== 1 && modrm
.rm
<= 1)
6194 /* Override "sidt". */
6195 size_t olen
= strlen (obuf
);
6196 char *p
= obuf
+ olen
- 4;
6197 const char * const *names
= (address_mode
== mode_64bit
6198 ? names64
: names32
);
6200 /* We might have a suffix when disassembling with -Msuffix. */
6204 /* Remove "addr16/addr32" if we aren't in Intel mode. */
6206 && (prefixes
& PREFIX_ADDR
)
6209 && strncmp (p
- 7, "addr", 4) == 0
6210 && (strncmp (p
- 3, "16", 2) == 0
6211 || strncmp (p
- 3, "32", 2) == 0))
6216 /* mwait %eax,%ecx */
6217 strcpy (p
, "mwait");
6219 strcpy (op_out
[0], names
[0]);
6223 /* monitor %eax,%ecx,%edx" */
6224 strcpy (p
, "monitor");
6227 const char * const *op1_names
;
6228 if (!(prefixes
& PREFIX_ADDR
))
6229 op1_names
= (address_mode
== mode_16bit
6233 op1_names
= (address_mode
!= mode_32bit
6234 ? names32
: names16
);
6235 used_prefixes
|= PREFIX_ADDR
;
6237 strcpy (op_out
[0], op1_names
[0]);
6238 strcpy (op_out
[2], names
[2]);
6243 strcpy (op_out
[1], names
[1]);
6254 SVME_Fixup (int bytemode
, int sizeflag
)
6286 OP_M (bytemode
, sizeflag
);
6289 /* Override "lidt". */
6290 p
= obuf
+ strlen (obuf
) - 4;
6291 /* We might have a suffix. */
6295 if (!(prefixes
& PREFIX_ADDR
))
6300 used_prefixes
|= PREFIX_ADDR
;
6304 strcpy (op_out
[1], names32
[1]);
6310 *obufp
++ = open_char
;
6311 if (address_mode
== mode_64bit
|| (sizeflag
& AFLAG
))
6315 strcpy (obufp
, alt
);
6316 obufp
+= strlen (alt
);
6317 *obufp
++ = close_char
;
6324 INVLPG_Fixup (int bytemode
, int sizeflag
)
6337 OP_M (bytemode
, sizeflag
);
6340 /* Override "invlpg". */
6341 strcpy (obuf
+ strlen (obuf
) - 6, alt
);
6348 /* Throw away prefixes and 1st. opcode byte. */
6349 codep
= insn_codep
+ 1;
6354 VMX_Fixup (int extrachar ATTRIBUTE_UNUSED
, int sizeflag
)
6361 /* Override "sgdt". */
6362 char *p
= obuf
+ strlen (obuf
) - 4;
6364 /* We might have a suffix when disassembling with -Msuffix. */
6371 strcpy (p
, "vmcall");
6374 strcpy (p
, "vmlaunch");
6377 strcpy (p
, "vmresume");
6380 strcpy (p
, "vmxoff");
6391 OP_VMX (int bytemode
, int sizeflag
)
6393 used_prefixes
|= (prefixes
& (PREFIX_DATA
| PREFIX_REPZ
));
6394 if (prefixes
& PREFIX_DATA
)
6395 strcpy (obuf
, "vmclear");
6396 else if (prefixes
& PREFIX_REPZ
)
6397 strcpy (obuf
, "vmxon");
6399 strcpy (obuf
, "vmptrld");
6400 OP_E (bytemode
, sizeflag
);
6404 REP_Fixup (int bytemode
, int sizeflag
)
6406 /* The 0xf3 prefix should be displayed as "rep" for ins, outs, movs,
6410 if (prefixes
& PREFIX_REPZ
)
6411 switch (*insn_codep
)
6413 case 0x6e: /* outsb */
6414 case 0x6f: /* outsw/outsl */
6415 case 0xa4: /* movsb */
6416 case 0xa5: /* movsw/movsl/movsq */
6422 case 0xaa: /* stosb */
6423 case 0xab: /* stosw/stosl/stosq */
6424 case 0xac: /* lodsb */
6425 case 0xad: /* lodsw/lodsl/lodsq */
6426 if (!intel_syntax
&& (sizeflag
& SUFFIX_ALWAYS
))
6431 case 0x6c: /* insb */
6432 case 0x6d: /* insl/insw */
6448 olen
= strlen (obuf
);
6449 p
= obuf
+ olen
- ilen
- 1 - 4;
6450 /* Handle "repz [addr16|addr32]". */
6451 if ((prefixes
& PREFIX_ADDR
))
6454 memmove (p
+ 3, p
+ 4, olen
- (p
+ 3 - obuf
));
6462 OP_IMREG (bytemode
, sizeflag
);
6465 OP_ESreg (bytemode
, sizeflag
);
6468 OP_DSreg (bytemode
, sizeflag
);
6477 CMPXCHG8B_Fixup (int bytemode
, int sizeflag
)
6482 /* Change cmpxchg8b to cmpxchg16b. */
6483 char *p
= obuf
+ strlen (obuf
) - 2;
6487 OP_M (bytemode
, sizeflag
);
6491 XMM_Fixup (int reg
, int sizeflag ATTRIBUTE_UNUSED
)
6493 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", reg
);
6494 oappend (scratchbuf
+ intel_syntax
);
6498 CRC32_Fixup (int bytemode
, int sizeflag
)
6500 /* Add proper suffix to "crc32". */
6501 char *p
= obuf
+ strlen (obuf
);
6518 else if (sizeflag
& DFLAG
)
6522 used_prefixes
|= (prefixes
& PREFIX_DATA
);
6525 oappend (INTERNAL_DISASSEMBLER_ERROR
);
6534 /* Skip mod/rm byte. */
6539 add
= (rex
& REX_B
) ? 8 : 0;
6540 if (bytemode
== b_mode
)
6544 oappend (names8rex
[modrm
.rm
+ add
]);
6546 oappend (names8
[modrm
.rm
+ add
]);
6552 oappend (names64
[modrm
.rm
+ add
]);
6553 else if ((prefixes
& PREFIX_DATA
))
6554 oappend (names16
[modrm
.rm
+ add
]);
6556 oappend (names32
[modrm
.rm
+ add
]);
6560 OP_E (bytemode
, sizeflag
);