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, see <http://www.gnu.org/licenses/>. */
21 /* 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
23 modified by John Hassey (hassey@dg-rtp.dg.com)
24 x86-64 support added by Jan Hubicka (jh@suse.cz)
25 VIA PadLock support by Michal Ludvig (mludvig@suse.cz). */
27 /* The main tables describing the instructions is essentially a copy
28 of the "Opcode Map" chapter (Appendix A) of the Intel 80386
29 Programmers Manual. Usually, there is a capital letter, followed
30 by a small letter. The capital letter tell the addressing mode,
31 and the small letter tells about the operand size. Refer to
32 the Intel manual for details. */
36 /* include/opcode/i386.h r1.78 */
38 /* opcode/i386.h -- Intel 80386 opcode macros
39 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
40 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
41 Free Software Foundation, Inc.
43 This file is part of GAS, the GNU Assembler, and GDB, the GNU Debugger.
45 This program is free software; you can redistribute it and/or modify
46 it under the terms of the GNU General Public License as published by
47 the Free Software Foundation; either version 2 of the License, or
48 (at your option) any later version.
50 This program is distributed in the hope that it will be useful,
51 but WITHOUT ANY WARRANTY; without even the implied warranty of
52 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53 GNU General Public License for more details.
55 You should have received a copy of the GNU General Public License
56 along with this program; if not, see <http://www.gnu.org/licenses/>. */
58 /* The SystemV/386 SVR3.2 assembler, and probably all AT&T derived
59 ix86 Unix assemblers, generate floating point instructions with
60 reversed source and destination registers in certain cases.
61 Unfortunately, gcc and possibly many other programs use this
62 reversed syntax, so we're stuck with it.
64 eg. `fsub %st(3),%st' results in st = st - st(3) as expected, but
65 `fsub %st,%st(3)' results in st(3) = st - st(3), rather than
66 the expected st(3) = st(3) - st
68 This happens with all the non-commutative arithmetic floating point
69 operations with two register operands, where the source register is
70 %st, and destination register is %st(i).
72 The affected opcode map is dceX, dcfX, deeX, defX. */
74 #ifndef SYSV386_COMPAT
75 /* Set non-zero for broken, compatible instructions. Set to zero for
76 non-broken opcodes at your peril. gcc generates SystemV/386
77 compatible instructions. */
78 #define SYSV386_COMPAT 1
81 /* Set non-zero to cater for old (<= 2.8.1) versions of gcc that could
82 generate nonsense fsubp, fsubrp, fdivp and fdivrp with operands
84 #define OLDGCC_COMPAT SYSV386_COMPAT
87 #define MOV_AX_DISP32 0xa0
88 #define POP_SEG_SHORT 0x07
89 #define JUMP_PC_RELATIVE 0xeb
90 #define INT_OPCODE 0xcd
91 #define INT3_OPCODE 0xcc
92 /* The opcode for the fwait instruction, which disassembler treats as a
93 prefix when it can. */
94 #define FWAIT_OPCODE 0x9b
95 #define ADDR_PREFIX_OPCODE 0x67
96 #define DATA_PREFIX_OPCODE 0x66
97 #define LOCK_PREFIX_OPCODE 0xf0
98 #define CS_PREFIX_OPCODE 0x2e
99 #define DS_PREFIX_OPCODE 0x3e
100 #define ES_PREFIX_OPCODE 0x26
101 #define FS_PREFIX_OPCODE 0x64
102 #define GS_PREFIX_OPCODE 0x65
103 #define SS_PREFIX_OPCODE 0x36
104 #define REPNE_PREFIX_OPCODE 0xf2
105 #define REPE_PREFIX_OPCODE 0xf3
107 #define TWO_BYTE_OPCODE_ESCAPE 0x0f
108 #define NOP_OPCODE (char) 0x90
110 /* register numbers */
111 #define EBP_REG_NUM 5
112 #define ESP_REG_NUM 4
114 /* modrm_byte.regmem for twobyte escape */
115 #define ESCAPE_TO_TWO_BYTE_ADDRESSING ESP_REG_NUM
116 /* index_base_byte.index for no index register addressing */
117 #define NO_INDEX_REGISTER ESP_REG_NUM
118 /* index_base_byte.base for no base register addressing */
119 #define NO_BASE_REGISTER EBP_REG_NUM
120 #define NO_BASE_REGISTER_16 6
122 /* modrm.mode = REGMEM_FIELD_HAS_REG when a register is in there */
123 #define REGMEM_FIELD_HAS_REG 0x3/* always = 0x3 */
124 #define REGMEM_FIELD_HAS_MEM (~REGMEM_FIELD_HAS_REG)
126 /* x86-64 extension prefix. */
127 #define REX_OPCODE 0x40
129 /* Indicates 64 bit operand size. */
131 /* High extension to reg field of modrm byte. */
133 /* High extension to SIB index field. */
135 /* High extension to base field of modrm or SIB, or reg field of opcode. */
138 /* max operands per insn */
139 #define MAX_OPERANDS 4
141 /* max immediates per insn (lcall, ljmp, insertq, extrq) */
142 #define MAX_IMMEDIATE_OPERANDS 2
144 /* max memory refs per insn (string ops) */
145 #define MAX_MEMORY_OPERANDS 2
147 /* max size of insn mnemonics. */
148 #define MAX_MNEM_SIZE 16
150 /* max size of register name in insn mnemonics. */
151 #define MAX_REG_NAME_SIZE 8
153 /* opcodes/i386-dis.c r1.126 */
154 #include "qemu-common.h"
158 static int fetch_data (struct disassemble_info
*, bfd_byte
*);
159 static void ckprefix (void);
160 static const char *prefix_name (int, int);
161 static int print_insn (bfd_vma
, disassemble_info
*);
162 static void dofloat (int);
163 static void OP_ST (int, int);
164 static void OP_STi (int, int);
165 static int putop (const char *, int);
166 static void oappend (const char *);
167 static void append_seg (void);
168 static void OP_indirE (int, int);
169 static void print_operand_value (char *buf
, size_t bufsize
, int hex
, bfd_vma disp
);
170 static void print_displacement (char *, bfd_vma
);
171 static void OP_E (int, int);
172 static void OP_G (int, int);
173 static bfd_vma
get64 (void);
174 static bfd_signed_vma
get32 (void);
175 static bfd_signed_vma
get32s (void);
176 static int get16 (void);
177 static void set_op (bfd_vma
, int);
178 static void OP_REG (int, int);
179 static void OP_IMREG (int, int);
180 static void OP_I (int, int);
181 static void OP_I64 (int, int);
182 static void OP_sI (int, int);
183 static void OP_J (int, int);
184 static void OP_SEG (int, int);
185 static void OP_DIR (int, int);
186 static void OP_OFF (int, int);
187 static void OP_OFF64 (int, int);
188 static void ptr_reg (int, int);
189 static void OP_ESreg (int, int);
190 static void OP_DSreg (int, int);
191 static void OP_C (int, int);
192 static void OP_D (int, int);
193 static void OP_T (int, int);
194 static void OP_R (int, int);
195 static void OP_MMX (int, int);
196 static void OP_XMM (int, int);
197 static void OP_EM (int, int);
198 static void OP_EX (int, int);
199 static void OP_EMC (int,int);
200 static void OP_MXC (int,int);
201 static void OP_MS (int, int);
202 static void OP_XS (int, int);
203 static void OP_M (int, int);
204 static void OP_VMX (int, int);
205 static void OP_0fae (int, int);
206 static void OP_0f07 (int, int);
207 static void NOP_Fixup1 (int, int);
208 static void NOP_Fixup2 (int, int);
209 static void OP_3DNowSuffix (int, int);
210 static void OP_SIMD_Suffix (int, int);
211 static void SIMD_Fixup (int, int);
212 static void PNI_Fixup (int, int);
213 static void SVME_Fixup (int, int);
214 static void INVLPG_Fixup (int, int);
215 static void BadOp (void);
216 static void VMX_Fixup (int, int);
217 static void REP_Fixup (int, int);
218 static void CMPXCHG8B_Fixup (int, int);
219 static void XMM_Fixup (int, int);
220 static void CRC32_Fixup (int, int);
223 /* Points to first byte not fetched. */
224 bfd_byte
*max_fetched
;
225 bfd_byte the_buffer
[MAX_MNEM_SIZE
];
238 static enum address_mode address_mode
;
240 /* Flags for the prefixes for the current instruction. See below. */
243 /* REX prefix the current instruction. See below. */
245 /* Bits of REX we've already used. */
247 /* Mark parts used in the REX prefix. When we are testing for
248 empty prefix (for 8bit register REX extension), just mask it
249 out. Otherwise test for REX bit is excuse for existence of REX
250 only in case value is nonzero. */
251 #define USED_REX(value) \
256 rex_used |= (value) | REX_OPCODE; \
259 rex_used |= REX_OPCODE; \
262 /* Flags for prefixes which we somehow handled when printing the
263 current instruction. */
264 static int used_prefixes
;
266 /* Flags stored in PREFIXES. */
267 #define PREFIX_REPZ 1
268 #define PREFIX_REPNZ 2
269 #define PREFIX_LOCK 4
271 #define PREFIX_SS 0x10
272 #define PREFIX_DS 0x20
273 #define PREFIX_ES 0x40
274 #define PREFIX_FS 0x80
275 #define PREFIX_GS 0x100
276 #define PREFIX_DATA 0x200
277 #define PREFIX_ADDR 0x400
278 #define PREFIX_FWAIT 0x800
280 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
281 to ADDR (exclusive) are valid. Returns 1 for success, longjmps
283 #define FETCH_DATA(info, addr) \
284 ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
285 ? 1 : fetch_data ((info), (addr)))
288 fetch_data (struct disassemble_info
*info
, bfd_byte
*addr
)
291 struct dis_private
*priv
= (struct dis_private
*) info
->private_data
;
292 bfd_vma start
= priv
->insn_start
+ (priv
->max_fetched
- priv
->the_buffer
);
294 if (addr
<= priv
->the_buffer
+ MAX_MNEM_SIZE
)
295 status
= (*info
->read_memory_func
) (start
,
297 addr
- priv
->max_fetched
,
303 /* If we did manage to read at least one byte, then
304 print_insn_i386 will do something sensible. Otherwise, print
305 an error. We do that here because this is where we know
307 if (priv
->max_fetched
== priv
->the_buffer
)
308 (*info
->memory_error_func
) (status
, start
, info
);
309 longjmp (priv
->bailout
, 1);
312 priv
->max_fetched
= addr
;
316 #define XX { NULL, 0 }
318 #define Eb { OP_E, b_mode }
319 #define Ev { OP_E, v_mode }
320 #define Ed { OP_E, d_mode }
321 #define Edq { OP_E, dq_mode }
322 #define Edqw { OP_E, dqw_mode }
323 #define Edqb { OP_E, dqb_mode }
324 #define Edqd { OP_E, dqd_mode }
325 #define indirEv { OP_indirE, stack_v_mode }
326 #define indirEp { OP_indirE, f_mode }
327 #define stackEv { OP_E, stack_v_mode }
328 #define Em { OP_E, m_mode }
329 #define Ew { OP_E, w_mode }
330 #define M { OP_M, 0 } /* lea, lgdt, etc. */
331 #define Ma { OP_M, v_mode }
332 #define Mp { OP_M, f_mode } /* 32 or 48 bit memory operand for LDS, LES etc */
333 #define Mq { OP_M, q_mode }
334 #define Gb { OP_G, b_mode }
335 #define Gv { OP_G, v_mode }
336 #define Gd { OP_G, d_mode }
337 #define Gdq { OP_G, dq_mode }
338 #define Gm { OP_G, m_mode }
339 #define Gw { OP_G, w_mode }
340 #define Rd { OP_R, d_mode }
341 #define Rm { OP_R, m_mode }
342 #define Ib { OP_I, b_mode }
343 #define sIb { OP_sI, b_mode } /* sign extened byte */
344 #define Iv { OP_I, v_mode }
345 #define Iq { OP_I, q_mode }
346 #define Iv64 { OP_I64, v_mode }
347 #define Iw { OP_I, w_mode }
348 #define I1 { OP_I, const_1_mode }
349 #define Jb { OP_J, b_mode }
350 #define Jv { OP_J, v_mode }
351 #define Cm { OP_C, m_mode }
352 #define Dm { OP_D, m_mode }
353 #define Td { OP_T, d_mode }
355 #define RMeAX { OP_REG, eAX_reg }
356 #define RMeBX { OP_REG, eBX_reg }
357 #define RMeCX { OP_REG, eCX_reg }
358 #define RMeDX { OP_REG, eDX_reg }
359 #define RMeSP { OP_REG, eSP_reg }
360 #define RMeBP { OP_REG, eBP_reg }
361 #define RMeSI { OP_REG, eSI_reg }
362 #define RMeDI { OP_REG, eDI_reg }
363 #define RMrAX { OP_REG, rAX_reg }
364 #define RMrBX { OP_REG, rBX_reg }
365 #define RMrCX { OP_REG, rCX_reg }
366 #define RMrDX { OP_REG, rDX_reg }
367 #define RMrSP { OP_REG, rSP_reg }
368 #define RMrBP { OP_REG, rBP_reg }
369 #define RMrSI { OP_REG, rSI_reg }
370 #define RMrDI { OP_REG, rDI_reg }
371 #define RMAL { OP_REG, al_reg }
372 #define RMAL { OP_REG, al_reg }
373 #define RMCL { OP_REG, cl_reg }
374 #define RMDL { OP_REG, dl_reg }
375 #define RMBL { OP_REG, bl_reg }
376 #define RMAH { OP_REG, ah_reg }
377 #define RMCH { OP_REG, ch_reg }
378 #define RMDH { OP_REG, dh_reg }
379 #define RMBH { OP_REG, bh_reg }
380 #define RMAX { OP_REG, ax_reg }
381 #define RMDX { OP_REG, dx_reg }
383 #define eAX { OP_IMREG, eAX_reg }
384 #define eBX { OP_IMREG, eBX_reg }
385 #define eCX { OP_IMREG, eCX_reg }
386 #define eDX { OP_IMREG, eDX_reg }
387 #define eSP { OP_IMREG, eSP_reg }
388 #define eBP { OP_IMREG, eBP_reg }
389 #define eSI { OP_IMREG, eSI_reg }
390 #define eDI { OP_IMREG, eDI_reg }
391 #define AL { OP_IMREG, al_reg }
392 #define CL { OP_IMREG, cl_reg }
393 #define DL { OP_IMREG, dl_reg }
394 #define BL { OP_IMREG, bl_reg }
395 #define AH { OP_IMREG, ah_reg }
396 #define CH { OP_IMREG, ch_reg }
397 #define DH { OP_IMREG, dh_reg }
398 #define BH { OP_IMREG, bh_reg }
399 #define AX { OP_IMREG, ax_reg }
400 #define DX { OP_IMREG, dx_reg }
401 #define zAX { OP_IMREG, z_mode_ax_reg }
402 #define indirDX { OP_IMREG, indir_dx_reg }
404 #define Sw { OP_SEG, w_mode }
405 #define Sv { OP_SEG, v_mode }
406 #define Ap { OP_DIR, 0 }
407 #define Ob { OP_OFF64, b_mode }
408 #define Ov { OP_OFF64, v_mode }
409 #define Xb { OP_DSreg, eSI_reg }
410 #define Xv { OP_DSreg, eSI_reg }
411 #define Xz { OP_DSreg, eSI_reg }
412 #define Yb { OP_ESreg, eDI_reg }
413 #define Yv { OP_ESreg, eDI_reg }
414 #define DSBX { OP_DSreg, eBX_reg }
416 #define es { OP_REG, es_reg }
417 #define ss { OP_REG, ss_reg }
418 #define cs { OP_REG, cs_reg }
419 #define ds { OP_REG, ds_reg }
420 #define fs { OP_REG, fs_reg }
421 #define gs { OP_REG, gs_reg }
423 #define MX { OP_MMX, 0 }
424 #define XM { OP_XMM, 0 }
425 #define EM { OP_EM, v_mode }
426 #define EMd { OP_EM, d_mode }
427 #define EMq { OP_EM, q_mode }
428 #define EXd { OP_EX, d_mode }
429 #define EXq { OP_EX, q_mode }
430 #define EXx { OP_EX, x_mode }
431 #define MS { OP_MS, v_mode }
432 #define XS { OP_XS, v_mode }
433 #define EMC { OP_EMC, v_mode }
434 #define MXC { OP_MXC, 0 }
435 #define VM { OP_VMX, q_mode }
436 #define OPSUF { OP_3DNowSuffix, 0 }
437 #define OPSIMD { OP_SIMD_Suffix, 0 }
438 #define XMM0 { XMM_Fixup, 0 }
440 /* Used handle "rep" prefix for string instructions. */
441 #define Xbr { REP_Fixup, eSI_reg }
442 #define Xvr { REP_Fixup, eSI_reg }
443 #define Ybr { REP_Fixup, eDI_reg }
444 #define Yvr { REP_Fixup, eDI_reg }
445 #define Yzr { REP_Fixup, eDI_reg }
446 #define indirDXr { REP_Fixup, indir_dx_reg }
447 #define ALr { REP_Fixup, al_reg }
448 #define eAXr { REP_Fixup, eAX_reg }
450 #define cond_jump_flag { NULL, cond_jump_mode }
451 #define loop_jcxz_flag { NULL, loop_jcxz_mode }
453 /* bits in sizeflag */
454 #define SUFFIX_ALWAYS 4
458 #define b_mode 1 /* byte operand */
459 #define v_mode 2 /* operand size depends on prefixes */
460 #define w_mode 3 /* word operand */
461 #define d_mode 4 /* double word operand */
462 #define q_mode 5 /* quad word operand */
463 #define t_mode 6 /* ten-byte operand */
464 #define x_mode 7 /* 16-byte XMM operand */
465 #define m_mode 8 /* d_mode in 32bit, q_mode in 64bit mode. */
466 #define cond_jump_mode 9
467 #define loop_jcxz_mode 10
468 #define dq_mode 11 /* operand size depends on REX prefixes. */
469 #define dqw_mode 12 /* registers like dq_mode, memory like w_mode. */
470 #define f_mode 13 /* 4- or 6-byte pointer operand */
471 #define const_1_mode 14
472 #define stack_v_mode 15 /* v_mode for stack-related opcodes. */
473 #define z_mode 16 /* non-quad operand size depends on prefixes */
474 #define o_mode 17 /* 16-byte operand */
475 #define dqb_mode 18 /* registers like dq_mode, memory like b_mode. */
476 #define dqd_mode 19 /* registers like dq_mode, memory like d_mode. */
521 #define z_mode_ax_reg 149
522 #define indir_dx_reg 150
526 #define USE_PREFIX_USER_TABLE 3
527 #define X86_64_SPECIAL 4
528 #define IS_3BYTE_OPCODE 5
530 #define FLOAT NULL, { { NULL, FLOATCODE } }
532 #define GRP1a NULL, { { NULL, USE_GROUPS }, { NULL, 0 } }
533 #define GRP1b NULL, { { NULL, USE_GROUPS }, { NULL, 1 } }
534 #define GRP1S NULL, { { NULL, USE_GROUPS }, { NULL, 2 } }
535 #define GRP1Ss NULL, { { NULL, USE_GROUPS }, { NULL, 3 } }
536 #define GRP2b NULL, { { NULL, USE_GROUPS }, { NULL, 4 } }
537 #define GRP2S NULL, { { NULL, USE_GROUPS }, { NULL, 5 } }
538 #define GRP2b_one NULL, { { NULL, USE_GROUPS }, { NULL, 6 } }
539 #define GRP2S_one NULL, { { NULL, USE_GROUPS }, { NULL, 7 } }
540 #define GRP2b_cl NULL, { { NULL, USE_GROUPS }, { NULL, 8 } }
541 #define GRP2S_cl NULL, { { NULL, USE_GROUPS }, { NULL, 9 } }
542 #define GRP3b NULL, { { NULL, USE_GROUPS }, { NULL, 10 } }
543 #define GRP3S NULL, { { NULL, USE_GROUPS }, { NULL, 11 } }
544 #define GRP4 NULL, { { NULL, USE_GROUPS }, { NULL, 12 } }
545 #define GRP5 NULL, { { NULL, USE_GROUPS }, { NULL, 13 } }
546 #define GRP6 NULL, { { NULL, USE_GROUPS }, { NULL, 14 } }
547 #define GRP7 NULL, { { NULL, USE_GROUPS }, { NULL, 15 } }
548 #define GRP8 NULL, { { NULL, USE_GROUPS }, { NULL, 16 } }
549 #define GRP9 NULL, { { NULL, USE_GROUPS }, { NULL, 17 } }
550 #define GRP11_C6 NULL, { { NULL, USE_GROUPS }, { NULL, 18 } }
551 #define GRP11_C7 NULL, { { NULL, USE_GROUPS }, { NULL, 19 } }
552 #define GRP12 NULL, { { NULL, USE_GROUPS }, { NULL, 20 } }
553 #define GRP13 NULL, { { NULL, USE_GROUPS }, { NULL, 21 } }
554 #define GRP14 NULL, { { NULL, USE_GROUPS }, { NULL, 22 } }
555 #define GRP15 NULL, { { NULL, USE_GROUPS }, { NULL, 23 } }
556 #define GRP16 NULL, { { NULL, USE_GROUPS }, { NULL, 24 } }
557 #define GRPAMD NULL, { { NULL, USE_GROUPS }, { NULL, 25 } }
558 #define GRPPADLCK1 NULL, { { NULL, USE_GROUPS }, { NULL, 26 } }
559 #define GRPPADLCK2 NULL, { { NULL, USE_GROUPS }, { NULL, 27 } }
561 #define PREGRP0 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 0 } }
562 #define PREGRP1 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 1 } }
563 #define PREGRP2 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 2 } }
564 #define PREGRP3 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 3 } }
565 #define PREGRP4 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 4 } }
566 #define PREGRP5 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 5 } }
567 #define PREGRP6 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 6 } }
568 #define PREGRP7 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 7 } }
569 #define PREGRP8 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 8 } }
570 #define PREGRP9 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 9 } }
571 #define PREGRP10 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 10 } }
572 #define PREGRP11 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 11 } }
573 #define PREGRP12 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 12 } }
574 #define PREGRP13 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 13 } }
575 #define PREGRP14 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 14 } }
576 #define PREGRP15 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 15 } }
577 #define PREGRP16 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 16 } }
578 #define PREGRP17 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 17 } }
579 #define PREGRP18 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 18 } }
580 #define PREGRP19 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 19 } }
581 #define PREGRP20 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 20 } }
582 #define PREGRP21 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 21 } }
583 #define PREGRP22 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 22 } }
584 #define PREGRP23 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 23 } }
585 #define PREGRP24 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 24 } }
586 #define PREGRP25 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 25 } }
587 #define PREGRP26 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 26 } }
588 #define PREGRP27 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 27 } }
589 #define PREGRP28 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 28 } }
590 #define PREGRP29 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 29 } }
591 #define PREGRP30 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 30 } }
592 #define PREGRP31 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 31 } }
593 #define PREGRP32 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 32 } }
594 #define PREGRP33 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 33 } }
595 #define PREGRP34 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 34 } }
596 #define PREGRP35 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 35 } }
597 #define PREGRP36 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 36 } }
598 #define PREGRP37 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 37 } }
599 #define PREGRP38 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 38 } }
600 #define PREGRP39 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 39 } }
601 #define PREGRP40 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 40 } }
602 #define PREGRP41 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 41 } }
603 #define PREGRP42 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 42 } }
604 #define PREGRP43 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 43 } }
605 #define PREGRP44 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 44 } }
606 #define PREGRP45 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 45 } }
607 #define PREGRP46 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 46 } }
608 #define PREGRP47 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 47 } }
609 #define PREGRP48 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 48 } }
610 #define PREGRP49 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 49 } }
611 #define PREGRP50 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 50 } }
612 #define PREGRP51 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 51 } }
613 #define PREGRP52 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 52 } }
614 #define PREGRP53 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 53 } }
615 #define PREGRP54 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 54 } }
616 #define PREGRP55 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 55 } }
617 #define PREGRP56 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 56 } }
618 #define PREGRP57 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 57 } }
619 #define PREGRP58 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 58 } }
620 #define PREGRP59 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 59 } }
621 #define PREGRP60 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 60 } }
622 #define PREGRP61 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 61 } }
623 #define PREGRP62 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 62 } }
624 #define PREGRP63 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 63 } }
625 #define PREGRP64 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 64 } }
626 #define PREGRP65 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 65 } }
627 #define PREGRP66 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 66 } }
628 #define PREGRP67 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 67 } }
629 #define PREGRP68 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 68 } }
630 #define PREGRP69 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 69 } }
631 #define PREGRP70 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 70 } }
632 #define PREGRP71 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 71 } }
633 #define PREGRP72 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 72 } }
634 #define PREGRP73 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 73 } }
635 #define PREGRP74 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 74 } }
636 #define PREGRP75 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 75 } }
637 #define PREGRP76 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 76 } }
638 #define PREGRP77 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 77 } }
639 #define PREGRP78 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 78 } }
640 #define PREGRP79 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 79 } }
641 #define PREGRP80 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 80 } }
642 #define PREGRP81 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 81 } }
643 #define PREGRP82 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 82 } }
644 #define PREGRP83 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 83 } }
645 #define PREGRP84 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 84 } }
646 #define PREGRP85 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 85 } }
647 #define PREGRP86 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 86 } }
648 #define PREGRP87 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 87 } }
649 #define PREGRP88 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 88 } }
650 #define PREGRP89 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 89 } }
651 #define PREGRP90 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 90 } }
652 #define PREGRP91 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 91 } }
653 #define PREGRP92 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 92 } }
654 #define PREGRP93 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 93 } }
655 #define PREGRP94 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 94 } }
656 #define PREGRP95 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 95 } }
657 #define PREGRP96 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 96 } }
658 #define PREGRP97 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 97 } }
661 #define X86_64_0 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 0 } }
662 #define X86_64_1 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 1 } }
663 #define X86_64_2 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 2 } }
664 #define X86_64_3 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 3 } }
666 #define THREE_BYTE_0 NULL, { { NULL, IS_3BYTE_OPCODE }, { NULL, 0 } }
667 #define THREE_BYTE_1 NULL, { { NULL, IS_3BYTE_OPCODE }, { NULL, 1 } }
669 typedef void (*op_rtn
) (int bytemode
, int sizeflag
);
680 /* Upper case letters in the instruction names here are macros.
681 'A' => print 'b' if no register operands or suffix_always is true
682 'B' => print 'b' if suffix_always is true
683 'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand
685 'D' => print 'w' if no register operands or 'w', 'l' or 'q', if
686 . suffix_always is true
687 'E' => print 'e' if 32-bit form of jcxz
688 'F' => print 'w' or 'l' depending on address size prefix (loop insns)
689 'G' => print 'w' or 'l' depending on operand size prefix (i/o insns)
690 'H' => print ",pt" or ",pn" branch hint
691 'I' => honor following macro letter even in Intel mode (implemented only
692 . for some of the macro letters)
694 'K' => print 'd' or 'q' if rex prefix is present.
695 'L' => print 'l' if suffix_always is true
696 'N' => print 'n' if instruction has no wait "prefix"
697 'O' => print 'd' or 'o' (or 'q' in Intel mode)
698 'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
699 . or suffix_always is true. print 'q' if rex prefix is present.
700 'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
702 'R' => print 'w', 'l' or 'q' ('d' for 'l' and 'e' in Intel mode)
703 'S' => print 'w', 'l' or 'q' if suffix_always is true
704 'T' => print 'q' in 64bit mode and behave as 'P' otherwise
705 'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
706 'V' => print 'q' in 64bit mode and behave as 'S' otherwise
707 'W' => print 'b', 'w' or 'l' ('d' in Intel mode)
708 'X' => print 's', 'd' depending on data16 prefix (for XMM)
709 'Y' => 'q' if instruction has an REX 64bit overwrite prefix
710 'Z' => print 'q' in 64bit mode and behave as 'L' otherwise
712 Many of the above letters print nothing in Intel mode. See "putop"
715 Braces '{' and '}', and vertical bars '|', indicate alternative
716 mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel
717 modes. In cases where there are only two alternatives, the X86_64
718 instruction is reserved, and "(bad)" is printed.
721 static const struct dis386 dis386
[] = {
723 { "addB", { Eb
, Gb
} },
724 { "addS", { Ev
, Gv
} },
725 { "addB", { Gb
, Eb
} },
726 { "addS", { Gv
, Ev
} },
727 { "addB", { AL
, Ib
} },
728 { "addS", { eAX
, Iv
} },
729 { "push{T|}", { es
} },
730 { "pop{T|}", { es
} },
732 { "orB", { Eb
, Gb
} },
733 { "orS", { Ev
, Gv
} },
734 { "orB", { Gb
, Eb
} },
735 { "orS", { Gv
, Ev
} },
736 { "orB", { AL
, Ib
} },
737 { "orS", { eAX
, Iv
} },
738 { "push{T|}", { cs
} },
739 { "(bad)", { XX
} }, /* 0x0f extended opcode escape */
741 { "adcB", { Eb
, Gb
} },
742 { "adcS", { Ev
, Gv
} },
743 { "adcB", { Gb
, Eb
} },
744 { "adcS", { Gv
, Ev
} },
745 { "adcB", { AL
, Ib
} },
746 { "adcS", { eAX
, Iv
} },
747 { "push{T|}", { ss
} },
748 { "pop{T|}", { ss
} },
750 { "sbbB", { Eb
, Gb
} },
751 { "sbbS", { Ev
, Gv
} },
752 { "sbbB", { Gb
, Eb
} },
753 { "sbbS", { Gv
, Ev
} },
754 { "sbbB", { AL
, Ib
} },
755 { "sbbS", { eAX
, Iv
} },
756 { "push{T|}", { ds
} },
757 { "pop{T|}", { ds
} },
759 { "andB", { Eb
, Gb
} },
760 { "andS", { Ev
, Gv
} },
761 { "andB", { Gb
, Eb
} },
762 { "andS", { Gv
, Ev
} },
763 { "andB", { AL
, Ib
} },
764 { "andS", { eAX
, Iv
} },
765 { "(bad)", { XX
} }, /* SEG ES prefix */
766 { "daa{|}", { XX
} },
768 { "subB", { Eb
, Gb
} },
769 { "subS", { Ev
, Gv
} },
770 { "subB", { Gb
, Eb
} },
771 { "subS", { Gv
, Ev
} },
772 { "subB", { AL
, Ib
} },
773 { "subS", { eAX
, Iv
} },
774 { "(bad)", { XX
} }, /* SEG CS prefix */
775 { "das{|}", { XX
} },
777 { "xorB", { Eb
, Gb
} },
778 { "xorS", { Ev
, Gv
} },
779 { "xorB", { Gb
, Eb
} },
780 { "xorS", { Gv
, Ev
} },
781 { "xorB", { AL
, Ib
} },
782 { "xorS", { eAX
, Iv
} },
783 { "(bad)", { XX
} }, /* SEG SS prefix */
784 { "aaa{|}", { XX
} },
786 { "cmpB", { Eb
, Gb
} },
787 { "cmpS", { Ev
, Gv
} },
788 { "cmpB", { Gb
, Eb
} },
789 { "cmpS", { Gv
, Ev
} },
790 { "cmpB", { AL
, Ib
} },
791 { "cmpS", { eAX
, Iv
} },
792 { "(bad)", { XX
} }, /* SEG DS prefix */
793 { "aas{|}", { XX
} },
795 { "inc{S|}", { RMeAX
} },
796 { "inc{S|}", { RMeCX
} },
797 { "inc{S|}", { RMeDX
} },
798 { "inc{S|}", { RMeBX
} },
799 { "inc{S|}", { RMeSP
} },
800 { "inc{S|}", { RMeBP
} },
801 { "inc{S|}", { RMeSI
} },
802 { "inc{S|}", { RMeDI
} },
804 { "dec{S|}", { RMeAX
} },
805 { "dec{S|}", { RMeCX
} },
806 { "dec{S|}", { RMeDX
} },
807 { "dec{S|}", { RMeBX
} },
808 { "dec{S|}", { RMeSP
} },
809 { "dec{S|}", { RMeBP
} },
810 { "dec{S|}", { RMeSI
} },
811 { "dec{S|}", { RMeDI
} },
813 { "pushV", { RMrAX
} },
814 { "pushV", { RMrCX
} },
815 { "pushV", { RMrDX
} },
816 { "pushV", { RMrBX
} },
817 { "pushV", { RMrSP
} },
818 { "pushV", { RMrBP
} },
819 { "pushV", { RMrSI
} },
820 { "pushV", { RMrDI
} },
822 { "popV", { RMrAX
} },
823 { "popV", { RMrCX
} },
824 { "popV", { RMrDX
} },
825 { "popV", { RMrBX
} },
826 { "popV", { RMrSP
} },
827 { "popV", { RMrBP
} },
828 { "popV", { RMrSI
} },
829 { "popV", { RMrDI
} },
835 { "(bad)", { XX
} }, /* seg fs */
836 { "(bad)", { XX
} }, /* seg gs */
837 { "(bad)", { XX
} }, /* op size prefix */
838 { "(bad)", { XX
} }, /* adr size prefix */
841 { "imulS", { Gv
, Ev
, Iv
} },
842 { "pushT", { sIb
} },
843 { "imulS", { Gv
, Ev
, sIb
} },
844 { "ins{b||b|}", { Ybr
, indirDX
} },
845 { "ins{R||G|}", { Yzr
, indirDX
} },
846 { "outs{b||b|}", { indirDXr
, Xb
} },
847 { "outs{R||G|}", { indirDXr
, Xz
} },
849 { "joH", { Jb
, XX
, cond_jump_flag
} },
850 { "jnoH", { Jb
, XX
, cond_jump_flag
} },
851 { "jbH", { Jb
, XX
, cond_jump_flag
} },
852 { "jaeH", { Jb
, XX
, cond_jump_flag
} },
853 { "jeH", { Jb
, XX
, cond_jump_flag
} },
854 { "jneH", { Jb
, XX
, cond_jump_flag
} },
855 { "jbeH", { Jb
, XX
, cond_jump_flag
} },
856 { "jaH", { Jb
, XX
, cond_jump_flag
} },
858 { "jsH", { Jb
, XX
, cond_jump_flag
} },
859 { "jnsH", { Jb
, XX
, cond_jump_flag
} },
860 { "jpH", { Jb
, XX
, cond_jump_flag
} },
861 { "jnpH", { Jb
, XX
, cond_jump_flag
} },
862 { "jlH", { Jb
, XX
, cond_jump_flag
} },
863 { "jgeH", { Jb
, XX
, cond_jump_flag
} },
864 { "jleH", { Jb
, XX
, cond_jump_flag
} },
865 { "jgH", { Jb
, XX
, cond_jump_flag
} },
871 { "testB", { Eb
, Gb
} },
872 { "testS", { Ev
, Gv
} },
873 { "xchgB", { Eb
, Gb
} },
874 { "xchgS", { Ev
, Gv
} },
876 { "movB", { Eb
, Gb
} },
877 { "movS", { Ev
, Gv
} },
878 { "movB", { Gb
, Eb
} },
879 { "movS", { Gv
, Ev
} },
880 { "movD", { Sv
, Sw
} },
881 { "leaS", { Gv
, M
} },
882 { "movD", { Sw
, Sv
} },
886 { "xchgS", { RMeCX
, eAX
} },
887 { "xchgS", { RMeDX
, eAX
} },
888 { "xchgS", { RMeBX
, eAX
} },
889 { "xchgS", { RMeSP
, eAX
} },
890 { "xchgS", { RMeBP
, eAX
} },
891 { "xchgS", { RMeSI
, eAX
} },
892 { "xchgS", { RMeDI
, eAX
} },
894 { "cW{t||t|}R", { XX
} },
895 { "cR{t||t|}O", { XX
} },
896 { "Jcall{T|}", { Ap
} },
897 { "(bad)", { XX
} }, /* fwait */
898 { "pushfT", { XX
} },
900 { "sahf{|}", { XX
} },
901 { "lahf{|}", { XX
} },
903 { "movB", { AL
, Ob
} },
904 { "movS", { eAX
, Ov
} },
905 { "movB", { Ob
, AL
} },
906 { "movS", { Ov
, eAX
} },
907 { "movs{b||b|}", { Ybr
, Xb
} },
908 { "movs{R||R|}", { Yvr
, Xv
} },
909 { "cmps{b||b|}", { Xb
, Yb
} },
910 { "cmps{R||R|}", { Xv
, Yv
} },
912 { "testB", { AL
, Ib
} },
913 { "testS", { eAX
, Iv
} },
914 { "stosB", { Ybr
, AL
} },
915 { "stosS", { Yvr
, eAX
} },
916 { "lodsB", { ALr
, Xb
} },
917 { "lodsS", { eAXr
, Xv
} },
918 { "scasB", { AL
, Yb
} },
919 { "scasS", { eAX
, Yv
} },
921 { "movB", { RMAL
, Ib
} },
922 { "movB", { RMCL
, Ib
} },
923 { "movB", { RMDL
, Ib
} },
924 { "movB", { RMBL
, Ib
} },
925 { "movB", { RMAH
, Ib
} },
926 { "movB", { RMCH
, Ib
} },
927 { "movB", { RMDH
, Ib
} },
928 { "movB", { RMBH
, Ib
} },
930 { "movS", { RMeAX
, Iv64
} },
931 { "movS", { RMeCX
, Iv64
} },
932 { "movS", { RMeDX
, Iv64
} },
933 { "movS", { RMeBX
, Iv64
} },
934 { "movS", { RMeSP
, Iv64
} },
935 { "movS", { RMeBP
, Iv64
} },
936 { "movS", { RMeSI
, Iv64
} },
937 { "movS", { RMeDI
, Iv64
} },
943 { "les{S|}", { Gv
, Mp
} },
944 { "ldsS", { Gv
, Mp
} },
948 { "enterT", { Iw
, Ib
} },
949 { "leaveT", { XX
} },
954 { "into{|}", { XX
} },
961 { "aam{|}", { sIb
} },
962 { "aad{|}", { sIb
} },
964 { "xlat", { DSBX
} },
975 { "loopneFH", { Jb
, XX
, loop_jcxz_flag
} },
976 { "loopeFH", { Jb
, XX
, loop_jcxz_flag
} },
977 { "loopFH", { Jb
, XX
, loop_jcxz_flag
} },
978 { "jEcxzH", { Jb
, XX
, loop_jcxz_flag
} },
979 { "inB", { AL
, Ib
} },
980 { "inG", { zAX
, Ib
} },
981 { "outB", { Ib
, AL
} },
982 { "outG", { Ib
, zAX
} },
986 { "Jjmp{T|}", { Ap
} },
988 { "inB", { AL
, indirDX
} },
989 { "inG", { zAX
, indirDX
} },
990 { "outB", { indirDX
, AL
} },
991 { "outG", { indirDX
, zAX
} },
993 { "(bad)", { XX
} }, /* lock prefix */
995 { "(bad)", { XX
} }, /* repne */
996 { "(bad)", { XX
} }, /* repz */
1012 static const struct dis386 dis386_twobyte
[] = {
1016 { "larS", { Gv
, Ew
} },
1017 { "lslS", { Gv
, Ew
} },
1018 { "(bad)", { XX
} },
1019 { "syscall", { XX
} },
1021 { "sysretP", { XX
} },
1024 { "wbinvd", { XX
} },
1025 { "(bad)", { XX
} },
1027 { "(bad)", { XX
} },
1029 { "femms", { XX
} },
1030 { "", { MX
, EM
, OPSUF
} }, /* See OP_3DNowSuffix. */
1035 { "movlpX", { EXq
, XM
, { SIMD_Fixup
, 'h' } } },
1036 { "unpcklpX", { XM
, EXq
} },
1037 { "unpckhpX", { XM
, EXq
} },
1039 { "movhpX", { EXq
, XM
, { SIMD_Fixup
, 'l' } } },
1042 { "(bad)", { XX
} },
1043 { "(bad)", { XX
} },
1044 { "(bad)", { XX
} },
1045 { "(bad)", { XX
} },
1046 { "(bad)", { XX
} },
1047 { "(bad)", { XX
} },
1050 { "movZ", { Rm
, Cm
} },
1051 { "movZ", { Rm
, Dm
} },
1052 { "movZ", { Cm
, Rm
} },
1053 { "movZ", { Dm
, Rm
} },
1054 { "movL", { Rd
, Td
} },
1055 { "(bad)", { XX
} },
1056 { "movL", { Td
, Rd
} },
1057 { "(bad)", { XX
} },
1059 { "movapX", { XM
, EXx
} },
1060 { "movapX", { EXx
, XM
} },
1068 { "wrmsr", { XX
} },
1069 { "rdtsc", { XX
} },
1070 { "rdmsr", { XX
} },
1071 { "rdpmc", { XX
} },
1072 { "sysenter", { XX
} },
1073 { "sysexit", { XX
} },
1074 { "(bad)", { XX
} },
1075 { "(bad)", { XX
} },
1078 { "(bad)", { XX
} },
1080 { "(bad)", { XX
} },
1081 { "(bad)", { XX
} },
1082 { "(bad)", { XX
} },
1083 { "(bad)", { XX
} },
1084 { "(bad)", { XX
} },
1086 { "cmovo", { Gv
, Ev
} },
1087 { "cmovno", { Gv
, Ev
} },
1088 { "cmovb", { Gv
, Ev
} },
1089 { "cmovae", { Gv
, Ev
} },
1090 { "cmove", { Gv
, Ev
} },
1091 { "cmovne", { Gv
, Ev
} },
1092 { "cmovbe", { Gv
, Ev
} },
1093 { "cmova", { Gv
, Ev
} },
1095 { "cmovs", { Gv
, Ev
} },
1096 { "cmovns", { Gv
, Ev
} },
1097 { "cmovp", { Gv
, Ev
} },
1098 { "cmovnp", { Gv
, Ev
} },
1099 { "cmovl", { Gv
, Ev
} },
1100 { "cmovge", { Gv
, Ev
} },
1101 { "cmovle", { Gv
, Ev
} },
1102 { "cmovg", { Gv
, Ev
} },
1104 { "movmskpX", { Gdq
, XS
} },
1108 { "andpX", { XM
, EXx
} },
1109 { "andnpX", { XM
, EXx
} },
1110 { "orpX", { XM
, EXx
} },
1111 { "xorpX", { XM
, EXx
} },
1125 { "packsswb", { MX
, EM
} },
1126 { "pcmpgtb", { MX
, EM
} },
1127 { "pcmpgtw", { MX
, EM
} },
1128 { "pcmpgtd", { MX
, EM
} },
1129 { "packuswb", { MX
, EM
} },
1131 { "punpckhbw", { MX
, EM
} },
1132 { "punpckhwd", { MX
, EM
} },
1133 { "punpckhdq", { MX
, EM
} },
1134 { "packssdw", { MX
, EM
} },
1137 { "movd", { MX
, Edq
} },
1144 { "pcmpeqb", { MX
, EM
} },
1145 { "pcmpeqw", { MX
, EM
} },
1146 { "pcmpeqd", { MX
, EM
} },
1151 { "(bad)", { XX
} },
1152 { "(bad)", { XX
} },
1158 { "joH", { Jv
, XX
, cond_jump_flag
} },
1159 { "jnoH", { Jv
, XX
, cond_jump_flag
} },
1160 { "jbH", { Jv
, XX
, cond_jump_flag
} },
1161 { "jaeH", { Jv
, XX
, cond_jump_flag
} },
1162 { "jeH", { Jv
, XX
, cond_jump_flag
} },
1163 { "jneH", { Jv
, XX
, cond_jump_flag
} },
1164 { "jbeH", { Jv
, XX
, cond_jump_flag
} },
1165 { "jaH", { Jv
, XX
, cond_jump_flag
} },
1167 { "jsH", { Jv
, XX
, cond_jump_flag
} },
1168 { "jnsH", { Jv
, XX
, cond_jump_flag
} },
1169 { "jpH", { Jv
, XX
, cond_jump_flag
} },
1170 { "jnpH", { Jv
, XX
, cond_jump_flag
} },
1171 { "jlH", { Jv
, XX
, cond_jump_flag
} },
1172 { "jgeH", { Jv
, XX
, cond_jump_flag
} },
1173 { "jleH", { Jv
, XX
, cond_jump_flag
} },
1174 { "jgH", { Jv
, XX
, cond_jump_flag
} },
1177 { "setno", { Eb
} },
1179 { "setae", { Eb
} },
1181 { "setne", { Eb
} },
1182 { "setbe", { Eb
} },
1186 { "setns", { Eb
} },
1188 { "setnp", { Eb
} },
1190 { "setge", { Eb
} },
1191 { "setle", { Eb
} },
1194 { "pushT", { fs
} },
1196 { "cpuid", { XX
} },
1197 { "btS", { Ev
, Gv
} },
1198 { "shldS", { Ev
, Gv
, Ib
} },
1199 { "shldS", { Ev
, Gv
, CL
} },
1203 { "pushT", { gs
} },
1206 { "btsS", { Ev
, Gv
} },
1207 { "shrdS", { Ev
, Gv
, Ib
} },
1208 { "shrdS", { Ev
, Gv
, CL
} },
1210 { "imulS", { Gv
, Ev
} },
1212 { "cmpxchgB", { Eb
, Gb
} },
1213 { "cmpxchgS", { Ev
, Gv
} },
1214 { "lssS", { Gv
, Mp
} },
1215 { "btrS", { Ev
, Gv
} },
1216 { "lfsS", { Gv
, Mp
} },
1217 { "lgsS", { Gv
, Mp
} },
1218 { "movz{bR|x|bR|x}", { Gv
, Eb
} },
1219 { "movz{wR|x|wR|x}", { Gv
, Ew
} }, /* yes, there really is movzww ! */
1224 { "btcS", { Ev
, Gv
} },
1225 { "bsfS", { Gv
, Ev
} },
1227 { "movs{bR|x|bR|x}", { Gv
, Eb
} },
1228 { "movs{wR|x|wR|x}", { Gv
, Ew
} }, /* yes, there really is movsww ! */
1230 { "xaddB", { Eb
, Gb
} },
1231 { "xaddS", { Ev
, Gv
} },
1233 { "movntiS", { Ev
, Gv
} },
1234 { "pinsrw", { MX
, Edqw
, Ib
} },
1235 { "pextrw", { Gdq
, MS
, Ib
} },
1236 { "shufpX", { XM
, EXx
, Ib
} },
1239 { "bswap", { RMeAX
} },
1240 { "bswap", { RMeCX
} },
1241 { "bswap", { RMeDX
} },
1242 { "bswap", { RMeBX
} },
1243 { "bswap", { RMeSP
} },
1244 { "bswap", { RMeBP
} },
1245 { "bswap", { RMeSI
} },
1246 { "bswap", { RMeDI
} },
1249 { "psrlw", { MX
, EM
} },
1250 { "psrld", { MX
, EM
} },
1251 { "psrlq", { MX
, EM
} },
1252 { "paddq", { MX
, EM
} },
1253 { "pmullw", { MX
, EM
} },
1255 { "pmovmskb", { Gdq
, MS
} },
1257 { "psubusb", { MX
, EM
} },
1258 { "psubusw", { MX
, EM
} },
1259 { "pminub", { MX
, EM
} },
1260 { "pand", { MX
, EM
} },
1261 { "paddusb", { MX
, EM
} },
1262 { "paddusw", { MX
, EM
} },
1263 { "pmaxub", { MX
, EM
} },
1264 { "pandn", { MX
, EM
} },
1266 { "pavgb", { MX
, EM
} },
1267 { "psraw", { MX
, EM
} },
1268 { "psrad", { MX
, EM
} },
1269 { "pavgw", { MX
, EM
} },
1270 { "pmulhuw", { MX
, EM
} },
1271 { "pmulhw", { MX
, EM
} },
1275 { "psubsb", { MX
, EM
} },
1276 { "psubsw", { MX
, EM
} },
1277 { "pminsw", { MX
, EM
} },
1278 { "por", { MX
, EM
} },
1279 { "paddsb", { MX
, EM
} },
1280 { "paddsw", { MX
, EM
} },
1281 { "pmaxsw", { MX
, EM
} },
1282 { "pxor", { MX
, EM
} },
1285 { "psllw", { MX
, EM
} },
1286 { "pslld", { MX
, EM
} },
1287 { "psllq", { MX
, EM
} },
1288 { "pmuludq", { MX
, EM
} },
1289 { "pmaddwd", { MX
, EM
} },
1290 { "psadbw", { MX
, EM
} },
1293 { "psubb", { MX
, EM
} },
1294 { "psubw", { MX
, EM
} },
1295 { "psubd", { MX
, EM
} },
1296 { "psubq", { MX
, EM
} },
1297 { "paddb", { MX
, EM
} },
1298 { "paddw", { MX
, EM
} },
1299 { "paddd", { MX
, EM
} },
1300 { "(bad)", { XX
} },
1303 static const unsigned char onebyte_has_modrm
[256] = {
1304 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1305 /* ------------------------------- */
1306 /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
1307 /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
1308 /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
1309 /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
1310 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
1311 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
1312 /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
1313 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
1314 /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
1315 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
1316 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
1317 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
1318 /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
1319 /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
1320 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
1321 /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 /* f0 */
1322 /* ------------------------------- */
1323 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1326 static const unsigned char twobyte_has_modrm
[256] = {
1327 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1328 /* ------------------------------- */
1329 /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
1330 /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1, /* 1f */
1331 /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
1332 /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
1333 /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
1334 /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
1335 /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
1336 /* 70 */ 1,1,1,1,1,1,1,0,1,1,0,0,1,1,1,1, /* 7f */
1337 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1338 /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
1339 /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
1340 /* b0 */ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, /* bf */
1341 /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
1342 /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
1343 /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
1344 /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 /* ff */
1345 /* ------------------------------- */
1346 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1349 static const unsigned char twobyte_uses_DATA_prefix
[256] = {
1350 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1351 /* ------------------------------- */
1352 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1353 /* 10 */ 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0, /* 1f */
1354 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1355 /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
1356 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1357 /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
1358 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
1359 /* 70 */ 1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1, /* 7f */
1360 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1361 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1362 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1363 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1364 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1365 /* d0 */ 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1366 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1367 /* f0 */ 1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 /* ff */
1368 /* ------------------------------- */
1369 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1372 static const unsigned char twobyte_uses_REPNZ_prefix
[256] = {
1373 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1374 /* ------------------------------- */
1375 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1376 /* 10 */ 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1377 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1378 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1379 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1380 /* 50 */ 0,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1, /* 5f */
1381 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1382 /* 70 */ 1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0, /* 7f */
1383 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1384 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1385 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1386 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1387 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1388 /* d0 */ 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1389 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1390 /* f0 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1391 /* ------------------------------- */
1392 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1395 static const unsigned char twobyte_uses_REPZ_prefix
[256] = {
1396 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1397 /* ------------------------------- */
1398 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1399 /* 10 */ 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0, /* 1f */
1400 /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1401 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1402 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1403 /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
1404 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, /* 6f */
1405 /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
1406 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1407 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1408 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1409 /* b0 */ 0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, /* bf */
1410 /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1411 /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1412 /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1413 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1414 /* ------------------------------- */
1415 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1418 /* This is used to determine if opcode 0f 38 XX uses DATA prefix. */
1419 static const unsigned char threebyte_0x38_uses_DATA_prefix
[256] = {
1420 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1421 /* ------------------------------- */
1422 /* 00 */ 1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, /* 0f */
1423 /* 10 */ 1,0,0,0,1,1,0,1,0,0,0,0,1,1,1,0, /* 1f */
1424 /* 20 */ 1,1,1,1,1,1,0,0,1,1,1,1,0,0,0,0, /* 2f */
1425 /* 30 */ 1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1, /* 3f */
1426 /* 40 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1427 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1428 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1429 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1430 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1431 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1432 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1433 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1434 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1435 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1436 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1437 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1438 /* ------------------------------- */
1439 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1442 /* This is used to determine if opcode 0f 38 XX uses REPNZ prefix. */
1443 static const unsigned char threebyte_0x38_uses_REPNZ_prefix
[256] = {
1444 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1445 /* ------------------------------- */
1446 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1447 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1448 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1449 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1450 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1451 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1452 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1453 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1454 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1455 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1456 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1457 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1458 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1459 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1460 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1461 /* f0 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1462 /* ------------------------------- */
1463 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1466 /* This is used to determine if opcode 0f 38 XX uses REPZ prefix. */
1467 static const unsigned char threebyte_0x38_uses_REPZ_prefix
[256] = {
1468 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1469 /* ------------------------------- */
1470 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1471 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1472 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1473 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1474 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1475 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1476 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1477 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1478 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1479 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1480 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1481 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1482 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1483 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1484 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1485 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1486 /* ------------------------------- */
1487 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1490 /* This is used to determine if opcode 0f 3a XX uses DATA prefix. */
1491 static const unsigned char threebyte_0x3a_uses_DATA_prefix
[256] = {
1492 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1493 /* ------------------------------- */
1494 /* 00 */ 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1, /* 0f */
1495 /* 10 */ 0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* 1f */
1496 /* 20 */ 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1497 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1498 /* 40 */ 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1499 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1500 /* 60 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1501 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1502 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1503 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1504 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1505 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1506 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1507 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1508 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1509 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1510 /* ------------------------------- */
1511 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1514 /* This is used to determine if opcode 0f 3a XX uses REPNZ prefix. */
1515 static const unsigned char threebyte_0x3a_uses_REPNZ_prefix
[256] = {
1516 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1517 /* ------------------------------- */
1518 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1519 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1520 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1521 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1522 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1523 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1524 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1525 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1526 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1527 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1528 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1529 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1530 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1531 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1532 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1533 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1534 /* ------------------------------- */
1535 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1538 /* This is used to determine if opcode 0f 3a XX uses REPZ prefix. */
1539 static const unsigned char threebyte_0x3a_uses_REPZ_prefix
[256] = {
1540 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1541 /* ------------------------------- */
1542 /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1543 /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1544 /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1545 /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1546 /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1547 /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1548 /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1549 /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1550 /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1551 /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1552 /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1553 /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1554 /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1555 /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1556 /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1557 /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1558 /* ------------------------------- */
1559 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
1562 static char obuf
[100];
1564 static char scratchbuf
[100];
1565 static unsigned char *start_codep
;
1566 static unsigned char *insn_codep
;
1567 static unsigned char *codep
;
1568 static disassemble_info
*the_info
;
1576 static unsigned char need_modrm
;
1578 /* If we are accessing mod/rm/reg without need_modrm set, then the
1579 values are stale. Hitting this abort likely indicates that you
1580 need to update onebyte_has_modrm or twobyte_has_modrm. */
1581 #define MODRM_CHECK if (!need_modrm) abort ()
1583 static const char * const *names64
;
1584 static const char * const *names32
;
1585 static const char * const *names16
;
1586 static const char * const *names8
;
1587 static const char * const *names8rex
;
1588 static const char * const *names_seg
;
1589 static const char * const *index16
;
1591 static const char * const intel_names64
[] = {
1592 "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
1593 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
1595 static const char * const intel_names32
[] = {
1596 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
1597 "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
1599 static const char * const intel_names16
[] = {
1600 "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
1601 "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
1603 static const char * const intel_names8
[] = {
1604 "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
1606 static const char * const intel_names8rex
[] = {
1607 "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
1608 "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
1610 static const char * const intel_names_seg
[] = {
1611 "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
1613 static const char * const intel_index16
[] = {
1614 "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
1617 static const char * const att_names64
[] = {
1618 "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
1619 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
1621 static const char * const att_names32
[] = {
1622 "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
1623 "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
1625 static const char * const att_names16
[] = {
1626 "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
1627 "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
1629 static const char * const att_names8
[] = {
1630 "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
1632 static const char * const att_names8rex
[] = {
1633 "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
1634 "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
1636 static const char * const att_names_seg
[] = {
1637 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
1639 static const char * const att_index16
[] = {
1640 "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
1643 static const struct dis386 grps
[][8] = {
1646 { "popU", { stackEv
} },
1647 { "(bad)", { XX
} },
1648 { "(bad)", { XX
} },
1649 { "(bad)", { XX
} },
1650 { "(bad)", { XX
} },
1651 { "(bad)", { XX
} },
1652 { "(bad)", { XX
} },
1653 { "(bad)", { XX
} },
1657 { "addA", { Eb
, Ib
} },
1658 { "orA", { Eb
, Ib
} },
1659 { "adcA", { Eb
, Ib
} },
1660 { "sbbA", { Eb
, Ib
} },
1661 { "andA", { Eb
, Ib
} },
1662 { "subA", { Eb
, Ib
} },
1663 { "xorA", { Eb
, Ib
} },
1664 { "cmpA", { Eb
, Ib
} },
1668 { "addQ", { Ev
, Iv
} },
1669 { "orQ", { Ev
, Iv
} },
1670 { "adcQ", { Ev
, Iv
} },
1671 { "sbbQ", { Ev
, Iv
} },
1672 { "andQ", { Ev
, Iv
} },
1673 { "subQ", { Ev
, Iv
} },
1674 { "xorQ", { Ev
, Iv
} },
1675 { "cmpQ", { Ev
, Iv
} },
1679 { "addQ", { Ev
, sIb
} },
1680 { "orQ", { Ev
, sIb
} },
1681 { "adcQ", { Ev
, sIb
} },
1682 { "sbbQ", { Ev
, sIb
} },
1683 { "andQ", { Ev
, sIb
} },
1684 { "subQ", { Ev
, sIb
} },
1685 { "xorQ", { Ev
, sIb
} },
1686 { "cmpQ", { Ev
, sIb
} },
1690 { "rolA", { Eb
, Ib
} },
1691 { "rorA", { Eb
, Ib
} },
1692 { "rclA", { Eb
, Ib
} },
1693 { "rcrA", { Eb
, Ib
} },
1694 { "shlA", { Eb
, Ib
} },
1695 { "shrA", { Eb
, Ib
} },
1696 { "(bad)", { XX
} },
1697 { "sarA", { Eb
, Ib
} },
1701 { "rolQ", { Ev
, Ib
} },
1702 { "rorQ", { Ev
, Ib
} },
1703 { "rclQ", { Ev
, Ib
} },
1704 { "rcrQ", { Ev
, Ib
} },
1705 { "shlQ", { Ev
, Ib
} },
1706 { "shrQ", { Ev
, Ib
} },
1707 { "(bad)", { XX
} },
1708 { "sarQ", { Ev
, Ib
} },
1712 { "rolA", { Eb
, I1
} },
1713 { "rorA", { Eb
, I1
} },
1714 { "rclA", { Eb
, I1
} },
1715 { "rcrA", { Eb
, I1
} },
1716 { "shlA", { Eb
, I1
} },
1717 { "shrA", { Eb
, I1
} },
1718 { "(bad)", { XX
} },
1719 { "sarA", { Eb
, I1
} },
1723 { "rolQ", { Ev
, I1
} },
1724 { "rorQ", { Ev
, I1
} },
1725 { "rclQ", { Ev
, I1
} },
1726 { "rcrQ", { Ev
, I1
} },
1727 { "shlQ", { Ev
, I1
} },
1728 { "shrQ", { Ev
, I1
} },
1729 { "(bad)", { XX
} },
1730 { "sarQ", { Ev
, I1
} },
1734 { "rolA", { Eb
, CL
} },
1735 { "rorA", { Eb
, CL
} },
1736 { "rclA", { Eb
, CL
} },
1737 { "rcrA", { Eb
, CL
} },
1738 { "shlA", { Eb
, CL
} },
1739 { "shrA", { Eb
, CL
} },
1740 { "(bad)", { XX
} },
1741 { "sarA", { Eb
, CL
} },
1745 { "rolQ", { Ev
, CL
} },
1746 { "rorQ", { Ev
, CL
} },
1747 { "rclQ", { Ev
, CL
} },
1748 { "rcrQ", { Ev
, CL
} },
1749 { "shlQ", { Ev
, CL
} },
1750 { "shrQ", { Ev
, CL
} },
1751 { "(bad)", { XX
} },
1752 { "sarQ", { Ev
, CL
} },
1756 { "testA", { Eb
, Ib
} },
1757 { "(bad)", { Eb
} },
1760 { "mulA", { Eb
} }, /* Don't print the implicit %al register, */
1761 { "imulA", { Eb
} }, /* to distinguish these opcodes from other */
1762 { "divA", { Eb
} }, /* mul/imul opcodes. Do the same for div */
1763 { "idivA", { Eb
} }, /* and idiv for consistency. */
1767 { "testQ", { Ev
, Iv
} },
1768 { "(bad)", { XX
} },
1771 { "mulQ", { Ev
} }, /* Don't print the implicit register. */
1772 { "imulQ", { Ev
} },
1774 { "idivQ", { Ev
} },
1780 { "(bad)", { XX
} },
1781 { "(bad)", { XX
} },
1782 { "(bad)", { XX
} },
1783 { "(bad)", { XX
} },
1784 { "(bad)", { XX
} },
1785 { "(bad)", { XX
} },
1791 { "callT", { indirEv
} },
1792 { "JcallT", { indirEp
} },
1793 { "jmpT", { indirEv
} },
1794 { "JjmpT", { indirEp
} },
1795 { "pushU", { stackEv
} },
1796 { "(bad)", { XX
} },
1800 { "sldtD", { Sv
} },
1806 { "(bad)", { XX
} },
1807 { "(bad)", { XX
} },
1811 { "sgdt{Q|IQ||}", { { VMX_Fixup
, 0 } } },
1812 { "sidt{Q|IQ||}", { { PNI_Fixup
, 0 } } },
1813 { "lgdt{Q|Q||}", { M
} },
1814 { "lidt{Q|Q||}", { { SVME_Fixup
, 0 } } },
1815 { "smswD", { Sv
} },
1816 { "(bad)", { XX
} },
1818 { "invlpg", { { INVLPG_Fixup
, w_mode
} } },
1822 { "(bad)", { XX
} },
1823 { "(bad)", { XX
} },
1824 { "(bad)", { XX
} },
1825 { "(bad)", { XX
} },
1826 { "btQ", { Ev
, Ib
} },
1827 { "btsQ", { Ev
, Ib
} },
1828 { "btrQ", { Ev
, Ib
} },
1829 { "btcQ", { Ev
, Ib
} },
1833 { "(bad)", { XX
} },
1834 { "cmpxchg8b", { { CMPXCHG8B_Fixup
, q_mode
} } },
1835 { "(bad)", { XX
} },
1836 { "(bad)", { XX
} },
1837 { "(bad)", { XX
} },
1838 { "(bad)", { XX
} },
1839 { "", { VM
} }, /* See OP_VMX. */
1840 { "vmptrst", { Mq
} },
1844 { "movA", { Eb
, Ib
} },
1845 { "(bad)", { XX
} },
1846 { "(bad)", { XX
} },
1847 { "(bad)", { XX
} },
1848 { "(bad)", { XX
} },
1849 { "(bad)", { XX
} },
1850 { "(bad)", { XX
} },
1851 { "(bad)", { XX
} },
1855 { "movQ", { Ev
, Iv
} },
1856 { "(bad)", { XX
} },
1857 { "(bad)", { XX
} },
1858 { "(bad)", { XX
} },
1859 { "(bad)", { XX
} },
1860 { "(bad)", { XX
} },
1861 { "(bad)", { XX
} },
1862 { "(bad)", { XX
} },
1866 { "(bad)", { XX
} },
1867 { "(bad)", { XX
} },
1868 { "psrlw", { MS
, Ib
} },
1869 { "(bad)", { XX
} },
1870 { "psraw", { MS
, Ib
} },
1871 { "(bad)", { XX
} },
1872 { "psllw", { MS
, Ib
} },
1873 { "(bad)", { XX
} },
1877 { "(bad)", { XX
} },
1878 { "(bad)", { XX
} },
1879 { "psrld", { MS
, Ib
} },
1880 { "(bad)", { XX
} },
1881 { "psrad", { MS
, Ib
} },
1882 { "(bad)", { XX
} },
1883 { "pslld", { MS
, Ib
} },
1884 { "(bad)", { XX
} },
1888 { "(bad)", { XX
} },
1889 { "(bad)", { XX
} },
1890 { "psrlq", { MS
, Ib
} },
1891 { "psrldq", { MS
, Ib
} },
1892 { "(bad)", { XX
} },
1893 { "(bad)", { XX
} },
1894 { "psllq", { MS
, Ib
} },
1895 { "pslldq", { MS
, Ib
} },
1899 { "fxsave", { Ev
} },
1900 { "fxrstor", { Ev
} },
1901 { "ldmxcsr", { Ev
} },
1902 { "stmxcsr", { Ev
} },
1903 { "(bad)", { XX
} },
1904 { "lfence", { { OP_0fae
, 0 } } },
1905 { "mfence", { { OP_0fae
, 0 } } },
1906 { "clflush", { { OP_0fae
, 0 } } },
1910 { "prefetchnta", { Ev
} },
1911 { "prefetcht0", { Ev
} },
1912 { "prefetcht1", { Ev
} },
1913 { "prefetcht2", { Ev
} },
1914 { "(bad)", { XX
} },
1915 { "(bad)", { XX
} },
1916 { "(bad)", { XX
} },
1917 { "(bad)", { XX
} },
1921 { "prefetch", { Eb
} },
1922 { "prefetchw", { Eb
} },
1923 { "(bad)", { XX
} },
1924 { "(bad)", { XX
} },
1925 { "(bad)", { XX
} },
1926 { "(bad)", { XX
} },
1927 { "(bad)", { XX
} },
1928 { "(bad)", { XX
} },
1932 { "xstore-rng", { { OP_0f07
, 0 } } },
1933 { "xcrypt-ecb", { { OP_0f07
, 0 } } },
1934 { "xcrypt-cbc", { { OP_0f07
, 0 } } },
1935 { "xcrypt-ctr", { { OP_0f07
, 0 } } },
1936 { "xcrypt-cfb", { { OP_0f07
, 0 } } },
1937 { "xcrypt-ofb", { { OP_0f07
, 0 } } },
1938 { "(bad)", { { OP_0f07
, 0 } } },
1939 { "(bad)", { { OP_0f07
, 0 } } },
1943 { "montmul", { { OP_0f07
, 0 } } },
1944 { "xsha1", { { OP_0f07
, 0 } } },
1945 { "xsha256", { { OP_0f07
, 0 } } },
1946 { "(bad)", { { OP_0f07
, 0 } } },
1947 { "(bad)", { { OP_0f07
, 0 } } },
1948 { "(bad)", { { OP_0f07
, 0 } } },
1949 { "(bad)", { { OP_0f07
, 0 } } },
1950 { "(bad)", { { OP_0f07
, 0 } } },
1954 static const struct dis386 prefix_user_table
[][4] = {
1957 { "addps", { XM
, EXx
} },
1958 { "addss", { XM
, EXd
} },
1959 { "addpd", { XM
, EXx
} },
1960 { "addsd", { XM
, EXq
} },
1964 { "", { XM
, EXx
, OPSIMD
} }, /* See OP_SIMD_SUFFIX. */
1965 { "", { XM
, EXx
, OPSIMD
} },
1966 { "", { XM
, EXx
, OPSIMD
} },
1967 { "", { XM
, EXx
, OPSIMD
} },
1971 { "cvtpi2ps", { XM
, EMC
} },
1972 { "cvtsi2ssY", { XM
, Ev
} },
1973 { "cvtpi2pd", { XM
, EMC
} },
1974 { "cvtsi2sdY", { XM
, Ev
} },
1978 { "cvtps2pi", { MXC
, EXx
} },
1979 { "cvtss2siY", { Gv
, EXx
} },
1980 { "cvtpd2pi", { MXC
, EXx
} },
1981 { "cvtsd2siY", { Gv
, EXx
} },
1985 { "cvttps2pi", { MXC
, EXx
} },
1986 { "cvttss2siY", { Gv
, EXx
} },
1987 { "cvttpd2pi", { MXC
, EXx
} },
1988 { "cvttsd2siY", { Gv
, EXx
} },
1992 { "divps", { XM
, EXx
} },
1993 { "divss", { XM
, EXx
} },
1994 { "divpd", { XM
, EXx
} },
1995 { "divsd", { XM
, EXx
} },
1999 { "maxps", { XM
, EXx
} },
2000 { "maxss", { XM
, EXx
} },
2001 { "maxpd", { XM
, EXx
} },
2002 { "maxsd", { XM
, EXx
} },
2006 { "minps", { XM
, EXx
} },
2007 { "minss", { XM
, EXx
} },
2008 { "minpd", { XM
, EXx
} },
2009 { "minsd", { XM
, EXx
} },
2013 { "movups", { XM
, EXx
} },
2014 { "movss", { XM
, EXx
} },
2015 { "movupd", { XM
, EXx
} },
2016 { "movsd", { XM
, EXx
} },
2020 { "movups", { EXx
, XM
} },
2021 { "movss", { EXx
, XM
} },
2022 { "movupd", { EXx
, XM
} },
2023 { "movsd", { EXx
, XM
} },
2027 { "mulps", { XM
, EXx
} },
2028 { "mulss", { XM
, EXx
} },
2029 { "mulpd", { XM
, EXx
} },
2030 { "mulsd", { XM
, EXx
} },
2034 { "rcpps", { XM
, EXx
} },
2035 { "rcpss", { XM
, EXx
} },
2036 { "(bad)", { XM
, EXx
} },
2037 { "(bad)", { XM
, EXx
} },
2041 { "rsqrtps",{ XM
, EXx
} },
2042 { "rsqrtss",{ XM
, EXx
} },
2043 { "(bad)", { XM
, EXx
} },
2044 { "(bad)", { XM
, EXx
} },
2048 { "sqrtps", { XM
, EXx
} },
2049 { "sqrtss", { XM
, EXx
} },
2050 { "sqrtpd", { XM
, EXx
} },
2051 { "sqrtsd", { XM
, EXx
} },
2055 { "subps", { XM
, EXx
} },
2056 { "subss", { XM
, EXx
} },
2057 { "subpd", { XM
, EXx
} },
2058 { "subsd", { XM
, EXx
} },
2062 { "(bad)", { XM
, EXx
} },
2063 { "cvtdq2pd", { XM
, EXq
} },
2064 { "cvttpd2dq", { XM
, EXx
} },
2065 { "cvtpd2dq", { XM
, EXx
} },
2069 { "cvtdq2ps", { XM
, EXx
} },
2070 { "cvttps2dq", { XM
, EXx
} },
2071 { "cvtps2dq", { XM
, EXx
} },
2072 { "(bad)", { XM
, EXx
} },
2076 { "cvtps2pd", { XM
, EXq
} },
2077 { "cvtss2sd", { XM
, EXx
} },
2078 { "cvtpd2ps", { XM
, EXx
} },
2079 { "cvtsd2ss", { XM
, EXx
} },
2083 { "maskmovq", { MX
, MS
} },
2084 { "(bad)", { XM
, EXx
} },
2085 { "maskmovdqu", { XM
, XS
} },
2086 { "(bad)", { XM
, EXx
} },
2090 { "movq", { MX
, EM
} },
2091 { "movdqu", { XM
, EXx
} },
2092 { "movdqa", { XM
, EXx
} },
2093 { "(bad)", { XM
, EXx
} },
2097 { "movq", { EM
, MX
} },
2098 { "movdqu", { EXx
, XM
} },
2099 { "movdqa", { EXx
, XM
} },
2100 { "(bad)", { EXx
, XM
} },
2104 { "(bad)", { EXx
, XM
} },
2105 { "movq2dq",{ XM
, MS
} },
2106 { "movq", { EXx
, XM
} },
2107 { "movdq2q",{ MX
, XS
} },
2111 { "pshufw", { MX
, EM
, Ib
} },
2112 { "pshufhw",{ XM
, EXx
, Ib
} },
2113 { "pshufd", { XM
, EXx
, Ib
} },
2114 { "pshuflw",{ XM
, EXx
, Ib
} },
2118 { "movd", { Edq
, MX
} },
2119 { "movq", { XM
, EXx
} },
2120 { "movd", { Edq
, XM
} },
2121 { "(bad)", { Ed
, XM
} },
2125 { "(bad)", { MX
, EXx
} },
2126 { "(bad)", { XM
, EXx
} },
2127 { "punpckhqdq", { XM
, EXx
} },
2128 { "(bad)", { XM
, EXx
} },
2132 { "movntq", { EM
, MX
} },
2133 { "(bad)", { EM
, XM
} },
2134 { "movntdq",{ EM
, XM
} },
2135 { "(bad)", { EM
, XM
} },
2139 { "(bad)", { MX
, EXx
} },
2140 { "(bad)", { XM
, EXx
} },
2141 { "punpcklqdq", { XM
, EXx
} },
2142 { "(bad)", { XM
, EXx
} },
2146 { "(bad)", { MX
, EXx
} },
2147 { "(bad)", { XM
, EXx
} },
2148 { "addsubpd", { XM
, EXx
} },
2149 { "addsubps", { XM
, EXx
} },
2153 { "(bad)", { MX
, EXx
} },
2154 { "(bad)", { XM
, EXx
} },
2155 { "haddpd", { XM
, EXx
} },
2156 { "haddps", { XM
, EXx
} },
2160 { "(bad)", { MX
, EXx
} },
2161 { "(bad)", { XM
, EXx
} },
2162 { "hsubpd", { XM
, EXx
} },
2163 { "hsubps", { XM
, EXx
} },
2167 { "movlpX", { XM
, EXq
, { SIMD_Fixup
, 'h' } } }, /* really only 2 operands */
2168 { "movsldup", { XM
, EXx
} },
2169 { "movlpd", { XM
, EXq
} },
2170 { "movddup", { XM
, EXq
} },
2174 { "movhpX", { XM
, EXq
, { SIMD_Fixup
, 'l' } } },
2175 { "movshdup", { XM
, EXx
} },
2176 { "movhpd", { XM
, EXq
} },
2177 { "(bad)", { XM
, EXq
} },
2181 { "(bad)", { XM
, EXx
} },
2182 { "(bad)", { XM
, EXx
} },
2183 { "(bad)", { XM
, EXx
} },
2184 { "lddqu", { XM
, M
} },
2188 {"movntps", { Ev
, XM
} },
2189 {"movntss", { Ev
, XM
} },
2190 {"movntpd", { Ev
, XM
} },
2191 {"movntsd", { Ev
, XM
} },
2196 {"vmread", { Em
, Gm
} },
2198 {"extrq", { XS
, Ib
, Ib
} },
2199 {"insertq", { XM
, XS
, Ib
, Ib
} },
2204 {"vmwrite", { Gm
, Em
} },
2206 {"extrq", { XM
, XS
} },
2207 {"insertq", { XM
, XS
} },
2212 { "bsrS", { Gv
, Ev
} },
2213 { "lzcntS", { Gv
, Ev
} },
2214 { "bsrS", { Gv
, Ev
} },
2215 { "(bad)", { XX
} },
2220 { "(bad)", { XX
} },
2221 { "popcntS", { Gv
, Ev
} },
2222 { "(bad)", { XX
} },
2223 { "(bad)", { XX
} },
2228 { "xchgS", { { NOP_Fixup1
, eAX_reg
}, { NOP_Fixup2
, eAX_reg
} } },
2229 { "pause", { XX
} },
2230 { "xchgS", { { NOP_Fixup1
, eAX_reg
}, { NOP_Fixup2
, eAX_reg
} } },
2231 { "(bad)", { XX
} },
2236 { "(bad)", { XX
} },
2237 { "(bad)", { XX
} },
2238 { "pblendvb", {XM
, EXx
, XMM0
} },
2239 { "(bad)", { XX
} },
2244 { "(bad)", { XX
} },
2245 { "(bad)", { XX
} },
2246 { "blendvps", {XM
, EXx
, XMM0
} },
2247 { "(bad)", { XX
} },
2252 { "(bad)", { XX
} },
2253 { "(bad)", { XX
} },
2254 { "blendvpd", { XM
, EXx
, XMM0
} },
2255 { "(bad)", { XX
} },
2260 { "(bad)", { XX
} },
2261 { "(bad)", { XX
} },
2262 { "ptest", { XM
, EXx
} },
2263 { "(bad)", { XX
} },
2268 { "(bad)", { XX
} },
2269 { "(bad)", { XX
} },
2270 { "pmovsxbw", { XM
, EXx
} },
2271 { "(bad)", { XX
} },
2276 { "(bad)", { XX
} },
2277 { "(bad)", { XX
} },
2278 { "pmovsxbd", { XM
, EXx
} },
2279 { "(bad)", { XX
} },
2284 { "(bad)", { XX
} },
2285 { "(bad)", { XX
} },
2286 { "pmovsxbq", { XM
, EXx
} },
2287 { "(bad)", { XX
} },
2292 { "(bad)", { XX
} },
2293 { "(bad)", { XX
} },
2294 { "pmovsxwd", { XM
, EXx
} },
2295 { "(bad)", { XX
} },
2300 { "(bad)", { XX
} },
2301 { "(bad)", { XX
} },
2302 { "pmovsxwq", { XM
, EXx
} },
2303 { "(bad)", { XX
} },
2308 { "(bad)", { XX
} },
2309 { "(bad)", { XX
} },
2310 { "pmovsxdq", { XM
, EXx
} },
2311 { "(bad)", { XX
} },
2316 { "(bad)", { XX
} },
2317 { "(bad)", { XX
} },
2318 { "pmuldq", { XM
, EXx
} },
2319 { "(bad)", { XX
} },
2324 { "(bad)", { XX
} },
2325 { "(bad)", { XX
} },
2326 { "pcmpeqq", { XM
, EXx
} },
2327 { "(bad)", { XX
} },
2332 { "(bad)", { XX
} },
2333 { "(bad)", { XX
} },
2334 { "movntdqa", { XM
, EM
} },
2335 { "(bad)", { XX
} },
2340 { "(bad)", { XX
} },
2341 { "(bad)", { XX
} },
2342 { "packusdw", { XM
, EXx
} },
2343 { "(bad)", { XX
} },
2348 { "(bad)", { XX
} },
2349 { "(bad)", { XX
} },
2350 { "pmovzxbw", { XM
, EXx
} },
2351 { "(bad)", { XX
} },
2356 { "(bad)", { XX
} },
2357 { "(bad)", { XX
} },
2358 { "pmovzxbd", { XM
, EXx
} },
2359 { "(bad)", { XX
} },
2364 { "(bad)", { XX
} },
2365 { "(bad)", { XX
} },
2366 { "pmovzxbq", { XM
, EXx
} },
2367 { "(bad)", { XX
} },
2372 { "(bad)", { XX
} },
2373 { "(bad)", { XX
} },
2374 { "pmovzxwd", { XM
, EXx
} },
2375 { "(bad)", { XX
} },
2380 { "(bad)", { XX
} },
2381 { "(bad)", { XX
} },
2382 { "pmovzxwq", { XM
, EXx
} },
2383 { "(bad)", { XX
} },
2388 { "(bad)", { XX
} },
2389 { "(bad)", { XX
} },
2390 { "pmovzxdq", { XM
, EXx
} },
2391 { "(bad)", { XX
} },
2396 { "(bad)", { XX
} },
2397 { "(bad)", { XX
} },
2398 { "pminsb", { XM
, EXx
} },
2399 { "(bad)", { XX
} },
2404 { "(bad)", { XX
} },
2405 { "(bad)", { XX
} },
2406 { "pminsd", { XM
, EXx
} },
2407 { "(bad)", { XX
} },
2412 { "(bad)", { XX
} },
2413 { "(bad)", { XX
} },
2414 { "pminuw", { XM
, EXx
} },
2415 { "(bad)", { XX
} },
2420 { "(bad)", { XX
} },
2421 { "(bad)", { XX
} },
2422 { "pminud", { XM
, EXx
} },
2423 { "(bad)", { XX
} },
2428 { "(bad)", { XX
} },
2429 { "(bad)", { XX
} },
2430 { "pmaxsb", { XM
, EXx
} },
2431 { "(bad)", { XX
} },
2436 { "(bad)", { XX
} },
2437 { "(bad)", { XX
} },
2438 { "pmaxsd", { XM
, EXx
} },
2439 { "(bad)", { XX
} },
2444 { "(bad)", { XX
} },
2445 { "(bad)", { XX
} },
2446 { "pmaxuw", { XM
, EXx
} },
2447 { "(bad)", { XX
} },
2452 { "(bad)", { XX
} },
2453 { "(bad)", { XX
} },
2454 { "pmaxud", { XM
, EXx
} },
2455 { "(bad)", { XX
} },
2460 { "(bad)", { XX
} },
2461 { "(bad)", { XX
} },
2462 { "pmulld", { XM
, EXx
} },
2463 { "(bad)", { XX
} },
2468 { "(bad)", { XX
} },
2469 { "(bad)", { XX
} },
2470 { "phminposuw", { XM
, EXx
} },
2471 { "(bad)", { XX
} },
2476 { "(bad)", { XX
} },
2477 { "(bad)", { XX
} },
2478 { "roundps", { XM
, EXx
, Ib
} },
2479 { "(bad)", { XX
} },
2484 { "(bad)", { XX
} },
2485 { "(bad)", { XX
} },
2486 { "roundpd", { XM
, EXx
, Ib
} },
2487 { "(bad)", { XX
} },
2492 { "(bad)", { XX
} },
2493 { "(bad)", { XX
} },
2494 { "roundss", { XM
, EXx
, Ib
} },
2495 { "(bad)", { XX
} },
2500 { "(bad)", { XX
} },
2501 { "(bad)", { XX
} },
2502 { "roundsd", { XM
, EXx
, Ib
} },
2503 { "(bad)", { XX
} },
2508 { "(bad)", { XX
} },
2509 { "(bad)", { XX
} },
2510 { "blendps", { XM
, EXx
, Ib
} },
2511 { "(bad)", { XX
} },
2516 { "(bad)", { XX
} },
2517 { "(bad)", { XX
} },
2518 { "blendpd", { XM
, EXx
, Ib
} },
2519 { "(bad)", { XX
} },
2524 { "(bad)", { XX
} },
2525 { "(bad)", { XX
} },
2526 { "pblendw", { XM
, EXx
, Ib
} },
2527 { "(bad)", { XX
} },
2532 { "(bad)", { XX
} },
2533 { "(bad)", { XX
} },
2534 { "pextrb", { Edqb
, XM
, Ib
} },
2535 { "(bad)", { XX
} },
2540 { "(bad)", { XX
} },
2541 { "(bad)", { XX
} },
2542 { "pextrw", { Edqw
, XM
, Ib
} },
2543 { "(bad)", { XX
} },
2548 { "(bad)", { XX
} },
2549 { "(bad)", { XX
} },
2550 { "pextrK", { Edq
, XM
, Ib
} },
2551 { "(bad)", { XX
} },
2556 { "(bad)", { XX
} },
2557 { "(bad)", { XX
} },
2558 { "extractps", { Edqd
, XM
, Ib
} },
2559 { "(bad)", { XX
} },
2564 { "(bad)", { XX
} },
2565 { "(bad)", { XX
} },
2566 { "pinsrb", { XM
, Edqb
, Ib
} },
2567 { "(bad)", { XX
} },
2572 { "(bad)", { XX
} },
2573 { "(bad)", { XX
} },
2574 { "insertps", { XM
, EXx
, Ib
} },
2575 { "(bad)", { XX
} },
2580 { "(bad)", { XX
} },
2581 { "(bad)", { XX
} },
2582 { "pinsrK", { XM
, Edq
, Ib
} },
2583 { "(bad)", { XX
} },
2588 { "(bad)", { XX
} },
2589 { "(bad)", { XX
} },
2590 { "dpps", { XM
, EXx
, Ib
} },
2591 { "(bad)", { XX
} },
2596 { "(bad)", { XX
} },
2597 { "(bad)", { XX
} },
2598 { "dppd", { XM
, EXx
, Ib
} },
2599 { "(bad)", { XX
} },
2604 { "(bad)", { XX
} },
2605 { "(bad)", { XX
} },
2606 { "mpsadbw", { XM
, EXx
, Ib
} },
2607 { "(bad)", { XX
} },
2612 { "(bad)", { XX
} },
2613 { "(bad)", { XX
} },
2614 { "pcmpgtq", { XM
, EXx
} },
2615 { "(bad)", { XX
} },
2620 { "(bad)", { XX
} },
2621 { "(bad)", { XX
} },
2622 { "(bad)", { XX
} },
2623 { "crc32", { Gdq
, { CRC32_Fixup
, b_mode
} } },
2628 { "(bad)", { XX
} },
2629 { "(bad)", { XX
} },
2630 { "(bad)", { XX
} },
2631 { "crc32", { Gdq
, { CRC32_Fixup
, v_mode
} } },
2636 { "(bad)", { XX
} },
2637 { "(bad)", { XX
} },
2638 { "pcmpestrm", { XM
, EXx
, Ib
} },
2639 { "(bad)", { XX
} },
2644 { "(bad)", { XX
} },
2645 { "(bad)", { XX
} },
2646 { "pcmpestri", { XM
, EXx
, Ib
} },
2647 { "(bad)", { XX
} },
2652 { "(bad)", { XX
} },
2653 { "(bad)", { XX
} },
2654 { "pcmpistrm", { XM
, EXx
, Ib
} },
2655 { "(bad)", { XX
} },
2660 { "(bad)", { XX
} },
2661 { "(bad)", { XX
} },
2662 { "pcmpistri", { XM
, EXx
, Ib
} },
2663 { "(bad)", { XX
} },
2668 { "ucomiss",{ XM
, EXd
} },
2669 { "(bad)", { XX
} },
2670 { "ucomisd",{ XM
, EXq
} },
2671 { "(bad)", { XX
} },
2676 { "comiss", { XM
, EXd
} },
2677 { "(bad)", { XX
} },
2678 { "comisd", { XM
, EXq
} },
2679 { "(bad)", { XX
} },
2684 { "punpcklbw",{ MX
, EMd
} },
2685 { "(bad)", { XX
} },
2686 { "punpcklbw",{ MX
, EMq
} },
2687 { "(bad)", { XX
} },
2692 { "punpcklwd",{ MX
, EMd
} },
2693 { "(bad)", { XX
} },
2694 { "punpcklwd",{ MX
, EMq
} },
2695 { "(bad)", { XX
} },
2700 { "punpckldq",{ MX
, EMd
} },
2701 { "(bad)", { XX
} },
2702 { "punpckldq",{ MX
, EMq
} },
2703 { "(bad)", { XX
} },
2707 static const struct dis386 x86_64_table
[][2] = {
2709 { "pusha{P|}", { XX
} },
2710 { "(bad)", { XX
} },
2713 { "popa{P|}", { XX
} },
2714 { "(bad)", { XX
} },
2717 { "bound{S|}", { Gv
, Ma
} },
2718 { "(bad)", { XX
} },
2721 { "arpl", { Ew
, Gw
} },
2722 { "movs{||lq|xd}", { Gv
, Ed
} },
2726 static const struct dis386 three_byte_table
[][256] = {
2730 { "pshufb", { MX
, EM
} },
2731 { "phaddw", { MX
, EM
} },
2732 { "phaddd", { MX
, EM
} },
2733 { "phaddsw", { MX
, EM
} },
2734 { "pmaddubsw", { MX
, EM
} },
2735 { "phsubw", { MX
, EM
} },
2736 { "phsubd", { MX
, EM
} },
2737 { "phsubsw", { MX
, EM
} },
2739 { "psignb", { MX
, EM
} },
2740 { "psignw", { MX
, EM
} },
2741 { "psignd", { MX
, EM
} },
2742 { "pmulhrsw", { MX
, EM
} },
2743 { "(bad)", { XX
} },
2744 { "(bad)", { XX
} },
2745 { "(bad)", { XX
} },
2746 { "(bad)", { XX
} },
2749 { "(bad)", { XX
} },
2750 { "(bad)", { XX
} },
2751 { "(bad)", { XX
} },
2754 { "(bad)", { XX
} },
2757 { "(bad)", { XX
} },
2758 { "(bad)", { XX
} },
2759 { "(bad)", { XX
} },
2760 { "(bad)", { XX
} },
2761 { "pabsb", { MX
, EM
} },
2762 { "pabsw", { MX
, EM
} },
2763 { "pabsd", { MX
, EM
} },
2764 { "(bad)", { XX
} },
2772 { "(bad)", { XX
} },
2773 { "(bad)", { XX
} },
2779 { "(bad)", { XX
} },
2780 { "(bad)", { XX
} },
2781 { "(bad)", { XX
} },
2782 { "(bad)", { XX
} },
2790 { "(bad)", { XX
} },
2804 { "(bad)", { XX
} },
2805 { "(bad)", { XX
} },
2806 { "(bad)", { XX
} },
2807 { "(bad)", { XX
} },
2808 { "(bad)", { XX
} },
2809 { "(bad)", { XX
} },
2811 { "(bad)", { XX
} },
2812 { "(bad)", { XX
} },
2813 { "(bad)", { XX
} },
2814 { "(bad)", { XX
} },
2815 { "(bad)", { XX
} },
2816 { "(bad)", { XX
} },
2817 { "(bad)", { XX
} },
2818 { "(bad)", { XX
} },
2820 { "(bad)", { XX
} },
2821 { "(bad)", { XX
} },
2822 { "(bad)", { XX
} },
2823 { "(bad)", { XX
} },
2824 { "(bad)", { XX
} },
2825 { "(bad)", { XX
} },
2826 { "(bad)", { XX
} },
2827 { "(bad)", { XX
} },
2829 { "(bad)", { XX
} },
2830 { "(bad)", { XX
} },
2831 { "(bad)", { XX
} },
2832 { "(bad)", { XX
} },
2833 { "(bad)", { XX
} },
2834 { "(bad)", { XX
} },
2835 { "(bad)", { XX
} },
2836 { "(bad)", { XX
} },
2838 { "(bad)", { XX
} },
2839 { "(bad)", { XX
} },
2840 { "(bad)", { XX
} },
2841 { "(bad)", { XX
} },
2842 { "(bad)", { XX
} },
2843 { "(bad)", { XX
} },
2844 { "(bad)", { XX
} },
2845 { "(bad)", { XX
} },
2847 { "(bad)", { XX
} },
2848 { "(bad)", { XX
} },
2849 { "(bad)", { XX
} },
2850 { "(bad)", { XX
} },
2851 { "(bad)", { XX
} },
2852 { "(bad)", { XX
} },
2853 { "(bad)", { XX
} },
2854 { "(bad)", { XX
} },
2856 { "(bad)", { XX
} },
2857 { "(bad)", { XX
} },
2858 { "(bad)", { XX
} },
2859 { "(bad)", { XX
} },
2860 { "(bad)", { XX
} },
2861 { "(bad)", { XX
} },
2862 { "(bad)", { XX
} },
2863 { "(bad)", { XX
} },
2865 { "(bad)", { XX
} },
2866 { "(bad)", { XX
} },
2867 { "(bad)", { XX
} },
2868 { "(bad)", { XX
} },
2869 { "(bad)", { XX
} },
2870 { "(bad)", { XX
} },
2871 { "(bad)", { XX
} },
2872 { "(bad)", { XX
} },
2874 { "(bad)", { XX
} },
2875 { "(bad)", { XX
} },
2876 { "(bad)", { XX
} },
2877 { "(bad)", { XX
} },
2878 { "(bad)", { XX
} },
2879 { "(bad)", { XX
} },
2880 { "(bad)", { XX
} },
2881 { "(bad)", { XX
} },
2883 { "(bad)", { XX
} },
2884 { "(bad)", { XX
} },
2885 { "(bad)", { XX
} },
2886 { "(bad)", { XX
} },
2887 { "(bad)", { XX
} },
2888 { "(bad)", { XX
} },
2889 { "(bad)", { XX
} },
2890 { "(bad)", { XX
} },
2892 { "(bad)", { XX
} },
2893 { "(bad)", { XX
} },
2894 { "(bad)", { XX
} },
2895 { "(bad)", { XX
} },
2896 { "(bad)", { XX
} },
2897 { "(bad)", { XX
} },
2898 { "(bad)", { XX
} },
2899 { "(bad)", { XX
} },
2901 { "(bad)", { XX
} },
2902 { "(bad)", { XX
} },
2903 { "(bad)", { XX
} },
2904 { "(bad)", { XX
} },
2905 { "(bad)", { XX
} },
2906 { "(bad)", { XX
} },
2907 { "(bad)", { XX
} },
2908 { "(bad)", { XX
} },
2910 { "(bad)", { XX
} },
2911 { "(bad)", { XX
} },
2912 { "(bad)", { XX
} },
2913 { "(bad)", { XX
} },
2914 { "(bad)", { XX
} },
2915 { "(bad)", { XX
} },
2916 { "(bad)", { XX
} },
2917 { "(bad)", { XX
} },
2919 { "(bad)", { XX
} },
2920 { "(bad)", { XX
} },
2921 { "(bad)", { XX
} },
2922 { "(bad)", { XX
} },
2923 { "(bad)", { XX
} },
2924 { "(bad)", { XX
} },
2925 { "(bad)", { XX
} },
2926 { "(bad)", { XX
} },
2928 { "(bad)", { XX
} },
2929 { "(bad)", { XX
} },
2930 { "(bad)", { XX
} },
2931 { "(bad)", { XX
} },
2932 { "(bad)", { XX
} },
2933 { "(bad)", { XX
} },
2934 { "(bad)", { XX
} },
2935 { "(bad)", { XX
} },
2937 { "(bad)", { XX
} },
2938 { "(bad)", { XX
} },
2939 { "(bad)", { XX
} },
2940 { "(bad)", { XX
} },
2941 { "(bad)", { XX
} },
2942 { "(bad)", { XX
} },
2943 { "(bad)", { XX
} },
2944 { "(bad)", { XX
} },
2946 { "(bad)", { XX
} },
2947 { "(bad)", { XX
} },
2948 { "(bad)", { XX
} },
2949 { "(bad)", { XX
} },
2950 { "(bad)", { XX
} },
2951 { "(bad)", { XX
} },
2952 { "(bad)", { XX
} },
2953 { "(bad)", { XX
} },
2955 { "(bad)", { XX
} },
2956 { "(bad)", { XX
} },
2957 { "(bad)", { XX
} },
2958 { "(bad)", { XX
} },
2959 { "(bad)", { XX
} },
2960 { "(bad)", { XX
} },
2961 { "(bad)", { XX
} },
2962 { "(bad)", { XX
} },
2964 { "(bad)", { XX
} },
2965 { "(bad)", { XX
} },
2966 { "(bad)", { XX
} },
2967 { "(bad)", { XX
} },
2968 { "(bad)", { XX
} },
2969 { "(bad)", { XX
} },
2970 { "(bad)", { XX
} },
2971 { "(bad)", { XX
} },
2973 { "(bad)", { XX
} },
2974 { "(bad)", { XX
} },
2975 { "(bad)", { XX
} },
2976 { "(bad)", { XX
} },
2977 { "(bad)", { XX
} },
2978 { "(bad)", { XX
} },
2979 { "(bad)", { XX
} },
2980 { "(bad)", { XX
} },
2982 { "(bad)", { XX
} },
2983 { "(bad)", { XX
} },
2984 { "(bad)", { XX
} },
2985 { "(bad)", { XX
} },
2986 { "(bad)", { XX
} },
2987 { "(bad)", { XX
} },
2988 { "(bad)", { XX
} },
2989 { "(bad)", { XX
} },
2991 { "(bad)", { XX
} },
2992 { "(bad)", { XX
} },
2993 { "(bad)", { XX
} },
2994 { "(bad)", { XX
} },
2995 { "(bad)", { XX
} },
2996 { "(bad)", { XX
} },
2997 { "(bad)", { XX
} },
2998 { "(bad)", { XX
} },
3002 { "(bad)", { XX
} },
3003 { "(bad)", { XX
} },
3004 { "(bad)", { XX
} },
3005 { "(bad)", { XX
} },
3006 { "(bad)", { XX
} },
3007 { "(bad)", { XX
} },
3009 { "(bad)", { XX
} },
3010 { "(bad)", { XX
} },
3011 { "(bad)", { XX
} },
3012 { "(bad)", { XX
} },
3013 { "(bad)", { XX
} },
3014 { "(bad)", { XX
} },
3015 { "(bad)", { XX
} },
3016 { "(bad)", { XX
} },
3021 { "(bad)", { XX
} },
3022 { "(bad)", { XX
} },
3023 { "(bad)", { XX
} },
3024 { "(bad)", { XX
} },
3025 { "(bad)", { XX
} },
3026 { "(bad)", { XX
} },
3027 { "(bad)", { XX
} },
3028 { "(bad)", { XX
} },
3037 { "palignr", { MX
, EM
, Ib
} },
3039 { "(bad)", { XX
} },
3040 { "(bad)", { XX
} },
3041 { "(bad)", { XX
} },
3042 { "(bad)", { XX
} },
3048 { "(bad)", { XX
} },
3049 { "(bad)", { XX
} },
3050 { "(bad)", { XX
} },
3051 { "(bad)", { XX
} },
3052 { "(bad)", { XX
} },
3053 { "(bad)", { XX
} },
3054 { "(bad)", { XX
} },
3055 { "(bad)", { XX
} },
3060 { "(bad)", { XX
} },
3061 { "(bad)", { XX
} },
3062 { "(bad)", { XX
} },
3063 { "(bad)", { XX
} },
3064 { "(bad)", { XX
} },
3066 { "(bad)", { XX
} },
3067 { "(bad)", { XX
} },
3068 { "(bad)", { XX
} },
3069 { "(bad)", { XX
} },
3070 { "(bad)", { XX
} },
3071 { "(bad)", { XX
} },
3072 { "(bad)", { XX
} },
3073 { "(bad)", { XX
} },
3075 { "(bad)", { XX
} },
3076 { "(bad)", { XX
} },
3077 { "(bad)", { XX
} },
3078 { "(bad)", { XX
} },
3079 { "(bad)", { XX
} },
3080 { "(bad)", { XX
} },
3081 { "(bad)", { XX
} },
3082 { "(bad)", { XX
} },
3084 { "(bad)", { XX
} },
3085 { "(bad)", { XX
} },
3086 { "(bad)", { XX
} },
3087 { "(bad)", { XX
} },
3088 { "(bad)", { XX
} },
3089 { "(bad)", { XX
} },
3090 { "(bad)", { XX
} },
3091 { "(bad)", { XX
} },
3096 { "(bad)", { XX
} },
3097 { "(bad)", { XX
} },
3098 { "(bad)", { XX
} },
3099 { "(bad)", { XX
} },
3100 { "(bad)", { XX
} },
3102 { "(bad)", { XX
} },
3103 { "(bad)", { XX
} },
3104 { "(bad)", { XX
} },
3105 { "(bad)", { XX
} },
3106 { "(bad)", { XX
} },
3107 { "(bad)", { XX
} },
3108 { "(bad)", { XX
} },
3109 { "(bad)", { XX
} },
3111 { "(bad)", { XX
} },
3112 { "(bad)", { XX
} },
3113 { "(bad)", { XX
} },
3114 { "(bad)", { XX
} },
3115 { "(bad)", { XX
} },
3116 { "(bad)", { XX
} },
3117 { "(bad)", { XX
} },
3118 { "(bad)", { XX
} },
3120 { "(bad)", { XX
} },
3121 { "(bad)", { XX
} },
3122 { "(bad)", { XX
} },
3123 { "(bad)", { XX
} },
3124 { "(bad)", { XX
} },
3125 { "(bad)", { XX
} },
3126 { "(bad)", { XX
} },
3127 { "(bad)", { XX
} },
3133 { "(bad)", { XX
} },
3134 { "(bad)", { XX
} },
3135 { "(bad)", { XX
} },
3136 { "(bad)", { XX
} },
3138 { "(bad)", { XX
} },
3139 { "(bad)", { XX
} },
3140 { "(bad)", { XX
} },
3141 { "(bad)", { XX
} },
3142 { "(bad)", { XX
} },
3143 { "(bad)", { XX
} },
3144 { "(bad)", { XX
} },
3145 { "(bad)", { XX
} },
3147 { "(bad)", { XX
} },
3148 { "(bad)", { XX
} },
3149 { "(bad)", { XX
} },
3150 { "(bad)", { XX
} },
3151 { "(bad)", { XX
} },
3152 { "(bad)", { XX
} },
3153 { "(bad)", { XX
} },
3154 { "(bad)", { XX
} },
3156 { "(bad)", { XX
} },
3157 { "(bad)", { XX
} },
3158 { "(bad)", { XX
} },
3159 { "(bad)", { XX
} },
3160 { "(bad)", { XX
} },
3161 { "(bad)", { XX
} },
3162 { "(bad)", { XX
} },
3163 { "(bad)", { XX
} },
3165 { "(bad)", { XX
} },
3166 { "(bad)", { XX
} },
3167 { "(bad)", { XX
} },
3168 { "(bad)", { XX
} },
3169 { "(bad)", { XX
} },
3170 { "(bad)", { XX
} },
3171 { "(bad)", { XX
} },
3172 { "(bad)", { XX
} },
3174 { "(bad)", { XX
} },
3175 { "(bad)", { XX
} },
3176 { "(bad)", { XX
} },
3177 { "(bad)", { XX
} },
3178 { "(bad)", { XX
} },
3179 { "(bad)", { XX
} },
3180 { "(bad)", { XX
} },
3181 { "(bad)", { XX
} },
3183 { "(bad)", { XX
} },
3184 { "(bad)", { XX
} },
3185 { "(bad)", { XX
} },
3186 { "(bad)", { XX
} },
3187 { "(bad)", { XX
} },
3188 { "(bad)", { XX
} },
3189 { "(bad)", { XX
} },
3190 { "(bad)", { XX
} },
3192 { "(bad)", { XX
} },
3193 { "(bad)", { XX
} },
3194 { "(bad)", { XX
} },
3195 { "(bad)", { XX
} },
3196 { "(bad)", { XX
} },
3197 { "(bad)", { XX
} },
3198 { "(bad)", { XX
} },
3199 { "(bad)", { XX
} },
3201 { "(bad)", { XX
} },
3202 { "(bad)", { XX
} },
3203 { "(bad)", { XX
} },
3204 { "(bad)", { XX
} },
3205 { "(bad)", { XX
} },
3206 { "(bad)", { XX
} },
3207 { "(bad)", { XX
} },
3208 { "(bad)", { XX
} },
3210 { "(bad)", { XX
} },
3211 { "(bad)", { XX
} },
3212 { "(bad)", { XX
} },
3213 { "(bad)", { XX
} },
3214 { "(bad)", { XX
} },
3215 { "(bad)", { XX
} },
3216 { "(bad)", { XX
} },
3217 { "(bad)", { XX
} },
3219 { "(bad)", { XX
} },
3220 { "(bad)", { XX
} },
3221 { "(bad)", { XX
} },
3222 { "(bad)", { XX
} },
3223 { "(bad)", { XX
} },
3224 { "(bad)", { XX
} },
3225 { "(bad)", { XX
} },
3226 { "(bad)", { XX
} },
3228 { "(bad)", { XX
} },
3229 { "(bad)", { XX
} },
3230 { "(bad)", { XX
} },
3231 { "(bad)", { XX
} },
3232 { "(bad)", { XX
} },
3233 { "(bad)", { XX
} },
3234 { "(bad)", { XX
} },
3235 { "(bad)", { XX
} },
3237 { "(bad)", { XX
} },
3238 { "(bad)", { XX
} },
3239 { "(bad)", { XX
} },
3240 { "(bad)", { XX
} },
3241 { "(bad)", { XX
} },
3242 { "(bad)", { XX
} },
3243 { "(bad)", { XX
} },
3244 { "(bad)", { XX
} },
3246 { "(bad)", { XX
} },
3247 { "(bad)", { XX
} },
3248 { "(bad)", { XX
} },
3249 { "(bad)", { XX
} },
3250 { "(bad)", { XX
} },
3251 { "(bad)", { XX
} },
3252 { "(bad)", { XX
} },
3253 { "(bad)", { XX
} },
3255 { "(bad)", { XX
} },
3256 { "(bad)", { XX
} },
3257 { "(bad)", { XX
} },
3258 { "(bad)", { XX
} },
3259 { "(bad)", { XX
} },
3260 { "(bad)", { XX
} },
3261 { "(bad)", { XX
} },
3262 { "(bad)", { XX
} },
3264 { "(bad)", { XX
} },
3265 { "(bad)", { XX
} },
3266 { "(bad)", { XX
} },
3267 { "(bad)", { XX
} },
3268 { "(bad)", { XX
} },
3269 { "(bad)", { XX
} },
3270 { "(bad)", { XX
} },
3271 { "(bad)", { XX
} },
3273 { "(bad)", { XX
} },
3274 { "(bad)", { XX
} },
3275 { "(bad)", { XX
} },
3276 { "(bad)", { XX
} },
3277 { "(bad)", { XX
} },
3278 { "(bad)", { XX
} },
3279 { "(bad)", { XX
} },
3280 { "(bad)", { XX
} },
3282 { "(bad)", { XX
} },
3283 { "(bad)", { XX
} },
3284 { "(bad)", { XX
} },
3285 { "(bad)", { XX
} },
3286 { "(bad)", { XX
} },
3287 { "(bad)", { XX
} },
3288 { "(bad)", { XX
} },
3289 { "(bad)", { XX
} },
3291 { "(bad)", { XX
} },
3292 { "(bad)", { XX
} },
3293 { "(bad)", { XX
} },
3294 { "(bad)", { XX
} },
3295 { "(bad)", { XX
} },
3296 { "(bad)", { XX
} },
3297 { "(bad)", { XX
} },
3298 { "(bad)", { XX
} },
3300 { "(bad)", { XX
} },
3301 { "(bad)", { XX
} },
3302 { "(bad)", { XX
} },
3303 { "(bad)", { XX
} },
3304 { "(bad)", { XX
} },
3305 { "(bad)", { XX
} },
3306 { "(bad)", { XX
} },
3307 { "(bad)", { XX
} },
3311 #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
3323 FETCH_DATA (the_info
, codep
+ 1);
3327 /* REX prefixes family. */
3344 if (address_mode
== mode_64bit
)
3350 prefixes
|= PREFIX_REPZ
;
3353 prefixes
|= PREFIX_REPNZ
;
3356 prefixes
|= PREFIX_LOCK
;
3359 prefixes
|= PREFIX_CS
;
3362 prefixes
|= PREFIX_SS
;
3365 prefixes
|= PREFIX_DS
;
3368 prefixes
|= PREFIX_ES
;
3371 prefixes
|= PREFIX_FS
;
3374 prefixes
|= PREFIX_GS
;
3377 prefixes
|= PREFIX_DATA
;
3380 prefixes
|= PREFIX_ADDR
;
3383 /* fwait is really an instruction. If there are prefixes
3384 before the fwait, they belong to the fwait, *not* to the
3385 following instruction. */
3386 if (prefixes
|| rex
)
3388 prefixes
|= PREFIX_FWAIT
;
3392 prefixes
= PREFIX_FWAIT
;
3397 /* Rex is ignored when followed by another prefix. */
3408 /* Return the name of the prefix byte PREF, or NULL if PREF is not a
3412 prefix_name (int pref
, int sizeflag
)
3414 static const char * const rexes
[16] =
3419 "rex.XB", /* 0x43 */
3421 "rex.RB", /* 0x45 */
3422 "rex.RX", /* 0x46 */
3423 "rex.RXB", /* 0x47 */
3425 "rex.WB", /* 0x49 */
3426 "rex.WX", /* 0x4a */
3427 "rex.WXB", /* 0x4b */
3428 "rex.WR", /* 0x4c */
3429 "rex.WRB", /* 0x4d */
3430 "rex.WRX", /* 0x4e */
3431 "rex.WRXB", /* 0x4f */
3436 /* REX prefixes family. */
3453 return rexes
[pref
- 0x40];
3473 return (sizeflag
& DFLAG
) ? "data16" : "data32";
3475 if (address_mode
== mode_64bit
)
3476 return (sizeflag
& AFLAG
) ? "addr32" : "addr64";
3478 return (sizeflag
& AFLAG
) ? "addr16" : "addr32";
3486 static char op_out
[MAX_OPERANDS
][100];
3487 static int op_ad
, op_index
[MAX_OPERANDS
];
3488 static int two_source_ops
;
3489 static bfd_vma op_address
[MAX_OPERANDS
];
3490 static bfd_vma op_riprel
[MAX_OPERANDS
];
3491 static bfd_vma start_pc
;
3494 * On the 386's of 1988, the maximum length of an instruction is 15 bytes.
3495 * (see topic "Redundant prefixes" in the "Differences from 8086"
3496 * section of the "Virtual 8086 Mode" chapter.)
3497 * 'pc' should be the address of this instruction, it will
3498 * be used to print the target address if this is a relative jump or call
3499 * The function returns the length of this instruction in bytes.
3502 static char intel_syntax
;
3503 static char open_char
;
3504 static char close_char
;
3505 static char separator_char
;
3506 static char scale_char
;
3509 print_insn_i386 (bfd_vma pc
, disassemble_info
*info
)
3513 return print_insn (pc
, info
);
3517 print_insn (bfd_vma pc
, disassemble_info
*info
)
3519 const struct dis386
*dp
;
3521 char *op_txt
[MAX_OPERANDS
];
3523 unsigned char uses_DATA_prefix
, uses_LOCK_prefix
;
3524 unsigned char uses_REPNZ_prefix
, uses_REPZ_prefix
;
3527 struct dis_private priv
;
3530 if (info
->mach
== bfd_mach_x86_64_intel_syntax
3531 || info
->mach
== bfd_mach_x86_64
)
3532 address_mode
= mode_64bit
;
3534 address_mode
= mode_32bit
;
3536 if (intel_syntax
== (char) -1)
3537 intel_syntax
= (info
->mach
== bfd_mach_i386_i386_intel_syntax
3538 || info
->mach
== bfd_mach_x86_64_intel_syntax
);
3540 if (info
->mach
== bfd_mach_i386_i386
3541 || info
->mach
== bfd_mach_x86_64
3542 || info
->mach
== bfd_mach_i386_i386_intel_syntax
3543 || info
->mach
== bfd_mach_x86_64_intel_syntax
)
3544 priv
.orig_sizeflag
= AFLAG
| DFLAG
;
3545 else if (info
->mach
== bfd_mach_i386_i8086
)
3546 priv
.orig_sizeflag
= 0;
3550 for (p
= info
->disassembler_options
; p
!= NULL
; )
3552 if (strncmp (p
, "x86-64", 6) == 0)
3554 address_mode
= mode_64bit
;
3555 priv
.orig_sizeflag
= AFLAG
| DFLAG
;
3557 else if (strncmp (p
, "i386", 4) == 0)
3559 address_mode
= mode_32bit
;
3560 priv
.orig_sizeflag
= AFLAG
| DFLAG
;
3562 else if (strncmp (p
, "i8086", 5) == 0)
3564 address_mode
= mode_16bit
;
3565 priv
.orig_sizeflag
= 0;
3567 else if (strncmp (p
, "intel", 5) == 0)
3571 else if (strncmp (p
, "att", 3) == 0)
3575 else if (strncmp (p
, "addr", 4) == 0)
3577 if (address_mode
== mode_64bit
)
3579 if (p
[4] == '3' && p
[5] == '2')
3580 priv
.orig_sizeflag
&= ~AFLAG
;
3581 else if (p
[4] == '6' && p
[5] == '4')
3582 priv
.orig_sizeflag
|= AFLAG
;
3586 if (p
[4] == '1' && p
[5] == '6')
3587 priv
.orig_sizeflag
&= ~AFLAG
;
3588 else if (p
[4] == '3' && p
[5] == '2')
3589 priv
.orig_sizeflag
|= AFLAG
;
3592 else if (strncmp (p
, "data", 4) == 0)
3594 if (p
[4] == '1' && p
[5] == '6')
3595 priv
.orig_sizeflag
&= ~DFLAG
;
3596 else if (p
[4] == '3' && p
[5] == '2')
3597 priv
.orig_sizeflag
|= DFLAG
;
3599 else if (strncmp (p
, "suffix", 6) == 0)
3600 priv
.orig_sizeflag
|= SUFFIX_ALWAYS
;
3602 p
= strchr (p
, ',');
3609 names64
= intel_names64
;
3610 names32
= intel_names32
;
3611 names16
= intel_names16
;
3612 names8
= intel_names8
;
3613 names8rex
= intel_names8rex
;
3614 names_seg
= intel_names_seg
;
3615 index16
= intel_index16
;
3618 separator_char
= '+';
3623 names64
= att_names64
;
3624 names32
= att_names32
;
3625 names16
= att_names16
;
3626 names8
= att_names8
;
3627 names8rex
= att_names8rex
;
3628 names_seg
= att_names_seg
;
3629 index16
= att_index16
;
3632 separator_char
= ',';
3636 /* The output looks better if we put 7 bytes on a line, since that
3637 puts most long word instructions on a single line. */
3638 info
->bytes_per_line
= 7;
3640 info
->private_data
= &priv
;
3641 priv
.max_fetched
= priv
.the_buffer
;
3642 priv
.insn_start
= pc
;
3645 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3653 start_codep
= priv
.the_buffer
;
3654 codep
= priv
.the_buffer
;
3656 if (setjmp (priv
.bailout
) != 0)
3660 /* Getting here means we tried for data but didn't get it. That
3661 means we have an incomplete instruction of some sort. Just
3662 print the first byte as a prefix or a .byte pseudo-op. */
3663 if (codep
> priv
.the_buffer
)
3665 name
= prefix_name (priv
.the_buffer
[0], priv
.orig_sizeflag
);
3667 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3670 /* Just print the first byte as a .byte instruction. */
3671 (*info
->fprintf_func
) (info
->stream
, ".byte 0x%x",
3672 (unsigned int) priv
.the_buffer
[0]);
3685 sizeflag
= priv
.orig_sizeflag
;
3687 FETCH_DATA (info
, codep
+ 1);
3688 two_source_ops
= (*codep
== 0x62) || (*codep
== 0xc8);
3690 if (((prefixes
& PREFIX_FWAIT
)
3691 && ((*codep
< 0xd8) || (*codep
> 0xdf)))
3692 || (rex
&& rex_used
))
3696 /* fwait not followed by floating point instruction, or rex followed
3697 by other prefixes. Print the first prefix. */
3698 name
= prefix_name (priv
.the_buffer
[0], priv
.orig_sizeflag
);
3700 name
= INTERNAL_DISASSEMBLER_ERROR
;
3701 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3708 unsigned char threebyte
;
3709 FETCH_DATA (info
, codep
+ 2);
3710 threebyte
= *++codep
;
3711 dp
= &dis386_twobyte
[threebyte
];
3712 need_modrm
= twobyte_has_modrm
[*codep
];
3713 uses_DATA_prefix
= twobyte_uses_DATA_prefix
[*codep
];
3714 uses_REPNZ_prefix
= twobyte_uses_REPNZ_prefix
[*codep
];
3715 uses_REPZ_prefix
= twobyte_uses_REPZ_prefix
[*codep
];
3716 uses_LOCK_prefix
= (*codep
& ~0x02) == 0x20;
3718 if (dp
->name
== NULL
&& dp
->op
[0].bytemode
== IS_3BYTE_OPCODE
)
3720 FETCH_DATA (info
, codep
+ 2);
3725 uses_DATA_prefix
= threebyte_0x38_uses_DATA_prefix
[op
];
3726 uses_REPNZ_prefix
= threebyte_0x38_uses_REPNZ_prefix
[op
];
3727 uses_REPZ_prefix
= threebyte_0x38_uses_REPZ_prefix
[op
];
3730 uses_DATA_prefix
= threebyte_0x3a_uses_DATA_prefix
[op
];
3731 uses_REPNZ_prefix
= threebyte_0x3a_uses_REPNZ_prefix
[op
];
3732 uses_REPZ_prefix
= threebyte_0x3a_uses_REPZ_prefix
[op
];
3741 dp
= &dis386
[*codep
];
3742 need_modrm
= onebyte_has_modrm
[*codep
];
3743 uses_DATA_prefix
= 0;
3744 uses_REPNZ_prefix
= 0;
3745 /* pause is 0xf3 0x90. */
3746 uses_REPZ_prefix
= *codep
== 0x90;
3747 uses_LOCK_prefix
= 0;
3751 if (!uses_REPZ_prefix
&& (prefixes
& PREFIX_REPZ
))
3754 used_prefixes
|= PREFIX_REPZ
;
3756 if (!uses_REPNZ_prefix
&& (prefixes
& PREFIX_REPNZ
))
3759 used_prefixes
|= PREFIX_REPNZ
;
3762 if (!uses_LOCK_prefix
&& (prefixes
& PREFIX_LOCK
))
3765 used_prefixes
|= PREFIX_LOCK
;
3768 if (prefixes
& PREFIX_ADDR
)
3771 if (dp
->op
[2].bytemode
!= loop_jcxz_mode
|| intel_syntax
)
3773 if ((sizeflag
& AFLAG
) || address_mode
== mode_64bit
)
3774 oappend ("addr32 ");
3776 oappend ("addr16 ");
3777 used_prefixes
|= PREFIX_ADDR
;
3781 if (!uses_DATA_prefix
&& (prefixes
& PREFIX_DATA
))
3784 if (dp
->op
[2].bytemode
== cond_jump_mode
3785 && dp
->op
[0].bytemode
== v_mode
3788 if (sizeflag
& DFLAG
)
3789 oappend ("data32 ");
3791 oappend ("data16 ");
3792 used_prefixes
|= PREFIX_DATA
;
3796 if (dp
->name
== NULL
&& dp
->op
[0].bytemode
== IS_3BYTE_OPCODE
)
3798 dp
= &three_byte_table
[dp
->op
[1].bytemode
][op
];
3799 modrm
.mod
= (*codep
>> 6) & 3;
3800 modrm
.reg
= (*codep
>> 3) & 7;
3801 modrm
.rm
= *codep
& 7;
3803 else if (need_modrm
)
3805 FETCH_DATA (info
, codep
+ 1);
3806 modrm
.mod
= (*codep
>> 6) & 3;
3807 modrm
.reg
= (*codep
>> 3) & 7;
3808 modrm
.rm
= *codep
& 7;
3811 if (dp
->name
== NULL
&& dp
->op
[0].bytemode
== FLOATCODE
)
3818 if (dp
->name
== NULL
)
3820 switch (dp
->op
[0].bytemode
)
3823 dp
= &grps
[dp
->op
[1].bytemode
][modrm
.reg
];
3826 case USE_PREFIX_USER_TABLE
:
3828 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
3829 if (prefixes
& PREFIX_REPZ
)
3833 /* We should check PREFIX_REPNZ and PREFIX_REPZ
3834 before PREFIX_DATA. */
3835 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
3836 if (prefixes
& PREFIX_REPNZ
)
3840 used_prefixes
|= (prefixes
& PREFIX_DATA
);
3841 if (prefixes
& PREFIX_DATA
)
3845 dp
= &prefix_user_table
[dp
->op
[1].bytemode
][index
];
3848 case X86_64_SPECIAL
:
3849 index
= address_mode
== mode_64bit
? 1 : 0;
3850 dp
= &x86_64_table
[dp
->op
[1].bytemode
][index
];
3854 oappend (INTERNAL_DISASSEMBLER_ERROR
);
3859 if (putop (dp
->name
, sizeflag
) == 0)
3861 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3864 op_ad
= MAX_OPERANDS
- 1 - i
;
3866 (*dp
->op
[i
].rtn
) (dp
->op
[i
].bytemode
, sizeflag
);
3871 /* See if any prefixes were not used. If so, print the first one
3872 separately. If we don't do this, we'll wind up printing an
3873 instruction stream which does not precisely correspond to the
3874 bytes we are disassembling. */
3875 if ((prefixes
& ~used_prefixes
) != 0)
3879 name
= prefix_name (priv
.the_buffer
[0], priv
.orig_sizeflag
);
3881 name
= INTERNAL_DISASSEMBLER_ERROR
;
3882 (*info
->fprintf_func
) (info
->stream
, "%s", name
);
3885 if (rex
& ~rex_used
)
3888 name
= prefix_name (rex
| 0x40, priv
.orig_sizeflag
);
3890 name
= INTERNAL_DISASSEMBLER_ERROR
;
3891 (*info
->fprintf_func
) (info
->stream
, "%s ", name
);
3894 obufp
= obuf
+ strlen (obuf
);
3895 for (i
= strlen (obuf
); i
< 6; i
++)
3898 (*info
->fprintf_func
) (info
->stream
, "%s", obuf
);
3900 /* The enter and bound instructions are printed with operands in the same
3901 order as the intel book; everything else is printed in reverse order. */
3902 if (intel_syntax
|| two_source_ops
)
3906 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3907 op_txt
[i
] = op_out
[i
];
3909 for (i
= 0; i
< (MAX_OPERANDS
>> 1); ++i
)
3911 op_ad
= op_index
[i
];
3912 op_index
[i
] = op_index
[MAX_OPERANDS
- 1 - i
];
3913 op_index
[MAX_OPERANDS
- 1 - i
] = op_ad
;
3914 riprel
= op_riprel
[i
];
3915 op_riprel
[i
] = op_riprel
[MAX_OPERANDS
- 1 - i
];
3916 op_riprel
[MAX_OPERANDS
- 1 - i
] = riprel
;
3921 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3922 op_txt
[MAX_OPERANDS
- 1 - i
] = op_out
[i
];
3926 for (i
= 0; i
< MAX_OPERANDS
; ++i
)
3930 (*info
->fprintf_func
) (info
->stream
, ",");
3931 if (op_index
[i
] != -1 && !op_riprel
[i
])
3932 (*info
->print_address_func
) ((bfd_vma
) op_address
[op_index
[i
]], info
);
3934 (*info
->fprintf_func
) (info
->stream
, "%s", op_txt
[i
]);
3938 for (i
= 0; i
< MAX_OPERANDS
; i
++)
3939 if (op_index
[i
] != -1 && op_riprel
[i
])
3941 (*info
->fprintf_func
) (info
->stream
, " # ");
3942 (*info
->print_address_func
) ((bfd_vma
) (start_pc
+ codep
- start_codep
3943 + op_address
[op_index
[i
]]), info
);
3946 return codep
- priv
.the_buffer
;
3949 static const char *float_mem
[] = {
4024 static const unsigned char float_mem_mode
[] = {
4099 #define ST { OP_ST, 0 }
4100 #define STi { OP_STi, 0 }
4102 #define FGRPd9_2 NULL, { { NULL, 0 } }
4103 #define FGRPd9_4 NULL, { { NULL, 1 } }
4104 #define FGRPd9_5 NULL, { { NULL, 2 } }
4105 #define FGRPd9_6 NULL, { { NULL, 3 } }
4106 #define FGRPd9_7 NULL, { { NULL, 4 } }
4107 #define FGRPda_5 NULL, { { NULL, 5 } }
4108 #define FGRPdb_4 NULL, { { NULL, 6 } }
4109 #define FGRPde_3 NULL, { { NULL, 7 } }
4110 #define FGRPdf_4 NULL, { { NULL, 8 } }
4112 static const struct dis386 float_reg
[][8] = {
4115 { "fadd", { ST
, STi
} },
4116 { "fmul", { ST
, STi
} },
4117 { "fcom", { STi
} },
4118 { "fcomp", { STi
} },
4119 { "fsub", { ST
, STi
} },
4120 { "fsubr", { ST
, STi
} },
4121 { "fdiv", { ST
, STi
} },
4122 { "fdivr", { ST
, STi
} },
4127 { "fxch", { STi
} },
4129 { "(bad)", { XX
} },
4137 { "fcmovb", { ST
, STi
} },
4138 { "fcmove", { ST
, STi
} },
4139 { "fcmovbe",{ ST
, STi
} },
4140 { "fcmovu", { ST
, STi
} },
4141 { "(bad)", { XX
} },
4143 { "(bad)", { XX
} },
4144 { "(bad)", { XX
} },
4148 { "fcmovnb",{ ST
, STi
} },
4149 { "fcmovne",{ ST
, STi
} },
4150 { "fcmovnbe",{ ST
, STi
} },
4151 { "fcmovnu",{ ST
, STi
} },
4153 { "fucomi", { ST
, STi
} },
4154 { "fcomi", { ST
, STi
} },
4155 { "(bad)", { XX
} },
4159 { "fadd", { STi
, ST
} },
4160 { "fmul", { STi
, ST
} },
4161 { "(bad)", { XX
} },
4162 { "(bad)", { XX
} },
4164 { "fsub", { STi
, ST
} },
4165 { "fsubr", { STi
, ST
} },
4166 { "fdiv", { STi
, ST
} },
4167 { "fdivr", { STi
, ST
} },
4169 { "fsubr", { STi
, ST
} },
4170 { "fsub", { STi
, ST
} },
4171 { "fdivr", { STi
, ST
} },
4172 { "fdiv", { STi
, ST
} },
4177 { "ffree", { STi
} },
4178 { "(bad)", { XX
} },
4180 { "fstp", { STi
} },
4181 { "fucom", { STi
} },
4182 { "fucomp", { STi
} },
4183 { "(bad)", { XX
} },
4184 { "(bad)", { XX
} },
4188 { "faddp", { STi
, ST
} },
4189 { "fmulp", { STi
, ST
} },
4190 { "(bad)", { XX
} },
4193 { "fsubp", { STi
, ST
} },
4194 { "fsubrp", { STi
, ST
} },
4195 { "fdivp", { STi
, ST
} },
4196 { "fdivrp", { STi
, ST
} },
4198 { "fsubrp", { STi
, ST
} },
4199 { "fsubp", { STi
, ST
} },
4200 { "fdivrp", { STi
, ST
} },
4201 { "fdivp", { STi
, ST
} },
4206 { "ffreep", { STi
} },
4207 { "(bad)", { XX
} },
4208 { "(bad)", { XX
} },
4209 { "(bad)", { XX
} },
4211 { "fucomip", { ST
, STi
} },
4212 { "fcomip", { ST
, STi
} },
4213 { "(bad)", { XX
} },
4217 static const char *fgrps
[][8] = {
4220 "fnop","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4225 "fchs","fabs","(bad)","(bad)","ftst","fxam","(bad)","(bad)",
4230 "fld1","fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","(bad)",
4235 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp","fincstp",
4240 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos",
4245 "(bad)","fucompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4250 "feni(287 only)","fdisi(287 only)","fNclex","fNinit",
4251 "fNsetpm(287 only)","(bad)","(bad)","(bad)",
4256 "(bad)","fcompp","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4261 "fNstsw","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)","(bad)",
4266 dofloat (int sizeflag
)
4268 const struct dis386
*dp
;
4269 unsigned char floatop
;
4271 floatop
= codep
[-1];
4275 int fp_indx
= (floatop
- 0xd8) * 8 + modrm
.reg
;
4277 putop (float_mem
[fp_indx
], sizeflag
);
4280 OP_E (float_mem_mode
[fp_indx
], sizeflag
);
4283 /* Skip mod/rm byte. */
4287 dp
= &float_reg
[floatop
- 0xd8][modrm
.reg
];
4288 if (dp
->name
== NULL
)
4290 putop (fgrps
[dp
->op
[0].bytemode
][modrm
.rm
], sizeflag
);
4292 /* Instruction fnstsw is only one with strange arg. */
4293 if (floatop
== 0xdf && codep
[-1] == 0xe0)
4294 pstrcpy (op_out
[0], sizeof(op_out
[0]), names16
[0]);
4298 putop (dp
->name
, sizeflag
);
4303 (*dp
->op
[0].rtn
) (dp
->op
[0].bytemode
, sizeflag
);
4308 (*dp
->op
[1].rtn
) (dp
->op
[1].bytemode
, sizeflag
);
4313 OP_ST (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
4315 oappend ("%st" + intel_syntax
);
4319 OP_STi (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
4321 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%st(%d)", modrm
.rm
);
4322 oappend (scratchbuf
+ intel_syntax
);
4325 /* Capital letters in template are macros. */
4327 putop (const char *template, int sizeflag
)
4332 for (p
= template; *p
; p
++)
4343 if (address_mode
== mode_64bit
)
4351 /* Alternative not valid. */
4352 pstrcpy (obuf
, sizeof(obuf
), "(bad)");
4356 else if (*p
== '\0')
4377 if (modrm
.mod
!= 3 || (sizeflag
& SUFFIX_ALWAYS
))
4383 if (sizeflag
& SUFFIX_ALWAYS
)
4387 if (intel_syntax
&& !alt
)
4389 if ((prefixes
& PREFIX_DATA
) || (sizeflag
& SUFFIX_ALWAYS
))
4391 if (sizeflag
& DFLAG
)
4392 *obufp
++ = intel_syntax
? 'd' : 'l';
4394 *obufp
++ = intel_syntax
? 'w' : 's';
4395 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4399 if (intel_syntax
|| !(sizeflag
& SUFFIX_ALWAYS
))
4406 else if (sizeflag
& DFLAG
)
4407 *obufp
++ = intel_syntax
? 'd' : 'l';
4410 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4415 case 'E': /* For jcxz/jecxz */
4416 if (address_mode
== mode_64bit
)
4418 if (sizeflag
& AFLAG
)
4424 if (sizeflag
& AFLAG
)
4426 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
4431 if ((prefixes
& PREFIX_ADDR
) || (sizeflag
& SUFFIX_ALWAYS
))
4433 if (sizeflag
& AFLAG
)
4434 *obufp
++ = address_mode
== mode_64bit
? 'q' : 'l';
4436 *obufp
++ = address_mode
== mode_64bit
? 'l' : 'w';
4437 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
4441 if (intel_syntax
|| (obufp
[-1] != 's' && !(sizeflag
& SUFFIX_ALWAYS
)))
4443 if ((rex
& REX_W
) || (sizeflag
& DFLAG
))
4448 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4453 if ((prefixes
& (PREFIX_CS
| PREFIX_DS
)) == PREFIX_CS
4454 || (prefixes
& (PREFIX_CS
| PREFIX_DS
)) == PREFIX_DS
)
4456 used_prefixes
|= prefixes
& (PREFIX_CS
| PREFIX_DS
);
4459 if (prefixes
& PREFIX_DS
)
4480 if (address_mode
== mode_64bit
&& (sizeflag
& SUFFIX_ALWAYS
))
4489 if (sizeflag
& SUFFIX_ALWAYS
)
4493 if ((prefixes
& PREFIX_FWAIT
) == 0)
4496 used_prefixes
|= PREFIX_FWAIT
;
4502 else if (intel_syntax
&& (sizeflag
& DFLAG
))
4507 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4512 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4521 if ((prefixes
& PREFIX_DATA
)
4523 || (sizeflag
& SUFFIX_ALWAYS
))
4530 if (sizeflag
& DFLAG
)
4535 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4541 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4543 if (modrm
.mod
!= 3 || (sizeflag
& SUFFIX_ALWAYS
))
4549 if (intel_syntax
&& !alt
)
4552 if (modrm
.mod
!= 3 || (sizeflag
& SUFFIX_ALWAYS
))
4558 if (sizeflag
& DFLAG
)
4559 *obufp
++ = intel_syntax
? 'd' : 'l';
4563 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4570 else if (sizeflag
& DFLAG
)
4579 if (intel_syntax
&& !p
[1]
4580 && ((rex
& REX_W
) || (sizeflag
& DFLAG
)))
4583 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4588 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4590 if (sizeflag
& SUFFIX_ALWAYS
)
4598 if (sizeflag
& SUFFIX_ALWAYS
)
4604 if (sizeflag
& DFLAG
)
4608 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4613 if (prefixes
& PREFIX_DATA
)
4617 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4628 /* implicit operand size 'l' for i386 or 'q' for x86-64 */
4630 /* operand size flag for cwtl, cbtw */
4639 else if (sizeflag
& DFLAG
)
4644 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4654 oappend (const char *s
)
4657 obufp
+= strlen (s
);
4663 if (prefixes
& PREFIX_CS
)
4665 used_prefixes
|= PREFIX_CS
;
4666 oappend ("%cs:" + intel_syntax
);
4668 if (prefixes
& PREFIX_DS
)
4670 used_prefixes
|= PREFIX_DS
;
4671 oappend ("%ds:" + intel_syntax
);
4673 if (prefixes
& PREFIX_SS
)
4675 used_prefixes
|= PREFIX_SS
;
4676 oappend ("%ss:" + intel_syntax
);
4678 if (prefixes
& PREFIX_ES
)
4680 used_prefixes
|= PREFIX_ES
;
4681 oappend ("%es:" + intel_syntax
);
4683 if (prefixes
& PREFIX_FS
)
4685 used_prefixes
|= PREFIX_FS
;
4686 oappend ("%fs:" + intel_syntax
);
4688 if (prefixes
& PREFIX_GS
)
4690 used_prefixes
|= PREFIX_GS
;
4691 oappend ("%gs:" + intel_syntax
);
4696 OP_indirE (int bytemode
, int sizeflag
)
4700 OP_E (bytemode
, sizeflag
);
4704 print_operand_value (char *buf
, size_t bufsize
, int hex
, bfd_vma disp
)
4706 if (address_mode
== mode_64bit
)
4714 snprintf_vma (tmp
, sizeof(tmp
), disp
);
4715 for (i
= 0; tmp
[i
] == '0' && tmp
[i
+ 1]; i
++);
4716 pstrcpy (buf
+ 2, bufsize
- 2, tmp
+ i
);
4720 bfd_signed_vma v
= disp
;
4727 /* Check for possible overflow on 0x8000000000000000. */
4730 pstrcpy (buf
, bufsize
, "9223372036854775808");
4736 pstrcpy (buf
, bufsize
, "0");
4744 tmp
[28 - i
] = (v
% 10) + '0';
4748 pstrcpy (buf
, bufsize
, tmp
+ 29 - i
);
4754 snprintf (buf
, bufsize
, "0x%x", (unsigned int) disp
);
4756 snprintf (buf
, bufsize
, "%d", (int) disp
);
4760 /* Put DISP in BUF as signed hex number. */
4763 print_displacement (char *buf
, bfd_vma disp
)
4765 bfd_signed_vma val
= disp
;
4774 /* Check for possible overflow. */
4777 switch (address_mode
)
4780 strcpy (buf
+ j
, "0x8000000000000000");
4783 strcpy (buf
+ j
, "0x80000000");
4786 strcpy (buf
+ j
, "0x8000");
4796 snprintf_vma (tmp
, sizeof(tmp
), val
);
4797 for (i
= 0; tmp
[i
] == '0'; i
++)
4801 strcpy (buf
+ j
, tmp
+ i
);
4805 intel_operand_size (int bytemode
, int sizeflag
)
4811 oappend ("BYTE PTR ");
4815 oappend ("WORD PTR ");
4818 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4820 oappend ("QWORD PTR ");
4821 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4829 oappend ("QWORD PTR ");
4830 else if ((sizeflag
& DFLAG
) || bytemode
== dq_mode
)
4831 oappend ("DWORD PTR ");
4833 oappend ("WORD PTR ");
4834 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4837 if ((rex
& REX_W
) || (sizeflag
& DFLAG
))
4839 oappend ("WORD PTR ");
4841 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4845 oappend ("DWORD PTR ");
4848 oappend ("QWORD PTR ");
4851 if (address_mode
== mode_64bit
)
4852 oappend ("QWORD PTR ");
4854 oappend ("DWORD PTR ");
4857 if (sizeflag
& DFLAG
)
4858 oappend ("FWORD PTR ");
4860 oappend ("DWORD PTR ");
4861 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4864 oappend ("TBYTE PTR ");
4867 oappend ("XMMWORD PTR ");
4870 oappend ("OWORD PTR ");
4878 OP_E (int bytemode
, int sizeflag
)
4887 /* Skip mod/rm byte. */
4898 oappend (names8rex
[modrm
.rm
+ add
]);
4900 oappend (names8
[modrm
.rm
+ add
]);
4903 oappend (names16
[modrm
.rm
+ add
]);
4906 oappend (names32
[modrm
.rm
+ add
]);
4909 oappend (names64
[modrm
.rm
+ add
]);
4912 if (address_mode
== mode_64bit
)
4913 oappend (names64
[modrm
.rm
+ add
]);
4915 oappend (names32
[modrm
.rm
+ add
]);
4918 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
4920 oappend (names64
[modrm
.rm
+ add
]);
4921 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4933 oappend (names64
[modrm
.rm
+ add
]);
4934 else if ((sizeflag
& DFLAG
) || bytemode
!= v_mode
)
4935 oappend (names32
[modrm
.rm
+ add
]);
4937 oappend (names16
[modrm
.rm
+ add
]);
4938 used_prefixes
|= (prefixes
& PREFIX_DATA
);
4943 oappend (INTERNAL_DISASSEMBLER_ERROR
);
4951 intel_operand_size (bytemode
, sizeflag
);
4954 if ((sizeflag
& AFLAG
) || address_mode
== mode_64bit
)
4956 /* 32/64 bit address mode */
4971 FETCH_DATA (the_info
, codep
+ 1);
4972 index
= (*codep
>> 3) & 7;
4973 if (address_mode
== mode_64bit
|| index
!= 0x4)
4974 /* When INDEX == 0x4 in 32 bit mode, SCALE is ignored. */
4975 scale
= (*codep
>> 6) & 3;
4987 if ((base
& 7) == 5)
4990 if (address_mode
== mode_64bit
&& !havesib
)
4996 FETCH_DATA (the_info
, codep
+ 1);
4998 if ((disp
& 0x80) != 0)
5006 havedisp
= havebase
|| (havesib
&& (index
!= 4 || scale
!= 0));
5009 if (modrm
.mod
!= 0 || (base
& 7) == 5)
5011 if (havedisp
|| riprel
)
5012 print_displacement (scratchbuf
, disp
);
5014 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, disp
);
5015 oappend (scratchbuf
);
5023 if (havedisp
|| (intel_syntax
&& riprel
))
5025 *obufp
++ = open_char
;
5026 if (intel_syntax
&& riprel
)
5033 oappend (address_mode
== mode_64bit
&& (sizeflag
& AFLAG
)
5034 ? names64
[base
] : names32
[base
]);
5039 if (!intel_syntax
|| havebase
)
5041 *obufp
++ = separator_char
;
5044 oappend (address_mode
== mode_64bit
&& (sizeflag
& AFLAG
)
5045 ? names64
[index
] : names32
[index
]);
5047 if (scale
!= 0 || (!intel_syntax
&& index
!= 4))
5049 *obufp
++ = scale_char
;
5051 snprintf (scratchbuf
, sizeof(scratchbuf
), "%d", 1 << scale
);
5052 oappend (scratchbuf
);
5056 && (disp
|| modrm
.mod
!= 0 || (base
& 7) == 5))
5058 if ((bfd_signed_vma
) disp
>= 0)
5063 else if (modrm
.mod
!= 1)
5067 disp
= - (bfd_signed_vma
) disp
;
5070 print_displacement (scratchbuf
, disp
);
5071 oappend (scratchbuf
);
5074 *obufp
++ = close_char
;
5077 else if (intel_syntax
)
5079 if (modrm
.mod
!= 0 || (base
& 7) == 5)
5081 if (prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5082 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
))
5086 oappend (names_seg
[ds_reg
- es_reg
]);
5089 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, disp
);
5090 oappend (scratchbuf
);
5095 { /* 16 bit address mode */
5102 if ((disp
& 0x8000) != 0)
5107 FETCH_DATA (the_info
, codep
+ 1);
5109 if ((disp
& 0x80) != 0)
5114 if ((disp
& 0x8000) != 0)
5120 if (modrm
.mod
!= 0 || modrm
.rm
== 6)
5122 print_displacement (scratchbuf
, disp
);
5123 oappend (scratchbuf
);
5126 if (modrm
.mod
!= 0 || modrm
.rm
!= 6)
5128 *obufp
++ = open_char
;
5130 oappend (index16
[modrm
.rm
]);
5132 && (disp
|| modrm
.mod
!= 0 || modrm
.rm
== 6))
5134 if ((bfd_signed_vma
) disp
>= 0)
5139 else if (modrm
.mod
!= 1)
5143 disp
= - (bfd_signed_vma
) disp
;
5146 print_displacement (scratchbuf
, disp
);
5147 oappend (scratchbuf
);
5150 *obufp
++ = close_char
;
5153 else if (intel_syntax
)
5155 if (prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5156 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
))
5160 oappend (names_seg
[ds_reg
- es_reg
]);
5163 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1,
5165 oappend (scratchbuf
);
5171 OP_G (int bytemode
, int sizeflag
)
5182 oappend (names8rex
[modrm
.reg
+ add
]);
5184 oappend (names8
[modrm
.reg
+ add
]);
5187 oappend (names16
[modrm
.reg
+ add
]);
5190 oappend (names32
[modrm
.reg
+ add
]);
5193 oappend (names64
[modrm
.reg
+ add
]);
5202 oappend (names64
[modrm
.reg
+ add
]);
5203 else if ((sizeflag
& DFLAG
) || bytemode
!= v_mode
)
5204 oappend (names32
[modrm
.reg
+ add
]);
5206 oappend (names16
[modrm
.reg
+ add
]);
5207 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5210 if (address_mode
== mode_64bit
)
5211 oappend (names64
[modrm
.reg
+ add
]);
5213 oappend (names32
[modrm
.reg
+ add
]);
5216 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5229 FETCH_DATA (the_info
, codep
+ 8);
5230 a
= *codep
++ & 0xff;
5231 a
|= (*codep
++ & 0xff) << 8;
5232 a
|= (*codep
++ & 0xff) << 16;
5233 a
|= (*codep
++ & 0xff) << 24;
5234 b
= *codep
++ & 0xff;
5235 b
|= (*codep
++ & 0xff) << 8;
5236 b
|= (*codep
++ & 0xff) << 16;
5237 b
|= (*codep
++ & 0xff) << 24;
5238 x
= a
+ ((bfd_vma
) b
<< 32);
5246 static bfd_signed_vma
5249 bfd_signed_vma x
= 0;
5251 FETCH_DATA (the_info
, codep
+ 4);
5252 x
= *codep
++ & (bfd_signed_vma
) 0xff;
5253 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
5254 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
5255 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
5259 static bfd_signed_vma
5262 bfd_signed_vma x
= 0;
5264 FETCH_DATA (the_info
, codep
+ 4);
5265 x
= *codep
++ & (bfd_signed_vma
) 0xff;
5266 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 8;
5267 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 16;
5268 x
|= (*codep
++ & (bfd_signed_vma
) 0xff) << 24;
5270 x
= (x
^ ((bfd_signed_vma
) 1 << 31)) - ((bfd_signed_vma
) 1 << 31);
5280 FETCH_DATA (the_info
, codep
+ 2);
5281 x
= *codep
++ & 0xff;
5282 x
|= (*codep
++ & 0xff) << 8;
5287 set_op (bfd_vma op
, int riprel
)
5289 op_index
[op_ad
] = op_ad
;
5290 if (address_mode
== mode_64bit
)
5292 op_address
[op_ad
] = op
;
5293 op_riprel
[op_ad
] = riprel
;
5297 /* Mask to get a 32-bit address. */
5298 op_address
[op_ad
] = op
& 0xffffffff;
5299 op_riprel
[op_ad
] = riprel
& 0xffffffff;
5304 OP_REG (int code
, int sizeflag
)
5314 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
5315 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
5316 s
= names16
[code
- ax_reg
+ add
];
5318 case es_reg
: case ss_reg
: case cs_reg
:
5319 case ds_reg
: case fs_reg
: case gs_reg
:
5320 s
= names_seg
[code
- es_reg
+ add
];
5322 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
5323 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
5326 s
= names8rex
[code
- al_reg
+ add
];
5328 s
= names8
[code
- al_reg
];
5330 case rAX_reg
: case rCX_reg
: case rDX_reg
: case rBX_reg
:
5331 case rSP_reg
: case rBP_reg
: case rSI_reg
: case rDI_reg
:
5332 if (address_mode
== mode_64bit
&& (sizeflag
& DFLAG
))
5334 s
= names64
[code
- rAX_reg
+ add
];
5337 code
+= eAX_reg
- rAX_reg
;
5339 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
5340 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
5343 s
= names64
[code
- eAX_reg
+ add
];
5344 else if (sizeflag
& DFLAG
)
5345 s
= names32
[code
- eAX_reg
+ add
];
5347 s
= names16
[code
- eAX_reg
+ add
];
5348 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5351 s
= INTERNAL_DISASSEMBLER_ERROR
;
5358 OP_IMREG (int code
, int sizeflag
)
5370 case ax_reg
: case cx_reg
: case dx_reg
: case bx_reg
:
5371 case sp_reg
: case bp_reg
: case si_reg
: case di_reg
:
5372 s
= names16
[code
- ax_reg
];
5374 case es_reg
: case ss_reg
: case cs_reg
:
5375 case ds_reg
: case fs_reg
: case gs_reg
:
5376 s
= names_seg
[code
- es_reg
];
5378 case al_reg
: case ah_reg
: case cl_reg
: case ch_reg
:
5379 case dl_reg
: case dh_reg
: case bl_reg
: case bh_reg
:
5382 s
= names8rex
[code
- al_reg
];
5384 s
= names8
[code
- al_reg
];
5386 case eAX_reg
: case eCX_reg
: case eDX_reg
: case eBX_reg
:
5387 case eSP_reg
: case eBP_reg
: case eSI_reg
: case eDI_reg
:
5390 s
= names64
[code
- eAX_reg
];
5391 else if (sizeflag
& DFLAG
)
5392 s
= names32
[code
- eAX_reg
];
5394 s
= names16
[code
- eAX_reg
];
5395 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5398 if ((rex
& REX_W
) || (sizeflag
& DFLAG
))
5403 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5406 s
= INTERNAL_DISASSEMBLER_ERROR
;
5413 OP_I (int bytemode
, int sizeflag
)
5416 bfd_signed_vma mask
= -1;
5421 FETCH_DATA (the_info
, codep
+ 1);
5426 if (address_mode
== mode_64bit
)
5436 else if (sizeflag
& DFLAG
)
5446 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5457 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5462 scratchbuf
[0] = '$';
5463 print_operand_value (scratchbuf
+ 1, sizeof(scratchbuf
) - 1, 1, op
);
5464 oappend (scratchbuf
+ intel_syntax
);
5465 scratchbuf
[0] = '\0';
5469 OP_I64 (int bytemode
, int sizeflag
)
5472 bfd_signed_vma mask
= -1;
5474 if (address_mode
!= mode_64bit
)
5476 OP_I (bytemode
, sizeflag
);
5483 FETCH_DATA (the_info
, codep
+ 1);
5491 else if (sizeflag
& DFLAG
)
5501 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5508 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5513 scratchbuf
[0] = '$';
5514 print_operand_value (scratchbuf
+ 1, sizeof(scratchbuf
) - 1, 1, op
);
5515 oappend (scratchbuf
+ intel_syntax
);
5516 scratchbuf
[0] = '\0';
5520 OP_sI (int bytemode
, int sizeflag
)
5523 bfd_signed_vma mask
= -1;
5528 FETCH_DATA (the_info
, codep
+ 1);
5530 if ((op
& 0x80) != 0)
5538 else if (sizeflag
& DFLAG
)
5547 if ((op
& 0x8000) != 0)
5550 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5555 if ((op
& 0x8000) != 0)
5559 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5563 scratchbuf
[0] = '$';
5564 print_operand_value (scratchbuf
+ 1, sizeof(scratchbuf
) - 1, 1, op
);
5565 oappend (scratchbuf
+ intel_syntax
);
5569 OP_J (int bytemode
, int sizeflag
)
5573 bfd_vma segment
= 0;
5578 FETCH_DATA (the_info
, codep
+ 1);
5580 if ((disp
& 0x80) != 0)
5584 if ((sizeflag
& DFLAG
) || (rex
& REX_W
))
5589 if ((disp
& 0x8000) != 0)
5591 /* In 16bit mode, address is wrapped around at 64k within
5592 the same segment. Otherwise, a data16 prefix on a jump
5593 instruction means that the pc is masked to 16 bits after
5594 the displacement is added! */
5596 if ((prefixes
& PREFIX_DATA
) == 0)
5597 segment
= ((start_pc
+ codep
- start_codep
)
5598 & ~((bfd_vma
) 0xffff));
5600 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5603 oappend (INTERNAL_DISASSEMBLER_ERROR
);
5606 disp
= ((start_pc
+ codep
- start_codep
+ disp
) & mask
) | segment
;
5608 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, disp
);
5609 oappend (scratchbuf
);
5613 OP_SEG (int bytemode
, int sizeflag
)
5615 if (bytemode
== w_mode
)
5616 oappend (names_seg
[modrm
.reg
]);
5618 OP_E (modrm
.mod
== 3 ? bytemode
: w_mode
, sizeflag
);
5622 OP_DIR (int dummy ATTRIBUTE_UNUSED
, int sizeflag
)
5626 if (sizeflag
& DFLAG
)
5636 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5638 snprintf (scratchbuf
, sizeof(scratchbuf
), "0x%x:0x%x", seg
, offset
);
5640 snprintf (scratchbuf
, sizeof(scratchbuf
), "$0x%x,$0x%x", seg
, offset
);
5641 oappend (scratchbuf
);
5645 OP_OFF (int bytemode
, int sizeflag
)
5649 if (intel_syntax
&& (sizeflag
& SUFFIX_ALWAYS
))
5650 intel_operand_size (bytemode
, sizeflag
);
5653 if ((sizeflag
& AFLAG
) || address_mode
== mode_64bit
)
5660 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5661 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
5663 oappend (names_seg
[ds_reg
- es_reg
]);
5667 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, off
);
5668 oappend (scratchbuf
);
5672 OP_OFF64 (int bytemode
, int sizeflag
)
5676 if (address_mode
!= mode_64bit
5677 || (prefixes
& PREFIX_ADDR
))
5679 OP_OFF (bytemode
, sizeflag
);
5683 if (intel_syntax
&& (sizeflag
& SUFFIX_ALWAYS
))
5684 intel_operand_size (bytemode
, sizeflag
);
5691 if (!(prefixes
& (PREFIX_CS
| PREFIX_SS
| PREFIX_DS
5692 | PREFIX_ES
| PREFIX_FS
| PREFIX_GS
)))
5694 oappend (names_seg
[ds_reg
- es_reg
]);
5698 print_operand_value (scratchbuf
, sizeof(scratchbuf
), 1, off
);
5699 oappend (scratchbuf
);
5703 ptr_reg (int code
, int sizeflag
)
5707 *obufp
++ = open_char
;
5708 used_prefixes
|= (prefixes
& PREFIX_ADDR
);
5709 if (address_mode
== mode_64bit
)
5711 if (!(sizeflag
& AFLAG
))
5712 s
= names32
[code
- eAX_reg
];
5714 s
= names64
[code
- eAX_reg
];
5716 else if (sizeflag
& AFLAG
)
5717 s
= names32
[code
- eAX_reg
];
5719 s
= names16
[code
- eAX_reg
];
5721 *obufp
++ = close_char
;
5726 OP_ESreg (int code
, int sizeflag
)
5732 case 0x6d: /* insw/insl */
5733 intel_operand_size (z_mode
, sizeflag
);
5735 case 0xa5: /* movsw/movsl/movsq */
5736 case 0xa7: /* cmpsw/cmpsl/cmpsq */
5737 case 0xab: /* stosw/stosl */
5738 case 0xaf: /* scasw/scasl */
5739 intel_operand_size (v_mode
, sizeflag
);
5742 intel_operand_size (b_mode
, sizeflag
);
5745 oappend ("%es:" + intel_syntax
);
5746 ptr_reg (code
, sizeflag
);
5750 OP_DSreg (int code
, int sizeflag
)
5756 case 0x6f: /* outsw/outsl */
5757 intel_operand_size (z_mode
, sizeflag
);
5759 case 0xa5: /* movsw/movsl/movsq */
5760 case 0xa7: /* cmpsw/cmpsl/cmpsq */
5761 case 0xad: /* lodsw/lodsl/lodsq */
5762 intel_operand_size (v_mode
, sizeflag
);
5765 intel_operand_size (b_mode
, sizeflag
);
5775 prefixes
|= PREFIX_DS
;
5777 ptr_reg (code
, sizeflag
);
5781 OP_C (int dummy ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5789 else if (address_mode
!= mode_64bit
&& (prefixes
& PREFIX_LOCK
))
5791 used_prefixes
|= PREFIX_LOCK
;
5794 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%cr%d", modrm
.reg
+ add
);
5795 oappend (scratchbuf
+ intel_syntax
);
5799 OP_D (int dummy ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5806 snprintf (scratchbuf
, sizeof(scratchbuf
), "db%d", modrm
.reg
+ add
);
5808 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%db%d", modrm
.reg
+ add
);
5809 oappend (scratchbuf
);
5813 OP_T (int dummy ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5815 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%tr%d", modrm
.reg
);
5816 oappend (scratchbuf
+ intel_syntax
);
5820 OP_R (int bytemode
, int sizeflag
)
5823 OP_E (bytemode
, sizeflag
);
5829 OP_MMX (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5831 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5832 if (prefixes
& PREFIX_DATA
)
5838 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.reg
+ add
);
5841 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.reg
);
5842 oappend (scratchbuf
+ intel_syntax
);
5846 OP_XMM (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5852 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.reg
+ add
);
5853 oappend (scratchbuf
+ intel_syntax
);
5857 OP_EM (int bytemode
, int sizeflag
)
5861 if (intel_syntax
&& bytemode
== v_mode
)
5863 bytemode
= (prefixes
& PREFIX_DATA
) ? x_mode
: q_mode
;
5864 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5866 OP_E (bytemode
, sizeflag
);
5870 /* Skip mod/rm byte. */
5873 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5874 if (prefixes
& PREFIX_DATA
)
5881 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.rm
+ add
);
5884 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.rm
);
5885 oappend (scratchbuf
+ intel_syntax
);
5888 /* cvt* are the only instructions in sse2 which have
5889 both SSE and MMX operands and also have 0x66 prefix
5890 in their opcode. 0x66 was originally used to differentiate
5891 between SSE and MMX instruction(operands). So we have to handle the
5892 cvt* separately using OP_EMC and OP_MXC */
5894 OP_EMC (int bytemode
, int sizeflag
)
5898 if (intel_syntax
&& bytemode
== v_mode
)
5900 bytemode
= (prefixes
& PREFIX_DATA
) ? x_mode
: q_mode
;
5901 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5903 OP_E (bytemode
, sizeflag
);
5907 /* Skip mod/rm byte. */
5910 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5911 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.rm
);
5912 oappend (scratchbuf
+ intel_syntax
);
5916 OP_MXC (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
5918 used_prefixes
|= (prefixes
& PREFIX_DATA
);
5919 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%mm%d", modrm
.reg
);
5920 oappend (scratchbuf
+ intel_syntax
);
5924 OP_EX (int bytemode
, int sizeflag
)
5929 OP_E (bytemode
, sizeflag
);
5936 /* Skip mod/rm byte. */
5939 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", modrm
.rm
+ add
);
5940 oappend (scratchbuf
+ intel_syntax
);
5944 OP_MS (int bytemode
, int sizeflag
)
5947 OP_EM (bytemode
, sizeflag
);
5953 OP_XS (int bytemode
, int sizeflag
)
5956 OP_EX (bytemode
, sizeflag
);
5962 OP_M (int bytemode
, int sizeflag
)
5965 /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
5968 OP_E (bytemode
, sizeflag
);
5972 OP_0f07 (int bytemode
, int sizeflag
)
5974 if (modrm
.mod
!= 3 || modrm
.rm
!= 0)
5977 OP_E (bytemode
, sizeflag
);
5981 OP_0fae (int bytemode
, int sizeflag
)
5986 strcpy (obuf
+ strlen (obuf
) - sizeof ("clflush") + 1, "sfence");
5988 if (modrm
.reg
< 5 || modrm
.rm
!= 0)
5990 BadOp (); /* bad sfence, mfence, or lfence */
5994 else if (modrm
.reg
!= 7)
5996 BadOp (); /* bad clflush */
6000 OP_E (bytemode
, sizeflag
);
6003 /* NOP is an alias of "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in
6004 32bit mode and "xchg %rax,%rax" in 64bit mode. */
6007 NOP_Fixup1 (int bytemode
, int sizeflag
)
6009 if ((prefixes
& PREFIX_DATA
) != 0
6012 && address_mode
== mode_64bit
))
6013 OP_REG (bytemode
, sizeflag
);
6015 strcpy (obuf
, "nop");
6019 NOP_Fixup2 (int bytemode
, int sizeflag
)
6021 if ((prefixes
& PREFIX_DATA
) != 0
6024 && address_mode
== mode_64bit
))
6025 OP_IMREG (bytemode
, sizeflag
);
6028 static const char *Suffix3DNow
[] = {
6029 /* 00 */ NULL
, NULL
, NULL
, NULL
,
6030 /* 04 */ NULL
, NULL
, NULL
, NULL
,
6031 /* 08 */ NULL
, NULL
, NULL
, NULL
,
6032 /* 0C */ "pi2fw", "pi2fd", NULL
, NULL
,
6033 /* 10 */ NULL
, NULL
, NULL
, NULL
,
6034 /* 14 */ NULL
, NULL
, NULL
, NULL
,
6035 /* 18 */ NULL
, NULL
, NULL
, NULL
,
6036 /* 1C */ "pf2iw", "pf2id", NULL
, NULL
,
6037 /* 20 */ NULL
, NULL
, NULL
, NULL
,
6038 /* 24 */ NULL
, NULL
, NULL
, NULL
,
6039 /* 28 */ NULL
, NULL
, NULL
, NULL
,
6040 /* 2C */ NULL
, NULL
, NULL
, NULL
,
6041 /* 30 */ NULL
, NULL
, NULL
, NULL
,
6042 /* 34 */ NULL
, NULL
, NULL
, NULL
,
6043 /* 38 */ NULL
, NULL
, NULL
, NULL
,
6044 /* 3C */ NULL
, NULL
, NULL
, NULL
,
6045 /* 40 */ NULL
, NULL
, NULL
, NULL
,
6046 /* 44 */ NULL
, NULL
, NULL
, NULL
,
6047 /* 48 */ NULL
, NULL
, NULL
, NULL
,
6048 /* 4C */ NULL
, NULL
, NULL
, NULL
,
6049 /* 50 */ NULL
, NULL
, NULL
, NULL
,
6050 /* 54 */ NULL
, NULL
, NULL
, NULL
,
6051 /* 58 */ NULL
, NULL
, NULL
, NULL
,
6052 /* 5C */ NULL
, NULL
, NULL
, NULL
,
6053 /* 60 */ NULL
, NULL
, NULL
, NULL
,
6054 /* 64 */ NULL
, NULL
, NULL
, NULL
,
6055 /* 68 */ NULL
, NULL
, NULL
, NULL
,
6056 /* 6C */ NULL
, NULL
, NULL
, NULL
,
6057 /* 70 */ NULL
, NULL
, NULL
, NULL
,
6058 /* 74 */ NULL
, NULL
, NULL
, NULL
,
6059 /* 78 */ NULL
, NULL
, NULL
, NULL
,
6060 /* 7C */ NULL
, NULL
, NULL
, NULL
,
6061 /* 80 */ NULL
, NULL
, NULL
, NULL
,
6062 /* 84 */ NULL
, NULL
, NULL
, NULL
,
6063 /* 88 */ NULL
, NULL
, "pfnacc", NULL
,
6064 /* 8C */ NULL
, NULL
, "pfpnacc", NULL
,
6065 /* 90 */ "pfcmpge", NULL
, NULL
, NULL
,
6066 /* 94 */ "pfmin", NULL
, "pfrcp", "pfrsqrt",
6067 /* 98 */ NULL
, NULL
, "pfsub", NULL
,
6068 /* 9C */ NULL
, NULL
, "pfadd", NULL
,
6069 /* A0 */ "pfcmpgt", NULL
, NULL
, NULL
,
6070 /* A4 */ "pfmax", NULL
, "pfrcpit1", "pfrsqit1",
6071 /* A8 */ NULL
, NULL
, "pfsubr", NULL
,
6072 /* AC */ NULL
, NULL
, "pfacc", NULL
,
6073 /* B0 */ "pfcmpeq", NULL
, NULL
, NULL
,
6074 /* B4 */ "pfmul", NULL
, "pfrcpit2", "pmulhrw",
6075 /* B8 */ NULL
, NULL
, NULL
, "pswapd",
6076 /* BC */ NULL
, NULL
, NULL
, "pavgusb",
6077 /* C0 */ NULL
, NULL
, NULL
, NULL
,
6078 /* C4 */ NULL
, NULL
, NULL
, NULL
,
6079 /* C8 */ NULL
, NULL
, NULL
, NULL
,
6080 /* CC */ NULL
, NULL
, NULL
, NULL
,
6081 /* D0 */ NULL
, NULL
, NULL
, NULL
,
6082 /* D4 */ NULL
, NULL
, NULL
, NULL
,
6083 /* D8 */ NULL
, NULL
, NULL
, NULL
,
6084 /* DC */ NULL
, NULL
, NULL
, NULL
,
6085 /* E0 */ NULL
, NULL
, NULL
, NULL
,
6086 /* E4 */ NULL
, NULL
, NULL
, NULL
,
6087 /* E8 */ NULL
, NULL
, NULL
, NULL
,
6088 /* EC */ NULL
, NULL
, NULL
, NULL
,
6089 /* F0 */ NULL
, NULL
, NULL
, NULL
,
6090 /* F4 */ NULL
, NULL
, NULL
, NULL
,
6091 /* F8 */ NULL
, NULL
, NULL
, NULL
,
6092 /* FC */ NULL
, NULL
, NULL
, NULL
,
6096 OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
6098 const char *mnemonic
;
6100 FETCH_DATA (the_info
, codep
+ 1);
6101 /* AMD 3DNow! instructions are specified by an opcode suffix in the
6102 place where an 8-bit immediate would normally go. ie. the last
6103 byte of the instruction. */
6104 obufp
= obuf
+ strlen (obuf
);
6105 mnemonic
= Suffix3DNow
[*codep
++ & 0xff];
6110 /* Since a variable sized modrm/sib chunk is between the start
6111 of the opcode (0x0f0f) and the opcode suffix, we need to do
6112 all the modrm processing first, and don't know until now that
6113 we have a bad opcode. This necessitates some cleaning up. */
6114 op_out
[0][0] = '\0';
6115 op_out
[1][0] = '\0';
6120 static const char *simd_cmp_op
[] = {
6132 OP_SIMD_Suffix (int bytemode ATTRIBUTE_UNUSED
, int sizeflag ATTRIBUTE_UNUSED
)
6134 unsigned int cmp_type
;
6136 FETCH_DATA (the_info
, codep
+ 1);
6137 obufp
= obuf
+ strlen (obuf
);
6138 cmp_type
= *codep
++ & 0xff;
6141 char suffix1
= 'p', suffix2
= 's';
6142 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
6143 if (prefixes
& PREFIX_REPZ
)
6147 used_prefixes
|= (prefixes
& PREFIX_DATA
);
6148 if (prefixes
& PREFIX_DATA
)
6152 used_prefixes
|= (prefixes
& PREFIX_REPNZ
);
6153 if (prefixes
& PREFIX_REPNZ
)
6154 suffix1
= 's', suffix2
= 'd';
6157 snprintf (scratchbuf
, sizeof(scratchbuf
), "cmp%s%c%c",
6158 simd_cmp_op
[cmp_type
], suffix1
, suffix2
);
6159 used_prefixes
|= (prefixes
& PREFIX_REPZ
);
6160 oappend (scratchbuf
);
6164 /* We have a bad extension byte. Clean up. */
6165 op_out
[0][0] = '\0';
6166 op_out
[1][0] = '\0';
6172 SIMD_Fixup (int extrachar
, int sizeflag ATTRIBUTE_UNUSED
)
6174 /* Change movlps/movhps to movhlps/movlhps for 2 register operand
6175 forms of these instructions. */
6178 char *p
= obuf
+ strlen (obuf
);
6181 *(p
- 1) = *(p
- 2);
6182 *(p
- 2) = *(p
- 3);
6183 *(p
- 3) = extrachar
;
6188 PNI_Fixup (int extrachar ATTRIBUTE_UNUSED
, int sizeflag
)
6190 if (modrm
.mod
== 3 && modrm
.reg
== 1 && modrm
.rm
<= 1)
6192 /* Override "sidt". */
6193 size_t olen
= strlen (obuf
);
6194 char *p
= obuf
+ olen
- 4;
6195 const char * const *names
= (address_mode
== mode_64bit
6196 ? names64
: names32
);
6198 /* We might have a suffix when disassembling with -Msuffix. */
6202 /* Remove "addr16/addr32" if we aren't in Intel mode. */
6204 && (prefixes
& PREFIX_ADDR
)
6207 && strncmp (p
- 7, "addr", 4) == 0
6208 && (strncmp (p
- 3, "16", 2) == 0
6209 || strncmp (p
- 3, "32", 2) == 0))
6214 /* mwait %eax,%ecx */
6215 strcpy (p
, "mwait");
6217 strcpy (op_out
[0], names
[0]);
6221 /* monitor %eax,%ecx,%edx" */
6222 strcpy (p
, "monitor");
6225 const char * const *op1_names
;
6226 if (!(prefixes
& PREFIX_ADDR
))
6227 op1_names
= (address_mode
== mode_16bit
6231 op1_names
= (address_mode
!= mode_32bit
6232 ? names32
: names16
);
6233 used_prefixes
|= PREFIX_ADDR
;
6235 strcpy (op_out
[0], op1_names
[0]);
6236 strcpy (op_out
[2], names
[2]);
6241 strcpy (op_out
[1], names
[1]);
6252 SVME_Fixup (int bytemode
, int sizeflag
)
6284 OP_M (bytemode
, sizeflag
);
6287 /* Override "lidt". */
6288 p
= obuf
+ strlen (obuf
) - 4;
6289 /* We might have a suffix. */
6293 if (!(prefixes
& PREFIX_ADDR
))
6298 used_prefixes
|= PREFIX_ADDR
;
6302 strcpy (op_out
[1], names32
[1]);
6308 *obufp
++ = open_char
;
6309 if (address_mode
== mode_64bit
|| (sizeflag
& AFLAG
))
6313 strcpy (obufp
, alt
);
6314 obufp
+= strlen (alt
);
6315 *obufp
++ = close_char
;
6322 INVLPG_Fixup (int bytemode
, int sizeflag
)
6335 OP_M (bytemode
, sizeflag
);
6338 /* Override "invlpg". */
6339 strcpy (obuf
+ strlen (obuf
) - 6, alt
);
6346 /* Throw away prefixes and 1st. opcode byte. */
6347 codep
= insn_codep
+ 1;
6352 VMX_Fixup (int extrachar ATTRIBUTE_UNUSED
, int sizeflag
)
6359 /* Override "sgdt". */
6360 char *p
= obuf
+ strlen (obuf
) - 4;
6362 /* We might have a suffix when disassembling with -Msuffix. */
6369 strcpy (p
, "vmcall");
6372 strcpy (p
, "vmlaunch");
6375 strcpy (p
, "vmresume");
6378 strcpy (p
, "vmxoff");
6389 OP_VMX (int bytemode
, int sizeflag
)
6391 used_prefixes
|= (prefixes
& (PREFIX_DATA
| PREFIX_REPZ
));
6392 if (prefixes
& PREFIX_DATA
)
6393 strcpy (obuf
, "vmclear");
6394 else if (prefixes
& PREFIX_REPZ
)
6395 strcpy (obuf
, "vmxon");
6397 strcpy (obuf
, "vmptrld");
6398 OP_E (bytemode
, sizeflag
);
6402 REP_Fixup (int bytemode
, int sizeflag
)
6404 /* The 0xf3 prefix should be displayed as "rep" for ins, outs, movs,
6408 if (prefixes
& PREFIX_REPZ
)
6409 switch (*insn_codep
)
6411 case 0x6e: /* outsb */
6412 case 0x6f: /* outsw/outsl */
6413 case 0xa4: /* movsb */
6414 case 0xa5: /* movsw/movsl/movsq */
6420 case 0xaa: /* stosb */
6421 case 0xab: /* stosw/stosl/stosq */
6422 case 0xac: /* lodsb */
6423 case 0xad: /* lodsw/lodsl/lodsq */
6424 if (!intel_syntax
&& (sizeflag
& SUFFIX_ALWAYS
))
6429 case 0x6c: /* insb */
6430 case 0x6d: /* insl/insw */
6446 olen
= strlen (obuf
);
6447 p
= obuf
+ olen
- ilen
- 1 - 4;
6448 /* Handle "repz [addr16|addr32]". */
6449 if ((prefixes
& PREFIX_ADDR
))
6452 memmove (p
+ 3, p
+ 4, olen
- (p
+ 3 - obuf
));
6460 OP_IMREG (bytemode
, sizeflag
);
6463 OP_ESreg (bytemode
, sizeflag
);
6466 OP_DSreg (bytemode
, sizeflag
);
6475 CMPXCHG8B_Fixup (int bytemode
, int sizeflag
)
6480 /* Change cmpxchg8b to cmpxchg16b. */
6481 char *p
= obuf
+ strlen (obuf
) - 2;
6485 OP_M (bytemode
, sizeflag
);
6489 XMM_Fixup (int reg
, int sizeflag ATTRIBUTE_UNUSED
)
6491 snprintf (scratchbuf
, sizeof(scratchbuf
), "%%xmm%d", reg
);
6492 oappend (scratchbuf
+ intel_syntax
);
6496 CRC32_Fixup (int bytemode
, int sizeflag
)
6498 /* Add proper suffix to "crc32". */
6499 char *p
= obuf
+ strlen (obuf
);
6516 else if (sizeflag
& DFLAG
)
6520 used_prefixes
|= (prefixes
& PREFIX_DATA
);
6523 oappend (INTERNAL_DISASSEMBLER_ERROR
);
6532 /* Skip mod/rm byte. */
6537 add
= (rex
& REX_B
) ? 8 : 0;
6538 if (bytemode
== b_mode
)
6542 oappend (names8rex
[modrm
.rm
+ add
]);
6544 oappend (names8
[modrm
.rm
+ add
]);
6550 oappend (names64
[modrm
.rm
+ add
]);
6551 else if ((prefixes
& PREFIX_DATA
))
6552 oappend (names16
[modrm
.rm
+ add
]);
6554 oappend (names32
[modrm
.rm
+ add
]);
6558 OP_E (bytemode
, sizeflag
);