compute checksum for roms bigger than a segment
[qemu-kvm/fedora.git] / i386-dis.c
blobb2af03371bb7f58dbdebf603acecaa67d9862c2b
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)
22 July 1988
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. */
34 #include <stdlib.h>
35 #include "dis-asm.h"
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
79 #endif
80 #ifndef OLDGCC_COMPAT
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
83 reversed. */
84 #define OLDGCC_COMPAT SYSV386_COMPAT
85 #endif
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. */
130 #define REX_W 8
131 /* High extension to reg field of modrm byte. */
132 #define REX_R 4
133 /* High extension to SIB index field. */
134 #define REX_X 2
135 /* High extension to base field of modrm or SIB, or reg field of opcode. */
136 #define REX_B 1
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"
156 #include <setjmp.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);
222 struct dis_private {
223 /* Points to first byte not fetched. */
224 bfd_byte *max_fetched;
225 bfd_byte the_buffer[MAX_MNEM_SIZE];
226 bfd_vma insn_start;
227 int orig_sizeflag;
228 jmp_buf bailout;
231 enum address_mode
233 mode_16bit,
234 mode_32bit,
235 mode_64bit
238 static enum address_mode address_mode;
240 /* Flags for the prefixes for the current instruction. See below. */
241 static int prefixes;
243 /* REX prefix the current instruction. See below. */
244 static int rex;
245 /* Bits of REX we've already used. */
246 static int rex_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) \
253 if (value) \
255 if ((rex & value)) \
256 rex_used |= (value) | REX_OPCODE; \
258 else \
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
270 #define PREFIX_CS 8
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
282 on error. */
283 #define FETCH_DATA(info, addr) \
284 ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
285 ? 1 : fetch_data ((info), (addr)))
287 static int
288 fetch_data (struct disassemble_info *info, bfd_byte *addr)
290 int status;
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,
296 priv->max_fetched,
297 addr - priv->max_fetched,
298 info);
299 else
300 status = -1;
301 if (status != 0)
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
306 STATUS. */
307 if (priv->max_fetched == priv->the_buffer)
308 (*info->memory_error_func) (status, start, info);
309 longjmp (priv->bailout, 1);
311 else
312 priv->max_fetched = addr;
313 return 1;
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
455 #define AFLAG 2
456 #define DFLAG 1
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. */
478 #define es_reg 100
479 #define cs_reg 101
480 #define ss_reg 102
481 #define ds_reg 103
482 #define fs_reg 104
483 #define gs_reg 105
485 #define eAX_reg 108
486 #define eCX_reg 109
487 #define eDX_reg 110
488 #define eBX_reg 111
489 #define eSP_reg 112
490 #define eBP_reg 113
491 #define eSI_reg 114
492 #define eDI_reg 115
494 #define al_reg 116
495 #define cl_reg 117
496 #define dl_reg 118
497 #define bl_reg 119
498 #define ah_reg 120
499 #define ch_reg 121
500 #define dh_reg 122
501 #define bh_reg 123
503 #define ax_reg 124
504 #define cx_reg 125
505 #define dx_reg 126
506 #define bx_reg 127
507 #define sp_reg 128
508 #define bp_reg 129
509 #define si_reg 130
510 #define di_reg 131
512 #define rAX_reg 132
513 #define rCX_reg 133
514 #define rDX_reg 134
515 #define rBX_reg 135
516 #define rSP_reg 136
517 #define rBP_reg 137
518 #define rSI_reg 138
519 #define rDI_reg 139
521 #define z_mode_ax_reg 149
522 #define indir_dx_reg 150
524 #define FLOATCODE 1
525 #define USE_GROUPS 2
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);
671 struct dis386 {
672 const char *name;
673 struct
675 op_rtn rtn;
676 int bytemode;
677 } op[MAX_OPERANDS];
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
684 . size prefix
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)
693 'J' => print 'l'
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
701 . is true
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"
713 for the details.
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[] = {
722 /* 00 */
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 } },
731 /* 08 */
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 */
740 /* 10 */
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 } },
749 /* 18 */
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 } },
758 /* 20 */
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 } },
767 /* 28 */
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 } },
776 /* 30 */
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 } },
785 /* 38 */
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 } },
794 /* 40 */
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 } },
803 /* 48 */
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 } },
812 /* 50 */
813 { "pushV", { RMrAX } },
814 { "pushV", { RMrCX } },
815 { "pushV", { RMrDX } },
816 { "pushV", { RMrBX } },
817 { "pushV", { RMrSP } },
818 { "pushV", { RMrBP } },
819 { "pushV", { RMrSI } },
820 { "pushV", { RMrDI } },
821 /* 58 */
822 { "popV", { RMrAX } },
823 { "popV", { RMrCX } },
824 { "popV", { RMrDX } },
825 { "popV", { RMrBX } },
826 { "popV", { RMrSP } },
827 { "popV", { RMrBP } },
828 { "popV", { RMrSI } },
829 { "popV", { RMrDI } },
830 /* 60 */
831 { X86_64_0 },
832 { X86_64_1 },
833 { X86_64_2 },
834 { X86_64_3 },
835 { "(bad)", { XX } }, /* seg fs */
836 { "(bad)", { XX } }, /* seg gs */
837 { "(bad)", { XX } }, /* op size prefix */
838 { "(bad)", { XX } }, /* adr size prefix */
839 /* 68 */
840 { "pushT", { Iq } },
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 } },
848 /* 70 */
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 } },
857 /* 78 */
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 } },
866 /* 80 */
867 { GRP1b },
868 { GRP1S },
869 { "(bad)", { XX } },
870 { GRP1Ss },
871 { "testB", { Eb, Gb } },
872 { "testS", { Ev, Gv } },
873 { "xchgB", { Eb, Gb } },
874 { "xchgS", { Ev, Gv } },
875 /* 88 */
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 } },
883 { GRP1a },
884 /* 90 */
885 { PREGRP38 },
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 } },
893 /* 98 */
894 { "cW{t||t|}R", { XX } },
895 { "cR{t||t|}O", { XX } },
896 { "Jcall{T|}", { Ap } },
897 { "(bad)", { XX } }, /* fwait */
898 { "pushfT", { XX } },
899 { "popfT", { XX } },
900 { "sahf{|}", { XX } },
901 { "lahf{|}", { XX } },
902 /* a0 */
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 } },
911 /* a8 */
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 } },
920 /* b0 */
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 } },
929 /* b8 */
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 } },
938 /* c0 */
939 { GRP2b },
940 { GRP2S },
941 { "retT", { Iw } },
942 { "retT", { XX } },
943 { "les{S|}", { Gv, Mp } },
944 { "ldsS", { Gv, Mp } },
945 { GRP11_C6 },
946 { GRP11_C7 },
947 /* c8 */
948 { "enterT", { Iw, Ib } },
949 { "leaveT", { XX } },
950 { "lretP", { Iw } },
951 { "lretP", { XX } },
952 { "int3", { XX } },
953 { "int", { Ib } },
954 { "into{|}", { XX } },
955 { "iretP", { XX } },
956 /* d0 */
957 { GRP2b_one },
958 { GRP2S_one },
959 { GRP2b_cl },
960 { GRP2S_cl },
961 { "aam{|}", { sIb } },
962 { "aad{|}", { sIb } },
963 { "(bad)", { XX } },
964 { "xlat", { DSBX } },
965 /* d8 */
966 { FLOAT },
967 { FLOAT },
968 { FLOAT },
969 { FLOAT },
970 { FLOAT },
971 { FLOAT },
972 { FLOAT },
973 { FLOAT },
974 /* e0 */
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 } },
983 /* e8 */
984 { "callT", { Jv } },
985 { "jmpT", { Jv } },
986 { "Jjmp{T|}", { Ap } },
987 { "jmp", { Jb } },
988 { "inB", { AL, indirDX } },
989 { "inG", { zAX, indirDX } },
990 { "outB", { indirDX, AL } },
991 { "outG", { indirDX, zAX } },
992 /* f0 */
993 { "(bad)", { XX } }, /* lock prefix */
994 { "icebp", { XX } },
995 { "(bad)", { XX } }, /* repne */
996 { "(bad)", { XX } }, /* repz */
997 { "hlt", { XX } },
998 { "cmc", { XX } },
999 { GRP3b },
1000 { GRP3S },
1001 /* f8 */
1002 { "clc", { XX } },
1003 { "stc", { XX } },
1004 { "cli", { XX } },
1005 { "sti", { XX } },
1006 { "cld", { XX } },
1007 { "std", { XX } },
1008 { GRP4 },
1009 { GRP5 },
1012 static const struct dis386 dis386_twobyte[] = {
1013 /* 00 */
1014 { GRP6 },
1015 { GRP7 },
1016 { "larS", { Gv, Ew } },
1017 { "lslS", { Gv, Ew } },
1018 { "(bad)", { XX } },
1019 { "syscall", { XX } },
1020 { "clts", { XX } },
1021 { "sysretP", { XX } },
1022 /* 08 */
1023 { "invd", { XX } },
1024 { "wbinvd", { XX } },
1025 { "(bad)", { XX } },
1026 { "ud2a", { XX } },
1027 { "(bad)", { XX } },
1028 { GRPAMD },
1029 { "femms", { XX } },
1030 { "", { MX, EM, OPSUF } }, /* See OP_3DNowSuffix. */
1031 /* 10 */
1032 { PREGRP8 },
1033 { PREGRP9 },
1034 { PREGRP30 },
1035 { "movlpX", { EXq, XM, { SIMD_Fixup, 'h' } } },
1036 { "unpcklpX", { XM, EXq } },
1037 { "unpckhpX", { XM, EXq } },
1038 { PREGRP31 },
1039 { "movhpX", { EXq, XM, { SIMD_Fixup, 'l' } } },
1040 /* 18 */
1041 { GRP16 },
1042 { "(bad)", { XX } },
1043 { "(bad)", { XX } },
1044 { "(bad)", { XX } },
1045 { "(bad)", { XX } },
1046 { "(bad)", { XX } },
1047 { "(bad)", { XX } },
1048 { "nopQ", { Ev } },
1049 /* 20 */
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 } },
1058 /* 28 */
1059 { "movapX", { XM, EXx } },
1060 { "movapX", { EXx, XM } },
1061 { PREGRP2 },
1062 { PREGRP33 },
1063 { PREGRP4 },
1064 { PREGRP3 },
1065 { PREGRP93 },
1066 { PREGRP94 },
1067 /* 30 */
1068 { "wrmsr", { XX } },
1069 { "rdtsc", { XX } },
1070 { "rdmsr", { XX } },
1071 { "rdpmc", { XX } },
1072 { "sysenter", { XX } },
1073 { "sysexit", { XX } },
1074 { "(bad)", { XX } },
1075 { "(bad)", { XX } },
1076 /* 38 */
1077 { THREE_BYTE_0 },
1078 { "(bad)", { XX } },
1079 { THREE_BYTE_1 },
1080 { "(bad)", { XX } },
1081 { "(bad)", { XX } },
1082 { "(bad)", { XX } },
1083 { "(bad)", { XX } },
1084 { "(bad)", { XX } },
1085 /* 40 */
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 } },
1094 /* 48 */
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 } },
1103 /* 50 */
1104 { "movmskpX", { Gdq, XS } },
1105 { PREGRP13 },
1106 { PREGRP12 },
1107 { PREGRP11 },
1108 { "andpX", { XM, EXx } },
1109 { "andnpX", { XM, EXx } },
1110 { "orpX", { XM, EXx } },
1111 { "xorpX", { XM, EXx } },
1112 /* 58 */
1113 { PREGRP0 },
1114 { PREGRP10 },
1115 { PREGRP17 },
1116 { PREGRP16 },
1117 { PREGRP14 },
1118 { PREGRP7 },
1119 { PREGRP5 },
1120 { PREGRP6 },
1121 /* 60 */
1122 { PREGRP95 },
1123 { PREGRP96 },
1124 { PREGRP97 },
1125 { "packsswb", { MX, EM } },
1126 { "pcmpgtb", { MX, EM } },
1127 { "pcmpgtw", { MX, EM } },
1128 { "pcmpgtd", { MX, EM } },
1129 { "packuswb", { MX, EM } },
1130 /* 68 */
1131 { "punpckhbw", { MX, EM } },
1132 { "punpckhwd", { MX, EM } },
1133 { "punpckhdq", { MX, EM } },
1134 { "packssdw", { MX, EM } },
1135 { PREGRP26 },
1136 { PREGRP24 },
1137 { "movd", { MX, Edq } },
1138 { PREGRP19 },
1139 /* 70 */
1140 { PREGRP22 },
1141 { GRP12 },
1142 { GRP13 },
1143 { GRP14 },
1144 { "pcmpeqb", { MX, EM } },
1145 { "pcmpeqw", { MX, EM } },
1146 { "pcmpeqd", { MX, EM } },
1147 { "emms", { XX } },
1148 /* 78 */
1149 { PREGRP34 },
1150 { PREGRP35 },
1151 { "(bad)", { XX } },
1152 { "(bad)", { XX } },
1153 { PREGRP28 },
1154 { PREGRP29 },
1155 { PREGRP23 },
1156 { PREGRP20 },
1157 /* 80 */
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 } },
1166 /* 88 */
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 } },
1175 /* 90 */
1176 { "seto", { Eb } },
1177 { "setno", { Eb } },
1178 { "setb", { Eb } },
1179 { "setae", { Eb } },
1180 { "sete", { Eb } },
1181 { "setne", { Eb } },
1182 { "setbe", { Eb } },
1183 { "seta", { Eb } },
1184 /* 98 */
1185 { "sets", { Eb } },
1186 { "setns", { Eb } },
1187 { "setp", { Eb } },
1188 { "setnp", { Eb } },
1189 { "setl", { Eb } },
1190 { "setge", { Eb } },
1191 { "setle", { Eb } },
1192 { "setg", { Eb } },
1193 /* a0 */
1194 { "pushT", { fs } },
1195 { "popT", { fs } },
1196 { "cpuid", { XX } },
1197 { "btS", { Ev, Gv } },
1198 { "shldS", { Ev, Gv, Ib } },
1199 { "shldS", { Ev, Gv, CL } },
1200 { GRPPADLCK2 },
1201 { GRPPADLCK1 },
1202 /* a8 */
1203 { "pushT", { gs } },
1204 { "popT", { gs } },
1205 { "rsm", { XX } },
1206 { "btsS", { Ev, Gv } },
1207 { "shrdS", { Ev, Gv, Ib } },
1208 { "shrdS", { Ev, Gv, CL } },
1209 { GRP15 },
1210 { "imulS", { Gv, Ev } },
1211 /* b0 */
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 ! */
1220 /* b8 */
1221 { PREGRP37 },
1222 { "ud2b", { XX } },
1223 { GRP8 },
1224 { "btcS", { Ev, Gv } },
1225 { "bsfS", { Gv, Ev } },
1226 { PREGRP36 },
1227 { "movs{bR|x|bR|x}", { Gv, Eb } },
1228 { "movs{wR|x|wR|x}", { Gv, Ew } }, /* yes, there really is movsww ! */
1229 /* c0 */
1230 { "xaddB", { Eb, Gb } },
1231 { "xaddS", { Ev, Gv } },
1232 { PREGRP1 },
1233 { "movntiS", { Ev, Gv } },
1234 { "pinsrw", { MX, Edqw, Ib } },
1235 { "pextrw", { Gdq, MS, Ib } },
1236 { "shufpX", { XM, EXx, Ib } },
1237 { GRP9 },
1238 /* c8 */
1239 { "bswap", { RMeAX } },
1240 { "bswap", { RMeCX } },
1241 { "bswap", { RMeDX } },
1242 { "bswap", { RMeBX } },
1243 { "bswap", { RMeSP } },
1244 { "bswap", { RMeBP } },
1245 { "bswap", { RMeSI } },
1246 { "bswap", { RMeDI } },
1247 /* d0 */
1248 { PREGRP27 },
1249 { "psrlw", { MX, EM } },
1250 { "psrld", { MX, EM } },
1251 { "psrlq", { MX, EM } },
1252 { "paddq", { MX, EM } },
1253 { "pmullw", { MX, EM } },
1254 { PREGRP21 },
1255 { "pmovmskb", { Gdq, MS } },
1256 /* d8 */
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 } },
1265 /* e0 */
1266 { "pavgb", { MX, EM } },
1267 { "psraw", { MX, EM } },
1268 { "psrad", { MX, EM } },
1269 { "pavgw", { MX, EM } },
1270 { "pmulhuw", { MX, EM } },
1271 { "pmulhw", { MX, EM } },
1272 { PREGRP15 },
1273 { PREGRP25 },
1274 /* e8 */
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 } },
1283 /* f0 */
1284 { PREGRP32 },
1285 { "psllw", { MX, EM } },
1286 { "pslld", { MX, EM } },
1287 { "psllq", { MX, EM } },
1288 { "pmuludq", { MX, EM } },
1289 { "pmaddwd", { MX, EM } },
1290 { "psadbw", { MX, EM } },
1291 { PREGRP18 },
1292 /* f8 */
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];
1563 static char *obufp;
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;
1569 static struct
1571 int mod;
1572 int reg;
1573 int rm;
1575 modrm;
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] = {
1644 /* GRP1a */
1646 { "popU", { stackEv } },
1647 { "(bad)", { XX } },
1648 { "(bad)", { XX } },
1649 { "(bad)", { XX } },
1650 { "(bad)", { XX } },
1651 { "(bad)", { XX } },
1652 { "(bad)", { XX } },
1653 { "(bad)", { XX } },
1655 /* GRP1b */
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 } },
1666 /* GRP1S */
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 } },
1677 /* GRP1Ss */
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 } },
1688 /* GRP2b */
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 } },
1699 /* GRP2S */
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 } },
1710 /* GRP2b_one */
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 } },
1721 /* GRP2S_one */
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 } },
1732 /* GRP2b_cl */
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 } },
1743 /* GRP2S_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 } },
1754 /* GRP3b */
1756 { "testA", { Eb, Ib } },
1757 { "(bad)", { Eb } },
1758 { "notA", { Eb } },
1759 { "negA", { 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. */
1765 /* GRP3S */
1767 { "testQ", { Ev, Iv } },
1768 { "(bad)", { XX } },
1769 { "notQ", { Ev } },
1770 { "negQ", { Ev } },
1771 { "mulQ", { Ev } }, /* Don't print the implicit register. */
1772 { "imulQ", { Ev } },
1773 { "divQ", { Ev } },
1774 { "idivQ", { Ev } },
1776 /* GRP4 */
1778 { "incA", { Eb } },
1779 { "decA", { Eb } },
1780 { "(bad)", { XX } },
1781 { "(bad)", { XX } },
1782 { "(bad)", { XX } },
1783 { "(bad)", { XX } },
1784 { "(bad)", { XX } },
1785 { "(bad)", { XX } },
1787 /* GRP5 */
1789 { "incQ", { Ev } },
1790 { "decQ", { Ev } },
1791 { "callT", { indirEv } },
1792 { "JcallT", { indirEp } },
1793 { "jmpT", { indirEv } },
1794 { "JjmpT", { indirEp } },
1795 { "pushU", { stackEv } },
1796 { "(bad)", { XX } },
1798 /* GRP6 */
1800 { "sldtD", { Sv } },
1801 { "strD", { Sv } },
1802 { "lldt", { Ew } },
1803 { "ltr", { Ew } },
1804 { "verr", { Ew } },
1805 { "verw", { Ew } },
1806 { "(bad)", { XX } },
1807 { "(bad)", { XX } },
1809 /* GRP7 */
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 } },
1817 { "lmsw", { Ew } },
1818 { "invlpg", { { INVLPG_Fixup, w_mode } } },
1820 /* GRP8 */
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 } },
1831 /* GRP9 */
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 } },
1842 /* GRP11_C6 */
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 } },
1853 /* GRP11_C7 */
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 } },
1864 /* GRP12 */
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 } },
1875 /* GRP13 */
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 } },
1886 /* GRP14 */
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 } },
1897 /* GRP15 */
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 } } },
1908 /* GRP16 */
1910 { "prefetchnta", { Ev } },
1911 { "prefetcht0", { Ev } },
1912 { "prefetcht1", { Ev } },
1913 { "prefetcht2", { Ev } },
1914 { "(bad)", { XX } },
1915 { "(bad)", { XX } },
1916 { "(bad)", { XX } },
1917 { "(bad)", { XX } },
1919 /* GRPAMD */
1921 { "prefetch", { Eb } },
1922 { "prefetchw", { Eb } },
1923 { "(bad)", { XX } },
1924 { "(bad)", { XX } },
1925 { "(bad)", { XX } },
1926 { "(bad)", { XX } },
1927 { "(bad)", { XX } },
1928 { "(bad)", { XX } },
1930 /* GRPPADLCK1 */
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 } } },
1941 /* GRPPADLCK2 */
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] = {
1955 /* PREGRP0 */
1957 { "addps", { XM, EXx } },
1958 { "addss", { XM, EXd } },
1959 { "addpd", { XM, EXx } },
1960 { "addsd", { XM, EXq } },
1962 /* PREGRP1 */
1964 { "", { XM, EXx, OPSIMD } }, /* See OP_SIMD_SUFFIX. */
1965 { "", { XM, EXx, OPSIMD } },
1966 { "", { XM, EXx, OPSIMD } },
1967 { "", { XM, EXx, OPSIMD } },
1969 /* PREGRP2 */
1971 { "cvtpi2ps", { XM, EMC } },
1972 { "cvtsi2ssY", { XM, Ev } },
1973 { "cvtpi2pd", { XM, EMC } },
1974 { "cvtsi2sdY", { XM, Ev } },
1976 /* PREGRP3 */
1978 { "cvtps2pi", { MXC, EXx } },
1979 { "cvtss2siY", { Gv, EXx } },
1980 { "cvtpd2pi", { MXC, EXx } },
1981 { "cvtsd2siY", { Gv, EXx } },
1983 /* PREGRP4 */
1985 { "cvttps2pi", { MXC, EXx } },
1986 { "cvttss2siY", { Gv, EXx } },
1987 { "cvttpd2pi", { MXC, EXx } },
1988 { "cvttsd2siY", { Gv, EXx } },
1990 /* PREGRP5 */
1992 { "divps", { XM, EXx } },
1993 { "divss", { XM, EXx } },
1994 { "divpd", { XM, EXx } },
1995 { "divsd", { XM, EXx } },
1997 /* PREGRP6 */
1999 { "maxps", { XM, EXx } },
2000 { "maxss", { XM, EXx } },
2001 { "maxpd", { XM, EXx } },
2002 { "maxsd", { XM, EXx } },
2004 /* PREGRP7 */
2006 { "minps", { XM, EXx } },
2007 { "minss", { XM, EXx } },
2008 { "minpd", { XM, EXx } },
2009 { "minsd", { XM, EXx } },
2011 /* PREGRP8 */
2013 { "movups", { XM, EXx } },
2014 { "movss", { XM, EXx } },
2015 { "movupd", { XM, EXx } },
2016 { "movsd", { XM, EXx } },
2018 /* PREGRP9 */
2020 { "movups", { EXx, XM } },
2021 { "movss", { EXx, XM } },
2022 { "movupd", { EXx, XM } },
2023 { "movsd", { EXx, XM } },
2025 /* PREGRP10 */
2027 { "mulps", { XM, EXx } },
2028 { "mulss", { XM, EXx } },
2029 { "mulpd", { XM, EXx } },
2030 { "mulsd", { XM, EXx } },
2032 /* PREGRP11 */
2034 { "rcpps", { XM, EXx } },
2035 { "rcpss", { XM, EXx } },
2036 { "(bad)", { XM, EXx } },
2037 { "(bad)", { XM, EXx } },
2039 /* PREGRP12 */
2041 { "rsqrtps",{ XM, EXx } },
2042 { "rsqrtss",{ XM, EXx } },
2043 { "(bad)", { XM, EXx } },
2044 { "(bad)", { XM, EXx } },
2046 /* PREGRP13 */
2048 { "sqrtps", { XM, EXx } },
2049 { "sqrtss", { XM, EXx } },
2050 { "sqrtpd", { XM, EXx } },
2051 { "sqrtsd", { XM, EXx } },
2053 /* PREGRP14 */
2055 { "subps", { XM, EXx } },
2056 { "subss", { XM, EXx } },
2057 { "subpd", { XM, EXx } },
2058 { "subsd", { XM, EXx } },
2060 /* PREGRP15 */
2062 { "(bad)", { XM, EXx } },
2063 { "cvtdq2pd", { XM, EXq } },
2064 { "cvttpd2dq", { XM, EXx } },
2065 { "cvtpd2dq", { XM, EXx } },
2067 /* PREGRP16 */
2069 { "cvtdq2ps", { XM, EXx } },
2070 { "cvttps2dq", { XM, EXx } },
2071 { "cvtps2dq", { XM, EXx } },
2072 { "(bad)", { XM, EXx } },
2074 /* PREGRP17 */
2076 { "cvtps2pd", { XM, EXq } },
2077 { "cvtss2sd", { XM, EXx } },
2078 { "cvtpd2ps", { XM, EXx } },
2079 { "cvtsd2ss", { XM, EXx } },
2081 /* PREGRP18 */
2083 { "maskmovq", { MX, MS } },
2084 { "(bad)", { XM, EXx } },
2085 { "maskmovdqu", { XM, XS } },
2086 { "(bad)", { XM, EXx } },
2088 /* PREGRP19 */
2090 { "movq", { MX, EM } },
2091 { "movdqu", { XM, EXx } },
2092 { "movdqa", { XM, EXx } },
2093 { "(bad)", { XM, EXx } },
2095 /* PREGRP20 */
2097 { "movq", { EM, MX } },
2098 { "movdqu", { EXx, XM } },
2099 { "movdqa", { EXx, XM } },
2100 { "(bad)", { EXx, XM } },
2102 /* PREGRP21 */
2104 { "(bad)", { EXx, XM } },
2105 { "movq2dq",{ XM, MS } },
2106 { "movq", { EXx, XM } },
2107 { "movdq2q",{ MX, XS } },
2109 /* PREGRP22 */
2111 { "pshufw", { MX, EM, Ib } },
2112 { "pshufhw",{ XM, EXx, Ib } },
2113 { "pshufd", { XM, EXx, Ib } },
2114 { "pshuflw",{ XM, EXx, Ib } },
2116 /* PREGRP23 */
2118 { "movd", { Edq, MX } },
2119 { "movq", { XM, EXx } },
2120 { "movd", { Edq, XM } },
2121 { "(bad)", { Ed, XM } },
2123 /* PREGRP24 */
2125 { "(bad)", { MX, EXx } },
2126 { "(bad)", { XM, EXx } },
2127 { "punpckhqdq", { XM, EXx } },
2128 { "(bad)", { XM, EXx } },
2130 /* PREGRP25 */
2132 { "movntq", { EM, MX } },
2133 { "(bad)", { EM, XM } },
2134 { "movntdq",{ EM, XM } },
2135 { "(bad)", { EM, XM } },
2137 /* PREGRP26 */
2139 { "(bad)", { MX, EXx } },
2140 { "(bad)", { XM, EXx } },
2141 { "punpcklqdq", { XM, EXx } },
2142 { "(bad)", { XM, EXx } },
2144 /* PREGRP27 */
2146 { "(bad)", { MX, EXx } },
2147 { "(bad)", { XM, EXx } },
2148 { "addsubpd", { XM, EXx } },
2149 { "addsubps", { XM, EXx } },
2151 /* PREGRP28 */
2153 { "(bad)", { MX, EXx } },
2154 { "(bad)", { XM, EXx } },
2155 { "haddpd", { XM, EXx } },
2156 { "haddps", { XM, EXx } },
2158 /* PREGRP29 */
2160 { "(bad)", { MX, EXx } },
2161 { "(bad)", { XM, EXx } },
2162 { "hsubpd", { XM, EXx } },
2163 { "hsubps", { XM, EXx } },
2165 /* PREGRP30 */
2167 { "movlpX", { XM, EXq, { SIMD_Fixup, 'h' } } }, /* really only 2 operands */
2168 { "movsldup", { XM, EXx } },
2169 { "movlpd", { XM, EXq } },
2170 { "movddup", { XM, EXq } },
2172 /* PREGRP31 */
2174 { "movhpX", { XM, EXq, { SIMD_Fixup, 'l' } } },
2175 { "movshdup", { XM, EXx } },
2176 { "movhpd", { XM, EXq } },
2177 { "(bad)", { XM, EXq } },
2179 /* PREGRP32 */
2181 { "(bad)", { XM, EXx } },
2182 { "(bad)", { XM, EXx } },
2183 { "(bad)", { XM, EXx } },
2184 { "lddqu", { XM, M } },
2186 /* PREGRP33 */
2188 {"movntps", { Ev, XM } },
2189 {"movntss", { Ev, XM } },
2190 {"movntpd", { Ev, XM } },
2191 {"movntsd", { Ev, XM } },
2194 /* PREGRP34 */
2196 {"vmread", { Em, Gm } },
2197 {"(bad)", { XX } },
2198 {"extrq", { XS, Ib, Ib } },
2199 {"insertq", { XM, XS, Ib, Ib } },
2202 /* PREGRP35 */
2204 {"vmwrite", { Gm, Em } },
2205 {"(bad)", { XX } },
2206 {"extrq", { XM, XS } },
2207 {"insertq", { XM, XS } },
2210 /* PREGRP36 */
2212 { "bsrS", { Gv, Ev } },
2213 { "lzcntS", { Gv, Ev } },
2214 { "bsrS", { Gv, Ev } },
2215 { "(bad)", { XX } },
2218 /* PREGRP37 */
2220 { "(bad)", { XX } },
2221 { "popcntS", { Gv, Ev } },
2222 { "(bad)", { XX } },
2223 { "(bad)", { XX } },
2226 /* PREGRP38 */
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 } },
2234 /* PREGRP39 */
2236 { "(bad)", { XX } },
2237 { "(bad)", { XX } },
2238 { "pblendvb", {XM, EXx, XMM0 } },
2239 { "(bad)", { XX } },
2242 /* PREGRP40 */
2244 { "(bad)", { XX } },
2245 { "(bad)", { XX } },
2246 { "blendvps", {XM, EXx, XMM0 } },
2247 { "(bad)", { XX } },
2250 /* PREGRP41 */
2252 { "(bad)", { XX } },
2253 { "(bad)", { XX } },
2254 { "blendvpd", { XM, EXx, XMM0 } },
2255 { "(bad)", { XX } },
2258 /* PREGRP42 */
2260 { "(bad)", { XX } },
2261 { "(bad)", { XX } },
2262 { "ptest", { XM, EXx } },
2263 { "(bad)", { XX } },
2266 /* PREGRP43 */
2268 { "(bad)", { XX } },
2269 { "(bad)", { XX } },
2270 { "pmovsxbw", { XM, EXx } },
2271 { "(bad)", { XX } },
2274 /* PREGRP44 */
2276 { "(bad)", { XX } },
2277 { "(bad)", { XX } },
2278 { "pmovsxbd", { XM, EXx } },
2279 { "(bad)", { XX } },
2282 /* PREGRP45 */
2284 { "(bad)", { XX } },
2285 { "(bad)", { XX } },
2286 { "pmovsxbq", { XM, EXx } },
2287 { "(bad)", { XX } },
2290 /* PREGRP46 */
2292 { "(bad)", { XX } },
2293 { "(bad)", { XX } },
2294 { "pmovsxwd", { XM, EXx } },
2295 { "(bad)", { XX } },
2298 /* PREGRP47 */
2300 { "(bad)", { XX } },
2301 { "(bad)", { XX } },
2302 { "pmovsxwq", { XM, EXx } },
2303 { "(bad)", { XX } },
2306 /* PREGRP48 */
2308 { "(bad)", { XX } },
2309 { "(bad)", { XX } },
2310 { "pmovsxdq", { XM, EXx } },
2311 { "(bad)", { XX } },
2314 /* PREGRP49 */
2316 { "(bad)", { XX } },
2317 { "(bad)", { XX } },
2318 { "pmuldq", { XM, EXx } },
2319 { "(bad)", { XX } },
2322 /* PREGRP50 */
2324 { "(bad)", { XX } },
2325 { "(bad)", { XX } },
2326 { "pcmpeqq", { XM, EXx } },
2327 { "(bad)", { XX } },
2330 /* PREGRP51 */
2332 { "(bad)", { XX } },
2333 { "(bad)", { XX } },
2334 { "movntdqa", { XM, EM } },
2335 { "(bad)", { XX } },
2338 /* PREGRP52 */
2340 { "(bad)", { XX } },
2341 { "(bad)", { XX } },
2342 { "packusdw", { XM, EXx } },
2343 { "(bad)", { XX } },
2346 /* PREGRP53 */
2348 { "(bad)", { XX } },
2349 { "(bad)", { XX } },
2350 { "pmovzxbw", { XM, EXx } },
2351 { "(bad)", { XX } },
2354 /* PREGRP54 */
2356 { "(bad)", { XX } },
2357 { "(bad)", { XX } },
2358 { "pmovzxbd", { XM, EXx } },
2359 { "(bad)", { XX } },
2362 /* PREGRP55 */
2364 { "(bad)", { XX } },
2365 { "(bad)", { XX } },
2366 { "pmovzxbq", { XM, EXx } },
2367 { "(bad)", { XX } },
2370 /* PREGRP56 */
2372 { "(bad)", { XX } },
2373 { "(bad)", { XX } },
2374 { "pmovzxwd", { XM, EXx } },
2375 { "(bad)", { XX } },
2378 /* PREGRP57 */
2380 { "(bad)", { XX } },
2381 { "(bad)", { XX } },
2382 { "pmovzxwq", { XM, EXx } },
2383 { "(bad)", { XX } },
2386 /* PREGRP58 */
2388 { "(bad)", { XX } },
2389 { "(bad)", { XX } },
2390 { "pmovzxdq", { XM, EXx } },
2391 { "(bad)", { XX } },
2394 /* PREGRP59 */
2396 { "(bad)", { XX } },
2397 { "(bad)", { XX } },
2398 { "pminsb", { XM, EXx } },
2399 { "(bad)", { XX } },
2402 /* PREGRP60 */
2404 { "(bad)", { XX } },
2405 { "(bad)", { XX } },
2406 { "pminsd", { XM, EXx } },
2407 { "(bad)", { XX } },
2410 /* PREGRP61 */
2412 { "(bad)", { XX } },
2413 { "(bad)", { XX } },
2414 { "pminuw", { XM, EXx } },
2415 { "(bad)", { XX } },
2418 /* PREGRP62 */
2420 { "(bad)", { XX } },
2421 { "(bad)", { XX } },
2422 { "pminud", { XM, EXx } },
2423 { "(bad)", { XX } },
2426 /* PREGRP63 */
2428 { "(bad)", { XX } },
2429 { "(bad)", { XX } },
2430 { "pmaxsb", { XM, EXx } },
2431 { "(bad)", { XX } },
2434 /* PREGRP64 */
2436 { "(bad)", { XX } },
2437 { "(bad)", { XX } },
2438 { "pmaxsd", { XM, EXx } },
2439 { "(bad)", { XX } },
2442 /* PREGRP65 */
2444 { "(bad)", { XX } },
2445 { "(bad)", { XX } },
2446 { "pmaxuw", { XM, EXx } },
2447 { "(bad)", { XX } },
2450 /* PREGRP66 */
2452 { "(bad)", { XX } },
2453 { "(bad)", { XX } },
2454 { "pmaxud", { XM, EXx } },
2455 { "(bad)", { XX } },
2458 /* PREGRP67 */
2460 { "(bad)", { XX } },
2461 { "(bad)", { XX } },
2462 { "pmulld", { XM, EXx } },
2463 { "(bad)", { XX } },
2466 /* PREGRP68 */
2468 { "(bad)", { XX } },
2469 { "(bad)", { XX } },
2470 { "phminposuw", { XM, EXx } },
2471 { "(bad)", { XX } },
2474 /* PREGRP69 */
2476 { "(bad)", { XX } },
2477 { "(bad)", { XX } },
2478 { "roundps", { XM, EXx, Ib } },
2479 { "(bad)", { XX } },
2482 /* PREGRP70 */
2484 { "(bad)", { XX } },
2485 { "(bad)", { XX } },
2486 { "roundpd", { XM, EXx, Ib } },
2487 { "(bad)", { XX } },
2490 /* PREGRP71 */
2492 { "(bad)", { XX } },
2493 { "(bad)", { XX } },
2494 { "roundss", { XM, EXx, Ib } },
2495 { "(bad)", { XX } },
2498 /* PREGRP72 */
2500 { "(bad)", { XX } },
2501 { "(bad)", { XX } },
2502 { "roundsd", { XM, EXx, Ib } },
2503 { "(bad)", { XX } },
2506 /* PREGRP73 */
2508 { "(bad)", { XX } },
2509 { "(bad)", { XX } },
2510 { "blendps", { XM, EXx, Ib } },
2511 { "(bad)", { XX } },
2514 /* PREGRP74 */
2516 { "(bad)", { XX } },
2517 { "(bad)", { XX } },
2518 { "blendpd", { XM, EXx, Ib } },
2519 { "(bad)", { XX } },
2522 /* PREGRP75 */
2524 { "(bad)", { XX } },
2525 { "(bad)", { XX } },
2526 { "pblendw", { XM, EXx, Ib } },
2527 { "(bad)", { XX } },
2530 /* PREGRP76 */
2532 { "(bad)", { XX } },
2533 { "(bad)", { XX } },
2534 { "pextrb", { Edqb, XM, Ib } },
2535 { "(bad)", { XX } },
2538 /* PREGRP77 */
2540 { "(bad)", { XX } },
2541 { "(bad)", { XX } },
2542 { "pextrw", { Edqw, XM, Ib } },
2543 { "(bad)", { XX } },
2546 /* PREGRP78 */
2548 { "(bad)", { XX } },
2549 { "(bad)", { XX } },
2550 { "pextrK", { Edq, XM, Ib } },
2551 { "(bad)", { XX } },
2554 /* PREGRP79 */
2556 { "(bad)", { XX } },
2557 { "(bad)", { XX } },
2558 { "extractps", { Edqd, XM, Ib } },
2559 { "(bad)", { XX } },
2562 /* PREGRP80 */
2564 { "(bad)", { XX } },
2565 { "(bad)", { XX } },
2566 { "pinsrb", { XM, Edqb, Ib } },
2567 { "(bad)", { XX } },
2570 /* PREGRP81 */
2572 { "(bad)", { XX } },
2573 { "(bad)", { XX } },
2574 { "insertps", { XM, EXx, Ib } },
2575 { "(bad)", { XX } },
2578 /* PREGRP82 */
2580 { "(bad)", { XX } },
2581 { "(bad)", { XX } },
2582 { "pinsrK", { XM, Edq, Ib } },
2583 { "(bad)", { XX } },
2586 /* PREGRP83 */
2588 { "(bad)", { XX } },
2589 { "(bad)", { XX } },
2590 { "dpps", { XM, EXx, Ib } },
2591 { "(bad)", { XX } },
2594 /* PREGRP84 */
2596 { "(bad)", { XX } },
2597 { "(bad)", { XX } },
2598 { "dppd", { XM, EXx, Ib } },
2599 { "(bad)", { XX } },
2602 /* PREGRP85 */
2604 { "(bad)", { XX } },
2605 { "(bad)", { XX } },
2606 { "mpsadbw", { XM, EXx, Ib } },
2607 { "(bad)", { XX } },
2610 /* PREGRP86 */
2612 { "(bad)", { XX } },
2613 { "(bad)", { XX } },
2614 { "pcmpgtq", { XM, EXx } },
2615 { "(bad)", { XX } },
2618 /* PREGRP87 */
2620 { "(bad)", { XX } },
2621 { "(bad)", { XX } },
2622 { "(bad)", { XX } },
2623 { "crc32", { Gdq, { CRC32_Fixup, b_mode } } },
2626 /* PREGRP88 */
2628 { "(bad)", { XX } },
2629 { "(bad)", { XX } },
2630 { "(bad)", { XX } },
2631 { "crc32", { Gdq, { CRC32_Fixup, v_mode } } },
2634 /* PREGRP89 */
2636 { "(bad)", { XX } },
2637 { "(bad)", { XX } },
2638 { "pcmpestrm", { XM, EXx, Ib } },
2639 { "(bad)", { XX } },
2642 /* PREGRP90 */
2644 { "(bad)", { XX } },
2645 { "(bad)", { XX } },
2646 { "pcmpestri", { XM, EXx, Ib } },
2647 { "(bad)", { XX } },
2650 /* PREGRP91 */
2652 { "(bad)", { XX } },
2653 { "(bad)", { XX } },
2654 { "pcmpistrm", { XM, EXx, Ib } },
2655 { "(bad)", { XX } },
2658 /* PREGRP92 */
2660 { "(bad)", { XX } },
2661 { "(bad)", { XX } },
2662 { "pcmpistri", { XM, EXx, Ib } },
2663 { "(bad)", { XX } },
2666 /* PREGRP93 */
2668 { "ucomiss",{ XM, EXd } },
2669 { "(bad)", { XX } },
2670 { "ucomisd",{ XM, EXq } },
2671 { "(bad)", { XX } },
2674 /* PREGRP94 */
2676 { "comiss", { XM, EXd } },
2677 { "(bad)", { XX } },
2678 { "comisd", { XM, EXq } },
2679 { "(bad)", { XX } },
2682 /* PREGRP95 */
2684 { "punpcklbw",{ MX, EMd } },
2685 { "(bad)", { XX } },
2686 { "punpcklbw",{ MX, EMq } },
2687 { "(bad)", { XX } },
2690 /* PREGRP96 */
2692 { "punpcklwd",{ MX, EMd } },
2693 { "(bad)", { XX } },
2694 { "punpcklwd",{ MX, EMq } },
2695 { "(bad)", { XX } },
2698 /* PREGRP97 */
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] = {
2727 /* THREE_BYTE_0 */
2729 /* 00 */
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 } },
2738 /* 08 */
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 } },
2747 /* 10 */
2748 { PREGRP39 },
2749 { "(bad)", { XX } },
2750 { "(bad)", { XX } },
2751 { "(bad)", { XX } },
2752 { PREGRP40 },
2753 { PREGRP41 },
2754 { "(bad)", { XX } },
2755 { PREGRP42 },
2756 /* 18 */
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 } },
2765 /* 20 */
2766 { PREGRP43 },
2767 { PREGRP44 },
2768 { PREGRP45 },
2769 { PREGRP46 },
2770 { PREGRP47 },
2771 { PREGRP48 },
2772 { "(bad)", { XX } },
2773 { "(bad)", { XX } },
2774 /* 28 */
2775 { PREGRP49 },
2776 { PREGRP50 },
2777 { PREGRP51 },
2778 { PREGRP52 },
2779 { "(bad)", { XX } },
2780 { "(bad)", { XX } },
2781 { "(bad)", { XX } },
2782 { "(bad)", { XX } },
2783 /* 30 */
2784 { PREGRP53 },
2785 { PREGRP54 },
2786 { PREGRP55 },
2787 { PREGRP56 },
2788 { PREGRP57 },
2789 { PREGRP58 },
2790 { "(bad)", { XX } },
2791 { PREGRP86 },
2792 /* 38 */
2793 { PREGRP59 },
2794 { PREGRP60 },
2795 { PREGRP61 },
2796 { PREGRP62 },
2797 { PREGRP63 },
2798 { PREGRP64 },
2799 { PREGRP65 },
2800 { PREGRP66 },
2801 /* 40 */
2802 { PREGRP67 },
2803 { PREGRP68 },
2804 { "(bad)", { XX } },
2805 { "(bad)", { XX } },
2806 { "(bad)", { XX } },
2807 { "(bad)", { XX } },
2808 { "(bad)", { XX } },
2809 { "(bad)", { XX } },
2810 /* 48 */
2811 { "(bad)", { XX } },
2812 { "(bad)", { XX } },
2813 { "(bad)", { XX } },
2814 { "(bad)", { XX } },
2815 { "(bad)", { XX } },
2816 { "(bad)", { XX } },
2817 { "(bad)", { XX } },
2818 { "(bad)", { XX } },
2819 /* 50 */
2820 { "(bad)", { XX } },
2821 { "(bad)", { XX } },
2822 { "(bad)", { XX } },
2823 { "(bad)", { XX } },
2824 { "(bad)", { XX } },
2825 { "(bad)", { XX } },
2826 { "(bad)", { XX } },
2827 { "(bad)", { XX } },
2828 /* 58 */
2829 { "(bad)", { XX } },
2830 { "(bad)", { XX } },
2831 { "(bad)", { XX } },
2832 { "(bad)", { XX } },
2833 { "(bad)", { XX } },
2834 { "(bad)", { XX } },
2835 { "(bad)", { XX } },
2836 { "(bad)", { XX } },
2837 /* 60 */
2838 { "(bad)", { XX } },
2839 { "(bad)", { XX } },
2840 { "(bad)", { XX } },
2841 { "(bad)", { XX } },
2842 { "(bad)", { XX } },
2843 { "(bad)", { XX } },
2844 { "(bad)", { XX } },
2845 { "(bad)", { XX } },
2846 /* 68 */
2847 { "(bad)", { XX } },
2848 { "(bad)", { XX } },
2849 { "(bad)", { XX } },
2850 { "(bad)", { XX } },
2851 { "(bad)", { XX } },
2852 { "(bad)", { XX } },
2853 { "(bad)", { XX } },
2854 { "(bad)", { XX } },
2855 /* 70 */
2856 { "(bad)", { XX } },
2857 { "(bad)", { XX } },
2858 { "(bad)", { XX } },
2859 { "(bad)", { XX } },
2860 { "(bad)", { XX } },
2861 { "(bad)", { XX } },
2862 { "(bad)", { XX } },
2863 { "(bad)", { XX } },
2864 /* 78 */
2865 { "(bad)", { XX } },
2866 { "(bad)", { XX } },
2867 { "(bad)", { XX } },
2868 { "(bad)", { XX } },
2869 { "(bad)", { XX } },
2870 { "(bad)", { XX } },
2871 { "(bad)", { XX } },
2872 { "(bad)", { XX } },
2873 /* 80 */
2874 { "(bad)", { XX } },
2875 { "(bad)", { XX } },
2876 { "(bad)", { XX } },
2877 { "(bad)", { XX } },
2878 { "(bad)", { XX } },
2879 { "(bad)", { XX } },
2880 { "(bad)", { XX } },
2881 { "(bad)", { XX } },
2882 /* 88 */
2883 { "(bad)", { XX } },
2884 { "(bad)", { XX } },
2885 { "(bad)", { XX } },
2886 { "(bad)", { XX } },
2887 { "(bad)", { XX } },
2888 { "(bad)", { XX } },
2889 { "(bad)", { XX } },
2890 { "(bad)", { XX } },
2891 /* 90 */
2892 { "(bad)", { XX } },
2893 { "(bad)", { XX } },
2894 { "(bad)", { XX } },
2895 { "(bad)", { XX } },
2896 { "(bad)", { XX } },
2897 { "(bad)", { XX } },
2898 { "(bad)", { XX } },
2899 { "(bad)", { XX } },
2900 /* 98 */
2901 { "(bad)", { XX } },
2902 { "(bad)", { XX } },
2903 { "(bad)", { XX } },
2904 { "(bad)", { XX } },
2905 { "(bad)", { XX } },
2906 { "(bad)", { XX } },
2907 { "(bad)", { XX } },
2908 { "(bad)", { XX } },
2909 /* a0 */
2910 { "(bad)", { XX } },
2911 { "(bad)", { XX } },
2912 { "(bad)", { XX } },
2913 { "(bad)", { XX } },
2914 { "(bad)", { XX } },
2915 { "(bad)", { XX } },
2916 { "(bad)", { XX } },
2917 { "(bad)", { XX } },
2918 /* a8 */
2919 { "(bad)", { XX } },
2920 { "(bad)", { XX } },
2921 { "(bad)", { XX } },
2922 { "(bad)", { XX } },
2923 { "(bad)", { XX } },
2924 { "(bad)", { XX } },
2925 { "(bad)", { XX } },
2926 { "(bad)", { XX } },
2927 /* b0 */
2928 { "(bad)", { XX } },
2929 { "(bad)", { XX } },
2930 { "(bad)", { XX } },
2931 { "(bad)", { XX } },
2932 { "(bad)", { XX } },
2933 { "(bad)", { XX } },
2934 { "(bad)", { XX } },
2935 { "(bad)", { XX } },
2936 /* b8 */
2937 { "(bad)", { XX } },
2938 { "(bad)", { XX } },
2939 { "(bad)", { XX } },
2940 { "(bad)", { XX } },
2941 { "(bad)", { XX } },
2942 { "(bad)", { XX } },
2943 { "(bad)", { XX } },
2944 { "(bad)", { XX } },
2945 /* c0 */
2946 { "(bad)", { XX } },
2947 { "(bad)", { XX } },
2948 { "(bad)", { XX } },
2949 { "(bad)", { XX } },
2950 { "(bad)", { XX } },
2951 { "(bad)", { XX } },
2952 { "(bad)", { XX } },
2953 { "(bad)", { XX } },
2954 /* c8 */
2955 { "(bad)", { XX } },
2956 { "(bad)", { XX } },
2957 { "(bad)", { XX } },
2958 { "(bad)", { XX } },
2959 { "(bad)", { XX } },
2960 { "(bad)", { XX } },
2961 { "(bad)", { XX } },
2962 { "(bad)", { XX } },
2963 /* d0 */
2964 { "(bad)", { XX } },
2965 { "(bad)", { XX } },
2966 { "(bad)", { XX } },
2967 { "(bad)", { XX } },
2968 { "(bad)", { XX } },
2969 { "(bad)", { XX } },
2970 { "(bad)", { XX } },
2971 { "(bad)", { XX } },
2972 /* d8 */
2973 { "(bad)", { XX } },
2974 { "(bad)", { XX } },
2975 { "(bad)", { XX } },
2976 { "(bad)", { XX } },
2977 { "(bad)", { XX } },
2978 { "(bad)", { XX } },
2979 { "(bad)", { XX } },
2980 { "(bad)", { XX } },
2981 /* e0 */
2982 { "(bad)", { XX } },
2983 { "(bad)", { XX } },
2984 { "(bad)", { XX } },
2985 { "(bad)", { XX } },
2986 { "(bad)", { XX } },
2987 { "(bad)", { XX } },
2988 { "(bad)", { XX } },
2989 { "(bad)", { XX } },
2990 /* e8 */
2991 { "(bad)", { XX } },
2992 { "(bad)", { XX } },
2993 { "(bad)", { XX } },
2994 { "(bad)", { XX } },
2995 { "(bad)", { XX } },
2996 { "(bad)", { XX } },
2997 { "(bad)", { XX } },
2998 { "(bad)", { XX } },
2999 /* f0 */
3000 { PREGRP87 },
3001 { PREGRP88 },
3002 { "(bad)", { XX } },
3003 { "(bad)", { XX } },
3004 { "(bad)", { XX } },
3005 { "(bad)", { XX } },
3006 { "(bad)", { XX } },
3007 { "(bad)", { XX } },
3008 /* f8 */
3009 { "(bad)", { XX } },
3010 { "(bad)", { XX } },
3011 { "(bad)", { XX } },
3012 { "(bad)", { XX } },
3013 { "(bad)", { XX } },
3014 { "(bad)", { XX } },
3015 { "(bad)", { XX } },
3016 { "(bad)", { XX } },
3018 /* THREE_BYTE_1 */
3020 /* 00 */
3021 { "(bad)", { XX } },
3022 { "(bad)", { XX } },
3023 { "(bad)", { XX } },
3024 { "(bad)", { XX } },
3025 { "(bad)", { XX } },
3026 { "(bad)", { XX } },
3027 { "(bad)", { XX } },
3028 { "(bad)", { XX } },
3029 /* 08 */
3030 { PREGRP69 },
3031 { PREGRP70 },
3032 { PREGRP71 },
3033 { PREGRP72 },
3034 { PREGRP73 },
3035 { PREGRP74 },
3036 { PREGRP75 },
3037 { "palignr", { MX, EM, Ib } },
3038 /* 10 */
3039 { "(bad)", { XX } },
3040 { "(bad)", { XX } },
3041 { "(bad)", { XX } },
3042 { "(bad)", { XX } },
3043 { PREGRP76 },
3044 { PREGRP77 },
3045 { PREGRP78 },
3046 { PREGRP79 },
3047 /* 18 */
3048 { "(bad)", { XX } },
3049 { "(bad)", { XX } },
3050 { "(bad)", { XX } },
3051 { "(bad)", { XX } },
3052 { "(bad)", { XX } },
3053 { "(bad)", { XX } },
3054 { "(bad)", { XX } },
3055 { "(bad)", { XX } },
3056 /* 20 */
3057 { PREGRP80 },
3058 { PREGRP81 },
3059 { PREGRP82 },
3060 { "(bad)", { XX } },
3061 { "(bad)", { XX } },
3062 { "(bad)", { XX } },
3063 { "(bad)", { XX } },
3064 { "(bad)", { XX } },
3065 /* 28 */
3066 { "(bad)", { XX } },
3067 { "(bad)", { XX } },
3068 { "(bad)", { XX } },
3069 { "(bad)", { XX } },
3070 { "(bad)", { XX } },
3071 { "(bad)", { XX } },
3072 { "(bad)", { XX } },
3073 { "(bad)", { XX } },
3074 /* 30 */
3075 { "(bad)", { XX } },
3076 { "(bad)", { XX } },
3077 { "(bad)", { XX } },
3078 { "(bad)", { XX } },
3079 { "(bad)", { XX } },
3080 { "(bad)", { XX } },
3081 { "(bad)", { XX } },
3082 { "(bad)", { XX } },
3083 /* 38 */
3084 { "(bad)", { XX } },
3085 { "(bad)", { XX } },
3086 { "(bad)", { XX } },
3087 { "(bad)", { XX } },
3088 { "(bad)", { XX } },
3089 { "(bad)", { XX } },
3090 { "(bad)", { XX } },
3091 { "(bad)", { XX } },
3092 /* 40 */
3093 { PREGRP83 },
3094 { PREGRP84 },
3095 { PREGRP85 },
3096 { "(bad)", { XX } },
3097 { "(bad)", { XX } },
3098 { "(bad)", { XX } },
3099 { "(bad)", { XX } },
3100 { "(bad)", { XX } },
3101 /* 48 */
3102 { "(bad)", { XX } },
3103 { "(bad)", { XX } },
3104 { "(bad)", { XX } },
3105 { "(bad)", { XX } },
3106 { "(bad)", { XX } },
3107 { "(bad)", { XX } },
3108 { "(bad)", { XX } },
3109 { "(bad)", { XX } },
3110 /* 50 */
3111 { "(bad)", { XX } },
3112 { "(bad)", { XX } },
3113 { "(bad)", { XX } },
3114 { "(bad)", { XX } },
3115 { "(bad)", { XX } },
3116 { "(bad)", { XX } },
3117 { "(bad)", { XX } },
3118 { "(bad)", { XX } },
3119 /* 58 */
3120 { "(bad)", { XX } },
3121 { "(bad)", { XX } },
3122 { "(bad)", { XX } },
3123 { "(bad)", { XX } },
3124 { "(bad)", { XX } },
3125 { "(bad)", { XX } },
3126 { "(bad)", { XX } },
3127 { "(bad)", { XX } },
3128 /* 60 */
3129 { PREGRP89 },
3130 { PREGRP90 },
3131 { PREGRP91 },
3132 { PREGRP92 },
3133 { "(bad)", { XX } },
3134 { "(bad)", { XX } },
3135 { "(bad)", { XX } },
3136 { "(bad)", { XX } },
3137 /* 68 */
3138 { "(bad)", { XX } },
3139 { "(bad)", { XX } },
3140 { "(bad)", { XX } },
3141 { "(bad)", { XX } },
3142 { "(bad)", { XX } },
3143 { "(bad)", { XX } },
3144 { "(bad)", { XX } },
3145 { "(bad)", { XX } },
3146 /* 70 */
3147 { "(bad)", { XX } },
3148 { "(bad)", { XX } },
3149 { "(bad)", { XX } },
3150 { "(bad)", { XX } },
3151 { "(bad)", { XX } },
3152 { "(bad)", { XX } },
3153 { "(bad)", { XX } },
3154 { "(bad)", { XX } },
3155 /* 78 */
3156 { "(bad)", { XX } },
3157 { "(bad)", { XX } },
3158 { "(bad)", { XX } },
3159 { "(bad)", { XX } },
3160 { "(bad)", { XX } },
3161 { "(bad)", { XX } },
3162 { "(bad)", { XX } },
3163 { "(bad)", { XX } },
3164 /* 80 */
3165 { "(bad)", { XX } },
3166 { "(bad)", { XX } },
3167 { "(bad)", { XX } },
3168 { "(bad)", { XX } },
3169 { "(bad)", { XX } },
3170 { "(bad)", { XX } },
3171 { "(bad)", { XX } },
3172 { "(bad)", { XX } },
3173 /* 88 */
3174 { "(bad)", { XX } },
3175 { "(bad)", { XX } },
3176 { "(bad)", { XX } },
3177 { "(bad)", { XX } },
3178 { "(bad)", { XX } },
3179 { "(bad)", { XX } },
3180 { "(bad)", { XX } },
3181 { "(bad)", { XX } },
3182 /* 90 */
3183 { "(bad)", { XX } },
3184 { "(bad)", { XX } },
3185 { "(bad)", { XX } },
3186 { "(bad)", { XX } },
3187 { "(bad)", { XX } },
3188 { "(bad)", { XX } },
3189 { "(bad)", { XX } },
3190 { "(bad)", { XX } },
3191 /* 98 */
3192 { "(bad)", { XX } },
3193 { "(bad)", { XX } },
3194 { "(bad)", { XX } },
3195 { "(bad)", { XX } },
3196 { "(bad)", { XX } },
3197 { "(bad)", { XX } },
3198 { "(bad)", { XX } },
3199 { "(bad)", { XX } },
3200 /* a0 */
3201 { "(bad)", { XX } },
3202 { "(bad)", { XX } },
3203 { "(bad)", { XX } },
3204 { "(bad)", { XX } },
3205 { "(bad)", { XX } },
3206 { "(bad)", { XX } },
3207 { "(bad)", { XX } },
3208 { "(bad)", { XX } },
3209 /* a8 */
3210 { "(bad)", { XX } },
3211 { "(bad)", { XX } },
3212 { "(bad)", { XX } },
3213 { "(bad)", { XX } },
3214 { "(bad)", { XX } },
3215 { "(bad)", { XX } },
3216 { "(bad)", { XX } },
3217 { "(bad)", { XX } },
3218 /* b0 */
3219 { "(bad)", { XX } },
3220 { "(bad)", { XX } },
3221 { "(bad)", { XX } },
3222 { "(bad)", { XX } },
3223 { "(bad)", { XX } },
3224 { "(bad)", { XX } },
3225 { "(bad)", { XX } },
3226 { "(bad)", { XX } },
3227 /* b8 */
3228 { "(bad)", { XX } },
3229 { "(bad)", { XX } },
3230 { "(bad)", { XX } },
3231 { "(bad)", { XX } },
3232 { "(bad)", { XX } },
3233 { "(bad)", { XX } },
3234 { "(bad)", { XX } },
3235 { "(bad)", { XX } },
3236 /* c0 */
3237 { "(bad)", { XX } },
3238 { "(bad)", { XX } },
3239 { "(bad)", { XX } },
3240 { "(bad)", { XX } },
3241 { "(bad)", { XX } },
3242 { "(bad)", { XX } },
3243 { "(bad)", { XX } },
3244 { "(bad)", { XX } },
3245 /* c8 */
3246 { "(bad)", { XX } },
3247 { "(bad)", { XX } },
3248 { "(bad)", { XX } },
3249 { "(bad)", { XX } },
3250 { "(bad)", { XX } },
3251 { "(bad)", { XX } },
3252 { "(bad)", { XX } },
3253 { "(bad)", { XX } },
3254 /* d0 */
3255 { "(bad)", { XX } },
3256 { "(bad)", { XX } },
3257 { "(bad)", { XX } },
3258 { "(bad)", { XX } },
3259 { "(bad)", { XX } },
3260 { "(bad)", { XX } },
3261 { "(bad)", { XX } },
3262 { "(bad)", { XX } },
3263 /* d8 */
3264 { "(bad)", { XX } },
3265 { "(bad)", { XX } },
3266 { "(bad)", { XX } },
3267 { "(bad)", { XX } },
3268 { "(bad)", { XX } },
3269 { "(bad)", { XX } },
3270 { "(bad)", { XX } },
3271 { "(bad)", { XX } },
3272 /* e0 */
3273 { "(bad)", { XX } },
3274 { "(bad)", { XX } },
3275 { "(bad)", { XX } },
3276 { "(bad)", { XX } },
3277 { "(bad)", { XX } },
3278 { "(bad)", { XX } },
3279 { "(bad)", { XX } },
3280 { "(bad)", { XX } },
3281 /* e8 */
3282 { "(bad)", { XX } },
3283 { "(bad)", { XX } },
3284 { "(bad)", { XX } },
3285 { "(bad)&