ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mon/src/disass/i386-dis.c
(Generate patch)

Comparing mon/src/disass/i386-dis.c (file contents):
Revision 1.2 by gbeauche, 2002-09-07T12:48:15Z vs.
Revision 1.4 by gbeauche, 2008-01-01T14:58:01Z

# Line 1 | Line 1
1   /* Print i386 instructions for GDB, the GNU debugger.
2     Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 <   2001
4 <   Free Software Foundation, Inc.
3 >   2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4  
5 < This file is part of GDB.
5 >   This file is part of GDB.
6  
7 < This program is free software; you can redistribute it and/or modify
8 < it under the terms of the GNU General Public License as published by
9 < the Free Software Foundation; either version 2 of the License, or
10 < (at your option) any later version.
11 <
12 < This program is distributed in the hope that it will be useful,
13 < but WITHOUT ANY WARRANTY; without even the implied warranty of
14 < MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 < GNU General Public License for more details.
16 <
17 < You should have received a copy of the GNU General Public License
18 < along with this program; if not, write to the Free Software
19 < Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20 <
21 < /*
22 < * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
23 < * July 1988
24 < *  modified by John Hassey (hassey@dg-rtp.dg.com)
25 < *  x86-64 support added by Jan Hubicka (jh@suse.cz)
26 < */
27 <
28 < /*
29 < * The main tables describing the instructions is essentially a copy
30 < * of the "Opcode Map" chapter (Appendix A) of the Intel 80386
31 < * Programmers Manual.  Usually, there is a capital letter, followed
32 < * by a small letter.  The capital letter tell the addressing mode,
34 < * and the small letter tells about the operand size.  Refer to
35 < * the Intel manual for details.
36 < */
7 >   This program is free software; you can redistribute it and/or modify
8 >   it under the terms of the GNU General Public License as published by
9 >   the Free Software Foundation; either version 2 of the License, or
10 >   (at your option) any later version.
11 >
12 >   This program is distributed in the hope that it will be useful,
13 >   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 >   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 >   GNU General Public License for more details.
16 >
17 >   You should have received a copy of the GNU General Public License
18 >   along with this program; if not, write to the Free Software
19 >   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20 >
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).  */
26 >
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.  */
33  
34   #include "dis-asm.h"
35   #include "opintl.h"
36  
37 < #define MAXLEN 20
37 > #define MAXLEN 15
38  
39   #include <setjmp.h>
40  
# Line 48 | Line 44 | Foundation, Inc., 59 Temple Place - Suit
44   #define UNIXWARE_COMPAT 1
45   #endif
46  
47 < static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *));
48 < static void ckprefix PARAMS ((void));
49 < static const char *prefix_name PARAMS ((int, int));
50 < static int print_insn PARAMS ((bfd_vma, disassemble_info *));
51 < static void dofloat PARAMS ((int));
52 < static void OP_ST PARAMS ((int, int));
53 < static void OP_STi  PARAMS ((int, int));
54 < static int putop PARAMS ((const char *, int));
55 < static void oappend PARAMS ((const char *));
56 < static void append_seg PARAMS ((void));
57 < static void OP_indirE PARAMS ((int, int));
58 < static void print_operand_value PARAMS ((char *, int, bfd_vma));
59 < static void OP_E PARAMS ((int, int));
60 < static void OP_G PARAMS ((int, int));
61 < static bfd_vma get64 PARAMS ((void));
62 < static bfd_signed_vma get32 PARAMS ((void));
63 < static bfd_signed_vma get32s PARAMS ((void));
64 < static int get16 PARAMS ((void));
65 < static void set_op PARAMS ((bfd_vma, int));
66 < static void OP_REG PARAMS ((int, int));
67 < static void OP_IMREG PARAMS ((int, int));
68 < static void OP_I PARAMS ((int, int));
69 < static void OP_I64 PARAMS ((int, int));
70 < static void OP_sI PARAMS ((int, int));
71 < static void OP_J PARAMS ((int, int));
72 < static void OP_SEG PARAMS ((int, int));
73 < static void OP_DIR PARAMS ((int, int));
74 < static void OP_OFF PARAMS ((int, int));
75 < static void OP_OFF64 PARAMS ((int, int));
76 < static void ptr_reg PARAMS ((int, int));
77 < static void OP_ESreg PARAMS ((int, int));
78 < static void OP_DSreg PARAMS ((int, int));
79 < static void OP_C PARAMS ((int, int));
80 < static void OP_D PARAMS ((int, int));
81 < static void OP_T PARAMS ((int, int));
82 < static void OP_Rd PARAMS ((int, int));
83 < static void OP_MMX PARAMS ((int, int));
84 < static void OP_XMM PARAMS ((int, int));
85 < static void OP_EM PARAMS ((int, int));
86 < static void OP_EX PARAMS ((int, int));
87 < static void OP_MS PARAMS ((int, int));
88 < static void OP_XS PARAMS ((int, int));
89 < static void OP_3DNowSuffix PARAMS ((int, int));
90 < static void OP_SIMD_Suffix PARAMS ((int, int));
91 < static void SIMD_Fixup PARAMS ((int, int));
92 < static void BadOp PARAMS ((void));
47 > static int fetch_data (struct disassemble_info *, bfd_byte *);
48 > static void ckprefix (void);
49 > static const char *prefix_name (int, int);
50 > static int print_insn (bfd_vma, disassemble_info *);
51 > static void dofloat (int);
52 > static void OP_ST (int, int);
53 > static void OP_STi (int, int);
54 > static int putop (const char *, int);
55 > static void oappend (const char *);
56 > static void append_seg (void);
57 > static void OP_indirE (int, int);
58 > static void print_operand_value (char *, int, bfd_vma);
59 > static void OP_E (int, int);
60 > static void OP_G (int, int);
61 > static bfd_vma get64 (void);
62 > static bfd_signed_vma get32 (void);
63 > static bfd_signed_vma get32s (void);
64 > static int get16 (void);
65 > static void set_op (bfd_vma, int);
66 > static void OP_REG (int, int);
67 > static void OP_IMREG (int, int);
68 > static void OP_I (int, int);
69 > static void OP_I64 (int, int);
70 > static void OP_sI (int, int);
71 > static void OP_J (int, int);
72 > static void OP_SEG (int, int);
73 > static void OP_DIR (int, int);
74 > static void OP_OFF (int, int);
75 > static void OP_OFF64 (int, int);
76 > static void ptr_reg (int, int);
77 > static void OP_ESreg (int, int);
78 > static void OP_DSreg (int, int);
79 > static void OP_C (int, int);
80 > static void OP_D (int, int);
81 > static void OP_T (int, int);
82 > static void OP_Rd (int, int);
83 > static void OP_MMX (int, int);
84 > static void OP_XMM (int, int);
85 > static void OP_EM (int, int);
86 > static void OP_EX (int, int);
87 > static void OP_EMC (int,int);
88 > static void OP_MXC (int,int);
89 > static void OP_MS (int, int);
90 > static void OP_XS (int, int);
91 > static void OP_M (int, int);
92 > static void OP_VMX (int, int);
93 > static void OP_0fae (int, int);
94 > static void OP_0f07 (int, int);
95 > static void NOP_Fixup1 (int, int);
96 > static void NOP_Fixup2 (int, int);
97 > static void OP_3DNowSuffix (int, int);
98 > static void OP_SIMD_Suffix (int, int);
99 > static void SIMD_Fixup (int, int);
100 > static void PNI_Fixup (int, int);
101 > static void SVME_Fixup (int, int);
102 > static void INVLPG_Fixup (int, int);
103 > static void BadOp (void);
104 > static void VMX_Fixup (int, int);
105 > static void REP_Fixup (int, int);
106 > static void CMPXCHG8B_Fixup (int, int);
107  
108   struct dis_private {
109    /* Points to first byte not fetched.  */
# Line 108 | Line 118 | struct dis_private {
118     when we can.  */
119   #define FWAIT_OPCODE (0x9b)
120  
121 < /* Set to 1 for 64bit mode disassembly.  */
122 < static int mode_64bit;
121 > enum address_mode
122 > {
123 >  mode_16bit,
124 >  mode_32bit,
125 >  mode_64bit
126 > };
127 >
128 > enum address_mode address_mode;
129  
130   /* Flags for the prefixes for the current instruction.  See below.  */
131   static int prefixes;
# Line 160 | Line 176 | static int used_prefixes;
176     ? 1 : fetch_data ((info), (addr)))
177  
178   static int
179 < fetch_data (info, addr)
164 <     struct disassemble_info *info;
165 <     bfd_byte *addr;
179 > fetch_data (struct disassemble_info *info, bfd_byte *addr)
180   {
181    int status;
182    struct dis_private *priv = (struct dis_private *) info->private_data;
183    bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer);
184  
185 <  status = (*info->read_memory_func) (start,
186 <                                      priv->max_fetched,
187 <                                      addr - priv->max_fetched,
188 <                                      info);
185 >  if (addr <= priv->the_buffer + MAXLEN)
186 >    status = (*info->read_memory_func) (start,
187 >                                        priv->max_fetched,
188 >                                        addr - priv->max_fetched,
189 >                                        info);
190 >  else
191 >    status = -1;
192    if (status != 0)
193      {
194        /* If we did manage to read at least one byte, then
195 <         print_insn_i386 will do something sensible.  Otherwise, print
196 <         an error.  We do that here because this is where we know
197 <         STATUS.  */
195 >         print_insn_i386 will do something sensible.  Otherwise, print
196 >         an error.  We do that here because this is where we know
197 >         STATUS.  */
198        if (priv->max_fetched == priv->the_buffer)
199          (*info->memory_error_func) (status, start, info);
200        longjmp (priv->bailout, 1);
# Line 192 | Line 209 | fetch_data (info, addr)
209   #define Eb OP_E, b_mode
210   #define Ev OP_E, v_mode
211   #define Ed OP_E, d_mode
212 < #define indirEb OP_indirE, b_mode
213 < #define indirEv OP_indirE, v_mode
212 > #define Edq OP_E, dq_mode
213 > #define Edqw OP_E, dqw_mode
214 > #define indirEv OP_indirE, stack_v_mode
215 > #define indirEp OP_indirE, f_mode
216 > #define stackEv OP_E, stack_v_mode
217 > #define Em OP_E, m_mode
218   #define Ew OP_E, w_mode
219 < #define Ma OP_E, v_mode
220 < #define M OP_E, 0               /* lea, lgdt, etc. */
221 < #define Mp OP_E, 0              /* 32 or 48 bit memory operand for LDS, LES etc */
219 > #define M OP_M, 0               /* lea, lgdt, etc. */
220 > #define Ma OP_M, v_mode
221 > #define Mp OP_M, f_mode         /* 32 or 48 bit memory operand for LDS, LES etc */
222 > #define Mq OP_M, q_mode
223   #define Gb OP_G, b_mode
224   #define Gv OP_G, v_mode
225   #define Gd OP_G, d_mode
226 + #define Gdq OP_G, dq_mode
227 + #define Gm OP_G, m_mode
228   #define Gw OP_G, w_mode
229   #define Rd OP_Rd, d_mode
230   #define Rm OP_Rd, m_mode
# Line 210 | Line 234 | fetch_data (info, addr)
234   #define Iq OP_I, q_mode
235   #define Iv64 OP_I64, v_mode
236   #define Iw OP_I, w_mode
237 + #define I1 OP_I, const_1_mode
238   #define Jb OP_J, b_mode
239   #define Jv OP_J, v_mode
240   #define Cm OP_C, m_mode
# Line 253 | Line 278 | fetch_data (info, addr)
278   #define eSI OP_IMREG, eSI_reg
279   #define eDI OP_IMREG, eDI_reg
280   #define AL OP_IMREG, al_reg
256 #define AL OP_IMREG, al_reg
281   #define CL OP_IMREG, cl_reg
282   #define DL OP_IMREG, dl_reg
283   #define BL OP_IMREG, bl_reg
# Line 263 | Line 287 | fetch_data (info, addr)
287   #define BH OP_IMREG, bh_reg
288   #define AX OP_IMREG, ax_reg
289   #define DX OP_IMREG, dx_reg
290 + #define zAX OP_IMREG, z_mode_ax_reg
291   #define indirDX OP_IMREG, indir_dx_reg
292  
293   #define Sw OP_SEG, w_mode
294 + #define Sv OP_SEG, v_mode
295   #define Ap OP_DIR, 0
296 < #define Ob OP_OFF, b_mode
297 < #define Ob64 OP_OFF64, b_mode
272 < #define Ov OP_OFF, v_mode
273 < #define Ov64 OP_OFF64, v_mode
296 > #define Ob OP_OFF64, b_mode
297 > #define Ov OP_OFF64, v_mode
298   #define Xb OP_DSreg, eSI_reg
299   #define Xv OP_DSreg, eSI_reg
300 + #define Xz OP_DSreg, eSI_reg
301   #define Yb OP_ESreg, eDI_reg
302   #define Yv OP_ESreg, eDI_reg
303   #define DSBX OP_DSreg, eBX_reg
# Line 290 | Line 315 | fetch_data (info, addr)
315   #define EX OP_EX, v_mode
316   #define MS OP_MS, v_mode
317   #define XS OP_XS, v_mode
318 < #define None OP_E, 0
318 > #define EMC OP_EMC, v_mode
319 > #define MXC OP_MXC, 0
320 > #define VM OP_VMX, q_mode
321   #define OPSUF OP_3DNowSuffix, 0
322   #define OPSIMD OP_SIMD_Suffix, 0
323  
324 + /* Used handle "rep" prefix for string instructions.  */
325 + #define Xbr REP_Fixup, eSI_reg
326 + #define Xvr REP_Fixup, eSI_reg
327 + #define Ybr REP_Fixup, eDI_reg
328 + #define Yvr REP_Fixup, eDI_reg
329 + #define Yzr REP_Fixup, eDI_reg
330 + #define indirDXr REP_Fixup, indir_dx_reg
331 + #define ALr REP_Fixup, al_reg
332 + #define eAXr REP_Fixup, eAX_reg
333 +
334   #define cond_jump_flag NULL, cond_jump_mode
335   #define loop_jcxz_flag NULL, loop_jcxz_mode
336  
# Line 307 | Line 344 | fetch_data (info, addr)
344   #define w_mode 3  /* word operand */
345   #define d_mode 4  /* double word operand  */
346   #define q_mode 5  /* quad word operand */
347 < #define x_mode 6
348 < #define m_mode 7  /* d_mode in 32bit, q_mode in 64bit mode.  */
349 < #define cond_jump_mode 8
350 < #define loop_jcxz_mode 9
347 > #define t_mode 6  /* ten-byte operand */
348 > #define x_mode 7  /* 16-byte XMM operand */
349 > #define m_mode 8  /* d_mode in 32bit, q_mode in 64bit mode.  */
350 > #define cond_jump_mode 9
351 > #define loop_jcxz_mode 10
352 > #define dq_mode 11 /* operand size depends on REX prefixes.  */
353 > #define dqw_mode 12 /* registers like dq_mode, memory like w_mode.  */
354 > #define f_mode 13 /* 4- or 6-byte pointer operand */
355 > #define const_1_mode 14
356 > #define stack_v_mode 15 /* v_mode for stack-related opcodes.  */
357 > #define z_mode 16 /* non-quad operand size depends on prefixes */
358 > #define o_mode 17  /* 16-byte operand */
359  
360   #define es_reg 100
361   #define cs_reg 101
# Line 355 | Line 400 | fetch_data (info, addr)
400   #define rSI_reg 138
401   #define rDI_reg 139
402  
403 + #define z_mode_ax_reg 149
404   #define indir_dx_reg 150
405  
406   #define FLOATCODE 1
407   #define USE_GROUPS 2
408   #define USE_PREFIX_USER_TABLE 3
409   #define X86_64_SPECIAL 4
410 + #define IS_3BYTE_OPCODE 5
411  
412 < #define FLOAT     NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
412 > #define FLOAT     NULL, NULL, FLOATCODE, NULL, 0, NULL, 0, NULL, 0
413  
414 < #define GRP1b     NULL, NULL, USE_GROUPS, NULL,  0, NULL, 0
415 < #define GRP1S     NULL, NULL, USE_GROUPS, NULL,  1, NULL, 0
416 < #define GRP1Ss    NULL, NULL, USE_GROUPS, NULL,  2, NULL, 0
417 < #define GRP2b     NULL, NULL, USE_GROUPS, NULL,  3, NULL, 0
418 < #define GRP2S     NULL, NULL, USE_GROUPS, NULL,  4, NULL, 0
419 < #define GRP2b_one NULL, NULL, USE_GROUPS, NULL,  5, NULL, 0
420 < #define GRP2S_one NULL, NULL, USE_GROUPS, NULL,  6, NULL, 0
421 < #define GRP2b_cl  NULL, NULL, USE_GROUPS, NULL,  7, NULL, 0
422 < #define GRP2S_cl  NULL, NULL, USE_GROUPS, NULL,  8, NULL, 0
423 < #define GRP3b     NULL, NULL, USE_GROUPS, NULL,  9, NULL, 0
424 < #define GRP3S     NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0
425 < #define GRP4      NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0
426 < #define GRP5      NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0
427 < #define GRP6      NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0
428 < #define GRP7      NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0
429 < #define GRP8      NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0
430 < #define GRP9      NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0
431 < #define GRP10     NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0
432 < #define GRP11     NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0
433 < #define GRP12     NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0
434 < #define GRP13     NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0
435 < #define GRP14     NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0
436 < #define GRPAMD    NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0
437 <
438 < #define PREGRP0   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  0, NULL, 0
439 < #define PREGRP1   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  1, NULL, 0
440 < #define PREGRP2   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  2, NULL, 0
441 < #define PREGRP3   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  3, NULL, 0
442 < #define PREGRP4   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  4, NULL, 0
443 < #define PREGRP5   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  5, NULL, 0
444 < #define PREGRP6   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  6, NULL, 0
445 < #define PREGRP7   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  7, NULL, 0
446 < #define PREGRP8   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  8, NULL, 0
447 < #define PREGRP9   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  9, NULL, 0
448 < #define PREGRP10  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0
449 < #define PREGRP11  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0
450 < #define PREGRP12  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0
451 < #define PREGRP13  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0
452 < #define PREGRP14  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0
453 < #define PREGRP15  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0
454 < #define PREGRP16  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0
455 < #define PREGRP17  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0
456 < #define PREGRP18  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0
457 < #define PREGRP19  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0
458 < #define PREGRP20  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0
459 < #define PREGRP21  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0
460 < #define PREGRP22  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0
461 < #define PREGRP23  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0
462 < #define PREGRP24  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0
463 < #define PREGRP25  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0
464 < #define PREGRP26  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0
414 > #define GRP1b     NULL, NULL, USE_GROUPS, NULL,  0, NULL, 0, NULL, 0
415 > #define GRP1S     NULL, NULL, USE_GROUPS, NULL,  1, NULL, 0, NULL, 0
416 > #define GRP1Ss    NULL, NULL, USE_GROUPS, NULL,  2, NULL, 0, NULL, 0
417 > #define GRP2b     NULL, NULL, USE_GROUPS, NULL,  3, NULL, 0, NULL, 0
418 > #define GRP2S     NULL, NULL, USE_GROUPS, NULL,  4, NULL, 0, NULL, 0
419 > #define GRP2b_one NULL, NULL, USE_GROUPS, NULL,  5, NULL, 0, NULL, 0
420 > #define GRP2S_one NULL, NULL, USE_GROUPS, NULL,  6, NULL, 0, NULL, 0
421 > #define GRP2b_cl  NULL, NULL, USE_GROUPS, NULL,  7, NULL, 0, NULL, 0
422 > #define GRP2S_cl  NULL, NULL, USE_GROUPS, NULL,  8, NULL, 0, NULL, 0
423 > #define GRP3b     NULL, NULL, USE_GROUPS, NULL,  9, NULL, 0, NULL, 0
424 > #define GRP3S     NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0, NULL, 0
425 > #define GRP4      NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0, NULL, 0
426 > #define GRP5      NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0, NULL, 0
427 > #define GRP6      NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0, NULL, 0
428 > #define GRP7      NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0, NULL, 0
429 > #define GRP8      NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0, NULL, 0
430 > #define GRP9      NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0, NULL, 0
431 > #define GRP11_C6  NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0, NULL, 0
432 > #define GRP11_C7  NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0, NULL, 0
433 > #define GRP12     NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0, NULL, 0
434 > #define GRP13     NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0, NULL, 0
435 > #define GRP14     NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0, NULL, 0
436 > #define GRP15     NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0, NULL, 0
437 > #define GRP16     NULL, NULL, USE_GROUPS, NULL, 23, NULL, 0, NULL, 0
438 > #define GRPAMD    NULL, NULL, USE_GROUPS, NULL, 24, NULL, 0, NULL, 0
439 > #define GRPPADLCK1 NULL, NULL, USE_GROUPS, NULL, 25, NULL, 0, NULL, 0
440 > #define GRPPADLCK2 NULL, NULL, USE_GROUPS, NULL, 26, NULL, 0, NULL, 0
441 >
442 > #define PREGRP0   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  0, NULL, 0, NULL, 0
443 > #define PREGRP1   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  1, NULL, 0, NULL, 0
444 > #define PREGRP2   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  2, NULL, 0, NULL, 0
445 > #define PREGRP3   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  3, NULL, 0, NULL, 0
446 > #define PREGRP4   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  4, NULL, 0, NULL, 0
447 > #define PREGRP5   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  5, NULL, 0, NULL, 0
448 > #define PREGRP6   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  6, NULL, 0, NULL, 0
449 > #define PREGRP7   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  7, NULL, 0, NULL, 0
450 > #define PREGRP8   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  8, NULL, 0, NULL, 0
451 > #define PREGRP9   NULL, NULL, USE_PREFIX_USER_TABLE, NULL,  9, NULL, 0, NULL, 0
452 > #define PREGRP10  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0, NULL, 0
453 > #define PREGRP11  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0, NULL, 0
454 > #define PREGRP12  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0, NULL, 0
455 > #define PREGRP13  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0, NULL, 0
456 > #define PREGRP14  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0, NULL, 0
457 > #define PREGRP15  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0, NULL, 0
458 > #define PREGRP16  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0, NULL, 0
459 > #define PREGRP17  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0, NULL, 0
460 > #define PREGRP18  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0, NULL, 0
461 > #define PREGRP19  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0, NULL, 0
462 > #define PREGRP20  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0, NULL, 0
463 > #define PREGRP21  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0, NULL, 0
464 > #define PREGRP22  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0, NULL, 0
465 > #define PREGRP23  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0, NULL, 0
466 > #define PREGRP24  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0, NULL, 0
467 > #define PREGRP25  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0, NULL, 0
468 > #define PREGRP26  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0, NULL, 0
469 > #define PREGRP27  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 27, NULL, 0, NULL, 0
470 > #define PREGRP28  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 28, NULL, 0, NULL, 0
471 > #define PREGRP29  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 29, NULL, 0, NULL, 0
472 > #define PREGRP30  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 30, NULL, 0, NULL, 0
473 > #define PREGRP31  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 31, NULL, 0, NULL, 0
474 > #define PREGRP32  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 32, NULL, 0, NULL, 0
475 > #define PREGRP33  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 33, NULL, 0, NULL, 0
476 > #define PREGRP34  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 34, NULL, 0, NULL, 0
477 > #define PREGRP35  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 35, NULL, 0, NULL, 0
478 > #define PREGRP36  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 36, NULL, 0, NULL, 0
479 > #define PREGRP37  NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 37, NULL, 0, NULL, 0
480 >
481 >
482 > #define X86_64_0  NULL, NULL, X86_64_SPECIAL, NULL, 0, NULL, 0, NULL, 0
483 > #define X86_64_1  NULL, NULL, X86_64_SPECIAL, NULL, 1, NULL, 0, NULL, 0
484 > #define X86_64_2  NULL, NULL, X86_64_SPECIAL, NULL, 2, NULL, 0, NULL, 0
485 > #define X86_64_3  NULL, NULL, X86_64_SPECIAL, NULL, 3, NULL, 0, NULL, 0
486  
487 < #define X86_64_0  NULL, NULL, X86_64_SPECIAL, NULL,  0, NULL, 0
487 > #define THREE_BYTE_0 NULL, NULL, IS_3BYTE_OPCODE, NULL, 0, NULL, 0, NULL, 0
488 > #define THREE_BYTE_1 NULL, NULL, IS_3BYTE_OPCODE, NULL, 1, NULL, 0, NULL, 0
489  
490 < typedef void (*op_rtn) PARAMS ((int bytemode, int sizeflag));
490 > typedef void (*op_rtn) (int bytemode, int sizeflag);
491  
492   struct dis386 {
493    const char *name;
# Line 428 | Line 497 | struct dis386 {
497    int bytemode2;
498    op_rtn op3;
499    int bytemode3;
500 +  op_rtn op4;
501 +  int bytemode4;
502   };
503  
504   /* Upper case letters in the instruction names here are macros.
505     'A' => print 'b' if no register operands or suffix_always is true
506     'B' => print 'b' if suffix_always is true
507 +   'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand
508 +   .      size prefix
509 +   'D' => print 'w' if no register operands or 'w', 'l' or 'q', if
510 +   .      suffix_always is true
511     'E' => print 'e' if 32-bit form of jcxz
512     'F' => print 'w' or 'l' depending on address size prefix (loop insns)
513 +   'G' => print 'w' or 'l' depending on operand size prefix (i/o insns)
514     'H' => print ",pt" or ",pn" branch hint
515 +   'I' => honor following macro letter even in Intel mode (implemented only
516 +   .      for some of the macro letters)
517 +   'J' => print 'l'
518     'L' => print 'l' if suffix_always is true
519     'N' => print 'n' if instruction has no wait "prefix"
520 <   'O' => print 'd', or 'o'
520 >   'O' => print 'd' or 'o' (or 'q' in Intel mode)
521     'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
522     .      or suffix_always is true.  print 'q' if rex prefix is present.
523     'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
524     .      is true
525 <   'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
525 >   'R' => print 'w', 'l' or 'q' ('d' for 'l' and 'e' in Intel mode)
526     'S' => print 'w', 'l' or 'q' if suffix_always is true
527     'T' => print 'q' in 64bit mode and behave as 'P' otherwise
528     'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
529 +   'V' => print 'q' in 64bit mode and behave as 'S' otherwise
530 +   'W' => print 'b', 'w' or 'l' ('d' in Intel mode)
531     'X' => print 's', 'd' depending on data16 prefix (for XMM)
451   'W' => print 'b' or 'w' ("w" or "de" in intel mode)
532     'Y' => 'q' if instruction has an REX 64bit overwrite prefix
533 +   'Z' => print 'q' in 64bit mode and behave as 'L' otherwise
534  
535     Many of the above letters print nothing in Intel mode.  See "putop"
536     for the details.
# Line 462 | Line 543 | struct dis386 {
543  
544   static const struct dis386 dis386[] = {
545    /* 00 */
546 <  { "addB",             Eb, Gb, XX },
547 <  { "addS",             Ev, Gv, XX },
548 <  { "addB",             Gb, Eb, XX },
549 <  { "addS",             Gv, Ev, XX },
550 <  { "addB",             AL, Ib, XX },
551 <  { "addS",             eAX, Iv, XX },
552 <  { "push{T|}",         es, XX, XX },
553 <  { "pop{T|}",          es, XX, XX },
546 >  { "addB",             Eb, Gb, XX, XX },
547 >  { "addS",             Ev, Gv, XX, XX },
548 >  { "addB",             Gb, Eb, XX, XX },
549 >  { "addS",             Gv, Ev, XX, XX },
550 >  { "addB",             AL, Ib, XX, XX },
551 >  { "addS",             eAX, Iv, XX, XX },
552 >  { "push{T|}",         es, XX, XX, XX },
553 >  { "pop{T|}",          es, XX, XX, XX },
554    /* 08 */
555 <  { "orB",              Eb, Gb, XX },
556 <  { "orS",              Ev, Gv, XX },
557 <  { "orB",              Gb, Eb, XX },
558 <  { "orS",              Gv, Ev, XX },
559 <  { "orB",              AL, Ib, XX },
560 <  { "orS",              eAX, Iv, XX },
561 <  { "push{T|}",         cs, XX, XX },
562 <  { "(bad)",            XX, XX, XX },   /* 0x0f extended opcode escape */
555 >  { "orB",              Eb, Gb, XX, XX },
556 >  { "orS",              Ev, Gv, XX, XX },
557 >  { "orB",              Gb, Eb, XX, XX },
558 >  { "orS",              Gv, Ev, XX, XX },
559 >  { "orB",              AL, Ib, XX, XX },
560 >  { "orS",              eAX, Iv, XX, XX },
561 >  { "push{T|}",         cs, XX, XX, XX },
562 >  { "(bad)",            XX, XX, XX, XX },       /* 0x0f extended opcode escape */
563    /* 10 */
564 <  { "adcB",             Eb, Gb, XX },
565 <  { "adcS",             Ev, Gv, XX },
566 <  { "adcB",             Gb, Eb, XX },
567 <  { "adcS",             Gv, Ev, XX },
568 <  { "adcB",             AL, Ib, XX },
569 <  { "adcS",             eAX, Iv, XX },
570 <  { "push{T|}",         ss, XX, XX },
571 <  { "popT|}",           ss, XX, XX },
564 >  { "adcB",             Eb, Gb, XX, XX },
565 >  { "adcS",             Ev, Gv, XX, XX },
566 >  { "adcB",             Gb, Eb, XX, XX },
567 >  { "adcS",             Gv, Ev, XX, XX },
568 >  { "adcB",             AL, Ib, XX, XX },
569 >  { "adcS",             eAX, Iv, XX, XX },
570 >  { "push{T|}",         ss, XX, XX, XX },
571 >  { "pop{T|}",          ss, XX, XX, XX },
572    /* 18 */
573 <  { "sbbB",             Eb, Gb, XX },
574 <  { "sbbS",             Ev, Gv, XX },
575 <  { "sbbB",             Gb, Eb, XX },
576 <  { "sbbS",             Gv, Ev, XX },
577 <  { "sbbB",             AL, Ib, XX },
578 <  { "sbbS",             eAX, Iv, XX },
579 <  { "push{T|}",         ds, XX, XX },
580 <  { "pop{T|}",          ds, XX, XX },
573 >  { "sbbB",             Eb, Gb, XX, XX },
574 >  { "sbbS",             Ev, Gv, XX, XX },
575 >  { "sbbB",             Gb, Eb, XX, XX },
576 >  { "sbbS",             Gv, Ev, XX, XX },
577 >  { "sbbB",             AL, Ib, XX, XX },
578 >  { "sbbS",             eAX, Iv, XX, XX },
579 >  { "push{T|}",         ds, XX, XX, XX },
580 >  { "pop{T|}",          ds, XX, XX, XX },
581    /* 20 */
582 <  { "andB",             Eb, Gb, XX },
583 <  { "andS",             Ev, Gv, XX },
584 <  { "andB",             Gb, Eb, XX },
585 <  { "andS",             Gv, Ev, XX },
586 <  { "andB",             AL, Ib, XX },
587 <  { "andS",             eAX, Iv, XX },
588 <  { "(bad)",            XX, XX, XX },   /* SEG ES prefix */
589 <  { "daa{|}",           XX, XX, XX },
582 >  { "andB",             Eb, Gb, XX, XX },
583 >  { "andS",             Ev, Gv, XX, XX },
584 >  { "andB",             Gb, Eb, XX, XX },
585 >  { "andS",             Gv, Ev, XX, XX },
586 >  { "andB",             AL, Ib, XX, XX },
587 >  { "andS",             eAX, Iv, XX, XX },
588 >  { "(bad)",            XX, XX, XX, XX },       /* SEG ES prefix */
589 >  { "daa{|}",           XX, XX, XX, XX },
590    /* 28 */
591 <  { "subB",             Eb, Gb, XX },
592 <  { "subS",             Ev, Gv, XX },
593 <  { "subB",             Gb, Eb, XX },
594 <  { "subS",             Gv, Ev, XX },
595 <  { "subB",             AL, Ib, XX },
596 <  { "subS",             eAX, Iv, XX },
597 <  { "(bad)",            XX, XX, XX },   /* SEG CS prefix */
598 <  { "das{|}",           XX, XX, XX },
591 >  { "subB",             Eb, Gb, XX, XX },
592 >  { "subS",             Ev, Gv, XX, XX },
593 >  { "subB",             Gb, Eb, XX, XX },
594 >  { "subS",             Gv, Ev, XX, XX },
595 >  { "subB",             AL, Ib, XX, XX },
596 >  { "subS",             eAX, Iv, XX, XX },
597 >  { "(bad)",            XX, XX, XX, XX },       /* SEG CS prefix */
598 >  { "das{|}",           XX, XX, XX, XX },
599    /* 30 */
600 <  { "xorB",             Eb, Gb, XX },
601 <  { "xorS",             Ev, Gv, XX },
602 <  { "xorB",             Gb, Eb, XX },
603 <  { "xorS",             Gv, Ev, XX },
604 <  { "xorB",             AL, Ib, XX },
605 <  { "xorS",             eAX, Iv, XX },
606 <  { "(bad)",            XX, XX, XX },   /* SEG SS prefix */
607 <  { "aaa{|}",           XX, XX, XX },
600 >  { "xorB",             Eb, Gb, XX, XX },
601 >  { "xorS",             Ev, Gv, XX, XX },
602 >  { "xorB",             Gb, Eb, XX, XX },
603 >  { "xorS",             Gv, Ev, XX, XX },
604 >  { "xorB",             AL, Ib, XX, XX },
605 >  { "xorS",             eAX, Iv, XX, XX },
606 >  { "(bad)",            XX, XX, XX, XX },       /* SEG SS prefix */
607 >  { "aaa{|}",           XX, XX, XX, XX },
608    /* 38 */
609 <  { "cmpB",             Eb, Gb, XX },
610 <  { "cmpS",             Ev, Gv, XX },
611 <  { "cmpB",             Gb, Eb, XX },
612 <  { "cmpS",             Gv, Ev, XX },
613 <  { "cmpB",             AL, Ib, XX },
614 <  { "cmpS",             eAX, Iv, XX },
615 <  { "(bad)",            XX, XX, XX },   /* SEG DS prefix */
616 <  { "aas{|}",           XX, XX, XX },
609 >  { "cmpB",             Eb, Gb, XX, XX },
610 >  { "cmpS",             Ev, Gv, XX, XX },
611 >  { "cmpB",             Gb, Eb, XX, XX },
612 >  { "cmpS",             Gv, Ev, XX, XX },
613 >  { "cmpB",             AL, Ib, XX, XX },
614 >  { "cmpS",             eAX, Iv, XX, XX },
615 >  { "(bad)",            XX, XX, XX, XX },       /* SEG DS prefix */
616 >  { "aas{|}",           XX, XX, XX, XX },
617    /* 40 */
618 <  { "inc{S|}",          RMeAX, XX, XX },
619 <  { "inc{S|}",          RMeCX, XX, XX },
620 <  { "inc{S|}",          RMeDX, XX, XX },
621 <  { "inc{S|}",          RMeBX, XX, XX },
622 <  { "inc{S|}",          RMeSP, XX, XX },
623 <  { "inc{S|}",          RMeBP, XX, XX },
624 <  { "inc{S|}",          RMeSI, XX, XX },
625 <  { "inc{S|}",          RMeDI, XX, XX },
618 >  { "inc{S|}",          RMeAX, XX, XX, XX },
619 >  { "inc{S|}",          RMeCX, XX, XX, XX },
620 >  { "inc{S|}",          RMeDX, XX, XX, XX },
621 >  { "inc{S|}",          RMeBX, XX, XX, XX },
622 >  { "inc{S|}",          RMeSP, XX, XX, XX },
623 >  { "inc{S|}",          RMeBP, XX, XX, XX },
624 >  { "inc{S|}",          RMeSI, XX, XX, XX },
625 >  { "inc{S|}",          RMeDI, XX, XX, XX },
626    /* 48 */
627 <  { "dec{S|}",          RMeAX, XX, XX },
628 <  { "dec{S|}",          RMeCX, XX, XX },
629 <  { "dec{S|}",          RMeDX, XX, XX },
630 <  { "dec{S|}",          RMeBX, XX, XX },
631 <  { "dec{S|}",          RMeSP, XX, XX },
632 <  { "dec{S|}",          RMeBP, XX, XX },
633 <  { "dec{S|}",          RMeSI, XX, XX },
634 <  { "dec{S|}",          RMeDI, XX, XX },
627 >  { "dec{S|}",          RMeAX, XX, XX, XX },
628 >  { "dec{S|}",          RMeCX, XX, XX, XX },
629 >  { "dec{S|}",          RMeDX, XX, XX, XX },
630 >  { "dec{S|}",          RMeBX, XX, XX, XX },
631 >  { "dec{S|}",          RMeSP, XX, XX, XX },
632 >  { "dec{S|}",          RMeBP, XX, XX, XX },
633 >  { "dec{S|}",          RMeSI, XX, XX, XX },
634 >  { "dec{S|}",          RMeDI, XX, XX, XX },
635    /* 50 */
636 <  { "pushS",            RMrAX, XX, XX },
637 <  { "pushS",            RMrCX, XX, XX },
638 <  { "pushS",            RMrDX, XX, XX },
639 <  { "pushS",            RMrBX, XX, XX },
640 <  { "pushS",            RMrSP, XX, XX },
641 <  { "pushS",            RMrBP, XX, XX },
642 <  { "pushS",            RMrSI, XX, XX },
643 <  { "pushS",            RMrDI, XX, XX },
636 >  { "pushV",            RMrAX, XX, XX, XX },
637 >  { "pushV",            RMrCX, XX, XX, XX },
638 >  { "pushV",            RMrDX, XX, XX, XX },
639 >  { "pushV",            RMrBX, XX, XX, XX },
640 >  { "pushV",            RMrSP, XX, XX, XX },
641 >  { "pushV",            RMrBP, XX, XX, XX },
642 >  { "pushV",            RMrSI, XX, XX, XX },
643 >  { "pushV",            RMrDI, XX, XX, XX },
644    /* 58 */
645 <  { "popS",             RMrAX, XX, XX },
646 <  { "popS",             RMrCX, XX, XX },
647 <  { "popS",             RMrDX, XX, XX },
648 <  { "popS",             RMrBX, XX, XX },
649 <  { "popS",             RMrSP, XX, XX },
650 <  { "popS",             RMrBP, XX, XX },
651 <  { "popS",             RMrSI, XX, XX },
652 <  { "popS",             RMrDI, XX, XX },
645 >  { "popV",             RMrAX, XX, XX, XX },
646 >  { "popV",             RMrCX, XX, XX, XX },
647 >  { "popV",             RMrDX, XX, XX, XX },
648 >  { "popV",             RMrBX, XX, XX, XX },
649 >  { "popV",             RMrSP, XX, XX, XX },
650 >  { "popV",             RMrBP, XX, XX, XX },
651 >  { "popV",             RMrSI, XX, XX, XX },
652 >  { "popV",             RMrDI, XX, XX, XX },
653    /* 60 */
573  { "pusha{P|}",        XX, XX, XX },
574  { "popa{P|}",         XX, XX, XX },
575  { "bound{S|}",        Gv, Ma, XX },
654    { X86_64_0 },
655 <  { "(bad)",            XX, XX, XX },   /* seg fs */
656 <  { "(bad)",            XX, XX, XX },   /* seg gs */
657 <  { "(bad)",            XX, XX, XX },   /* op size prefix */
658 <  { "(bad)",            XX, XX, XX },   /* adr size prefix */
655 >  { X86_64_1 },
656 >  { X86_64_2 },
657 >  { X86_64_3 },
658 >  { "(bad)",            XX, XX, XX, XX },       /* seg fs */
659 >  { "(bad)",            XX, XX, XX, XX },       /* seg gs */
660 >  { "(bad)",            XX, XX, XX, XX },       /* op size prefix */
661 >  { "(bad)",            XX, XX, XX, XX },       /* adr size prefix */
662    /* 68 */
663 <  { "pushT",            Iq, XX, XX },
664 <  { "imulS",            Gv, Ev, Iv },
665 <  { "pushT",            sIb, XX, XX },
666 <  { "imulS",            Gv, Ev, sIb },
667 <  { "ins{b||b|}",       Yb, indirDX, XX },
668 <  { "ins{R||R|}",       Yv, indirDX, XX },
669 <  { "outs{b||b|}",      indirDX, Xb, XX },
670 <  { "outs{R||R|}",      indirDX, Xv, XX },
663 >  { "pushT",            Iq, XX, XX, XX },
664 >  { "imulS",            Gv, Ev, Iv, XX },
665 >  { "pushT",            sIb, XX, XX, XX },
666 >  { "imulS",            Gv, Ev, sIb, XX },
667 >  { "ins{b||b|}",       Ybr, indirDX, XX, XX },
668 >  { "ins{R||G|}",       Yzr, indirDX, XX, XX },
669 >  { "outs{b||b|}",      indirDXr, Xb, XX, XX },
670 >  { "outs{R||G|}",      indirDXr, Xz, XX, XX },
671    /* 70 */
672 <  { "joH",              Jb, XX, cond_jump_flag },
673 <  { "jnoH",             Jb, XX, cond_jump_flag },
674 <  { "jbH",              Jb, XX, cond_jump_flag },
675 <  { "jaeH",             Jb, XX, cond_jump_flag },
676 <  { "jeH",              Jb, XX, cond_jump_flag },
677 <  { "jneH",             Jb, XX, cond_jump_flag },
678 <  { "jbeH",             Jb, XX, cond_jump_flag },
679 <  { "jaH",              Jb, XX, cond_jump_flag },
672 >  { "joH",              Jb, XX, cond_jump_flag, XX },
673 >  { "jnoH",             Jb, XX, cond_jump_flag, XX },
674 >  { "jbH",              Jb, XX, cond_jump_flag, XX },
675 >  { "jaeH",             Jb, XX, cond_jump_flag, XX },
676 >  { "jeH",              Jb, XX, cond_jump_flag, XX },
677 >  { "jneH",             Jb, XX, cond_jump_flag, XX },
678 >  { "jbeH",             Jb, XX, cond_jump_flag, XX },
679 >  { "jaH",              Jb, XX, cond_jump_flag, XX },
680    /* 78 */
681 <  { "jsH",              Jb, XX, cond_jump_flag },
682 <  { "jnsH",             Jb, XX, cond_jump_flag },
683 <  { "jpH",              Jb, XX, cond_jump_flag },
684 <  { "jnpH",             Jb, XX, cond_jump_flag },
685 <  { "jlH",              Jb, XX, cond_jump_flag },
686 <  { "jgeH",             Jb, XX, cond_jump_flag },
687 <  { "jleH",             Jb, XX, cond_jump_flag },
688 <  { "jgH",              Jb, XX, cond_jump_flag },
681 >  { "jsH",              Jb, XX, cond_jump_flag, XX },
682 >  { "jnsH",             Jb, XX, cond_jump_flag, XX },
683 >  { "jpH",              Jb, XX, cond_jump_flag, XX },
684 >  { "jnpH",             Jb, XX, cond_jump_flag, XX },
685 >  { "jlH",              Jb, XX, cond_jump_flag, XX },
686 >  { "jgeH",             Jb, XX, cond_jump_flag, XX },
687 >  { "jleH",             Jb, XX, cond_jump_flag, XX },
688 >  { "jgH",              Jb, XX, cond_jump_flag, XX },
689    /* 80 */
690    { GRP1b },
691    { GRP1S },
692 <  { "(bad)",            XX, XX, XX },
692 >  { "(bad)",            XX, XX, XX, XX },
693    { GRP1Ss },
694 <  { "testB",            Eb, Gb, XX },
695 <  { "testS",            Ev, Gv, XX },
696 <  { "xchgB",            Eb, Gb, XX },
697 <  { "xchgS",            Ev, Gv, XX },
694 >  { "testB",            Eb, Gb, XX, XX },
695 >  { "testS",            Ev, Gv, XX, XX },
696 >  { "xchgB",            Eb, Gb, XX, XX },
697 >  { "xchgS",            Ev, Gv, XX, XX },
698    /* 88 */
699 <  { "movB",             Eb, Gb, XX },
700 <  { "movS",             Ev, Gv, XX },
701 <  { "movB",             Gb, Eb, XX },
702 <  { "movS",             Gv, Ev, XX },
703 <  { "movQ",             Ev, Sw, XX },
704 <  { "leaS",             Gv, M, XX },
705 <  { "movQ",             Sw, Ev, XX },
706 <  { "popU",             Ev, XX, XX },
699 >  { "movB",             Eb, Gb, XX, XX },
700 >  { "movS",             Ev, Gv, XX, XX },
701 >  { "movB",             Gb, Eb, XX, XX },
702 >  { "movS",             Gv, Ev, XX, XX },
703 >  { "movD",             Sv, Sw, XX, XX },
704 >  { "leaS",             Gv, M, XX, XX },
705 >  { "movD",             Sw, Sv, XX, XX },
706 >  { "popU",             stackEv, XX, XX, XX },
707    /* 90 */
708 <  { "nop",              XX, XX, XX },
709 <  /* FIXME: NOP with REPz prefix is called PAUSE.  */
710 <  { "xchgS",            RMeCX, eAX, XX },
711 <  { "xchgS",            RMeDX, eAX, XX },
712 <  { "xchgS",            RMeBX, eAX, XX },
713 <  { "xchgS",            RMeSP, eAX, XX },
714 <  { "xchgS",            RMeBP, eAX, XX },
715 <  { "xchgS",            RMeSI, eAX, XX },
635 <  { "xchgS",            RMeDI, eAX, XX },
708 >  { "xchgS",            NOP_Fixup1, eAX_reg, NOP_Fixup2, eAX_reg, XX, XX },
709 >  { "xchgS",            RMeCX, eAX, XX, XX },
710 >  { "xchgS",            RMeDX, eAX, XX, XX },
711 >  { "xchgS",            RMeBX, eAX, XX, XX },
712 >  { "xchgS",            RMeSP, eAX, XX, XX },
713 >  { "xchgS",            RMeBP, eAX, XX, XX },
714 >  { "xchgS",            RMeSI, eAX, XX, XX },
715 >  { "xchgS",            RMeDI, eAX, XX, XX },
716    /* 98 */
717 <  { "cW{tR||tR|}",      XX, XX, XX },
718 <  { "cR{tO||tO|}",      XX, XX, XX },
719 <  { "lcall{T|}",        Ap, XX, XX },
720 <  { "(bad)",            XX, XX, XX },   /* fwait */
721 <  { "pushfT",           XX, XX, XX },
722 <  { "popfT",            XX, XX, XX },
723 <  { "sahf{|}",          XX, XX, XX },
724 <  { "lahf{|}",          XX, XX, XX },
717 >  { "cW{t||t|}R",       XX, XX, XX, XX },
718 >  { "cR{t||t|}O",       XX, XX, XX, XX },
719 >  { "Jcall{T|}",        Ap, XX, XX, XX },
720 >  { "(bad)",            XX, XX, XX, XX },       /* fwait */
721 >  { "pushfT",           XX, XX, XX, XX },
722 >  { "popfT",            XX, XX, XX, XX },
723 >  { "sahf{|}",          XX, XX, XX, XX },
724 >  { "lahf{|}",          XX, XX, XX, XX },
725    /* a0 */
726 <  { "movB",             AL, Ob64, XX },
727 <  { "movS",             eAX, Ov64, XX },
728 <  { "movB",             Ob64, AL, XX },
729 <  { "movS",             Ov64, eAX, XX },
730 <  { "movs{b||b|}",      Yb, Xb, XX },
731 <  { "movs{R||R|}",      Yv, Xv, XX },
732 <  { "cmps{b||b|}",      Xb, Yb, XX },
733 <  { "cmps{R||R|}",      Xv, Yv, XX },
726 >  { "movB",             AL, Ob, XX, XX },
727 >  { "movS",             eAX, Ov, XX, XX },
728 >  { "movB",             Ob, AL, XX, XX },
729 >  { "movS",             Ov, eAX, XX, XX },
730 >  { "movs{b||b|}",      Ybr, Xb, XX, XX },
731 >  { "movs{R||R|}",      Yvr, Xv, XX, XX },
732 >  { "cmps{b||b|}",      Xb, Yb, XX, XX },
733 >  { "cmps{R||R|}",      Xv, Yv, XX, XX },
734    /* a8 */
735 <  { "testB",            AL, Ib, XX },
736 <  { "testS",            eAX, Iv, XX },
737 <  { "stosB",            Yb, AL, XX },
738 <  { "stosS",            Yv, eAX, XX },
739 <  { "lodsB",            AL, Xb, XX },
740 <  { "lodsS",            eAX, Xv, XX },
741 <  { "scasB",            AL, Yb, XX },
742 <  { "scasS",            eAX, Yv, XX },
735 >  { "testB",            AL, Ib, XX, XX },
736 >  { "testS",            eAX, Iv, XX, XX },
737 >  { "stosB",            Ybr, AL, XX, XX },
738 >  { "stosS",            Yvr, eAX, XX, XX },
739 >  { "lodsB",            ALr, Xb, XX, XX },
740 >  { "lodsS",            eAXr, Xv, XX, XX },
741 >  { "scasB",            AL, Yb, XX, XX },
742 >  { "scasS",            eAX, Yv, XX, XX },
743    /* b0 */
744 <  { "movB",             RMAL, Ib, XX },
745 <  { "movB",             RMCL, Ib, XX },
746 <  { "movB",             RMDL, Ib, XX },
747 <  { "movB",             RMBL, Ib, XX },
748 <  { "movB",             RMAH, Ib, XX },
749 <  { "movB",             RMCH, Ib, XX },
750 <  { "movB",             RMDH, Ib, XX },
751 <  { "movB",             RMBH, Ib, XX },
744 >  { "movB",             RMAL, Ib, XX, XX },
745 >  { "movB",             RMCL, Ib, XX, XX },
746 >  { "movB",             RMDL, Ib, XX, XX },
747 >  { "movB",             RMBL, Ib, XX, XX },
748 >  { "movB",             RMAH, Ib, XX, XX },
749 >  { "movB",             RMCH, Ib, XX, XX },
750 >  { "movB",             RMDH, Ib, XX, XX },
751 >  { "movB",             RMBH, Ib, XX, XX },
752    /* b8 */
753 <  { "movS",             RMeAX, Iv64, XX },
754 <  { "movS",             RMeCX, Iv64, XX },
755 <  { "movS",             RMeDX, Iv64, XX },
756 <  { "movS",             RMeBX, Iv64, XX },
757 <  { "movS",             RMeSP, Iv64, XX },
758 <  { "movS",             RMeBP, Iv64, XX },
759 <  { "movS",             RMeSI, Iv64, XX },
760 <  { "movS",             RMeDI, Iv64, XX },
753 >  { "movS",             RMeAX, Iv64, XX, XX },
754 >  { "movS",             RMeCX, Iv64, XX, XX },
755 >  { "movS",             RMeDX, Iv64, XX, XX },
756 >  { "movS",             RMeBX, Iv64, XX, XX },
757 >  { "movS",             RMeSP, Iv64, XX, XX },
758 >  { "movS",             RMeBP, Iv64, XX, XX },
759 >  { "movS",             RMeSI, Iv64, XX, XX },
760 >  { "movS",             RMeDI, Iv64, XX, XX },
761    /* c0 */
762    { GRP2b },
763    { GRP2S },
764 <  { "retT",             Iw, XX, XX },
765 <  { "retT",             XX, XX, XX },
766 <  { "les{S|}",          Gv, Mp, XX },
767 <  { "ldsS",             Gv, Mp, XX },
768 <  { "movA",             Eb, Ib, XX },
769 <  { "movQ",             Ev, Iv, XX },
764 >  { "retT",             Iw, XX, XX, XX },
765 >  { "retT",             XX, XX, XX, XX },
766 >  { "les{S|}",          Gv, Mp, XX, XX },
767 >  { "ldsS",             Gv, Mp, XX, XX },
768 >  { GRP11_C6 },
769 >  { GRP11_C7 },
770    /* c8 */
771 <  { "enterT",           Iw, Ib, XX },
772 <  { "leaveT",           XX, XX, XX },
773 <  { "lretP",            Iw, XX, XX },
774 <  { "lretP",            XX, XX, XX },
775 <  { "int3",             XX, XX, XX },
776 <  { "int",              Ib, XX, XX },
777 <  { "into{|}",          XX, XX, XX },
778 <  { "iretP",            XX, XX, XX },
771 >  { "enterT",           Iw, Ib, XX, XX },
772 >  { "leaveT",           XX, XX, XX, XX },
773 >  { "lretP",            Iw, XX, XX, XX },
774 >  { "lretP",            XX, XX, XX, XX },
775 >  { "int3",             XX, XX, XX, XX },
776 >  { "int",              Ib, XX, XX, XX },
777 >  { "into{|}",          XX, XX, XX, XX },
778 >  { "iretP",            XX, XX, XX, XX },
779    /* d0 */
780    { GRP2b_one },
781    { GRP2S_one },
782    { GRP2b_cl },
783    { GRP2S_cl },
784 <  { "aam{|}",           sIb, XX, XX },
785 <  { "aad{|}",           sIb, XX, XX },
786 <  { "(bad)",            XX, XX, XX },
787 <  { "xlat",             DSBX, XX, XX },
784 >  { "aam{|}",           sIb, XX, XX, XX },
785 >  { "aad{|}",           sIb, XX, XX, XX },
786 >  { "(bad)",            XX, XX, XX, XX },
787 >  { "xlat",             DSBX, XX, XX, XX },
788    /* d8 */
789    { FLOAT },
790    { FLOAT },
# Line 715 | Line 795 | static const struct dis386 dis386[] = {
795    { FLOAT },
796    { FLOAT },
797    /* e0 */
798 <  { "loopneFH",         Jb, XX, loop_jcxz_flag },
799 <  { "loopeFH",          Jb, XX, loop_jcxz_flag },
800 <  { "loopFH",           Jb, XX, loop_jcxz_flag },
801 <  { "jEcxzH",           Jb, XX, loop_jcxz_flag },
802 <  { "inB",              AL, Ib, XX },
803 <  { "inS",              eAX, Ib, XX },
804 <  { "outB",             Ib, AL, XX },
805 <  { "outS",             Ib, eAX, XX },
798 >  { "loopneFH",         Jb, XX, loop_jcxz_flag, XX },
799 >  { "loopeFH",          Jb, XX, loop_jcxz_flag, XX },
800 >  { "loopFH",           Jb, XX, loop_jcxz_flag, XX },
801 >  { "jEcxzH",           Jb, XX, loop_jcxz_flag, XX },
802 >  { "inB",              AL, Ib, XX, XX },
803 >  { "inG",              zAX, Ib, XX, XX },
804 >  { "outB",             Ib, AL, XX, XX },
805 >  { "outG",             Ib, zAX, XX, XX },
806    /* e8 */
807 <  { "callT",            Jv, XX, XX },
808 <  { "jmpT",             Jv, XX, XX },
809 <  { "ljmp{T|}",         Ap, XX, XX },
810 <  { "jmp",              Jb, XX, XX },
811 <  { "inB",              AL, indirDX, XX },
812 <  { "inS",              eAX, indirDX, XX },
813 <  { "outB",             indirDX, AL, XX },
814 <  { "outS",             indirDX, eAX, XX },
807 >  { "callT",            Jv, XX, XX, XX },
808 >  { "jmpT",             Jv, XX, XX, XX },
809 >  { "Jjmp{T|}",         Ap, XX, XX, XX },
810 >  { "jmp",              Jb, XX, XX, XX },
811 >  { "inB",              AL, indirDX, XX, XX },
812 >  { "inG",              zAX, indirDX, XX, XX },
813 >  { "outB",             indirDX, AL, XX, XX },
814 >  { "outG",             indirDX, zAX, XX, XX },
815    /* f0 */
816 <  { "(bad)",            XX, XX, XX },   /* lock prefix */
817 <  { "(bad)",            XX, XX, XX },
818 <  { "(bad)",            XX, XX, XX },   /* repne */
819 <  { "(bad)",            XX, XX, XX },   /* repz */
820 <  { "hlt",              XX, XX, XX },
821 <  { "cmc",              XX, XX, XX },
816 >  { "(bad)",            XX, XX, XX, XX },       /* lock prefix */
817 >  { "icebp",            XX, XX, XX, XX },
818 >  { "(bad)",            XX, XX, XX, XX },       /* repne */
819 >  { "(bad)",            XX, XX, XX, XX },       /* repz */
820 >  { "hlt",              XX, XX, XX, XX },
821 >  { "cmc",              XX, XX, XX, XX },
822    { GRP3b },
823    { GRP3S },
824    /* f8 */
825 <  { "clc",              XX, XX, XX },
826 <  { "stc",              XX, XX, XX },
827 <  { "cli",              XX, XX, XX },
828 <  { "sti",              XX, XX, XX },
829 <  { "cld",              XX, XX, XX },
830 <  { "std",              XX, XX, XX },
825 >  { "clc",              XX, XX, XX, XX },
826 >  { "stc",              XX, XX, XX, XX },
827 >  { "cli",              XX, XX, XX, XX },
828 >  { "sti",              XX, XX, XX, XX },
829 >  { "cld",              XX, XX, XX, XX },
830 >  { "std",              XX, XX, XX, XX },
831    { GRP4 },
832    { GRP5 },
833   };
# Line 756 | Line 836 | static const struct dis386 dis386_twobyt
836    /* 00 */
837    { GRP6 },
838    { GRP7 },
839 <  { "larS",             Gv, Ew, XX },
840 <  { "lslS",             Gv, Ew, XX },
841 <  { "(bad)",            XX, XX, XX },
842 <  { "syscall",          XX, XX, XX },
843 <  { "clts",             XX, XX, XX },
844 <  { "sysretP",          XX, XX, XX },
839 >  { "larS",             Gv, Ew, XX, XX },
840 >  { "lslS",             Gv, Ew, XX, XX },
841 >  { "(bad)",            XX, XX, XX, XX },
842 >  { "syscall",          XX, XX, XX, XX },
843 >  { "clts",             XX, XX, XX, XX },
844 >  { "sysretP",          XX, XX, XX, XX },
845    /* 08 */
846 <  { "invd",             XX, XX, XX },
847 <  { "wbinvd",           XX, XX, XX },
848 <  { "(bad)",            XX, XX, XX },
849 <  { "ud2a",             XX, XX, XX },
850 <  { "(bad)",            XX, XX, XX },
846 >  { "invd",             XX, XX, XX, XX },
847 >  { "wbinvd",           XX, XX, XX, XX },
848 >  { "(bad)",            XX, XX, XX, XX },
849 >  { "ud2a",             XX, XX, XX, XX },
850 >  { "(bad)",            XX, XX, XX, XX },
851    { GRPAMD },
852 <  { "femms",            XX, XX, XX },
853 <  { "",                 MX, EM, OPSUF }, /* See OP_3DNowSuffix.  */
852 >  { "femms",            XX, XX, XX, XX },
853 >  { "",                 MX, EM, OPSUF, XX }, /* See OP_3DNowSuffix.  */
854    /* 10 */
855    { PREGRP8 },
856    { PREGRP9 },
857 <  { "movlpX",           XM, EX, SIMD_Fixup, 'h' }, /* really only 2 operands */
858 <  { "movlpX",           EX, XM, SIMD_Fixup, 'h' },
859 <  { "unpcklpX",         XM, EX, XX },
860 <  { "unpckhpX",         XM, EX, XX },
861 <  { "movhpX",           XM, EX, SIMD_Fixup, 'l' },
862 <  { "movhpX",           EX, XM, SIMD_Fixup, 'l' },
857 >  { PREGRP30 },
858 >  { "movlpX",           EX, XM, SIMD_Fixup, 'h', XX },
859 >  { "unpcklpX",         XM, EX, XX, XX },
860 >  { "unpckhpX",         XM, EX, XX, XX },
861 >  { PREGRP31 },
862 >  { "movhpX",           EX, XM, SIMD_Fixup, 'l', XX },
863    /* 18 */
864 <  { GRP14 },
865 <  { "(bad)",            XX, XX, XX },
866 <  { "(bad)",            XX, XX, XX },
867 <  { "(bad)",            XX, XX, XX },
868 <  { "(bad)",            XX, XX, XX },
869 <  { "(bad)",            XX, XX, XX },
870 <  { "(bad)",            XX, XX, XX },
871 <  { "(bad)",            XX, XX, XX },
864 >  { GRP16 },
865 >  { "(bad)",            XX, XX, XX, XX },
866 >  { "(bad)",            XX, XX, XX, XX },
867 >  { "(bad)",            XX, XX, XX, XX },
868 >  { "(bad)",            XX, XX, XX, XX },
869 >  { "(bad)",            XX, XX, XX, XX },
870 >  { "(bad)",            XX, XX, XX, XX },
871 >  { "nopQ",             Ev, XX, XX, XX },
872    /* 20 */
873 <  { "movL",             Rm, Cm, XX },
874 <  { "movL",             Rm, Dm, XX },
875 <  { "movL",             Cm, Rm, XX },
876 <  { "movL",             Dm, Rm, XX },
877 <  { "movL",             Rd, Td, XX },
878 <  { "(bad)",            XX, XX, XX },
879 <  { "movL",             Td, Rd, XX },
880 <  { "(bad)",            XX, XX, XX },
873 >  { "movZ",             Rm, Cm, XX, XX },
874 >  { "movZ",             Rm, Dm, XX, XX },
875 >  { "movZ",             Cm, Rm, XX, XX },
876 >  { "movZ",             Dm, Rm, XX, XX },
877 >  { "movL",             Rd, Td, XX, XX },
878 >  { "(bad)",            XX, XX, XX, XX },
879 >  { "movL",             Td, Rd, XX, XX },
880 >  { "(bad)",            XX, XX, XX, XX },
881    /* 28 */
882 <  { "movapX",           XM, EX, XX },
883 <  { "movapX",           EX, XM, XX },
882 >  { "movapX",           XM, EX, XX, XX },
883 >  { "movapX",           EX, XM, XX, XX },
884    { PREGRP2 },
885 <  { "movntpX",          Ev, XM, XX },
885 >  { PREGRP33 },
886    { PREGRP4 },
887    { PREGRP3 },
888 <  { "ucomisX",          XM,EX, XX },
889 <  { "comisX",           XM,EX, XX },
888 >  { "ucomisX",          XM,EX, XX, XX },
889 >  { "comisX",           XM,EX, XX, XX },
890    /* 30 */
891 <  { "wrmsr",            XX, XX, XX },
892 <  { "rdtsc",            XX, XX, XX },
893 <  { "rdmsr",            XX, XX, XX },
894 <  { "rdpmc",            XX, XX, XX },
895 <  { "sysenter",         XX, XX, XX },
896 <  { "sysexit",          XX, XX, XX },
897 <  { "(bad)",            XX, XX, XX },
898 <  { "(bad)",            XX, XX, XX },
891 >  { "wrmsr",            XX, XX, XX, XX },
892 >  { "rdtsc",            XX, XX, XX, XX },
893 >  { "rdmsr",            XX, XX, XX, XX },
894 >  { "rdpmc",            XX, XX, XX, XX },
895 >  { "sysenter",         XX, XX, XX, XX },
896 >  { "sysexit",          XX, XX, XX, XX },
897 >  { "(bad)",            XX, XX, XX, XX },
898 >  { "(bad)",            XX, XX, XX, XX },
899    /* 38 */
900 <  { "(bad)",            XX, XX, XX },
901 <  { "(bad)",            XX, XX, XX },
902 <  { "(bad)",            XX, XX, XX },
903 <  { "(bad)",            XX, XX, XX },
904 <  { "(bad)",            XX, XX, XX },
905 <  { "(bad)",            XX, XX, XX },
906 <  { "(bad)",            XX, XX, XX },
907 <  { "(bad)",            XX, XX, XX },
900 >  { THREE_BYTE_0 },
901 >  { "(bad)",            XX, XX, XX, XX },
902 >  { THREE_BYTE_1 },
903 >  { "(bad)",            XX, XX, XX, XX },
904 >  { "(bad)",            XX, XX, XX, XX },
905 >  { "(bad)",            XX, XX, XX, XX },
906 >  { "(bad)",            XX, XX, XX, XX },
907 >  { "(bad)",            XX, XX, XX, XX },
908    /* 40 */
909 <  { "cmovo",            Gv, Ev, XX },
910 <  { "cmovno",           Gv, Ev, XX },
911 <  { "cmovb",            Gv, Ev, XX },
912 <  { "cmovae",           Gv, Ev, XX },
913 <  { "cmove",            Gv, Ev, XX },
914 <  { "cmovne",           Gv, Ev, XX },
915 <  { "cmovbe",           Gv, Ev, XX },
916 <  { "cmova",            Gv, Ev, XX },
909 >  { "cmovo",            Gv, Ev, XX, XX },
910 >  { "cmovno",           Gv, Ev, XX, XX },
911 >  { "cmovb",            Gv, Ev, XX, XX },
912 >  { "cmovae",           Gv, Ev, XX, XX },
913 >  { "cmove",            Gv, Ev, XX, XX },
914 >  { "cmovne",           Gv, Ev, XX, XX },
915 >  { "cmovbe",           Gv, Ev, XX, XX },
916 >  { "cmova",            Gv, Ev, XX, XX },
917    /* 48 */
918 <  { "cmovs",            Gv, Ev, XX },
919 <  { "cmovns",           Gv, Ev, XX },
920 <  { "cmovp",            Gv, Ev, XX },
921 <  { "cmovnp",           Gv, Ev, XX },
922 <  { "cmovl",            Gv, Ev, XX },
923 <  { "cmovge",           Gv, Ev, XX },
924 <  { "cmovle",           Gv, Ev, XX },
925 <  { "cmovg",            Gv, Ev, XX },
918 >  { "cmovs",            Gv, Ev, XX, XX },
919 >  { "cmovns",           Gv, Ev, XX, XX },
920 >  { "cmovp",            Gv, Ev, XX, XX },
921 >  { "cmovnp",           Gv, Ev, XX, XX },
922 >  { "cmovl",            Gv, Ev, XX, XX },
923 >  { "cmovge",           Gv, Ev, XX, XX },
924 >  { "cmovle",           Gv, Ev, XX, XX },
925 >  { "cmovg",            Gv, Ev, XX, XX },
926    /* 50 */
927 <  { "movmskpX",         Gd, XS, XX },
927 >  { "movmskpX",         Gdq, XS, XX, XX },
928    { PREGRP13 },
929    { PREGRP12 },
930    { PREGRP11 },
931 <  { "andpX",            XM, EX, XX },
932 <  { "andnpX",           XM, EX, XX },
933 <  { "orpX",             XM, EX, XX },
934 <  { "xorpX",            XM, EX, XX },
931 >  { "andpX",            XM, EX, XX, XX },
932 >  { "andnpX",           XM, EX, XX, XX },
933 >  { "orpX",             XM, EX, XX, XX },
934 >  { "xorpX",            XM, EX, XX, XX },
935    /* 58 */
936    { PREGRP0 },
937    { PREGRP10 },
# Line 862 | Line 942 | static const struct dis386 dis386_twobyt
942    { PREGRP5 },
943    { PREGRP6 },
944    /* 60 */
945 <  { "punpcklbw",        MX, EM, XX },
946 <  { "punpcklwd",        MX, EM, XX },
947 <  { "punpckldq",        MX, EM, XX },
948 <  { "packsswb",         MX, EM, XX },
949 <  { "pcmpgtb",          MX, EM, XX },
950 <  { "pcmpgtw",          MX, EM, XX },
951 <  { "pcmpgtd",          MX, EM, XX },
952 <  { "packuswb",         MX, EM, XX },
945 >  { "punpcklbw",        MX, EM, XX, XX },
946 >  { "punpcklwd",        MX, EM, XX, XX },
947 >  { "punpckldq",        MX, EM, XX, XX },
948 >  { "packsswb",         MX, EM, XX, XX },
949 >  { "pcmpgtb",          MX, EM, XX, XX },
950 >  { "pcmpgtw",          MX, EM, XX, XX },
951 >  { "pcmpgtd",          MX, EM, XX, XX },
952 >  { "packuswb",         MX, EM, XX, XX },
953    /* 68 */
954 <  { "punpckhbw",        MX, EM, XX },
955 <  { "punpckhwd",        MX, EM, XX },
956 <  { "punpckhdq",        MX, EM, XX },
957 <  { "packssdw",         MX, EM, XX },
954 >  { "punpckhbw",        MX, EM, XX, XX },
955 >  { "punpckhwd",        MX, EM, XX, XX },
956 >  { "punpckhdq",        MX, EM, XX, XX },
957 >  { "packssdw",         MX, EM, XX, XX },
958    { PREGRP26 },
959    { PREGRP24 },
960 <  { "movd",             MX, Ed, XX },
960 >  { "movd",             MX, Edq, XX, XX },
961    { PREGRP19 },
962    /* 70 */
963    { PREGRP22 },
884  { GRP10 },
885  { GRP11 },
964    { GRP12 },
965 <  { "pcmpeqb",          MX, EM, XX },
966 <  { "pcmpeqw",          MX, EM, XX },
967 <  { "pcmpeqd",          MX, EM, XX },
968 <  { "emms",             XX, XX, XX },
965 >  { GRP13 },
966 >  { GRP14 },
967 >  { "pcmpeqb",          MX, EM, XX, XX },
968 >  { "pcmpeqw",          MX, EM, XX, XX },
969 >  { "pcmpeqd",          MX, EM, XX, XX },
970 >  { "emms",             XX, XX, XX, XX },
971    /* 78 */
972 <  { "(bad)",            XX, XX, XX },
973 <  { "(bad)",            XX, XX, XX },
974 <  { "(bad)",            XX, XX, XX },
975 <  { "(bad)",            XX, XX, XX },
976 <  { "(bad)",            XX, XX, XX },
977 <  { "(bad)",            XX, XX, XX },
972 >  { PREGRP34 },
973 >  { PREGRP35 },
974 >  { "(bad)",            XX, XX, XX, XX },
975 >  { "(bad)",            XX, XX, XX, XX },
976 >  { PREGRP28 },
977 >  { PREGRP29 },
978    { PREGRP23 },
979    { PREGRP20 },
980    /* 80 */
981 <  { "joH",              Jv, XX, cond_jump_flag },
982 <  { "jnoH",             Jv, XX, cond_jump_flag },
983 <  { "jbH",              Jv, XX, cond_jump_flag },
984 <  { "jaeH",             Jv, XX, cond_jump_flag },
985 <  { "jeH",              Jv, XX, cond_jump_flag },
986 <  { "jneH",             Jv, XX, cond_jump_flag },
987 <  { "jbeH",             Jv, XX, cond_jump_flag },
988 <  { "jaH",              Jv, XX, cond_jump_flag },
981 >  { "joH",              Jv, XX, cond_jump_flag, XX },
982 >  { "jnoH",             Jv, XX, cond_jump_flag, XX },
983 >  { "jbH",              Jv, XX, cond_jump_flag, XX },
984 >  { "jaeH",             Jv, XX, cond_jump_flag, XX },
985 >  { "jeH",              Jv, XX, cond_jump_flag, XX },
986 >  { "jneH",             Jv, XX, cond_jump_flag, XX },
987 >  { "jbeH",             Jv, XX, cond_jump_flag, XX },
988 >  { "jaH",              Jv, XX, cond_jump_flag, XX },
989    /* 88 */
990 <  { "jsH",              Jv, XX, cond_jump_flag },
991 <  { "jnsH",             Jv, XX, cond_jump_flag },
992 <  { "jpH",              Jv, XX, cond_jump_flag },
993 <  { "jnpH",             Jv, XX, cond_jump_flag },
994 <  { "jlH",              Jv, XX, cond_jump_flag },
995 <  { "jgeH",             Jv, XX, cond_jump_flag },
996 <  { "jleH",             Jv, XX, cond_jump_flag },
997 <  { "jgH",              Jv, XX, cond_jump_flag },
990 >  { "jsH",              Jv, XX, cond_jump_flag, XX },
991 >  { "jnsH",             Jv, XX, cond_jump_flag, XX },
992 >  { "jpH",              Jv, XX, cond_jump_flag, XX },
993 >  { "jnpH",             Jv, XX, cond_jump_flag, XX },
994 >  { "jlH",              Jv, XX, cond_jump_flag, XX },
995 >  { "jgeH",             Jv, XX, cond_jump_flag, XX },
996 >  { "jleH",             Jv, XX, cond_jump_flag, XX },
997 >  { "jgH",              Jv, XX, cond_jump_flag, XX },
998    /* 90 */
999 <  { "seto",             Eb, XX, XX },
1000 <  { "setno",            Eb, XX, XX },
1001 <  { "setb",             Eb, XX, XX },
1002 <  { "setae",            Eb, XX, XX },
1003 <  { "sete",             Eb, XX, XX },
1004 <  { "setne",            Eb, XX, XX },
1005 <  { "setbe",            Eb, XX, XX },
1006 <  { "seta",             Eb, XX, XX },
999 >  { "seto",             Eb, XX, XX, XX },
1000 >  { "setno",            Eb, XX, XX, XX },
1001 >  { "setb",             Eb, XX, XX, XX },
1002 >  { "setae",            Eb, XX, XX, XX },
1003 >  { "sete",             Eb, XX, XX, XX },
1004 >  { "setne",            Eb, XX, XX, XX },
1005 >  { "setbe",            Eb, XX, XX, XX },
1006 >  { "seta",             Eb, XX, XX, XX },
1007    /* 98 */
1008 <  { "sets",             Eb, XX, XX },
1009 <  { "setns",            Eb, XX, XX },
1010 <  { "setp",             Eb, XX, XX },
1011 <  { "setnp",            Eb, XX, XX },
1012 <  { "setl",             Eb, XX, XX },
1013 <  { "setge",            Eb, XX, XX },
1014 <  { "setle",            Eb, XX, XX },
1015 <  { "setg",             Eb, XX, XX },
1008 >  { "sets",             Eb, XX, XX, XX },
1009 >  { "setns",            Eb, XX, XX, XX },
1010 >  { "setp",             Eb, XX, XX, XX },
1011 >  { "setnp",            Eb, XX, XX, XX },
1012 >  { "setl",             Eb, XX, XX, XX },
1013 >  { "setge",            Eb, XX, XX, XX },
1014 >  { "setle",            Eb, XX, XX, XX },
1015 >  { "setg",             Eb, XX, XX, XX },
1016    /* a0 */
1017 <  { "pushT",            fs, XX, XX },
1018 <  { "popT",             fs, XX, XX },
1019 <  { "cpuid",            XX, XX, XX },
1020 <  { "btS",              Ev, Gv, XX },
1021 <  { "shldS",            Ev, Gv, Ib },
1022 <  { "shldS",            Ev, Gv, CL },
1023 <  { "(bad)",            XX, XX, XX },
1024 <  { "(bad)",            XX, XX, XX },
1017 >  { "pushT",            fs, XX, XX, XX },
1018 >  { "popT",             fs, XX, XX, XX },
1019 >  { "cpuid",            XX, XX, XX, XX },
1020 >  { "btS",              Ev, Gv, XX, XX },
1021 >  { "shldS",            Ev, Gv, Ib, XX },
1022 >  { "shldS",            Ev, Gv, CL, XX },
1023 >  { GRPPADLCK2 },
1024 >  { GRPPADLCK1 },
1025    /* a8 */
1026 <  { "pushT",            gs, XX, XX },
1027 <  { "popT",             gs, XX, XX },
1028 <  { "rsm",              XX, XX, XX },
1029 <  { "btsS",             Ev, Gv, XX },
1030 <  { "shrdS",            Ev, Gv, Ib },
1031 <  { "shrdS",            Ev, Gv, CL },
1032 <  { GRP13 },
1033 <  { "imulS",            Gv, Ev, XX },
1026 >  { "pushT",            gs, XX, XX, XX },
1027 >  { "popT",             gs, XX, XX, XX },
1028 >  { "rsm",              XX, XX, XX, XX },
1029 >  { "btsS",             Ev, Gv, XX, XX },
1030 >  { "shrdS",            Ev, Gv, Ib, XX },
1031 >  { "shrdS",            Ev, Gv, CL, XX },
1032 >  { GRP15 },
1033 >  { "imulS",            Gv, Ev, XX, XX },
1034    /* b0 */
1035 <  { "cmpxchgB",         Eb, Gb, XX },
1036 <  { "cmpxchgS",         Ev, Gv, XX },
1037 <  { "lssS",             Gv, Mp, XX },
1038 <  { "btrS",             Ev, Gv, XX },
1039 <  { "lfsS",             Gv, Mp, XX },
1040 <  { "lgsS",             Gv, Mp, XX },
1041 <  { "movz{bR|x|bR|x}",  Gv, Eb, XX },
1042 <  { "movz{wR|x|wR|x}",  Gv, Ew, XX }, /* yes, there really is movzww ! */
1035 >  { "cmpxchgB",         Eb, Gb, XX, XX },
1036 >  { "cmpxchgS",         Ev, Gv, XX, XX },
1037 >  { "lssS",             Gv, Mp, XX, XX },
1038 >  { "btrS",             Ev, Gv, XX, XX },
1039 >  { "lfsS",             Gv, Mp, XX, XX },
1040 >  { "lgsS",             Gv, Mp, XX, XX },
1041 >  { "movz{bR|x|bR|x}",  Gv, Eb, XX, XX },
1042 >  { "movz{wR|x|wR|x}",  Gv, Ew, XX, XX }, /* yes, there really is movzww ! */
1043    /* b8 */
1044 <  { "(bad)",            XX, XX, XX },
1045 <  { "ud2b",             XX, XX, XX },
1044 >  { PREGRP37 },
1045 >  { "ud2b",             XX, XX, XX, XX },
1046    { GRP8 },
1047 <  { "btcS",             Ev, Gv, XX },
1048 <  { "bsfS",             Gv, Ev, XX },
1049 <  { "bsrS",             Gv, Ev, XX },
1050 <  { "movs{bR|x|bR|x}",  Gv, Eb, XX },
1051 <  { "movs{wR|x|wR|x}",  Gv, Ew, XX }, /* yes, there really is movsww ! */
1047 >  { "btcS",             Ev, Gv, XX, XX },
1048 >  { "bsfS",             Gv, Ev, XX, XX },
1049 >  { PREGRP36 },
1050 >  { "movs{bR|x|bR|x}",  Gv, Eb, XX, XX },
1051 >  { "movs{wR|x|wR|x}",  Gv, Ew, XX, XX }, /* yes, there really is movsww ! */
1052    /* c0 */
1053 <  { "xaddB",            Eb, Gb, XX },
1054 <  { "xaddS",            Ev, Gv, XX },
1053 >  { "xaddB",            Eb, Gb, XX, XX },
1054 >  { "xaddS",            Ev, Gv, XX, XX },
1055    { PREGRP1 },
1056 <  { "movntiS",          Ev, Gv, XX },
1057 <  { "pinsrw",           MX, Ed, Ib },
1058 <  { "pextrw",           Gd, MS, Ib },
1059 <  { "shufpX",           XM, EX, Ib },
1056 >  { "movntiS",          Ev, Gv, XX, XX },
1057 >  { "pinsrw",           MX, Edqw, Ib, XX },
1058 >  { "pextrw",           Gdq, MS, Ib, XX },
1059 >  { "shufpX",           XM, EX, Ib, XX },
1060    { GRP9 },
1061    /* c8 */
1062 <  { "bswap",            RMeAX, XX, XX },
1063 <  { "bswap",            RMeCX, XX, XX },
1064 <  { "bswap",            RMeDX, XX, XX },
1065 <  { "bswap",            RMeBX, XX, XX },
1066 <  { "bswap",            RMeSP, XX, XX },
1067 <  { "bswap",            RMeBP, XX, XX },
1068 <  { "bswap",            RMeSI, XX, XX },
1069 <  { "bswap",            RMeDI, XX, XX },
1062 >  { "bswap",            RMeAX, XX, XX, XX },
1063 >  { "bswap",            RMeCX, XX, XX, XX },
1064 >  { "bswap",            RMeDX, XX, XX, XX },
1065 >  { "bswap",            RMeBX, XX, XX, XX },
1066 >  { "bswap",            RMeSP, XX, XX, XX },
1067 >  { "bswap",            RMeBP, XX, XX, XX },
1068 >  { "bswap",            RMeSI, XX, XX, XX },
1069 >  { "bswap",            RMeDI, XX, XX, XX },
1070    /* d0 */
1071 <  { "(bad)",            XX, XX, XX },
1072 <  { "psrlw",            MX, EM, XX },
1073 <  { "psrld",            MX, EM, XX },
1074 <  { "psrlq",            MX, EM, XX },
1075 <  { "paddq",            MX, EM, XX },
1076 <  { "pmullw",           MX, EM, XX },
1071 >  { PREGRP27 },
1072 >  { "psrlw",            MX, EM, XX, XX },
1073 >  { "psrld",            MX, EM, XX, XX },
1074 >  { "psrlq",            MX, EM, XX, XX },
1075 >  { "paddq",            MX, EM, XX, XX },
1076 >  { "pmullw",           MX, EM, XX, XX },
1077    { PREGRP21 },
1078 <  { "pmovmskb",         Gd, MS, XX },
1078 >  { "pmovmskb",         Gdq, MS, XX, XX },
1079    /* d8 */
1080 <  { "psubusb",          MX, EM, XX },
1081 <  { "psubusw",          MX, EM, XX },
1082 <  { "pminub",           MX, EM, XX },
1083 <  { "pand",             MX, EM, XX },
1084 <  { "paddusb",          MX, EM, XX },
1085 <  { "paddusw",          MX, EM, XX },
1086 <  { "pmaxub",           MX, EM, XX },
1087 <  { "pandn",            MX, EM, XX },
1080 >  { "psubusb",          MX, EM, XX, XX },
1081 >  { "psubusw",          MX, EM, XX, XX },
1082 >  { "pminub",           MX, EM, XX, XX },
1083 >  { "pand",             MX, EM, XX, XX },
1084 >  { "paddusb",          MX, EM, XX, XX },
1085 >  { "paddusw",          MX, EM, XX, XX },
1086 >  { "pmaxub",           MX, EM, XX, XX },
1087 >  { "pandn",            MX, EM, XX, XX },
1088    /* e0 */
1089 <  { "pavgb",            MX, EM, XX },
1090 <  { "psraw",            MX, EM, XX },
1091 <  { "psrad",            MX, EM, XX },
1092 <  { "pavgw",            MX, EM, XX },
1093 <  { "pmulhuw",          MX, EM, XX },
1094 <  { "pmulhw",           MX, EM, XX },
1089 >  { "pavgb",            MX, EM, XX, XX },
1090 >  { "psraw",            MX, EM, XX, XX },
1091 >  { "psrad",            MX, EM, XX, XX },
1092 >  { "pavgw",            MX, EM, XX, XX },
1093 >  { "pmulhuw",          MX, EM, XX, XX },
1094 >  { "pmulhw",           MX, EM, XX, XX },
1095    { PREGRP15 },
1096    { PREGRP25 },
1097    /* e8 */
1098 <  { "psubsb",           MX, EM, XX },
1099 <  { "psubsw",           MX, EM, XX },
1100 <  { "pminsw",           MX, EM, XX },
1101 <  { "por",              MX, EM, XX },
1102 <  { "paddsb",           MX, EM, XX },
1103 <  { "paddsw",           MX, EM, XX },
1104 <  { "pmaxsw",           MX, EM, XX },
1105 <  { "pxor",             MX, EM, XX },
1098 >  { "psubsb",           MX, EM, XX, XX },
1099 >  { "psubsw",           MX, EM, XX, XX },
1100 >  { "pminsw",           MX, EM, XX, XX },
1101 >  { "por",              MX, EM, XX, XX },
1102 >  { "paddsb",           MX, EM, XX, XX },
1103 >  { "paddsw",           MX, EM, XX, XX },
1104 >  { "pmaxsw",           MX, EM, XX, XX },
1105 >  { "pxor",             MX, EM, XX, XX },
1106    /* f0 */
1107 <  { "(bad)",            XX, XX, XX },
1108 <  { "psllw",            MX, EM, XX },
1109 <  { "pslld",            MX, EM, XX },
1110 <  { "psllq",            MX, EM, XX },
1111 <  { "pmuludq",          MX, EM, XX },
1112 <  { "pmaddwd",          MX, EM, XX },
1113 <  { "psadbw",           MX, EM, XX },
1107 >  { PREGRP32 },
1108 >  { "psllw",            MX, EM, XX, XX },
1109 >  { "pslld",            MX, EM, XX, XX },
1110 >  { "psllq",            MX, EM, XX, XX },
1111 >  { "pmuludq",          MX, EM, XX, XX },
1112 >  { "pmaddwd",          MX, EM, XX, XX },
1113 >  { "psadbw",           MX, EM, XX, XX },
1114    { PREGRP18 },
1115    /* f8 */
1116 <  { "psubb",            MX, EM, XX },
1117 <  { "psubw",            MX, EM, XX },
1118 <  { "psubd",            MX, EM, XX },
1119 <  { "psubq",            MX, EM, XX },
1120 <  { "paddb",            MX, EM, XX },
1121 <  { "paddw",            MX, EM, XX },
1122 <  { "paddd",            MX, EM, XX },
1123 <  { "(bad)",            XX, XX, XX }
1116 >  { "psubb",            MX, EM, XX, XX },
1117 >  { "psubw",            MX, EM, XX, XX },
1118 >  { "psubd",            MX, EM, XX, XX },
1119 >  { "psubq",            MX, EM, XX, XX },
1120 >  { "paddb",            MX, EM, XX, XX },
1121 >  { "paddw",            MX, EM, XX, XX },
1122 >  { "paddd",            MX, EM, XX, XX },
1123 >  { "(bad)",            XX, XX, XX, XX }
1124   };
1125  
1126   static const unsigned char onebyte_has_modrm[256] = {
# Line 1070 | Line 1150 | static const unsigned char twobyte_has_m
1150    /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1151    /*       -------------------------------        */
1152    /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
1153 <  /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
1153 >  /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1, /* 1f */
1154    /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
1155 <  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1155 >  /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
1156    /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
1157    /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
1158    /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
1159 <  /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1, /* 7f */
1159 >  /* 70 */ 1,1,1,1,1,1,1,0,1,1,0,0,1,1,1,1, /* 7f */
1160    /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1161    /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
1162 <  /* a0 */ 0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1, /* af */
1163 <  /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
1162 >  /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
1163 >  /* b0 */ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, /* bf */
1164    /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
1165 <  /* d0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
1165 >  /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
1166    /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
1167 <  /* f0 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
1167 >  /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0  /* ff */
1168    /*       -------------------------------        */
1169    /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1170   };
1171  
1172 < static const unsigned char twobyte_uses_SSE_prefix[256] = {
1172 > static const unsigned char twobyte_uses_DATA_prefix[256] = {
1173    /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1174    /*       -------------------------------        */
1175    /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1176 <  /* 10 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1177 <  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
1178 <  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1176 >  /* 10 */ 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0, /* 1f */
1177 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1178 >  /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
1179    /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1180    /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
1181    /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
1182 <  /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
1182 >  /* 70 */ 1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1, /* 7f */
1183 >  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1184 >  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1185 >  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1186 >  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1187 >  /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1188 >  /* d0 */ 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1189 >  /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1190 >  /* f0 */ 1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0  /* ff */
1191 >  /*       -------------------------------        */
1192 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1193 > };
1194 >
1195 > static const unsigned char twobyte_uses_REPNZ_prefix[256] = {
1196 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1197 >  /*       -------------------------------        */
1198 >  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1199 >  /* 10 */ 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1200 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1201 >  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1202 >  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1203 >  /* 50 */ 0,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1, /* 5f */
1204 >  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1205 >  /* 70 */ 1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0, /* 7f */
1206    /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1207    /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1208    /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1209    /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1210    /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1211 +  /* d0 */ 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1212 +  /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1213 +  /* f0 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1214 +  /*       -------------------------------        */
1215 +  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1216 + };
1217 +
1218 + static const unsigned char twobyte_uses_REPZ_prefix[256] = {
1219 +  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1220 +  /*       -------------------------------        */
1221 +  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1222 +  /* 10 */ 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0, /* 1f */
1223 +  /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0, /* 2f */
1224 +  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1225 +  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1226 +  /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
1227 +  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, /* 6f */
1228 +  /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 7f */
1229 +  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1230 +  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1231 +  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1232 +  /* b0 */ 0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0, /* bf */
1233 +  /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1234    /* d0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
1235    /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
1236 <  /* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0  /* ff */
1236 >  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1237 >  /*       -------------------------------        */
1238 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1239 > };
1240 >
1241 > /* This is used to determine if opcode 0f 38 XX uses DATA prefix.  */
1242 > static const unsigned char threebyte_0x38_uses_DATA_prefix[256] = {
1243 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1244 >  /*       -------------------------------        */
1245 >  /* 00 */ 1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, /* 0f */
1246 >  /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0, /* 1f */
1247 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1248 >  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1249 >  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1250 >  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1251 >  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1252 >  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1253 >  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1254 >  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1255 >  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1256 >  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1257 >  /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1258 >  /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1259 >  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1260 >  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1261 >  /*       -------------------------------        */
1262 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1263 > };
1264 >
1265 > /* This is used to determine if opcode 0f 38 XX uses REPNZ prefix.  */
1266 > static const unsigned char threebyte_0x38_uses_REPNZ_prefix[256] = {
1267 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1268 >  /*       -------------------------------        */
1269 >  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1270 >  /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1271 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1272 >  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1273 >  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1274 >  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1275 >  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1276 >  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1277 >  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1278 >  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1279 >  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1280 >  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1281 >  /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1282 >  /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1283 >  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1284 >  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1285 >  /*       -------------------------------        */
1286 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1287 > };
1288 >
1289 > /* This is used to determine if opcode 0f 38 XX uses REPZ prefix.  */
1290 > static const unsigned char threebyte_0x38_uses_REPZ_prefix[256] = {
1291 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1292 >  /*       -------------------------------        */
1293 >  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1294 >  /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1295 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1296 >  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1297 >  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1298 >  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1299 >  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1300 >  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1301 >  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1302 >  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1303 >  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1304 >  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1305 >  /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1306 >  /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1307 >  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1308 >  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1309 >  /*       -------------------------------        */
1310 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1311 > };
1312 >
1313 > /* This is used to determine if opcode 0f 3a XX uses DATA prefix.  */
1314 > static const unsigned char threebyte_0x3a_uses_DATA_prefix[256] = {
1315 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1316 >  /*       -------------------------------        */
1317 >  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, /* 0f */
1318 >  /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1319 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1320 >  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1321 >  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1322 >  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1323 >  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1324 >  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1325 >  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1326 >  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1327 >  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1328 >  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1329 >  /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1330 >  /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1331 >  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1332 >  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1333 >  /*       -------------------------------        */
1334 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1335 > };
1336 >
1337 > /* This is used to determine if opcode 0f 3a XX uses REPNZ prefix.  */
1338 > static const unsigned char threebyte_0x3a_uses_REPNZ_prefix[256] = {
1339 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1340 >  /*       -------------------------------        */
1341 >  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1342 >  /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1343 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1344 >  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1345 >  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1346 >  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1347 >  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1348 >  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1349 >  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1350 >  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1351 >  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1352 >  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1353 >  /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1354 >  /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1355 >  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1356 >  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1357 >  /*       -------------------------------        */
1358 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1359 > };
1360 >
1361 > /* This is used to determine if opcode 0f 3a XX uses REPZ prefix.  */
1362 > static const unsigned char threebyte_0x3a_uses_REPZ_prefix[256] = {
1363 >  /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1364 >  /*       -------------------------------        */
1365 >  /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
1366 >  /* 10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1f */
1367 >  /* 20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 2f */
1368 >  /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
1369 >  /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
1370 >  /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 5f */
1371 >  /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 6f */
1372 >  /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 7f */
1373 >  /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
1374 >  /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
1375 >  /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
1376 >  /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
1377 >  /* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
1378 >  /* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
1379 >  /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
1380 >  /* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
1381    /*       -------------------------------        */
1382    /*       0 1 2 3 4 5 6 7 8 9 a b c d e f        */
1383   };
# Line 1192 | Line 1462 | static const char *att_index16[] = {
1462   static const struct dis386 grps[][8] = {
1463    /* GRP1b */
1464    {
1465 <    { "addA",   Eb, Ib, XX },
1466 <    { "orA",    Eb, Ib, XX },
1467 <    { "adcA",   Eb, Ib, XX },
1468 <    { "sbbA",   Eb, Ib, XX },
1469 <    { "andA",   Eb, Ib, XX },
1470 <    { "subA",   Eb, Ib, XX },
1471 <    { "xorA",   Eb, Ib, XX },
1472 <    { "cmpA",   Eb, Ib, XX }
1465 >    { "addA",   Eb, Ib, XX, XX },
1466 >    { "orA",    Eb, Ib, XX, XX },
1467 >    { "adcA",   Eb, Ib, XX, XX },
1468 >    { "sbbA",   Eb, Ib, XX, XX },
1469 >    { "andA",   Eb, Ib, XX, XX },
1470 >    { "subA",   Eb, Ib, XX, XX },
1471 >    { "xorA",   Eb, Ib, XX, XX },
1472 >    { "cmpA",   Eb, Ib, XX, XX }
1473    },
1474    /* GRP1S */
1475    {
1476 <    { "addQ",   Ev, Iv, XX },
1477 <    { "orQ",    Ev, Iv, XX },
1478 <    { "adcQ",   Ev, Iv, XX },
1479 <    { "sbbQ",   Ev, Iv, XX },
1480 <    { "andQ",   Ev, Iv, XX },
1481 <    { "subQ",   Ev, Iv, XX },
1482 <    { "xorQ",   Ev, Iv, XX },
1483 <    { "cmpQ",   Ev, Iv, XX }
1476 >    { "addQ",   Ev, Iv, XX, XX },
1477 >    { "orQ",    Ev, Iv, XX, XX },
1478 >    { "adcQ",   Ev, Iv, XX, XX },
1479 >    { "sbbQ",   Ev, Iv, XX, XX },
1480 >    { "andQ",   Ev, Iv, XX, XX },
1481 >    { "subQ",   Ev, Iv, XX, XX },
1482 >    { "xorQ",   Ev, Iv, XX, XX },
1483 >    { "cmpQ",   Ev, Iv, XX, XX }
1484    },
1485    /* GRP1Ss */
1486    {
1487 <    { "addQ",   Ev, sIb, XX },
1488 <    { "orQ",    Ev, sIb, XX },
1489 <    { "adcQ",   Ev, sIb, XX },
1490 <    { "sbbQ",   Ev, sIb, XX },
1491 <    { "andQ",   Ev, sIb, XX },
1492 <    { "subQ",   Ev, sIb, XX },
1493 <    { "xorQ",   Ev, sIb, XX },
1494 <    { "cmpQ",   Ev, sIb, XX }
1487 >    { "addQ",   Ev, sIb, XX, XX },
1488 >    { "orQ",    Ev, sIb, XX, XX },
1489 >    { "adcQ",   Ev, sIb, XX, XX },
1490 >    { "sbbQ",   Ev, sIb, XX, XX },
1491 >    { "andQ",   Ev, sIb, XX, XX },
1492 >    { "subQ",   Ev, sIb, XX, XX },
1493 >    { "xorQ",   Ev, sIb, XX, XX },
1494 >    { "cmpQ",   Ev, sIb, XX, XX }
1495    },
1496    /* GRP2b */
1497    {
1498 <    { "rolA",   Eb, Ib, XX },
1499 <    { "rorA",   Eb, Ib, XX },
1500 <    { "rclA",   Eb, Ib, XX },
1501 <    { "rcrA",   Eb, Ib, XX },
1502 <    { "shlA",   Eb, Ib, XX },
1503 <    { "shrA",   Eb, Ib, XX },
1504 <    { "(bad)",  XX, XX, XX },
1505 <    { "sarA",   Eb, Ib, XX },
1498 >    { "rolA",   Eb, Ib, XX, XX },
1499 >    { "rorA",   Eb, Ib, XX, XX },
1500 >    { "rclA",   Eb, Ib, XX, XX },
1501 >    { "rcrA",   Eb, Ib, XX, XX },
1502 >    { "shlA",   Eb, Ib, XX, XX },
1503 >    { "shrA",   Eb, Ib, XX, XX },
1504 >    { "(bad)",  XX, XX, XX, XX },
1505 >    { "sarA",   Eb, Ib, XX, XX },
1506    },
1507    /* GRP2S */
1508    {
1509 <    { "rolQ",   Ev, Ib, XX },
1510 <    { "rorQ",   Ev, Ib, XX },
1511 <    { "rclQ",   Ev, Ib, XX },
1512 <    { "rcrQ",   Ev, Ib, XX },
1513 <    { "shlQ",   Ev, Ib, XX },
1514 <    { "shrQ",   Ev, Ib, XX },
1515 <    { "(bad)",  XX, XX, XX },
1516 <    { "sarQ",   Ev, Ib, XX },
1509 >    { "rolQ",   Ev, Ib, XX, XX },
1510 >    { "rorQ",   Ev, Ib, XX, XX },
1511 >    { "rclQ",   Ev, Ib, XX, XX },
1512 >    { "rcrQ",   Ev, Ib, XX, XX },
1513 >    { "shlQ",   Ev, Ib, XX, XX },
1514 >    { "shrQ",   Ev, Ib, XX, XX },
1515 >    { "(bad)",  XX, XX, XX, XX },
1516 >    { "sarQ",   Ev, Ib, XX, XX },
1517    },
1518    /* GRP2b_one */
1519    {
1520 <    { "rolA",   Eb, XX, XX },
1521 <    { "rorA",   Eb, XX, XX },
1522 <    { "rclA",   Eb, XX, XX },
1523 <    { "rcrA",   Eb, XX, XX },
1524 <    { "shlA",   Eb, XX, XX },
1525 <    { "shrA",   Eb, XX, XX },
1526 <    { "(bad)",  XX, XX, XX },
1527 <    { "sarA",   Eb, XX, XX },
1520 >    { "rolA",   Eb, I1, XX, XX },
1521 >    { "rorA",   Eb, I1, XX, XX },
1522 >    { "rclA",   Eb, I1, XX, XX },
1523 >    { "rcrA",   Eb, I1, XX, XX },
1524 >    { "shlA",   Eb, I1, XX, XX },
1525 >    { "shrA",   Eb, I1, XX, XX },
1526 >    { "(bad)",  XX, XX, XX, XX },
1527 >    { "sarA",   Eb, I1, XX, XX },
1528    },
1529    /* GRP2S_one */
1530    {
1531 <    { "rolQ",   Ev, XX, XX },
1532 <    { "rorQ",   Ev, XX, XX },
1533 <    { "rclQ",   Ev, XX, XX },
1534 <    { "rcrQ",   Ev, XX, XX },
1535 <    { "shlQ",   Ev, XX, XX },
1536 <    { "shrQ",   Ev, XX, XX },
1537 <    { "(bad)",  XX, XX, XX},
1538 <    { "sarQ",   Ev, XX, XX },
1531 >    { "rolQ",   Ev, I1, XX, XX },
1532 >    { "rorQ",   Ev, I1, XX, XX },
1533 >    { "rclQ",   Ev, I1, XX, XX },
1534 >    { "rcrQ",   Ev, I1, XX, XX },
1535 >    { "shlQ",   Ev, I1, XX, XX },
1536 >    { "shrQ",   Ev, I1, XX, XX },
1537 >    { "(bad)",  XX, XX, XX, XX },
1538 >    { "sarQ",   Ev, I1, XX, XX },
1539    },
1540    /* GRP2b_cl */
1541    {
1542 <    { "rolA",   Eb, CL, XX },
1543 <    { "rorA",   Eb, CL, XX },
1544 <    { "rclA",   Eb, CL, XX },
1545 <    { "rcrA",   Eb, CL, XX },
1546 <    { "shlA",   Eb, CL, XX },
1547 <    { "shrA",   Eb, CL, XX },
1548 <    { "(bad)",  XX, XX, XX },
1549 <    { "sarA",   Eb, CL, XX },
1542 >    { "rolA",   Eb, CL, XX, XX },
1543 >    { "rorA",   Eb, CL, XX, XX },
1544 >    { "rclA",   Eb, CL, XX, XX },
1545 >    { "rcrA",   Eb, CL, XX, XX },
1546 >    { "shlA",   Eb, CL, XX, XX },
1547 >    { "shrA",   Eb, CL, XX, XX },
1548 >    { "(bad)",  XX, XX, XX, XX },
1549 >    { "sarA",   Eb, CL, XX, XX },
1550    },
1551    /* GRP2S_cl */
1552    {
1553 <    { "rolQ",   Ev, CL, XX },
1554 <    { "rorQ",   Ev, CL, XX },
1555 <    { "rclQ",   Ev, CL, XX },
1556 <    { "rcrQ",   Ev, CL, XX },
1557 <    { "shlQ",   Ev, CL, XX },
1558 <    { "shrQ",   Ev, CL, XX },
1559 <    { "(bad)",  XX, XX, XX },
1560 <    { "sarQ",   Ev, CL, XX }
1553 >    { "rolQ",   Ev, CL, XX, XX },
1554 >    { "rorQ",   Ev, CL, XX, XX },
1555 >    { "rclQ",   Ev, CL, XX, XX },
1556 >    { "rcrQ",   Ev, CL, XX, XX },
1557 >    { "shlQ",   Ev, CL, XX, XX },
1558 >    { "shrQ",   Ev, CL, XX, XX },
1559 >    { "(bad)",  XX, XX, XX, XX },
1560 >    { "sarQ",   Ev, CL, XX, XX }
1561    },
1562    /* GRP3b */
1563    {
1564 <    { "testA",  Eb, Ib, XX },
1565 <    { "(bad)",  Eb, XX, XX },
1566 <    { "notA",   Eb, XX, XX },
1567 <    { "negA",   Eb, XX, XX },
1568 <    { "mulA",   Eb, XX, XX },   /* Don't print the implicit %al register,  */
1569 <    { "imulA",  Eb, XX, XX },   /* to distinguish these opcodes from other */
1570 <    { "divA",   Eb, XX, XX },   /* mul/imul opcodes.  Do the same for div  */
1571 <    { "idivA",  Eb, XX, XX }    /* and idiv for consistency.               */
1564 >    { "testA",  Eb, Ib, XX, XX },
1565 >    { "(bad)",  Eb, XX, XX, XX },
1566 >    { "notA",   Eb, XX, XX, XX },
1567 >    { "negA",   Eb, XX, XX, XX },
1568 >    { "mulA",   Eb, XX, XX, XX },       /* Don't print the implicit %al register,  */
1569 >    { "imulA",  Eb, XX, XX, XX },       /* to distinguish these opcodes from other */
1570 >    { "divA",   Eb, XX, XX, XX },       /* mul/imul opcodes.  Do the same for div  */
1571 >    { "idivA",  Eb, XX, XX, XX }        /* and idiv for consistency.               */
1572    },
1573    /* GRP3S */
1574    {
1575 <    { "testQ",  Ev, Iv, XX },
1576 <    { "(bad)",  XX, XX, XX },
1577 <    { "notQ",   Ev, XX, XX },
1578 <    { "negQ",   Ev, XX, XX },
1579 <    { "mulQ",   Ev, XX, XX },   /* Don't print the implicit register.  */
1580 <    { "imulQ",  Ev, XX, XX },
1581 <    { "divQ",   Ev, XX, XX },
1582 <    { "idivQ",  Ev, XX, XX },
1575 >    { "testQ",  Ev, Iv, XX, XX },
1576 >    { "(bad)",  XX, XX, XX, XX },
1577 >    { "notQ",   Ev, XX, XX, XX },
1578 >    { "negQ",   Ev, XX, XX, XX },
1579 >    { "mulQ",   Ev, XX, XX, XX },       /* Don't print the implicit register.  */
1580 >    { "imulQ",  Ev, XX, XX, XX },
1581 >    { "divQ",   Ev, XX, XX, XX },
1582 >    { "idivQ",  Ev, XX, XX, XX },
1583    },
1584    /* GRP4 */
1585    {
1586 <    { "incA",   Eb, XX, XX },
1587 <    { "decA",   Eb, XX, XX },
1588 <    { "(bad)",  XX, XX, XX },
1589 <    { "(bad)",  XX, XX, XX },
1590 <    { "(bad)",  XX, XX, XX },
1591 <    { "(bad)",  XX, XX, XX },
1592 <    { "(bad)",  XX, XX, XX },
1593 <    { "(bad)",  XX, XX, XX },
1586 >    { "incA",   Eb, XX, XX, XX },
1587 >    { "decA",   Eb, XX, XX, XX },
1588 >    { "(bad)",  XX, XX, XX, XX },
1589 >    { "(bad)",  XX, XX, XX, XX },
1590 >    { "(bad)",  XX, XX, XX, XX },
1591 >    { "(bad)",  XX, XX, XX, XX },
1592 >    { "(bad)",  XX, XX, XX, XX },
1593 >    { "(bad)",  XX, XX, XX, XX },
1594    },
1595    /* GRP5 */
1596    {
1597 <    { "incQ",   Ev, XX, XX },
1598 <    { "decQ",   Ev, XX, XX },
1599 <    { "callT",  indirEv, XX, XX },
1600 <    { "lcallT", indirEv, XX, XX },
1601 <    { "jmpT",   indirEv, XX, XX },
1602 <    { "ljmpT",  indirEv, XX, XX },
1603 <    { "pushU",  Ev, XX, XX },
1604 <    { "(bad)",  XX, XX, XX },
1597 >    { "incQ",   Ev, XX, XX, XX },
1598 >    { "decQ",   Ev, XX, XX, XX },
1599 >    { "callT",  indirEv, XX, XX, XX },
1600 >    { "JcallT", indirEp, XX, XX, XX },
1601 >    { "jmpT",   indirEv, XX, XX, XX },
1602 >    { "JjmpT",  indirEp, XX, XX, XX },
1603 >    { "pushU",  stackEv, XX, XX, XX },
1604 >    { "(bad)",  XX, XX, XX, XX },
1605    },
1606    /* GRP6 */
1607    {
1608 <    { "sldtQ",  Ev, XX, XX },
1609 <    { "strQ",   Ev, XX, XX },
1610 <    { "lldt",   Ew, XX, XX },
1611 <    { "ltr",    Ew, XX, XX },
1612 <    { "verr",   Ew, XX, XX },
1613 <    { "verw",   Ew, XX, XX },
1614 <    { "(bad)",  XX, XX, XX },
1615 <    { "(bad)",  XX, XX, XX }
1608 >    { "sldtD",  Sv, XX, XX, XX },
1609 >    { "strD",   Sv, XX, XX, XX },
1610 >    { "lldt",   Ew, XX, XX, XX },
1611 >    { "ltr",    Ew, XX, XX, XX },
1612 >    { "verr",   Ew, XX, XX, XX },
1613 >    { "verw",   Ew, XX, XX, XX },
1614 >    { "(bad)",  XX, XX, XX, XX },
1615 >    { "(bad)",  XX, XX, XX, XX }
1616    },
1617    /* GRP7 */
1618    {
1619 <    { "sgdtQ",   M, XX, XX },
1620 <    { "sidtQ",   M, XX, XX },
1621 <    { "lgdtQ",   M, XX, XX },
1622 <    { "lidtQ",   M, XX, XX },
1623 <    { "smswQ",  Ev, XX, XX },
1624 <    { "(bad)",  XX, XX, XX },
1625 <    { "lmsw",   Ew, XX, XX },
1626 <    { "invlpg", Ew, XX, XX },
1619 >    { "sgdt{Q|IQ||}", VMX_Fixup, 0, XX, XX, XX },
1620 >    { "sidt{Q|IQ||}", PNI_Fixup, 0, XX, XX, XX },
1621 >    { "lgdt{Q|Q||}",     M, XX, XX, XX },
1622 >    { "lidt{Q|Q||}",     SVME_Fixup, 0, XX, XX, XX },
1623 >    { "smswD",  Sv, XX, XX, XX },
1624 >    { "(bad)",  XX, XX, XX, XX },
1625 >    { "lmsw",   Ew, XX, XX, XX },
1626 >    { "invlpg", INVLPG_Fixup, w_mode, XX, XX, XX },
1627    },
1628    /* GRP8 */
1629    {
1630 <    { "(bad)",  XX, XX, XX },
1631 <    { "(bad)",  XX, XX, XX },
1632 <    { "(bad)",  XX, XX, XX },
1633 <    { "(bad)",  XX, XX, XX },
1634 <    { "btQ",    Ev, Ib, XX },
1635 <    { "btsQ",   Ev, Ib, XX },
1636 <    { "btrQ",   Ev, Ib, XX },
1637 <    { "btcQ",   Ev, Ib, XX },
1630 >    { "(bad)",  XX, XX, XX, XX },
1631 >    { "(bad)",  XX, XX, XX, XX },
1632 >    { "(bad)",  XX, XX, XX, XX },
1633 >    { "(bad)",  XX, XX, XX, XX },
1634 >    { "btQ",    Ev, Ib, XX, XX },
1635 >    { "btsQ",   Ev, Ib, XX, XX },
1636 >    { "btrQ",   Ev, Ib, XX, XX },
1637 >    { "btcQ",   Ev, Ib, XX, XX },
1638    },
1639    /* GRP9 */
1640    {
1641 <    { "(bad)",  XX, XX, XX },
1642 <    { "cmpxchg8b", Ev, XX, XX },
1643 <    { "(bad)",  XX, XX, XX },
1644 <    { "(bad)",  XX, XX, XX },
1645 <    { "(bad)",  XX, XX, XX },
1646 <    { "(bad)",  XX, XX, XX },
1647 <    { "(bad)",  XX, XX, XX },
1648 <    { "(bad)",  XX, XX, XX },
1649 <  },
1650 <  /* GRP10 */
1651 <  {
1652 <    { "(bad)",  XX, XX, XX },
1653 <    { "(bad)",  XX, XX, XX },
1654 <    { "psrlw",  MS, Ib, XX },
1655 <    { "(bad)",  XX, XX, XX },
1656 <    { "psraw",  MS, Ib, XX },
1657 <    { "(bad)",  XX, XX, XX },
1658 <    { "psllw",  MS, Ib, XX },
1659 <    { "(bad)",  XX, XX, XX },
1660 <  },
1661 <  /* GRP11 */
1662 <  {
1663 <    { "(bad)",  XX, XX, XX },
1664 <    { "(bad)",  XX, XX, XX },
1665 <    { "psrld",  MS, Ib, XX },
1666 <    { "(bad)",  XX, XX, XX },
1667 <    { "psrad",  MS, Ib, XX },
1668 <    { "(bad)",  XX, XX, XX },
1669 <    { "pslld",  MS, Ib, XX },
1670 <    { "(bad)",  XX, XX, XX },
1641 >    { "(bad)",  XX, XX, XX, XX },
1642 >    { "cmpxchg8b", CMPXCHG8B_Fixup, q_mode, XX, XX, XX },
1643 >    { "(bad)",  XX, XX, XX, XX },
1644 >    { "(bad)",  XX, XX, XX, XX },
1645 >    { "(bad)",  XX, XX, XX, XX },
1646 >    { "(bad)",  XX, XX, XX, XX },
1647 >    { "",       VM, XX, XX, XX },               /* See OP_VMX.  */
1648 >    { "vmptrst", Mq, XX, XX, XX },
1649 >  },
1650 >  /* GRP11_C6 */
1651 >  {
1652 >    { "movA",   Eb, Ib, XX, XX },
1653 >    { "(bad)",  XX, XX, XX, XX },
1654 >    { "(bad)",  XX, XX, XX, XX },
1655 >    { "(bad)",  XX, XX, XX, XX },
1656 >    { "(bad)",  XX, XX, XX, XX },
1657 >    { "(bad)",  XX, XX, XX, XX },
1658 >    { "(bad)",  XX, XX, XX, XX },
1659 >    { "(bad)",  XX, XX, XX, XX },
1660 >  },
1661 >  /* GRP11_C7 */
1662 >  {
1663 >    { "movQ",   Ev, Iv, XX, XX },
1664 >    { "(bad)",  XX, XX, XX, XX },
1665 >    { "(bad)",  XX, XX, XX, XX },
1666 >    { "(bad)",  XX, XX, XX, XX },
1667 >    { "(bad)",  XX, XX, XX, XX },
1668 >    { "(bad)",  XX, XX, XX, XX },
1669 >    { "(bad)",  XX, XX, XX, XX },
1670 >    { "(bad)",  XX, XX, XX, XX },
1671    },
1672    /* GRP12 */
1673    {
1674 <    { "(bad)",  XX, XX, XX },
1675 <    { "(bad)",  XX, XX, XX },
1676 <    { "psrlq",  MS, Ib, XX },
1677 <    { "psrldq", MS, Ib, XX },
1678 <    { "(bad)",  XX, XX, XX },
1679 <    { "(bad)",  XX, XX, XX },
1680 <    { "psllq",  MS, Ib, XX },
1681 <    { "pslldq", MS, Ib, XX },
1674 >    { "(bad)",  XX, XX, XX, XX },
1675 >    { "(bad)",  XX, XX, XX, XX },
1676 >    { "psrlw",  MS, Ib, XX, XX },
1677 >    { "(bad)",  XX, XX, XX, XX },
1678 >    { "psraw",  MS, Ib, XX, XX },
1679 >    { "(bad)",  XX, XX, XX, XX },
1680 >    { "psllw",  MS, Ib, XX, XX },
1681 >    { "(bad)",  XX, XX, XX, XX },
1682    },
1683    /* GRP13 */
1684    {
1685 <    { "fxsave", Ev, XX, XX },
1686 <    { "fxrstor", Ev, XX, XX },
1687 <    { "ldmxcsr", Ev, XX, XX },
1688 <    { "stmxcsr", Ev, XX, XX },
1689 <    { "(bad)",  XX, XX, XX },
1690 <    { "lfence", None, XX, XX },
1691 <    { "mfence", None, XX, XX },
1692 <    { "sfence", None, XX, XX },
1423 <    /* FIXME: the sfence with memory operand is clflush!  */
1685 >    { "(bad)",  XX, XX, XX, XX },
1686 >    { "(bad)",  XX, XX, XX, XX },
1687 >    { "psrld",  MS, Ib, XX, XX },
1688 >    { "(bad)",  XX, XX, XX, XX },
1689 >    { "psrad",  MS, Ib, XX, XX },
1690 >    { "(bad)",  XX, XX, XX, XX },
1691 >    { "pslld",  MS, Ib, XX, XX },
1692 >    { "(bad)",  XX, XX, XX, XX },
1693    },
1694    /* GRP14 */
1695    {
1696 <    { "prefetchnta", Ev, XX, XX },
1697 <    { "prefetcht0", Ev, XX, XX },
1698 <    { "prefetcht1", Ev, XX, XX },
1699 <    { "prefetcht2", Ev, XX, XX },
1700 <    { "(bad)",  XX, XX, XX },
1701 <    { "(bad)",  XX, XX, XX },
1702 <    { "(bad)",  XX, XX, XX },
1703 <    { "(bad)",  XX, XX, XX },
1696 >    { "(bad)",  XX, XX, XX, XX },
1697 >    { "(bad)",  XX, XX, XX, XX },
1698 >    { "psrlq",  MS, Ib, XX, XX },
1699 >    { "psrldq", MS, Ib, XX, XX },
1700 >    { "(bad)",  XX, XX, XX, XX },
1701 >    { "(bad)",  XX, XX, XX, XX },
1702 >    { "psllq",  MS, Ib, XX, XX },
1703 >    { "pslldq", MS, Ib, XX, XX },
1704 >  },
1705 >  /* GRP15 */
1706 >  {
1707 >    { "fxsave", Ev, XX, XX, XX },
1708 >    { "fxrstor", Ev, XX, XX, XX },
1709 >    { "ldmxcsr", Ev, XX, XX, XX },
1710 >    { "stmxcsr", Ev, XX, XX, XX },
1711 >    { "(bad)",  XX, XX, XX, XX },
1712 >    { "lfence", OP_0fae, 0, XX, XX, XX },
1713 >    { "mfence", OP_0fae, 0, XX, XX, XX },
1714 >    { "clflush", OP_0fae, 0, XX, XX, XX },
1715 >  },
1716 >  /* GRP16 */
1717 >  {
1718 >    { "prefetchnta", Ev, XX, XX, XX },
1719 >    { "prefetcht0", Ev, XX, XX, XX },
1720 >    { "prefetcht1", Ev, XX, XX, XX },
1721 >    { "prefetcht2", Ev, XX, XX, XX },
1722 >    { "(bad)",  XX, XX, XX, XX },
1723 >    { "(bad)",  XX, XX, XX, XX },
1724 >    { "(bad)",  XX, XX, XX, XX },
1725 >    { "(bad)",  XX, XX, XX, XX },
1726    },
1727    /* GRPAMD */
1728    {
1729 <    { "prefetch", Eb, XX, XX },
1730 <    { "prefetchw", Eb, XX, XX },
1731 <    { "(bad)",  XX, XX, XX },
1732 <    { "(bad)",  XX, XX, XX },
1733 <    { "(bad)",  XX, XX, XX },
1734 <    { "(bad)",  XX, XX, XX },
1735 <    { "(bad)",  XX, XX, XX },
1736 <    { "(bad)",  XX, XX, XX },
1729 >    { "prefetch", Eb, XX, XX, XX },
1730 >    { "prefetchw", Eb, XX, XX, XX },
1731 >    { "(bad)",  XX, XX, XX, XX },
1732 >    { "(bad)",  XX, XX, XX, XX },
1733 >    { "(bad)",  XX, XX, XX, XX },
1734 >    { "(bad)",  XX, XX, XX, XX },
1735 >    { "(bad)",  XX, XX, XX, XX },
1736 >    { "(bad)",  XX, XX, XX, XX },
1737 >  },
1738 >  /* GRPPADLCK1 */
1739 >  {
1740 >    { "xstore-rng", OP_0f07, 0, XX, XX, XX },
1741 >    { "xcrypt-ecb", OP_0f07, 0, XX, XX, XX },
1742 >    { "xcrypt-cbc", OP_0f07, 0, XX, XX, XX },
1743 >    { "xcrypt-ctr", OP_0f07, 0, XX, XX, XX },
1744 >    { "xcrypt-cfb", OP_0f07, 0, XX, XX, XX },
1745 >    { "xcrypt-ofb", OP_0f07, 0, XX, XX, XX },
1746 >    { "(bad)",  OP_0f07, 0, XX, XX, XX },
1747 >    { "(bad)",  OP_0f07, 0, XX, XX, XX },
1748 >  },
1749 >  /* GRPPADLCK2 */
1750 >  {
1751 >    { "montmul", OP_0f07, 0, XX, XX, XX },
1752 >    { "xsha1",   OP_0f07, 0, XX, XX, XX },
1753 >    { "xsha256", OP_0f07, 0, XX, XX, XX },
1754 >    { "(bad)",   OP_0f07, 0, XX, XX, XX },
1755 >    { "(bad)",   OP_0f07, 0, XX, XX, XX },
1756 >    { "(bad)",   OP_0f07, 0, XX, XX, XX },
1757 >    { "(bad)",   OP_0f07, 0, XX, XX, XX },
1758 >    { "(bad)",   OP_0f07, 0, XX, XX, XX },
1759    }
1760   };
1761  
1762   static const struct dis386 prefix_user_table[][4] = {
1763    /* PREGRP0 */
1764    {
1765 <    { "addps", XM, EX, XX },
1766 <    { "addss", XM, EX, XX },
1767 <    { "addpd", XM, EX, XX },
1768 <    { "addsd", XM, EX, XX },
1765 >    { "addps", XM, EX, XX, XX },
1766 >    { "addss", XM, EX, XX, XX },
1767 >    { "addpd", XM, EX, XX, XX },
1768 >    { "addsd", XM, EX, XX, XX },
1769    },
1770    /* PREGRP1 */
1771    {
1772 <    { "", XM, EX, OPSIMD },     /* See OP_SIMD_SUFFIX.  */
1773 <    { "", XM, EX, OPSIMD },
1774 <    { "", XM, EX, OPSIMD },
1775 <    { "", XM, EX, OPSIMD },
1772 >    { "", XM, EX, OPSIMD, XX }, /* See OP_SIMD_SUFFIX.  */
1773 >    { "", XM, EX, OPSIMD, XX },
1774 >    { "", XM, EX, OPSIMD, XX },
1775 >    { "", XM, EX, OPSIMD, XX },
1776    },
1777    /* PREGRP2 */
1778    {
1779 <    { "cvtpi2ps", XM, EM, XX },
1780 <    { "cvtsi2ssY", XM, Ev, XX },
1781 <    { "cvtpi2pd", XM, EM, XX },
1782 <    { "cvtsi2sdY", XM, Ev, XX },
1779 >    { "cvtpi2ps", XM, EMC, XX, XX },
1780 >    { "cvtsi2ssY", XM, Ev, XX, XX },
1781 >    { "cvtpi2pd", XM, EMC, XX, XX },
1782 >    { "cvtsi2sdY", XM, Ev, XX, XX },
1783    },
1784    /* PREGRP3 */
1785    {
1786 <    { "cvtps2pi", MX, EX, XX },
1787 <    { "cvtss2siY", Gv, EX, XX },
1788 <    { "cvtpd2pi", MX, EX, XX },
1789 <    { "cvtsd2siY", Gv, EX, XX },
1786 >    { "cvtps2pi", MXC, EX, XX, XX },
1787 >    { "cvtss2siY", Gv, EX, XX, XX },
1788 >    { "cvtpd2pi", MXC, EX, XX, XX },
1789 >    { "cvtsd2siY", Gv, EX, XX, XX },
1790    },
1791    /* PREGRP4 */
1792    {
1793 <    { "cvttps2pi", MX, EX, XX },
1794 <    { "cvttss2siY", Gv, EX, XX },
1795 <    { "cvttpd2pi", MX, EX, XX },
1796 <    { "cvttsd2siY", Gv, EX, XX },
1793 >    { "cvttps2pi", MXC, EX, XX, XX },
1794 >    { "cvttss2siY", Gv, EX, XX, XX },
1795 >    { "cvttpd2pi", MXC, EX, XX, XX },
1796 >    { "cvttsd2siY", Gv, EX, XX, XX },
1797    },
1798    /* PREGRP5 */
1799    {
1800 <    { "divps", XM, EX, XX },
1801 <    { "divss", XM, EX, XX },
1802 <    { "divpd", XM, EX, XX },
1803 <    { "divsd", XM, EX, XX },
1800 >    { "divps", XM, EX, XX, XX },
1801 >    { "divss", XM, EX, XX, XX },
1802 >    { "divpd", XM, EX, XX, XX },
1803 >    { "divsd", XM, EX, XX, XX },
1804    },
1805    /* PREGRP6 */
1806    {
1807 <    { "maxps", XM, EX, XX },
1808 <    { "maxss", XM, EX, XX },
1809 <    { "maxpd", XM, EX, XX },
1810 <    { "maxsd", XM, EX, XX },
1807 >    { "maxps", XM, EX, XX, XX },
1808 >    { "maxss", XM, EX, XX, XX },
1809 >    { "maxpd", XM, EX, XX, XX },
1810 >    { "maxsd", XM, EX, XX, XX },
1811    },
1812    /* PREGRP7 */
1813    {
1814 <    { "minps", XM, EX, XX },
1815 <    { "minss", XM, EX, XX },
1816 <    { "minpd", XM, EX, XX },
1817 <    { "minsd", XM, EX, XX },
1814 >    { "minps", XM, EX, XX, XX },
1815 >    { "minss", XM, EX, XX, XX },
1816 >    { "minpd", XM, EX, XX, XX },
1817 >    { "minsd", XM, EX, XX, XX },
1818    },
1819    /* PREGRP8 */
1820    {
1821 <    { "movups", XM, EX, XX },
1822 <    { "movss", XM, EX, XX },
1823 <    { "movupd", XM, EX, XX },
1824 <    { "movsd", XM, EX, XX },
1821 >    { "movups", XM, EX, XX, XX },
1822 >    { "movss", XM, EX, XX, XX },
1823 >    { "movupd", XM, EX, XX, XX },
1824 >    { "movsd", XM, EX, XX, XX },
1825    },
1826    /* PREGRP9 */
1827    {
1828 <    { "movups", EX, XM, XX },
1829 <    { "movss", EX, XM, XX },
1830 <    { "movupd", EX, XM, XX },
1831 <    { "movsd", EX, XM, XX },
1828 >    { "movups", EX, XM, XX, XX },
1829 >    { "movss", EX, XM, XX, XX },
1830 >    { "movupd", EX, XM, XX, XX },
1831 >    { "movsd", EX, XM, XX, XX },
1832    },
1833    /* PREGRP10 */
1834    {
1835 <    { "mulps", XM, EX, XX },
1836 <    { "mulss", XM, EX, XX },
1837 <    { "mulpd", XM, EX, XX },
1838 <    { "mulsd", XM, EX, XX },
1835 >    { "mulps", XM, EX, XX, XX },
1836 >    { "mulss", XM, EX, XX, XX },
1837 >    { "mulpd", XM, EX, XX, XX },
1838 >    { "mulsd", XM, EX, XX, XX },
1839    },
1840    /* PREGRP11 */
1841    {
1842 <    { "rcpps", XM, EX, XX },
1843 <    { "rcpss", XM, EX, XX },
1844 <    { "(bad)", XM, EX, XX },
1845 <    { "(bad)", XM, EX, XX },
1842 >    { "rcpps", XM, EX, XX, XX },
1843 >    { "rcpss", XM, EX, XX, XX },
1844 >    { "(bad)", XM, EX, XX, XX },
1845 >    { "(bad)", XM, EX, XX, XX },
1846    },
1847    /* PREGRP12 */
1848    {
1849 <    { "rsqrtps", XM, EX, XX },
1850 <    { "rsqrtss", XM, EX, XX },
1851 <    { "(bad)", XM, EX, XX },
1852 <    { "(bad)", XM, EX, XX },
1849 >    { "rsqrtps", XM, EX, XX, XX },
1850 >    { "rsqrtss", XM, EX, XX, XX },
1851 >    { "(bad)", XM, EX, XX, XX },
1852 >    { "(bad)", XM, EX, XX, XX },
1853    },
1854    /* PREGRP13 */
1855    {
1856 <    { "sqrtps", XM, EX, XX },
1857 <    { "sqrtss", XM, EX, XX },
1858 <    { "sqrtpd", XM, EX, XX },
1859 <    { "sqrtsd", XM, EX, XX },
1856 >    { "sqrtps", XM, EX, XX, XX },
1857 >    { "sqrtss", XM, EX, XX, XX },
1858 >    { "sqrtpd", XM, EX, XX, XX },
1859 >    { "sqrtsd", XM, EX, XX, XX },
1860    },
1861    /* PREGRP14 */
1862    {
1863 <    { "subps", XM, EX, XX },
1864 <    { "subss", XM, EX, XX },
1865 <    { "subpd", XM, EX, XX },
1866 <    { "subsd", XM, EX, XX },
1863 >    { "subps", XM, EX, XX, XX },
1864 >    { "subss", XM, EX, XX, XX },
1865 >    { "subpd", XM, EX, XX, XX },
1866 >    { "subsd", XM, EX, XX, XX },
1867    },
1868    /* PREGRP15 */
1869    {
1870 <    { "(bad)", XM, EX, XX },
1871 <    { "cvtdq2pd", XM, EX, XX },
1872 <    { "cvttpd2dq", XM, EX, XX },
1873 <    { "cvtpd2dq", XM, EX, XX },
1870 >    { "(bad)", XM, EX, XX, XX },
1871 >    { "cvtdq2pd", XM, EX, XX, XX },
1872 >    { "cvttpd2dq", XM, EX, XX, XX },
1873 >    { "cvtpd2dq", XM, EX, XX, XX },
1874    },
1875    /* PREGRP16 */
1876    {
1877 <    { "cvtdq2ps", XM, EX, XX },
1878 <    { "cvttps2dq",XM, EX, XX },
1879 <    { "cvtps2dq",XM, EX, XX },
1880 <    { "(bad)", XM, EX, XX },
1877 >    { "cvtdq2ps", XM, EX, XX, XX },
1878 >    { "cvttps2dq",XM, EX, XX, XX },
1879 >    { "cvtps2dq",XM, EX, XX, XX },
1880 >    { "(bad)", XM, EX, XX, XX },
1881    },
1882    /* PREGRP17 */
1883    {
1884 <    { "cvtps2pd", XM, EX, XX },
1885 <    { "cvtss2sd", XM, EX, XX },
1886 <    { "cvtpd2ps", XM, EX, XX },
1887 <    { "cvtsd2ss", XM, EX, XX },
1884 >    { "cvtps2pd", XM, EX, XX, XX },
1885 >    { "cvtss2sd", XM, EX, XX, XX },
1886 >    { "cvtpd2ps", XM, EX, XX, XX },
1887 >    { "cvtsd2ss", XM, EX, XX, XX },
1888    },
1889    /* PREGRP18 */
1890    {
1891 <    { "maskmovq", MX, MS, XX },
1892 <    { "(bad)", XM, EX, XX },
1893 <    { "maskmovdqu", XM, EX, XX },
1894 <    { "(bad)", XM, EX, XX },
1891 >    { "maskmovq", MX, MS, XX, XX },
1892 >    { "(bad)", XM, EX, XX, XX },
1893 >    { "maskmovdqu", XM, XS, XX, XX },
1894 >    { "(bad)", XM, EX, XX, XX },
1895    },
1896    /* PREGRP19 */
1897    {
1898 <    { "movq", MX, EM, XX },
1899 <    { "movdqu", XM, EX, XX },
1900 <    { "movdqa", XM, EX, XX },
1901 <    { "(bad)", XM, EX, XX },
1898 >    { "movq", MX, EM, XX, XX },
1899 >    { "movdqu", XM, EX, XX, XX },
1900 >    { "movdqa", XM, EX, XX, XX },
1901 >    { "(bad)", XM, EX, XX, XX },
1902    },
1903    /* PREGRP20 */
1904    {
1905 <    { "movq", EM, MX, XX },
1906 <    { "movdqu", EX, XM, XX },
1907 <    { "movdqa", EX, XM, XX },
1908 <    { "(bad)", EX, XM, XX },
1905 >    { "movq", EM, MX, XX, XX },
1906 >    { "movdqu", EX, XM, XX, XX },
1907 >    { "movdqa", EX, XM, XX, XX },
1908 >    { "(bad)", EX, XM, XX, XX },
1909    },
1910    /* PREGRP21 */
1911    {
1912 <    { "(bad)", EX, XM, XX },
1913 <    { "movq2dq", XM, MS, XX },
1914 <    { "movq", EX, XM, XX },
1915 <    { "movdq2q", MX, XS, XX },
1912 >    { "(bad)", EX, XM, XX, XX },
1913 >    { "movq2dq", XM, MS, XX, XX },
1914 >    { "movq", EX, XM, XX, XX },
1915 >    { "movdq2q", MX, XS, XX, XX },
1916    },
1917    /* PREGRP22 */
1918    {
1919 <    { "pshufw", MX, EM, Ib },
1920 <    { "pshufhw", XM, EX, Ib },
1921 <    { "pshufd", XM, EX, Ib },
1922 <    { "pshuflw", XM, EX, Ib },
1919 >    { "pshufw", MX, EM, Ib, XX },
1920 >    { "pshufhw", XM, EX, Ib, XX },
1921 >    { "pshufd", XM, EX, Ib, XX },
1922 >    { "pshuflw", XM, EX, Ib, XX },
1923    },
1924    /* PREGRP23 */
1925    {
1926 <    { "movd", Ed, MX, XX },
1927 <    { "movq", XM, EX, XX },
1928 <    { "movd", Ed, XM, XX },
1929 <    { "(bad)", Ed, XM, XX },
1926 >    { "movd", Edq, MX, XX, XX },
1927 >    { "movq", XM, EX, XX, XX },
1928 >    { "movd", Edq, XM, XX, XX },
1929 >    { "(bad)", Ed, XM, XX, XX },
1930    },
1931    /* PREGRP24 */
1932    {
1933 <    { "(bad)", MX, EX, XX },
1934 <    { "(bad)", XM, EX, XX },
1935 <    { "punpckhqdq", XM, EX, XX },
1936 <    { "(bad)", XM, EX, XX },
1933 >    { "(bad)", MX, EX, XX, XX },
1934 >    { "(bad)", XM, EX, XX, XX },
1935 >    { "punpckhqdq", XM, EX, XX, XX },
1936 >    { "(bad)", XM, EX, XX, XX },
1937    },
1938    /* PREGRP25 */
1939    {
1940 <  { "movntq", Ev, MX, XX },
1941 <  { "(bad)", Ev, XM, XX },
1942 <  { "movntdq", Ev, XM, XX },
1943 <  { "(bad)", Ev, XM, XX },
1940 >    { "movntq", EM, MX, XX, XX },
1941 >    { "(bad)", EM, XM, XX, XX },
1942 >    { "movntdq", EM, XM, XX, XX },
1943 >    { "(bad)", EM, XM, XX, XX },
1944    },
1945    /* PREGRP26 */
1946    {
1947 <    { "(bad)", MX, EX, XX },
1948 <    { "(bad)", XM, EX, XX },
1949 <    { "punpcklqdq", XM, EX, XX },
1950 <    { "(bad)", XM, EX, XX },
1947 >    { "(bad)", MX, EX, XX, XX },
1948 >    { "(bad)", XM, EX, XX, XX },
1949 >    { "punpcklqdq", XM, EX, XX, XX },
1950 >    { "(bad)", XM, EX, XX, XX },
1951 >  },
1952 >  /* PREGRP27 */
1953 >  {
1954 >    { "(bad)", MX, EX, XX, XX },
1955 >    { "(bad)", XM, EX, XX, XX },
1956 >    { "addsubpd", XM, EX, XX, XX },
1957 >    { "addsubps", XM, EX, XX, XX },
1958 >  },
1959 >  /* PREGRP28 */
1960 >  {
1961 >    { "(bad)", MX, EX, XX, XX },
1962 >    { "(bad)", XM, EX, XX, XX },
1963 >    { "haddpd", XM, EX, XX, XX },
1964 >    { "haddps", XM, EX, XX, XX },
1965 >  },
1966 >  /* PREGRP29 */
1967 >  {
1968 >    { "(bad)", MX, EX, XX, XX },
1969 >    { "(bad)", XM, EX, XX, XX },
1970 >    { "hsubpd", XM, EX, XX, XX },
1971 >    { "hsubps", XM, EX, XX, XX },
1972 >  },
1973 >  /* PREGRP30 */
1974 >  {
1975 >    { "movlpX", XM, EX, SIMD_Fixup, 'h', XX }, /* really only 2 operands */
1976 >    { "movsldup", XM, EX, XX, XX },
1977 >    { "movlpd", XM, EX, XX, XX },
1978 >    { "movddup", XM, EX, XX, XX },
1979 >  },
1980 >  /* PREGRP31 */
1981 >  {
1982 >    { "movhpX", XM, EX, SIMD_Fixup, 'l', XX },
1983 >    { "movshdup", XM, EX, XX, XX },
1984 >    { "movhpd", XM, EX, XX, XX },
1985 >    { "(bad)", XM, EX, XX, XX },
1986 >  },
1987 >  /* PREGRP32 */
1988 >  {
1989 >    { "(bad)", XM, EX, XX, XX },
1990 >    { "(bad)", XM, EX, XX, XX },
1991 >    { "(bad)", XM, EX, XX, XX },
1992 >    { "lddqu", XM, M, XX, XX },
1993 >  },
1994 >  /* PREGRP33 */
1995 >  {
1996 >    {"movntps",Ev, XM, XX, XX },
1997 >    {"movntss",Ev, XM, XX, XX },
1998 >    {"movntpd",Ev, XM, XX, XX },
1999 >    {"movntsd",Ev, XM, XX, XX },
2000 >  },
2001 >
2002 >  /* PREGRP34 */
2003 >  {
2004 >    {"vmread", Em, Gm, XX, XX },
2005 >    {"(bad)",  XX, XX, XX, XX },
2006 >    {"extrq",  XS, Ib, Ib, XX },
2007 >    {"insertq",XM, XS, Ib, Ib },
2008 >  },
2009 >  
2010 > /* PREGRP35 */  
2011 >  {
2012 >    {"vmwrite", Gm, Em, XX, XX },
2013 >    {"(bad)",   XX, XX, XX, XX },
2014 >    {"extrq",   XM, XS, XX, XX },
2015 >    {"insertq", XM, XS, XX, XX },
2016 >  },
2017 >
2018 >  /* PREGRP36 */
2019 >  {
2020 >    { "bsrS",   Gv, Ev, XX, XX },
2021 >    { "lzcntS", Gv, Ev, XX, XX },
2022 >    { "bsrS",  Gv, Ev, XX, XX },
2023 >    { "(bad)",  XX, XX, XX, XX },
2024 >  },
2025 >
2026 >  /* PREGRP37 */
2027 >  {
2028 >    { "(bad)",  XX, XX, XX, XX },
2029 >    { "popcntS",Gv, Ev, XX, XX },
2030 >    { "(bad)",  XX, XX, XX, XX },
2031 >    { "(bad)",  XX, XX, XX, XX },    
2032    },
2033   };
2034  
2035   static const struct dis386 x86_64_table[][2] = {
2036    {
2037 <    { "arpl", Ew, Gw, XX },
2038 <    { "movs{||lq|xd}", Gv, Ed, XX },
2037 >    { "pusha{P|}",      XX, XX, XX, XX },
2038 >    { "(bad)",          XX, XX, XX, XX },
2039 >  },
2040 >  {
2041 >    { "popa{P|}",       XX, XX, XX, XX },
2042 >    { "(bad)",          XX, XX, XX, XX },
2043 >  },
2044 >  {
2045 >    { "bound{S|}",      Gv, Ma, XX, XX },
2046 >    { "(bad)",          XX, XX, XX, XX },
2047 >  },
2048 >  {
2049 >    { "arpl",           Ew, Gw, XX, XX },
2050 >    { "movs{||lq|xd}",  Gv, Ed, XX, XX },
2051 >  },
2052 > };
2053 >
2054 > static const struct dis386 three_byte_table[][256] = {
2055 >  /* THREE_BYTE_0 */
2056 >  {
2057 >    /* 00 */
2058 >    { "pshufb",         MX, EM, XX, XX },
2059 >    { "phaddw",         MX, EM, XX, XX },
2060 >    { "phaddd",         MX, EM, XX, XX },
2061 >    { "phaddsw",        MX, EM, XX, XX },
2062 >    { "pmaddubsw",      MX, EM, XX, XX },
2063 >    { "phsubw",         MX, EM, XX, XX },
2064 >    { "phsubd",         MX, EM, XX, XX },
2065 >    { "phsubsw",        MX, EM, XX, XX },
2066 >    /* 08 */
2067 >    { "psignb",         MX, EM, XX, XX },
2068 >    { "psignw",         MX, EM, XX, XX },
2069 >    { "psignd",         MX, EM, XX, XX },
2070 >    { "pmulhrsw",       MX, EM, XX, XX },
2071 >    { "(bad)",          XX, XX, XX, XX },
2072 >    { "(bad)",          XX, XX, XX, XX },
2073 >    { "(bad)",          XX, XX, XX, XX },
2074 >    { "(bad)",          XX, XX, XX, XX },
2075 >    /* 10 */
2076 >    { "(bad)",          XX, XX, XX, XX },
2077 >    { "(bad)",          XX, XX, XX, XX },
2078 >    { "(bad)",          XX, XX, XX, XX },
2079 >    { "(bad)",          XX, XX, XX, XX },
2080 >    { "(bad)",          XX, XX, XX, XX },
2081 >    { "(bad)",          XX, XX, XX, XX },
2082 >    { "(bad)",          XX, XX, XX, XX },
2083 >    { "(bad)",          XX, XX, XX, XX },
2084 >    /* 18 */
2085 >    { "(bad)",          XX, XX, XX, XX },
2086 >    { "(bad)",          XX, XX, XX, XX },
2087 >    { "(bad)",          XX, XX, XX, XX },
2088 >    { "(bad)",          XX, XX, XX, XX },
2089 >    { "pabsb",          MX, EM, XX, XX },
2090 >    { "pabsw",          MX, EM, XX, XX },
2091 >    { "pabsd",          MX, EM, XX, XX },
2092 >    { "(bad)",          XX, XX, XX, XX },
2093 >    /* 20 */
2094 >    { "(bad)",          XX, XX, XX, XX },
2095 >    { "(bad)",          XX, XX, XX, XX },
2096 >    { "(bad)",          XX, XX, XX, XX },
2097 >    { "(bad)",          XX, XX, XX, XX },
2098 >    { "(bad)",          XX, XX, XX, XX },
2099 >    { "(bad)",          XX, XX, XX, XX },
2100 >    { "(bad)",          XX, XX, XX, XX },
2101 >    { "(bad)",          XX, XX, XX, XX },
2102 >    /* 28 */
2103 >    { "(bad)",          XX, XX, XX, XX },
2104 >    { "(bad)",          XX, XX, XX, XX },
2105 >    { "(bad)",          XX, XX, XX, XX },
2106 >    { "(bad)",          XX, XX, XX, XX },
2107 >    { "(bad)",          XX, XX, XX, XX },
2108 >    { "(bad)",          XX, XX, XX, XX },
2109 >    { "(bad)",          XX, XX, XX, XX },
2110 >    { "(bad)",          XX, XX, XX, XX },
2111 >    /* 30 */
2112 >    { "(bad)",          XX, XX, XX, XX },
2113 >    { "(bad)",          XX, XX, XX, XX },
2114 >    { "(bad)",          XX, XX, XX, XX },
2115 >    { "(bad)",          XX, XX, XX, XX },
2116 >    { "(bad)",          XX, XX, XX, XX },
2117 >    { "(bad)",          XX, XX, XX, XX },
2118 >    { "(bad)",          XX, XX, XX, XX },
2119 >    { "(bad)",          XX, XX, XX, XX },
2120 >    /* 38 */
2121 >    { "(bad)",          XX, XX, XX, XX },
2122 >    { "(bad)",          XX, XX, XX, XX },
2123 >    { "(bad)",          XX, XX, XX, XX },
2124 >    { "(bad)",          XX, XX, XX, XX },
2125 >    { "(bad)",          XX, XX, XX, XX },
2126 >    { "(bad)",          XX, XX, XX, XX },
2127 >    { "(bad)",          XX, XX, XX, XX },
2128 >    { "(bad)",          XX, XX, XX, XX },
2129 >    /* 40 */
2130 >    { "(bad)",          XX, XX, XX, XX },
2131 >    { "(bad)",          XX, XX, XX, XX },
2132 >    { "(bad)",          XX, XX, XX, XX },
2133 >    { "(bad)",          XX, XX, XX, XX },
2134 >    { "(bad)",          XX, XX, XX, XX },
2135 >    { "(bad)",          XX, XX, XX, XX },
2136 >    { "(bad)",          XX, XX, XX, XX },
2137 >    { "(bad)",          XX, XX, XX, XX },
2138 >    /* 48 */
2139 >    { "(bad)",          XX, XX, XX, XX },
2140 >    { "(bad)",          XX, XX, XX, XX },
2141 >    { "(bad)",          XX, XX, XX, XX },
2142 >    { "(bad)",          XX, XX, XX, XX },
2143 >    { "(bad)",          XX, XX, XX, XX },
2144 >    { "(bad)",          XX, XX, XX, XX },
2145 >    { "(bad)",          XX, XX, XX, XX },
2146 >    { "(bad)",          XX, XX, XX, XX },
2147 >    /* 50 */
2148 >    { "(bad)",          XX, XX, XX, XX },
2149 >    { "(bad)",          XX, XX, XX, XX },
2150 >    { "(bad)",          XX, XX, XX, XX },
2151 >    { "(bad)",          XX, XX, XX, XX },
2152 >    { "(bad)",          XX, XX, XX, XX },
2153 >    { "(bad)",          XX, XX, XX, XX },
2154 >    { "(bad)",          XX, XX, XX, XX },
2155 >    { "(bad)",          XX, XX, XX, XX },
2156 >    /* 58 */
2157 >    { "(bad)",          XX, XX, XX, XX },
2158 >    { "(bad)",          XX, XX, XX, XX },
2159 >    { "(bad)",          XX, XX, XX, XX },
2160 >    { "(bad)",          XX, XX, XX, XX },
2161 >    { "(bad)",          XX, XX, XX, XX },
2162 >    { "(bad)",          XX, XX, XX, XX },
2163 >    { "(bad)",          XX, XX, XX, XX },
2164 >    { "(bad)",          XX, XX, XX, XX },
2165 >    /* 60 */
2166 >    { "(bad)",          XX, XX, XX, XX },
2167 >    { "(bad)",          XX, XX, XX, XX },
2168 >    { "(bad)",          XX, XX, XX, XX },
2169 >    { "(bad)",          XX, XX, XX, XX },
2170 >    { "(bad)",          XX, XX, XX, XX },
2171 >    { "(bad)",          XX, XX, XX, XX },
2172 >    { "(bad)",          XX, XX, XX, XX },
2173 >    { "(bad)",          XX, XX, XX, XX },
2174 >    /* 68 */
2175 >    { "(bad)",          XX, XX, XX, XX },
2176 >    { "(bad)",          XX, XX, XX, XX },
2177 >    { "(bad)",          XX, XX, XX, XX },
2178 >    { "(bad)",          XX, XX, XX, XX },
2179 >    { "(bad)",          XX, XX, XX, XX },
2180 >    { "(bad)",          XX, XX, XX, XX },
2181 >    { "(bad)",          XX, XX, XX, XX },
2182 >    { "(bad)",          XX, XX, XX, XX },
2183 >    /* 70 */
2184 >    { "(bad)",          XX, XX, XX, XX },
2185 >    { "(bad)",          XX, XX, XX, XX },
2186 >    { "(bad)",          XX, XX, XX, XX },
2187 >    { "(bad)",          XX, XX, XX, XX },
2188 >    { "(bad)",          XX, XX, XX, XX },
2189 >    { "(bad)",          XX, XX, XX, XX },
2190 >    { "(bad)",          XX, XX, XX, XX },
2191 >    { "(bad)",          XX, XX, XX, XX },
2192 >    /* 78 */
2193 >    { "(bad)",          XX, XX, XX, XX },
2194 >    { "(bad)",          XX, XX, XX, XX },
2195 >    { "(bad)",          XX, XX, XX, XX },
2196 >    { "(bad)",          XX, XX, XX, XX },
2197 >    { "(bad)",          XX, XX, XX, XX },
2198 >    { "(bad)",          XX, XX, XX, XX },
2199 >    { "(bad)",          XX, XX, XX, XX },
2200 >    { "(bad)",          XX, XX, XX, XX },
2201 >    /* 80 */
2202 >    { "(bad)",          XX, XX, XX, XX },
2203 >    { "(bad)",          XX, XX, XX, XX },
2204 >    { "(bad)",          XX, XX, XX, XX },
2205 >    { "(bad)",          XX, XX, XX, XX },
2206 >    { "(bad)",          XX, XX, XX, XX },
2207 >    { "(bad)",          XX, XX, XX, XX },
2208 >    { "(bad)",          XX, XX, XX, XX },
2209 >    { "(bad)",          XX, XX, XX, XX },
2210 >    /* 88 */
2211 >    { "(bad)",          XX, XX, XX, XX },
2212 >    { "(bad)",          XX, XX, XX, XX },
2213 >    { "(bad)",          XX, XX, XX, XX },
2214 >    { "(bad)",          XX, XX, XX, XX },
2215 >    { "(bad)",          XX, XX, XX, XX },
2216 >    { "(bad)",          XX, XX, XX, XX },
2217 >    { "(bad)",          XX, XX, XX, XX },
2218 >    { "(bad)",          XX, XX, XX, XX },
2219 >    /* 90 */
2220 >    { "(bad)",          XX, XX, XX, XX },
2221 >    { "(bad)",          XX, XX, XX, XX },
2222 >    { "(bad)",          XX, XX, XX, XX },
2223 >    { "(bad)",          XX, XX, XX, XX },
2224 >    { "(bad)",          XX, XX, XX, XX },
2225 >    { "(bad)",          XX, XX, XX, XX },
2226 >    { "(bad)",          XX, XX, XX, XX },
2227 >    { "(bad)",          XX, XX, XX, XX },
2228 >    /* 98 */
2229 >    { "(bad)",          XX, XX, XX, XX },
2230 >    { "(bad)",          XX, XX, XX, XX },
2231 >    { "(bad)",          XX, XX, XX, XX },
2232 >    { "(bad)",          XX, XX, XX, XX },
2233 >    { "(bad)",          XX, XX, XX, XX },
2234 >    { "(bad)",          XX, XX, XX, XX },
2235 >    { "(bad)",          XX, XX, XX, XX },
2236 >    { "(bad)",          XX, XX, XX, XX },
2237 >    /* a0 */
2238 >    { "(bad)",          XX, XX, XX, XX },
2239 >    { "(bad)",          XX, XX, XX, XX },
2240 >    { "(bad)",          XX, XX, XX, XX },
2241 >    { "(bad)",          XX, XX, XX, XX },
2242 >    { "(bad)",          XX, XX, XX, XX },
2243 >    { "(bad)",          XX, XX, XX, XX },
2244 >    { "(bad)",          XX, XX, XX, XX },
2245 >    { "(bad)",          XX, XX, XX, XX },
2246 >    /* a8 */
2247 >    { "(bad)",          XX, XX, XX, XX },
2248 >    { "(bad)",          XX, XX, XX, XX },
2249 >    { "(bad)",          XX, XX, XX, XX },
2250 >    { "(bad)",          XX, XX, XX, XX },
2251 >    { "(bad)",          XX, XX, XX, XX },
2252 >    { "(bad)",          XX, XX, XX, XX },
2253 >    { "(bad)",          XX, XX, XX, XX },
2254 >    { "(bad)",          XX, XX, XX, XX },
2255 >    /* b0 */
2256 >    { "(bad)",          XX, XX, XX, XX },
2257 >    { "(bad)",          XX, XX, XX, XX },
2258 >    { "(bad)",          XX, XX, XX, XX },
2259 >    { "(bad)",          XX, XX, XX, XX },
2260 >    { "(bad)",          XX, XX, XX, XX },
2261 >    { "(bad)",          XX, XX, XX, XX },
2262 >    { "(bad)",          XX, XX, XX, XX },
2263 >    { "(bad)",          XX, XX, XX, XX },
2264 >    /* b8 */
2265 >    { "(bad)",          XX, XX, XX, XX },
2266 >    { "(bad)",          XX, XX, XX, XX },
2267 >    { "(bad)",          XX, XX, XX, XX },
2268 >    { "(bad)",          XX, XX, XX, XX },
2269 >    { "(bad)",          XX, XX, XX, XX },
2270 >    { "(bad)",          XX, XX, XX, XX },
2271 >    { "(bad)",          XX, XX, XX, XX },
2272 >    { "(bad)",          XX, XX, XX, XX },
2273 >    /* c0 */
2274 >    { "(bad)",          XX, XX, XX, XX },
2275 >    { "(bad)",          XX, XX, XX, XX },
2276 >    { "(bad)",          XX, XX, XX, XX },
2277 >    { "(bad)",          XX, XX, XX, XX },
2278 >    { "(bad)",          XX, XX, XX, XX },
2279 >    { "(bad)",          XX, XX, XX, XX },
2280 >    { "(bad)",          XX, XX, XX, XX },
2281 >    { "(bad)",          XX, XX, XX, XX },
2282 >    /* c8 */
2283 >    { "(bad)",          XX, XX, XX, XX },
2284 >    { "(bad)",          XX, XX, XX, XX },
2285 >    { "(bad)",          XX, XX, XX, XX },
2286 >    { "(bad)",          XX, XX, XX, XX },
2287 >    { "(bad)",          XX, XX, XX, XX },
2288 >    { "(bad)",          XX, XX, XX, XX },
2289 >    { "(bad)",          XX, XX, XX, XX },
2290 >    { "(bad)",          XX, XX, XX, XX },
2291 >    /* d0 */
2292 >    { "(bad)",          XX, XX, XX, XX },
2293 >    { "(bad)",          XX, XX, XX, XX },
2294 >    { "(bad)",          XX, XX, XX, XX },
2295 >    { "(bad)",          XX, XX, XX, XX },
2296 >    { "(bad)",          XX, XX, XX, XX },
2297 >    { "(bad)",          XX, XX, XX, XX },
2298 >    { "(bad)",          XX, XX, XX, XX },
2299 >    { "(bad)",          XX, XX, XX, XX },
2300 >    /* d8 */
2301 >    { "(bad)",          XX, XX, XX, XX },
2302 >    { "(bad)",          XX, XX, XX, XX },
2303 >    { "(bad)",          XX, XX, XX, XX },
2304 >    { "(bad)",          XX, XX, XX, XX },
2305 >    { "(bad)",          XX, XX, XX, XX },
2306 >    { "(bad)",          XX, XX, XX, XX },
2307 >    { "(bad)",          XX, XX, XX, XX },
2308 >    { "(bad)",          XX, XX, XX, XX },
2309 >    /* e0 */
2310 >    { "(bad)",          XX, XX, XX, XX },
2311 >    { "(bad)",          XX, XX, XX, XX },
2312 >    { "(bad)",          XX, XX, XX, XX },
2313 >    { "(bad)",          XX, XX, XX, XX },
2314 >    { "(bad)",          XX, XX, XX, XX },
2315 >    { "(bad)",          XX, XX, XX, XX },
2316 >    { "(bad)",          XX, XX, XX, XX },
2317 >    { "(bad)",          XX, XX, XX, XX },
2318 >    /* e8 */
2319 >    { "(bad)",          XX, XX, XX, XX },
2320 >    { "(bad)",          XX, XX, XX, XX },
2321 >    { "(bad)",          XX, XX, XX, XX },
2322 >    { "(bad)",          XX, XX, XX, XX },
2323 >    { "(bad)",          XX, XX, XX, XX },
2324 >    { "(bad)",          XX, XX, XX, XX },
2325 >    { "(bad)",          XX, XX, XX, XX },
2326 >    { "(bad)",          XX, XX, XX, XX },
2327 >    /* f0 */
2328 >    { "(bad)",          XX, XX, XX, XX },
2329 >    { "(bad)",          XX, XX, XX, XX },
2330 >    { "(bad)",          XX, XX, XX, XX },
2331 >    { "(bad)",          XX, XX, XX, XX },
2332 >    { "(bad)",          XX, XX, XX, XX },
2333 >    { "(bad)",          XX, XX, XX, XX },
2334 >    { "(bad)",          XX, XX, XX, XX },
2335 >    { "(bad)",          XX, XX, XX, XX },
2336 >    /* f8 */
2337 >    { "(bad)",          XX, XX, XX, XX },
2338 >    { "(bad)",          XX, XX, XX, XX },
2339 >    { "(bad)",          XX, XX, XX, XX },
2340 >    { "(bad)",          XX, XX, XX, XX },
2341 >    { "(bad)",          XX, XX, XX, XX },
2342 >    { "(bad)",          XX, XX, XX, XX },
2343 >    { "(bad)",          XX, XX, XX, XX },
2344 >    { "(bad)",          XX, XX, XX, XX }
2345 >  },
2346 >  /* THREE_BYTE_1 */
2347 >  {
2348 >    /* 00 */
2349 >    { "(bad)",          XX, XX, XX, XX },
2350 >    { "(bad)",          XX, XX, XX, XX },
2351 >    { "(bad)",          XX, XX, XX, XX },
2352 >    { "(bad)",          XX, XX, XX, XX },
2353 >    { "(bad)",          XX, XX, XX, XX },
2354 >    { "(bad)",          XX, XX, XX, XX },
2355 >    { "(bad)",          XX, XX, XX, XX },
2356 >    { "(bad)",          XX, XX, XX, XX },
2357 >    /* 08 */
2358 >    { "(bad)",          XX, XX, XX, XX },
2359 >    { "(bad)",          XX, XX, XX, XX },
2360 >    { "(bad)",          XX, XX, XX, XX },
2361 >    { "(bad)",          XX, XX, XX, XX },
2362 >    { "(bad)",          XX, XX, XX, XX },
2363 >    { "(bad)",          XX, XX, XX, XX },
2364 >    { "(bad)",          XX, XX, XX, XX },
2365 >    { "palignr",        MX, EM, Ib, XX },
2366 >    /* 10 */
2367 >    { "(bad)",          XX, XX, XX, XX },
2368 >    { "(bad)",          XX, XX, XX, XX },
2369 >    { "(bad)",          XX, XX, XX, XX },
2370 >    { "(bad)",          XX, XX, XX, XX },
2371 >    { "(bad)",          XX, XX, XX, XX },
2372 >    { "(bad)",          XX, XX, XX, XX },
2373 >    { "(bad)",          XX, XX, XX, XX },
2374 >    { "(bad)",          XX, XX, XX, XX },
2375 >    /* 18 */
2376 >    { "(bad)",          XX, XX, XX, XX },
2377 >    { "(bad)",          XX, XX, XX, XX },
2378 >    { "(bad)",          XX, XX, XX, XX },
2379 >    { "(bad)",          XX, XX, XX, XX },
2380 >    { "(bad)",          XX, XX, XX, XX },
2381 >    { "(bad)",          XX, XX, XX, XX },
2382 >    { "(bad)",          XX, XX, XX, XX },
2383 >    { "(bad)",          XX, XX, XX, XX },
2384 >    /* 20 */
2385 >    { "(bad)",          XX, XX, XX, XX },
2386 >    { "(bad)",          XX, XX, XX, XX },
2387 >    { "(bad)",          XX, XX, XX, XX },
2388 >    { "(bad)",          XX, XX, XX, XX },
2389 >    { "(bad)",          XX, XX, XX, XX },
2390 >    { "(bad)",          XX, XX, XX, XX },
2391 >    { "(bad)",          XX, XX, XX, XX },
2392 >    { "(bad)",          XX, XX, XX, XX },
2393 >    /* 28 */
2394 >    { "(bad)",          XX, XX, XX, XX },
2395 >    { "(bad)",          XX, XX, XX, XX },
2396 >    { "(bad)",          XX, XX, XX, XX },
2397 >    { "(bad)",          XX, XX, XX, XX },
2398 >    { "(bad)",          XX, XX, XX, XX },
2399 >    { "(bad)",          XX, XX, XX, XX },
2400 >    { "(bad)",          XX, XX, XX, XX },
2401 >    { "(bad)",          XX, XX, XX, XX },
2402 >    /* 30 */
2403 >    { "(bad)",          XX, XX, XX, XX },
2404 >    { "(bad)",          XX, XX, XX, XX },
2405 >    { "(bad)",          XX, XX, XX, XX },
2406 >    { "(bad)",          XX, XX, XX, XX },
2407 >    { "(bad)",          XX, XX, XX, XX },
2408 >    { "(bad)",          XX, XX, XX, XX },
2409 >    { "(bad)",          XX, XX, XX, XX },
2410 >    { "(bad)",          XX, XX, XX, XX },
2411 >    /* 38 */
2412 >    { "(bad)",          XX, XX, XX, XX },
2413 >    { "(bad)",          XX, XX, XX, XX },
2414 >    { "(bad)",          XX, XX, XX, XX },
2415 >    { "(bad)",          XX, XX, XX, XX },
2416 >    { "(bad)",          XX, XX, XX, XX },
2417 >    { "(bad)",          XX, XX, XX, XX },
2418 >    { "(bad)",          XX, XX, XX, XX },
2419 >    { "(bad)",          XX, XX, XX, XX },
2420 >    /* 40 */
2421 >    { "(bad)",          XX, XX, XX, XX },
2422 >    { "(bad)",          XX, XX, XX, XX },
2423 >    { "(bad)",          XX, XX, XX, XX },
2424 >    { "(bad)",          XX, XX, XX, XX },
2425 >    { "(bad)",          XX, XX, XX, XX },
2426 >    { "(bad)",          XX, XX, XX, XX },
2427 >    { "(bad)",          XX, XX, XX, XX },
2428 >    { "(bad)",          XX, XX, XX, XX },
2429 >    /* 48 */
2430 >    { "(bad)",          XX, XX, XX, XX },
2431 >    { "(bad)",          XX, XX, XX, XX },
2432 >    { "(bad)",          XX, XX, XX, XX },
2433 >    { "(bad)",          XX, XX, XX, XX },
2434 >    { "(bad)",          XX, XX, XX, XX },
2435 >    { "(bad)",          XX, XX, XX, XX },
2436 >    { "(bad)",          XX, XX, XX, XX },
2437 >    { "(bad)",          XX, XX, XX, XX },
2438 >    /* 50 */
2439 >    { "(bad)",          XX, XX, XX, XX },
2440 >    { "(bad)",          XX, XX, XX, XX },
2441 >    { "(bad)",          XX, XX, XX, XX },
2442 >    { "(bad)",          XX, XX, XX, XX },
2443 >    { "(bad)",          XX, XX, XX, XX },
2444 >    { "(bad)",          XX, XX, XX, XX },
2445 >    { "(bad)",          XX, XX, XX, XX },
2446 >    { "(bad)",          XX, XX, XX, XX },
2447 >    /* 58 */
2448 >    { "(bad)",          XX, XX, XX, XX },
2449 >    { "(bad)",          XX, XX, XX, XX },
2450 >    { "(bad)",          XX, XX, XX, XX },
2451 >    { "(bad)",          XX, XX, XX, XX },
2452 >    { "(bad)",          XX, XX, XX, XX },
2453 >    { "(bad)",          XX, XX, XX, XX },
2454 >    { "(bad)",          XX, XX, XX, XX },
2455 >    { "(bad)",          XX, XX, XX, XX },
2456 >    /* 60 */
2457 >    { "(bad)",          XX, XX, XX, XX },
2458 >    { "(bad)",          XX, XX, XX, XX },
2459 >    { "(bad)",          XX, XX, XX, XX },
2460 >    { "(bad)",          XX, XX, XX, XX },
2461 >    { "(bad)",          XX, XX, XX, XX },
2462 >    { "(bad)",          XX, XX, XX, XX },
2463 >    { "(bad)",          XX, XX, XX, XX },
2464 >    { "(bad)",          XX, XX, XX, XX },
2465 >    /* 68 */
2466 >    { "(bad)",          XX, XX, XX, XX },
2467 >    { "(bad)",          XX, XX, XX, XX },
2468 >    { "(bad)",          XX, XX, XX, XX },
2469 >    { "(bad)",          XX, XX, XX, XX },
2470 >    { "(bad)",          XX, XX, XX, XX },
2471 >    { "(bad)",          XX, XX, XX, XX },
2472 >    { "(bad)",          XX, XX, XX, XX },
2473 >    { "(bad)",          XX, XX, XX, XX },
2474 >    /* 70 */
2475 >    { "(bad)",          XX, XX, XX, XX },
2476 >    { "(bad)",          XX, XX, XX, XX },
2477 >    { "(bad)",          XX, XX, XX, XX },
2478 >    { "(bad)",          XX, XX, XX, XX },
2479 >    { "(bad)",          XX, XX, XX, XX },
2480 >    { "(bad)",          XX, XX, XX, XX },
2481 >    { "(bad)",          XX, XX, XX, XX },
2482 >    { "(bad)",          XX, XX, XX, XX },
2483 >    /* 78 */
2484 >    { "(bad)",          XX, XX, XX, XX },
2485 >    { "(bad)",          XX, XX, XX, XX },
2486 >    { "(bad)",          XX, XX, XX, XX },
2487 >    { "(bad)",          XX, XX, XX, XX },
2488 >    { "(bad)",          XX, XX, XX, XX },
2489 >    { "(bad)",          XX, XX, XX, XX },
2490 >    { "(bad)",          XX, XX, XX, XX },
2491 >    { "(bad)",          XX, XX, XX, XX },
2492 >    /* 80 */
2493 >    { "(bad)",          XX, XX, XX, XX },
2494 >    { "(bad)",          XX, XX, XX, XX },
2495 >    { "(bad)",          XX, XX, XX, XX },
2496 >    { "(bad)",          XX, XX, XX, XX },
2497 >    { "(bad)",          XX, XX, XX, XX },
2498 >    { "(bad)",          XX, XX, XX, XX },
2499 >    { "(bad)",          XX, XX, XX, XX },
2500 >    { "(bad)",          XX, XX, XX, XX },
2501 >    /* 88 */
2502 >    { "(bad)",          XX, XX, XX, XX },
2503 >    { "(bad)",          XX, XX, XX, XX },
2504 >    { "(bad)",          XX, XX, XX, XX },
2505 >    { "(bad)",          XX, XX, XX, XX },
2506 >    { "(bad)",          XX, XX, XX, XX },
2507 >    { "(bad)",          XX, XX, XX, XX },
2508 >    { "(bad)",          XX, XX, XX, XX },
2509 >    { "(bad)",          XX, XX, XX, XX },
2510 >    /* 90 */
2511 >    { "(bad)",          XX, XX, XX, XX },
2512 >    { "(bad)",          XX, XX, XX, XX },
2513 >    { "(bad)",          XX, XX, XX, XX },
2514 >    { "(bad)",          XX, XX, XX, XX },
2515 >    { "(bad)",          XX, XX, XX, XX },
2516 >    { "(bad)",          XX, XX, XX, XX },
2517 >    { "(bad)",          XX, XX, XX, XX },
2518 >    { "(bad)",          XX, XX, XX, XX },
2519 >    /* 98 */
2520 >    { "(bad)",          XX, XX, XX, XX },
2521 >    { "(bad)",          XX, XX, XX, XX },
2522 >    { "(bad)",          XX, XX, XX, XX },
2523 >    { "(bad)",          XX, XX, XX, XX },
2524 >    { "(bad)",          XX, XX, XX, XX },
2525 >    { "(bad)",          XX, XX, XX, XX },
2526 >    { "(bad)",          XX, XX, XX, XX },
2527 >    { "(bad)",          XX, XX, XX, XX },
2528 >    /* a0 */
2529 >    { "(bad)",          XX, XX, XX, XX },
2530 >    { "(bad)",          XX, XX, XX, XX },
2531 >    { "(bad)",          XX, XX, XX, XX },
2532 >    { "(bad)",          XX, XX, XX, XX },
2533 >    { "(bad)",          XX, XX, XX, XX },
2534 >    { "(bad)",          XX, XX, XX, XX },
2535 >    { "(bad)",          XX, XX, XX, XX },
2536 >    { "(bad)",          XX, XX, XX, XX },
2537 >    /* a8 */
2538 >    { "(bad)",          XX, XX, XX, XX },
2539 >    { "(bad)",          XX, XX, XX, XX },
2540 >    { "(bad)",          XX, XX, XX, XX },
2541 >    { "(bad)",          XX, XX, XX, XX },
2542 >    { "(bad)",          XX, XX, XX, XX },
2543 >    { "(bad)",          XX, XX, XX, XX },
2544 >    { "(bad)",          XX, XX, XX, XX },
2545 >    { "(bad)",          XX, XX, XX, XX },
2546 >    /* b0 */
2547 >    { "(bad)",          XX, XX, XX, XX },
2548 >    { "(bad)",          XX, XX, XX, XX },
2549 >    { "(bad)",          XX, XX, XX, XX },
2550 >    { "(bad)",          XX, XX, XX, XX },
2551 >    { "(bad)",          XX, XX, XX, XX },
2552 >    { "(bad)",          XX, XX, XX, XX },
2553 >    { "(bad)",          XX, XX, XX, XX },
2554 >    { "(bad)",          XX, XX, XX, XX },
2555 >    /* b8 */
2556 >    { "(bad)",          XX, XX, XX, XX },
2557 >    { "(bad)",          XX, XX, XX, XX },
2558 >    { "(bad)",          XX, XX, XX, XX },
2559 >    { "(bad)",          XX, XX, XX, XX },
2560 >    { "(bad)",          XX, XX, XX, XX },
2561 >    { "(bad)",          XX, XX, XX, XX },
2562 >    { "(bad)",          XX, XX, XX, XX },
2563 >    { "(bad)",          XX, XX, XX, XX },
2564 >    /* c0 */
2565 >    { "(bad)",          XX, XX, XX, XX },
2566 >    { "(bad)",          XX, XX, XX, XX },
2567 >    { "(bad)",          XX, XX, XX, XX },
2568 >    { "(bad)",          XX, XX, XX, XX },
2569 >    { "(bad)",          XX, XX, XX, XX },
2570 >    { "(bad)",          XX, XX, XX, XX },
2571 >    { "(bad)",          XX, XX, XX, XX },
2572 >    { "(bad)",          XX, XX, XX, XX },
2573 >    /* c8 */
2574 >    { "(bad)",          XX, XX, XX, XX },
2575 >    { "(bad)",          XX, XX, XX, XX },
2576 >    { "(bad)",          XX, XX, XX, XX },
2577 >    { "(bad)",          XX, XX, XX, XX },
2578 >    { "(bad)",          XX, XX, XX, XX },
2579 >    { "(bad)",          XX, XX, XX, XX },
2580 >    { "(bad)",          XX, XX, XX, XX },
2581 >    { "(bad)",          XX, XX, XX, XX },
2582 >    /* d0 */
2583 >    { "(bad)",          XX, XX, XX, XX },
2584 >    { "(bad)",          XX, XX, XX, XX },
2585 >    { "(bad)",          XX, XX, XX, XX },
2586 >    { "(bad)",          XX, XX, XX, XX },
2587 >    { "(bad)",          XX, XX, XX, XX },
2588 >    { "(bad)",          XX, XX, XX, XX },
2589 >    { "(bad)",          XX, XX, XX, XX },
2590 >    { "(bad)",          XX, XX, XX, XX },
2591 >    /* d8 */
2592 >    { "(bad)",          XX, XX, XX, XX },
2593 >    { "(bad)",          XX, XX, XX, XX },
2594 >    { "(bad)",          XX, XX, XX, XX },
2595 >    { "(bad)",          XX, XX, XX, XX },
2596 >    { "(bad)",          XX, XX, XX, XX },
2597 >    { "(bad)",          XX, XX, XX, XX },
2598 >    { "(bad)",          XX, XX, XX, XX },
2599 >    { "(bad)",          XX, XX, XX, XX },
2600 >    /* e0 */
2601 >    { "(bad)",          XX, XX, XX, XX },
2602 >    { "(bad)",          XX, XX, XX, XX },
2603 >    { "(bad)",          XX, XX, XX, XX },
2604 >    { "(bad)",          XX, XX, XX, XX },
2605 >    { "(bad)",          XX, XX, XX, XX },
2606 >    { "(bad)",          XX, XX, XX, XX },
2607 >    { "(bad)",          XX, XX, XX, XX },
2608 >    { "(bad)",          XX, XX, XX, XX },
2609 >    /* e8 */
2610 >    { "(bad)",          XX, XX, XX, XX },
2611 >    { "(bad)",          XX, XX, XX, XX },
2612 >    { "(bad)",          XX, XX, XX, XX },
2613 >    { "(bad)",          XX, XX, XX, XX },
2614 >    { "(bad)",          XX, XX, XX, XX },
2615 >    { "(bad)",          XX, XX, XX, XX },
2616 >    { "(bad)",          XX, XX, XX, XX },
2617 >    { "(bad)",          XX, XX, XX, XX },
2618 >    /* f0 */
2619 >    { "(bad)",          XX, XX, XX, XX },
2620 >    { "(bad)",          XX, XX, XX, XX },
2621 >    { "(bad)",          XX, XX, XX, XX },
2622 >    { "(bad)",          XX, XX, XX, XX },
2623 >    { "(bad)",          XX, XX, XX, XX },
2624 >    { "(bad)",          XX, XX, XX, XX },
2625 >    { "(bad)",          XX, XX, XX, XX },
2626 >    { "(bad)",          XX, XX, XX, XX },
2627 >    /* f8 */
2628 >    { "(bad)",          XX, XX, XX, XX },
2629 >    { "(bad)",          XX, XX, XX, XX },
2630 >    { "(bad)",          XX, XX, XX, XX },
2631 >    { "(bad)",          XX, XX, XX, XX },
2632 >    { "(bad)",          XX, XX, XX, XX },
2633 >    { "(bad)",          XX, XX, XX, XX },
2634 >    { "(bad)",          XX, XX, XX, XX },
2635 >    { "(bad)",          XX, XX, XX, XX }
2636    },
2637   };
2638  
2639   #define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
2640  
2641   static void
2642 < ckprefix ()
2642 > ckprefix (void)
2643   {
2644    int newrex;
2645    rex = 0;
# Line 1678 | Line 2669 | ckprefix ()
2669          case 0x4d:
2670          case 0x4e:
2671          case 0x4f:
2672 <            if (mode_64bit)
2672 >            if (address_mode == mode_64bit)
2673                newrex = *codep;
2674              else
2675                return;
# Line 1720 | Line 2711 | ckprefix ()
2711            /* fwait is really an instruction.  If there are prefixes
2712               before the fwait, they belong to the fwait, *not* to the
2713               following instruction.  */
2714 <          if (prefixes)
2714 >          if (prefixes || rex)
2715              {
2716                prefixes |= PREFIX_FWAIT;
2717                codep++;
# Line 1734 | Line 2725 | ckprefix ()
2725        /* Rex is ignored when followed by another prefix.  */
2726        if (rex)
2727          {
2728 <          oappend (prefix_name (rex, 0));
2729 <          oappend (" ");
2728 >          rex_used = rex;
2729 >          return;
2730          }
2731        rex = newrex;
2732        codep++;
# Line 1746 | Line 2737 | ckprefix ()
2737     prefix byte.  */
2738  
2739   static const char *
2740 < prefix_name (pref, sizeflag)
1750 <     int pref;
1751 <     int sizeflag;
2740 > prefix_name (int pref, int sizeflag)
2741   {
2742    switch (pref)
2743      {
# Line 1806 | Line 2795 | prefix_name (pref, sizeflag)
2795      case 0x66:
2796        return (sizeflag & DFLAG) ? "data16" : "data32";
2797      case 0x67:
2798 <      if (mode_64bit)
2799 <        return (sizeflag & AFLAG) ? "addr32" : "addr64";
2798 >      if (address_mode == mode_64bit)
2799 >        return (sizeflag & AFLAG) ? "addr32" : "addr64";
2800        else
2801 <        return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
2801 >        return (sizeflag & AFLAG) ? "addr16" : "addr32";
2802      case FWAIT_OPCODE:
2803        return "fwait";
2804      default:
# Line 1817 | Line 2806 | prefix_name (pref, sizeflag)
2806      }
2807   }
2808  
2809 < static char op1out[100], op2out[100], op3out[100];
2810 < static int op_ad, op_index[3];
2811 < static bfd_vma op_address[3];
2812 < static bfd_vma op_riprel[3];
2809 > static char op1out[100], op2out[100], op3out[100], op4out[100];
2810 > static int op_ad, op_index[4];
2811 > static int two_source_ops;
2812 > static bfd_vma op_address[4];
2813 > static bfd_vma op_riprel[4];
2814   static bfd_vma start_pc;
2815  
2816   /*
# Line 1842 | Line 2832 | static char scale_char;
2832     print_insn_i386_att and print_insn_i386_intel these functions can
2833     disappear, and print_insn_i386 be merged into print_insn.  */
2834   int
2835 < print_insn_i386_att (pc, info)
1846 <     bfd_vma pc;
1847 <     disassemble_info *info;
2835 > print_insn_i386_att (bfd_vma pc, disassemble_info *info)
2836   {
2837    intel_syntax = 0;
2838  
# Line 1852 | Line 2840 | print_insn_i386_att (pc, info)
2840   }
2841  
2842   int
2843 < print_insn_i386_intel (pc, info)
1856 <     bfd_vma pc;
1857 <     disassemble_info *info;
2843 > print_insn_i386_intel (bfd_vma pc, disassemble_info *info)
2844   {
2845    intel_syntax = 1;
2846  
# Line 1862 | Line 2848 | print_insn_i386_intel (pc, info)
2848   }
2849  
2850   int
2851 < print_insn_i386 (pc, info)
1866 <     bfd_vma pc;
1867 <     disassemble_info *info;
2851 > print_insn_i386 (bfd_vma pc, disassemble_info *info)
2852   {
2853    intel_syntax = -1;
2854  
# Line 1872 | Line 2856 | print_insn_i386 (pc, info)
2856   }
2857  
2858   static int
2859 < print_insn (pc, info)
1876 <     bfd_vma pc;
1877 <     disassemble_info *info;
2859 > print_insn (bfd_vma pc, disassemble_info *info)
2860   {
2861    const struct dis386 *dp;
2862    int i;
2863 <  int two_source_ops;
1882 <  char *first, *second, *third;
2863 >  char *first, *second, *third, *fourth;
2864    int needcomma;
2865 <  unsigned char uses_SSE_prefix;
2865 >  unsigned char uses_DATA_prefix, uses_LOCK_prefix;
2866 >  unsigned char uses_REPNZ_prefix, uses_REPZ_prefix;
2867    int sizeflag;
2868    const char *p;
2869    struct dis_private priv;
2870 +  unsigned char op;
2871  
2872 <  mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
2873 <                || info->mach == bfd_mach_x86_64);
2872 >  if (info->mach == bfd_mach_x86_64_intel_syntax
2873 >      || info->mach == bfd_mach_x86_64)
2874 >    address_mode = mode_64bit;
2875 >  else
2876 >    address_mode = mode_32bit;
2877  
2878 <  if (intel_syntax == -1)
2878 >  if (intel_syntax == (char) -1)
2879      intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
2880                      || info->mach == bfd_mach_x86_64_intel_syntax);
2881  
# Line 1905 | Line 2891 | print_insn (pc, info)
2891  
2892    for (p = info->disassembler_options; p != NULL; )
2893      {
2894 <      if (strncmp (p, "x86-64", 6) == 0)
2894 >      if (CONST_STRNEQ (p, "x86-64"))
2895          {
2896 <          mode_64bit = 1;
2896 >          address_mode = mode_64bit;
2897            priv.orig_sizeflag = AFLAG | DFLAG;
2898          }
2899 <      else if (strncmp (p, "i386", 4) == 0)
2899 >      else if (CONST_STRNEQ (p, "i386"))
2900          {
2901 <          mode_64bit = 0;
2901 >          address_mode = mode_32bit;
2902            priv.orig_sizeflag = AFLAG | DFLAG;
2903          }
2904 <      else if (strncmp (p, "i8086", 5) == 0)
2904 >      else if (CONST_STRNEQ (p, "i8086"))
2905          {
2906 <          mode_64bit = 0;
2906 >          address_mode = mode_16bit;
2907            priv.orig_sizeflag = 0;
2908          }
2909 <      else if (strncmp (p, "intel", 5) == 0)
2909 >      else if (CONST_STRNEQ (p, "intel"))
2910          {
2911            intel_syntax = 1;
2912          }
2913 <      else if (strncmp (p, "att", 3) == 0)
2913 >      else if (CONST_STRNEQ (p, "att"))
2914          {
2915            intel_syntax = 0;
2916          }
2917 <      else if (strncmp (p, "addr", 4) == 0)
2917 >      else if (CONST_STRNEQ (p, "addr"))
2918          {
2919            if (p[4] == '1' && p[5] == '6')
2920              priv.orig_sizeflag &= ~AFLAG;
2921            else if (p[4] == '3' && p[5] == '2')
2922              priv.orig_sizeflag |= AFLAG;
2923          }
2924 <      else if (strncmp (p, "data", 4) == 0)
2924 >      else if (CONST_STRNEQ (p, "data"))
2925          {
2926            if (p[4] == '1' && p[5] == '6')
2927              priv.orig_sizeflag &= ~DFLAG;
2928            else if (p[4] == '3' && p[5] == '2')
2929              priv.orig_sizeflag |= DFLAG;
2930          }
2931 <      else if (strncmp (p, "suffix", 6) == 0)
2931 >      else if (CONST_STRNEQ (p, "suffix"))
2932          priv.orig_sizeflag |= SUFFIX_ALWAYS;
2933  
2934        p = strchr (p, ',');
# Line 1983 | Line 2969 | print_insn (pc, info)
2969       puts most long word instructions on a single line.  */
2970    info->bytes_per_line = 7;
2971  
2972 <  info->private_data = (PTR) &priv;
2972 >  info->private_data = &priv;
2973    priv.max_fetched = priv.the_buffer;
2974    priv.insn_start = pc;
2975  
# Line 1991 | Line 2977 | print_insn (pc, info)
2977    op1out[0] = 0;
2978    op2out[0] = 0;
2979    op3out[0] = 0;
2980 +  op4out[0] = 0;
2981  
2982 <  op_index[0] = op_index[1] = op_index[2] = -1;
2982 >  op_index[0] = op_index[1] = op_index[2] = op_index[3] = -1;
2983  
2984    the_info = info;
2985    start_pc = pc;
# Line 2033 | Line 3020 | print_insn (pc, info)
3020    FETCH_DATA (info, codep + 1);
3021    two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
3022  
3023 <  if ((prefixes & PREFIX_FWAIT)
3024 <      && ((*codep < 0xd8) || (*codep > 0xdf)))
3023 >  if (((prefixes & PREFIX_FWAIT)
3024 >       && ((*codep < 0xd8) || (*codep > 0xdf)))
3025 >      || (rex && rex_used))
3026      {
3027        const char *name;
3028  
3029 <      /* fwait not followed by floating point instruction.  Print the
3030 <         first prefix, which is probably fwait itself.  */
3029 >      /* fwait not followed by floating point instruction, or rex followed
3030 >         by other prefixes.  Print the first prefix.  */
3031        name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
3032        if (name == NULL)
3033          name = INTERNAL_DISASSEMBLER_ERROR;
# Line 2047 | Line 3035 | print_insn (pc, info)
3035        return 1;
3036      }
3037  
3038 +  op = 0;
3039    if (*codep == 0x0f)
3040      {
3041 +      unsigned char threebyte;
3042        FETCH_DATA (info, codep + 2);
3043 <      dp = &dis386_twobyte[*++codep];
3043 >      threebyte = *++codep;
3044 >      dp = &dis386_twobyte[threebyte];
3045        need_modrm = twobyte_has_modrm[*codep];
3046 <      uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
3046 >      uses_DATA_prefix = twobyte_uses_DATA_prefix[*codep];
3047 >      uses_REPNZ_prefix = twobyte_uses_REPNZ_prefix[*codep];
3048 >      uses_REPZ_prefix = twobyte_uses_REPZ_prefix[*codep];
3049 >      uses_LOCK_prefix = (*codep & ~0x02) == 0x20;
3050 >      codep++;
3051 >      if (dp->name == NULL && dp->bytemode1 == IS_3BYTE_OPCODE)
3052 >        {
3053 >          FETCH_DATA (info, codep + 2);
3054 >          op = *codep++;
3055 >          switch (threebyte)
3056 >            {
3057 >            case 0x38:
3058 >              uses_DATA_prefix = threebyte_0x38_uses_DATA_prefix[op];
3059 >              uses_REPNZ_prefix = threebyte_0x38_uses_REPNZ_prefix[op];
3060 >              uses_REPZ_prefix = threebyte_0x38_uses_REPZ_prefix[op];
3061 >              break;
3062 >            case 0x3a:
3063 >              uses_DATA_prefix = threebyte_0x3a_uses_DATA_prefix[op];
3064 >              uses_REPNZ_prefix = threebyte_0x3a_uses_REPNZ_prefix[op];
3065 >              uses_REPZ_prefix = threebyte_0x3a_uses_REPZ_prefix[op];
3066 >              break;
3067 >            default:
3068 >              break;
3069 >            }
3070 >        }
3071      }
3072    else
3073      {
3074        dp = &dis386[*codep];
3075        need_modrm = onebyte_has_modrm[*codep];
3076 <      uses_SSE_prefix = 0;
3076 >      uses_DATA_prefix = 0;
3077 >      uses_REPNZ_prefix = 0;
3078 >      uses_REPZ_prefix = 0;
3079 >      uses_LOCK_prefix = 0;
3080 >      codep++;
3081      }
3082 <  codep++;
3083 <
2065 <  if (!uses_SSE_prefix && (prefixes & PREFIX_REPZ))
3082 >  
3083 >  if (!uses_REPZ_prefix && (prefixes & PREFIX_REPZ))
3084      {
3085        oappend ("repz ");
3086        used_prefixes |= PREFIX_REPZ;
3087      }
3088 <  if (!uses_SSE_prefix && (prefixes & PREFIX_REPNZ))
3088 >  if (!uses_REPNZ_prefix && (prefixes & PREFIX_REPNZ))
3089      {
3090        oappend ("repnz ");
3091        used_prefixes |= PREFIX_REPNZ;
3092      }
3093 <  if (prefixes & PREFIX_LOCK)
3093 >
3094 >  if (!uses_LOCK_prefix && (prefixes & PREFIX_LOCK))
3095      {
3096        oappend ("lock ");
3097        used_prefixes |= PREFIX_LOCK;
# Line 2083 | Line 3102 | print_insn (pc, info)
3102        sizeflag ^= AFLAG;
3103        if (dp->bytemode3 != loop_jcxz_mode || intel_syntax)
3104          {
3105 <          if ((sizeflag & AFLAG) || mode_64bit)
3105 >          if ((sizeflag & AFLAG) || address_mode == mode_64bit)
3106              oappend ("addr32 ");
3107            else
3108              oappend ("addr16 ");
# Line 2091 | Line 3110 | print_insn (pc, info)
3110          }
3111      }
3112  
3113 <  if (!uses_SSE_prefix && (prefixes & PREFIX_DATA))
3113 >  if (!uses_DATA_prefix && (prefixes & PREFIX_DATA))
3114      {
3115        sizeflag ^= DFLAG;
3116        if (dp->bytemode3 == cond_jump_mode
# Line 2106 | Line 3125 | print_insn (pc, info)
3125          }
3126      }
3127  
3128 <  if (need_modrm)
3128 >  if (dp->name == NULL && dp->bytemode1 == IS_3BYTE_OPCODE)
3129 >    {
3130 >      dp = &three_byte_table[dp->bytemode2][op];
3131 >      mod = (*codep >> 6) & 3;
3132 >      reg = (*codep >> 3) & 7;
3133 >      rm = *codep & 7;
3134 >    }
3135 >  else if (need_modrm)
3136      {
3137        FETCH_DATA (info, codep + 1);
3138        mod = (*codep >> 6) & 3;
# Line 2136 | Line 3162 | print_insn (pc, info)
3162                  index = 1;
3163                else
3164                  {
3165 <                  used_prefixes |= (prefixes & PREFIX_DATA);
3166 <                  if (prefixes & PREFIX_DATA)
3167 <                    index = 2;
3165 >                  /* We should check PREFIX_REPNZ and PREFIX_REPZ
3166 >                     before PREFIX_DATA.  */
3167 >                  used_prefixes |= (prefixes & PREFIX_REPNZ);
3168 >                  if (prefixes & PREFIX_REPNZ)
3169 >                    index = 3;
3170                    else
3171                      {
3172 <                      used_prefixes |= (prefixes & PREFIX_REPNZ);
3173 <                      if (prefixes & PREFIX_REPNZ)
3174 <                        index = 3;
3172 >                      used_prefixes |= (prefixes & PREFIX_DATA);
3173 >                      if (prefixes & PREFIX_DATA)
3174 >                        index = 2;
3175                      }
3176                  }
3177                dp = &prefix_user_table[dp->bytemode2][index];
3178                break;
3179  
3180              case X86_64_SPECIAL:
3181 <              dp = &x86_64_table[dp->bytemode2][mode_64bit];
3181 >              index = address_mode == mode_64bit ? 1 : 0;
3182 >              dp = &x86_64_table[dp->bytemode2][index];
3183                break;
3184  
3185              default:
# Line 2162 | Line 3191 | print_insn (pc, info)
3191        if (putop (dp->name, sizeflag) == 0)
3192          {
3193            obufp = op1out;
3194 <          op_ad = 2;
3194 >          op_ad = 3;
3195            if (dp->op1)
3196              (*dp->op1) (dp->bytemode1, sizeflag);
3197  
3198            obufp = op2out;
3199 <          op_ad = 1;
3199 >          op_ad = 2;
3200            if (dp->op2)
3201              (*dp->op2) (dp->bytemode2, sizeflag);
3202  
3203            obufp = op3out;
3204 <          op_ad = 0;
3204 >          op_ad = 1;
3205            if (dp->op3)
3206              (*dp->op3) (dp->bytemode3, sizeflag);
3207 +
3208 +          obufp = op4out;
3209 +          op_ad = 0;
3210 +          if (dp->op4)
3211 +            (*dp->op4) (dp->bytemode4, sizeflag);
3212          }
3213      }
3214  
# Line 2214 | Line 3248 | print_insn (pc, info)
3248        first = op1out;
3249        second = op2out;
3250        third = op3out;
3251 +      fourth = op4out;
3252        op_ad = op_index[0];
3253 <      op_index[0] = op_index[2];
3253 >      op_index[0] = op_index[3];
3254 >      op_index[3] = op_ad;
3255 >      op_ad = op_index[1];
3256 >      op_index[1] = op_index[2];
3257        op_index[2] = op_ad;
3258 +
3259      }
3260    else
3261      {
3262 <      first = op3out;
3263 <      second = op2out;
3264 <      third = op1out;
3262 >      first = op4out;
3263 >      second = op3out;
3264 >      third = op2out;
3265 >      fourth = op1out;
3266      }
3267    needcomma = 0;
3268    if (*first)
# Line 2233 | Line 3273 | print_insn (pc, info)
3273          (*info->fprintf_func) (info->stream, "%s", first);
3274        needcomma = 1;
3275      }
3276 +  
3277    if (*second)
3278      {
3279        if (needcomma)
# Line 2243 | Line 3284 | print_insn (pc, info)
3284          (*info->fprintf_func) (info->stream, "%s", second);
3285        needcomma = 1;
3286      }
3287 +
3288    if (*third)
3289      {
3290        if (needcomma)
# Line 2251 | Line 3293 | print_insn (pc, info)
3293          (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info);
3294        else
3295          (*info->fprintf_func) (info->stream, "%s", third);
3296 +      needcomma = 1;
3297 +    }
3298 +
3299 +  if (*fourth)
3300 +    {
3301 +      if (needcomma)
3302 +        (*info->fprintf_func) (info->stream, ",");
3303 +      if (op_index[3] != -1 && !op_riprel[3])
3304 +        (*info->print_address_func) ((bfd_vma) op_address[op_index[3]], info);
3305 +      else
3306 +        (*info->fprintf_func) (info->stream, "%s", fourth);
3307      }
3308 <  for (i = 0; i < 3; i++)
3308 >
3309 >  for (i = 0; i < 4; i++)
3310      if (op_index[i] != -1 && op_riprel[i])
3311        {
3312          (*info->fprintf_func) (info->stream, "        # ");
# Line 2272 | Line 3326 | static const char *float_mem[] = {
3326    "fsubr{s||s|}",
3327    "fdiv{s||s|}",
3328    "fdivr{s||s|}",
3329 <  /*  d9 */
3329 >  /* d9 */
3330    "fld{s||s|}",
3331    "(bad)",
3332    "fst{s||s|}",
3333    "fstp{s||s|}",
3334 <  "fldenv",
3334 >  "fldenvIC",
3335    "fldcw",
3336 <  "fNstenv",
3336 >  "fNstenvIC",
3337    "fNstcw",
3338    /* da */
3339    "fiadd{l||l|}",
# Line 2292 | Line 3346 | static const char *float_mem[] = {
3346    "fidivr{l||l|}",
3347    /* db */
3348    "fild{l||l|}",
3349 <  "(bad)",
3349 >  "fisttp{l||l|}",
3350    "fist{l||l|}",
3351    "fistp{l||l|}",
3352    "(bad)",
# Line 2310 | Line 3364 | static const char *float_mem[] = {
3364    "fdivr{l||l|}",
3365    /* dd */
3366    "fld{l||l|}",
3367 <  "(bad)",
3367 >  "fisttp{ll||ll|}",
3368    "fst{l||l|}",
3369    "fstp{l||l|}",
3370 <  "frstor",
3370 >  "frstorIC",
3371    "(bad)",
3372 <  "fNsave",
3372 >  "fNsaveIC",
3373    "fNstsw",
3374    /* de */
3375    "fiadd",
# Line 2328 | Line 3382 | static const char *float_mem[] = {
3382    "fidivr",
3383    /* df */
3384    "fild",
3385 <  "(bad)",
3385 >  "fisttp",
3386    "fist",
3387    "fistp",
3388    "fbld",
3389    "fild{ll||ll|}",
3390    "fbstp",
3391 <  "fistpll",
3391 >  "fistp{ll||ll|}",
3392 > };
3393 >
3394 > static const unsigned char float_mem_mode[] = {
3395 >  /* d8 */
3396 >  d_mode,
3397 >  d_mode,
3398 >  d_mode,
3399 >  d_mode,
3400 >  d_mode,
3401 >  d_mode,
3402 >  d_mode,
3403 >  d_mode,
3404 >  /* d9 */
3405 >  d_mode,
3406 >  0,
3407 >  d_mode,
3408 >  d_mode,
3409 >  0,
3410 >  w_mode,
3411 >  0,
3412 >  w_mode,
3413 >  /* da */
3414 >  d_mode,
3415 >  d_mode,
3416 >  d_mode,
3417 >  d_mode,
3418 >  d_mode,
3419 >  d_mode,
3420 >  d_mode,
3421 >  d_mode,
3422 >  /* db */
3423 >  d_mode,
3424 >  d_mode,
3425 >  d_mode,
3426 >  d_mode,
3427 >  0,
3428 >  t_mode,
3429 >  0,
3430 >  t_mode,
3431 >  /* dc */
3432 >  q_mode,
3433 >  q_mode,
3434 >  q_mode,
3435 >  q_mode,
3436 >  q_mode,
3437 >  q_mode,
3438 >  q_mode,
3439 >  q_mode,
3440 >  /* dd */
3441 >  q_mode,
3442 >  q_mode,
3443 >  q_mode,
3444 >  q_mode,
3445 >  0,
3446 >  0,
3447 >  0,
3448 >  w_mode,
3449 >  /* de */
3450 >  w_mode,
3451 >  w_mode,
3452 >  w_mode,
3453 >  w_mode,
3454 >  w_mode,
3455 >  w_mode,
3456 >  w_mode,
3457 >  w_mode,
3458 >  /* df */
3459 >  w_mode,
3460 >  w_mode,
3461 >  w_mode,
3462 >  w_mode,
3463 >  t_mode,
3464 >  q_mode,
3465 >  t_mode,
3466 >  q_mode
3467   };
3468  
3469   #define ST OP_ST, 0
3470   #define STi OP_STi, 0
3471  
3472 < #define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0
3473 < #define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0
3474 < #define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0
3475 < #define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0
3476 < #define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0
3477 < #define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0
3478 < #define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0
3479 < #define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0
3480 < #define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0
3472 > #define FGRPd9_2 NULL, NULL, 0, NULL, 0, NULL, 0, NULL, 0
3473 > #define FGRPd9_4 NULL, NULL, 1, NULL, 0, NULL, 0, NULL, 0
3474 > #define FGRPd9_5 NULL, NULL, 2, NULL, 0, NULL, 0, NULL, 0
3475 > #define FGRPd9_6 NULL, NULL, 3, NULL, 0, NULL, 0, NULL, 0
3476 > #define FGRPd9_7 NULL, NULL, 4, NULL, 0, NULL, 0, NULL, 0
3477 > #define FGRPda_5 NULL, NULL, 5, NULL, 0, NULL, 0, NULL, 0
3478 > #define FGRPdb_4 NULL, NULL, 6, NULL, 0, NULL, 0, NULL, 0
3479 > #define FGRPde_3 NULL, NULL, 7, NULL, 0, NULL, 0, NULL, 0
3480 > #define FGRPdf_4 NULL, NULL, 8, NULL, 0, NULL, 0, NULL, 0
3481  
3482   static const struct dis386 float_reg[][8] = {
3483    /* d8 */
3484    {
3485 <    { "fadd",   ST, STi, XX },
3486 <    { "fmul",   ST, STi, XX },
3487 <    { "fcom",   STi, XX, XX },
3488 <    { "fcomp",  STi, XX, XX },
3489 <    { "fsub",   ST, STi, XX },
3490 <    { "fsubr",  ST, STi, XX },
3491 <    { "fdiv",   ST, STi, XX },
3492 <    { "fdivr",  ST, STi, XX },
3485 >    { "fadd",   ST, STi, XX, XX },
3486 >    { "fmul",   ST, STi, XX, XX },
3487 >    { "fcom",   STi, XX, XX, XX },
3488 >    { "fcomp",  STi, XX, XX, XX },
3489 >    { "fsub",   ST, STi, XX, XX },
3490 >    { "fsubr",  ST, STi, XX, XX },
3491 >    { "fdiv",   ST, STi, XX, XX },
3492 >    { "fdivr",  ST, STi, XX, XX },
3493    },
3494    /* d9 */
3495    {
3496 <    { "fld",    STi, XX, XX },
3497 <    { "fxch",   STi, XX, XX },
3496 >    { "fld",    STi, XX, XX, XX },
3497 >    { "fxch",   STi, XX, XX, XX },
3498      { FGRPd9_2 },
3499 <    { "(bad)",  XX, XX, XX },
3499 >    { "(bad)",  XX, XX, XX, XX },
3500      { FGRPd9_4 },
3501      { FGRPd9_5 },
3502      { FGRPd9_6 },
# Line 2375 | Line 3504 | static const struct dis386 float_reg[][8
3504    },
3505    /* da */
3506    {
3507 <    { "fcmovb", ST, STi, XX },
3508 <    { "fcmove", ST, STi, XX },
3509 <    { "fcmovbe",ST, STi, XX },
3510 <    { "fcmovu", ST, STi, XX },
3511 <    { "(bad)",  XX, XX, XX },
3507 >    { "fcmovb", ST, STi, XX, XX },
3508 >    { "fcmove", ST, STi, XX, XX },
3509 >    { "fcmovbe",ST, STi, XX, XX },
3510 >    { "fcmovu", ST, STi, XX, XX },
3511 >    { "(bad)",  XX, XX, XX, XX },
3512      { FGRPda_5 },
3513 <    { "(bad)",  XX, XX, XX },
3514 <    { "(bad)",  XX, XX, XX },
3513 >    { "(bad)",  XX, XX, XX, XX },
3514 >    { "(bad)",  XX, XX, XX, XX },
3515    },
3516    /* db */
3517    {
3518 <    { "fcmovnb",ST, STi, XX },
3519 <    { "fcmovne",ST, STi, XX },
3520 <    { "fcmovnbe",ST, STi, XX },
3521 <    { "fcmovnu",ST, STi, XX },
3518 >    { "fcmovnb",ST, STi, XX, XX },
3519 >    { "fcmovne",ST, STi, XX, XX },
3520 >    { "fcmovnbe",ST, STi, XX, XX },
3521 >    { "fcmovnu",ST, STi, XX, XX },
3522      { FGRPdb_4 },
3523 <    { "fucomi", ST, STi, XX },
3524 <    { "fcomi",  ST, STi, XX },
3525 <    { "(bad)",  XX, XX, XX },
3523 >    { "fucomi", ST, STi, XX, XX },
3524 >    { "fcomi",  ST, STi, XX, XX },
3525 >    { "(bad)",  XX, XX, XX, XX },
3526    },
3527    /* dc */
3528    {
3529 <    { "fadd",   STi, ST, XX },
3530 <    { "fmul",   STi, ST, XX },
3531 <    { "(bad)",  XX, XX, XX },
3532 <    { "(bad)",  XX, XX, XX },
3529 >    { "fadd",   STi, ST, XX, XX },
3530 >    { "fmul",   STi, ST, XX, XX },
3531 >    { "(bad)",  XX, XX, XX, XX },
3532 >    { "(bad)",  XX, XX, XX, XX },
3533   #if UNIXWARE_COMPAT
3534 <    { "fsub",   STi, ST, XX },
3535 <    { "fsubr",  STi, ST, XX },
3536 <    { "fdiv",   STi, ST, XX },
3537 <    { "fdivr",  STi, ST, XX },
3534 >    { "fsub",   STi, ST, XX, XX },
3535 >    { "fsubr",  STi, ST, XX, XX },
3536 >    { "fdiv",   STi, ST, XX, XX },
3537 >    { "fdivr",  STi, ST, XX, XX },
3538   #else
3539 <    { "fsubr",  STi, ST, XX },
3540 <    { "fsub",   STi, ST, XX },
3541 <    { "fdivr",  STi, ST, XX },
3542 <    { "fdiv",   STi, ST, XX },
3539 >    { "fsubr",  STi, ST, XX, XX },
3540 >    { "fsub",   STi, ST, XX, XX },
3541 >    { "fdivr",  STi, ST, XX, XX },
3542 >    { "fdiv",   STi, ST, XX, XX },
3543   #endif
3544    },
3545    /* dd */
3546    {
3547 <    { "ffree",  STi, XX, XX },
3548 <    { "(bad)",  XX, XX, XX },
3549 <    { "fst",    STi, XX, XX },
3550 <    { "fstp",   STi, XX, XX },
3551 <    { "fucom",  STi, XX, XX },
3552 <    { "fucomp", STi, XX, XX },
3553 <    { "(bad)",  XX, XX, XX },
3554 <    { "(bad)",  XX, XX, XX },
3547 >    { "ffree",  STi, XX, XX, XX },
3548 >    { "(bad)",  XX, XX, XX, XX },
3549 >    { "fst",    STi, XX, XX, XX },
3550 >    { "fstp",   STi, XX, XX, XX },
3551 >    { "fucom",  STi, XX, XX, XX },
3552 >    { "fucomp", STi, XX, XX, XX },
3553 >    { "(bad)",  XX, XX, XX, XX },
3554 >    { "(bad)",  XX, XX, XX, XX },
3555    },
3556    /* de */
3557    {
3558 <    { "faddp",  STi, ST, XX },
3559 <    { "fmulp",  STi, ST, XX },
3560 <    { "(bad)",  XX, XX, XX },
3558 >    { "faddp",  STi, ST, XX, XX },
3559 >    { "fmulp",  STi, ST, XX, XX },
3560 >    { "(bad)",  XX, XX, XX, XX },
3561      { FGRPde_3 },
3562   #if UNIXWARE_COMPAT
3563 <    { "fsubp",  STi, ST, XX },
3564 <    { "fsubrp", STi, ST, XX },
3565 <    { "fdivp",  STi, ST, XX },
3566 <    { "fdivrp", STi, ST, XX },
3563 >    { "fsubp",  STi, ST, XX, XX },
3564 >    { "fsubrp", STi, ST, XX, XX },
3565 >    { "fdivp",  STi, ST, XX, XX },
3566 >    { "fdivrp", STi, ST, XX, XX },
3567   #else
3568 <    { "fsubrp", STi, ST, XX },
3569 <    { "fsubp",  STi, ST, XX },
3570 <    { "fdivrp", STi, ST, XX },
3571 <    { "fdivp",  STi, ST, XX },
3568 >    { "fsubrp", STi, ST, XX, XX },
3569 >    { "fsubp",  STi, ST, XX, XX },
3570 >    { "fdivrp", STi, ST, XX, XX },
3571 >    { "fdivp",  STi, ST, XX, XX },
3572   #endif
3573    },
3574    /* df */
3575    {
3576 <    { "ffreep", STi, XX, XX },
3577 <    { "(bad)",  XX, XX, XX },
3578 <    { "(bad)",  XX, XX, XX },
3579 <    { "(bad)",  XX, XX, XX },
3576 >    { "ffreep", STi, XX, XX, XX },
3577 >    { "(bad)",  XX, XX, XX, XX },
3578 >    { "(bad)",  XX, XX, XX, XX },
3579 >    { "(bad)",  XX, XX, XX, XX },
3580      { FGRPdf_4 },
3581 <    { "fucomip",ST, STi, XX },
3582 <    { "fcomip", ST, STi, XX },
3583 <    { "(bad)",  XX, XX, XX },
3581 >    { "fucomip",ST, STi, XX, XX },
3582 >    { "fcomip", ST, STi, XX, XX },
3583 >    { "(bad)",  XX, XX, XX, XX },
3584    },
3585   };
3586  
# Line 2504 | Line 3633 | static char *fgrps[][8] = {
3633   };
3634  
3635   static void
3636 < dofloat (sizeflag)
2508 <     int sizeflag;
3636 > dofloat (int sizeflag)
3637   {
3638    const struct dis386 *dp;
3639    unsigned char floatop;
# Line 2514 | Line 3642 | dofloat (sizeflag)
3642  
3643    if (mod != 3)
3644      {
3645 <      putop (float_mem[(floatop - 0xd8) * 8 + reg], sizeflag);
3645 >      int fp_indx = (floatop - 0xd8) * 8 + reg;
3646 >
3647 >      putop (float_mem[fp_indx], sizeflag);
3648        obufp = op1out;
3649 <      if (floatop == 0xdb)
3650 <        OP_E (x_mode, sizeflag);
2521 <      else if (floatop == 0xdd)
2522 <        OP_E (d_mode, sizeflag);
2523 <      else
2524 <        OP_E (v_mode, sizeflag);
3649 >      op_ad = 2;
3650 >      OP_E (float_mem_mode[fp_indx], sizeflag);
3651        return;
3652      }
3653    /* Skip mod/rm byte.  */
# Line 2542 | Line 3668 | dofloat (sizeflag)
3668        putop (dp->name, sizeflag);
3669  
3670        obufp = op1out;
3671 +      op_ad = 2;
3672        if (dp->op1)
3673          (*dp->op1) (dp->bytemode1, sizeflag);
3674 +
3675        obufp = op2out;
3676 +      op_ad = 1;
3677        if (dp->op2)
3678          (*dp->op2) (dp->bytemode2, sizeflag);
3679      }
3680   }
3681  
3682   static void
3683 < OP_ST (bytemode, sizeflag)
2555 <     int bytemode ATTRIBUTE_UNUSED;
2556 <     int sizeflag ATTRIBUTE_UNUSED;
3683 > OP_ST (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
3684   {
3685 <  oappend ("%st");
3685 >  oappend ("%st" + intel_syntax);
3686   }
3687  
3688   static void
3689 < OP_STi (bytemode, sizeflag)
2563 <     int bytemode ATTRIBUTE_UNUSED;
2564 <     int sizeflag ATTRIBUTE_UNUSED;
3689 > OP_STi (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
3690   {
3691    sprintf (scratchbuf, "%%st(%d)", rm);
3692    oappend (scratchbuf + intel_syntax);
# Line 2569 | Line 3694 | OP_STi (bytemode, sizeflag)
3694  
3695   /* Capital letters in template are macros.  */
3696   static int
3697 < putop (template, sizeflag)
2573 <     const char *template;
2574 <     int sizeflag;
3697 > putop (const char *template, int sizeflag)
3698   {
3699    const char *p;
3700 <  int alt;
3700 >  int alt = 0;
3701  
3702    for (p = template; *p; p++)
3703      {
# Line 2587 | Line 3710 | putop (template, sizeflag)
3710            alt = 0;
3711            if (intel_syntax)
3712              alt += 1;
3713 <          if (mode_64bit)
3713 >          if (address_mode == mode_64bit)
3714              alt += 2;
3715            while (alt != 0)
3716              {
# Line 2605 | Line 3728 | putop (template, sizeflag)
3728                  }
3729                alt--;
3730              }
3731 <          break;
3731 >          /* Fall through.  */
3732 >        case 'I':
3733 >          alt = 1;
3734 >          continue;
3735          case '|':
3736            while (*++p != '}')
3737              {
# Line 2616 | Line 3742 | putop (template, sizeflag)
3742          case '}':
3743            break;
3744          case 'A':
3745 <          if (intel_syntax)
3746 <            break;
3745 >          if (intel_syntax)
3746 >            break;
3747            if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
3748              *obufp++ = 'b';
3749            break;
3750          case 'B':
3751 <          if (intel_syntax)
3752 <            break;
3751 >          if (intel_syntax)
3752 >            break;
3753            if (sizeflag & SUFFIX_ALWAYS)
3754              *obufp++ = 'b';
3755            break;
3756 +        case 'C':
3757 +          if (intel_syntax && !alt)
3758 +            break;
3759 +          if ((prefixes & PREFIX_DATA) || (sizeflag & SUFFIX_ALWAYS))
3760 +            {
3761 +              if (sizeflag & DFLAG)
3762 +                *obufp++ = intel_syntax ? 'd' : 'l';
3763 +              else
3764 +                *obufp++ = intel_syntax ? 'w' : 's';
3765 +              used_prefixes |= (prefixes & PREFIX_DATA);
3766 +            }
3767 +          break;
3768 +        case 'D':
3769 +          if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS))
3770 +            break;
3771 +          USED_REX (REX_MODE64);
3772 +          if (mod == 3)
3773 +            {
3774 +              if (rex & REX_MODE64)
3775 +                *obufp++ = 'q';
3776 +              else if (sizeflag & DFLAG)
3777 +                *obufp++ = intel_syntax ? 'd' : 'l';
3778 +              else
3779 +                *obufp++ = 'w';
3780 +              used_prefixes |= (prefixes & PREFIX_DATA);
3781 +            }
3782 +          else
3783 +            *obufp++ = 'w';
3784 +          break;
3785          case 'E':               /* For jcxz/jecxz */
3786 <          if (mode_64bit)
3786 >          if (address_mode == mode_64bit)
3787              {
3788                if (sizeflag & AFLAG)
3789                  *obufp++ = 'r';
# Line 2641 | Line 3796 | putop (template, sizeflag)
3796            used_prefixes |= (prefixes & PREFIX_ADDR);
3797            break;
3798          case 'F':
3799 <          if (intel_syntax)
3800 <            break;
3799 >          if (intel_syntax)
3800 >            break;
3801            if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
3802              {
3803                if (sizeflag & AFLAG)
3804 <                *obufp++ = mode_64bit ? 'q' : 'l';
3804 >                *obufp++ = address_mode == mode_64bit ? 'q' : 'l';
3805                else
3806 <                *obufp++ = mode_64bit ? 'l' : 'w';
3806 >                *obufp++ = address_mode == mode_64bit ? 'l' : 'w';
3807                used_prefixes |= (prefixes & PREFIX_ADDR);
3808              }
3809            break;
3810 +        case 'G':
3811 +          if (intel_syntax || (obufp[-1] != 's' && !(sizeflag & SUFFIX_ALWAYS)))
3812 +            break;
3813 +          if ((rex & REX_MODE64) || (sizeflag & DFLAG))
3814 +            *obufp++ = 'l';
3815 +          else
3816 +            *obufp++ = 'w';
3817 +          if (!(rex & REX_MODE64))
3818 +            used_prefixes |= (prefixes & PREFIX_DATA);
3819 +          break;
3820          case 'H':
3821 <          if (intel_syntax)
3822 <            break;
3821 >          if (intel_syntax)
3822 >            break;
3823            if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
3824                || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
3825              {
# Line 2667 | Line 3832 | putop (template, sizeflag)
3832                  *obufp++ = 'n';
3833              }
3834            break;
3835 +        case 'J':
3836 +          if (intel_syntax)
3837 +            break;
3838 +          *obufp++ = 'l';
3839 +          break;
3840 +        case 'Z':
3841 +          if (intel_syntax)
3842 +            break;
3843 +          if (address_mode == mode_64bit && (sizeflag & SUFFIX_ALWAYS))
3844 +            {
3845 +              *obufp++ = 'q';
3846 +              break;
3847 +            }
3848 +          /* Fall through.  */
3849          case 'L':
3850 <          if (intel_syntax)
3851 <            break;
3850 >          if (intel_syntax)
3851 >            break;
3852            if (sizeflag & SUFFIX_ALWAYS)
3853              *obufp++ = 'l';
3854            break;
# Line 2683 | Line 3862 | putop (template, sizeflag)
3862            USED_REX (REX_MODE64);
3863            if (rex & REX_MODE64)
3864              *obufp++ = 'o';
3865 +          else if (intel_syntax && (sizeflag & DFLAG))
3866 +            *obufp++ = 'q';
3867            else
3868              *obufp++ = 'd';
3869 +          if (!(rex & REX_MODE64))
3870 +            used_prefixes |= (prefixes & PREFIX_DATA);
3871            break;
3872          case 'T':
3873 <          if (intel_syntax)
3874 <            break;
3875 <          if (mode_64bit)
3873 >          if (intel_syntax)
3874 >            break;
3875 >          if (address_mode == mode_64bit && (sizeflag & DFLAG))
3876              {
3877                *obufp++ = 'q';
3878                break;
3879              }
3880            /* Fall through.  */
3881          case 'P':
3882 <          if (intel_syntax)
3883 <            break;
3882 >          if (intel_syntax)
3883 >            break;
3884            if ((prefixes & PREFIX_DATA)
3885                || (rex & REX_MODE64)
3886                || (sizeflag & SUFFIX_ALWAYS))
# Line 2711 | Line 3894 | putop (template, sizeflag)
3894                        *obufp++ = 'l';
3895                     else
3896                       *obufp++ = 'w';
2714                   used_prefixes |= (prefixes & PREFIX_DATA);
3897                  }
3898 +              used_prefixes |= (prefixes & PREFIX_DATA);
3899              }
3900            break;
3901          case 'U':
3902 <          if (intel_syntax)
3903 <            break;
3904 <          if (mode_64bit)
3902 >          if (intel_syntax)
3903 >            break;
3904 >          if (address_mode == mode_64bit && (sizeflag & DFLAG))
3905              {
3906 <              *obufp++ = 'q';
3906 >              if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
3907 >                *obufp++ = 'q';
3908                break;
3909              }
3910            /* Fall through.  */
3911          case 'Q':
3912 <          if (intel_syntax)
3913 <            break;
3912 >          if (intel_syntax && !alt)
3913 >            break;
3914            USED_REX (REX_MODE64);
3915            if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
3916              {
# Line 2735 | Line 3919 | putop (template, sizeflag)
3919                else
3920                  {
3921                    if (sizeflag & DFLAG)
3922 <                    *obufp++ = 'l';
3922 >                    *obufp++ = intel_syntax ? 'd' : 'l';
3923                    else
3924                      *obufp++ = 'w';
2741                  used_prefixes |= (prefixes & PREFIX_DATA);
3925                  }
3926 +              used_prefixes |= (prefixes & PREFIX_DATA);
3927              }
3928            break;
3929          case 'R':
3930            USED_REX (REX_MODE64);
3931 <          if (intel_syntax)
3931 >          if (rex & REX_MODE64)
3932 >            *obufp++ = 'q';
3933 >          else if (sizeflag & DFLAG)
3934              {
3935 <              if (rex & REX_MODE64)
2750 <                {
2751 <                  *obufp++ = 'q';
2752 <                  *obufp++ = 't';
2753 <                }
2754 <              else if (sizeflag & DFLAG)
2755 <                {
3935 >              if (intel_syntax)
3936                    *obufp++ = 'd';
2757                  *obufp++ = 'q';
2758                }
3937                else
3938 <                {
2761 <                  *obufp++ = 'w';
2762 <                  *obufp++ = 'd';
2763 <                }
3938 >                  *obufp++ = 'l';
3939              }
3940            else
3941 <            {
3942 <              if (rex & REX_MODE64)
3943 <                *obufp++ = 'q';
3944 <              else if (sizeflag & DFLAG)
2770 <                *obufp++ = 'l';
2771 <              else
2772 <                *obufp++ = 'w';
2773 <            }
3941 >            *obufp++ = 'w';
3942 >          if (intel_syntax && !p[1]
3943 >              && ((rex & REX_MODE64) || (sizeflag & DFLAG)))
3944 >            *obufp++ = 'e';
3945            if (!(rex & REX_MODE64))
3946              used_prefixes |= (prefixes & PREFIX_DATA);
3947            break;
3948 +        case 'V':
3949 +          if (intel_syntax)
3950 +            break;
3951 +          if (address_mode == mode_64bit && (sizeflag & DFLAG))
3952 +            {
3953 +              if (sizeflag & SUFFIX_ALWAYS)
3954 +                *obufp++ = 'q';
3955 +              break;
3956 +            }
3957 +          /* Fall through.  */
3958          case 'S':
3959 <          if (intel_syntax)
3960 <            break;
3959 >          if (intel_syntax)
3960 >            break;
3961            if (sizeflag & SUFFIX_ALWAYS)
3962              {
3963                if (rex & REX_MODE64)
# Line 2796 | Line 3977 | putop (template, sizeflag)
3977              *obufp++ = 'd';
3978            else
3979              *obufp++ = 's';
3980 <          used_prefixes |= (prefixes & PREFIX_DATA);
3980 >          used_prefixes |= (prefixes & PREFIX_DATA);
3981            break;
3982          case 'Y':
3983 <          if (intel_syntax)
3984 <            break;
3983 >          if (intel_syntax)
3984 >            break;
3985            if (rex & REX_MODE64)
3986              {
3987                USED_REX (REX_MODE64);
# Line 2810 | Line 3991 | putop (template, sizeflag)
3991            /* implicit operand size 'l' for i386 or 'q' for x86-64 */
3992          case 'W':
3993            /* operand size flag for cwtl, cbtw */
3994 <          USED_REX (0);
3995 <          if (rex)
3996 <            *obufp++ = 'l';
3994 >          USED_REX (REX_MODE64);
3995 >          if (rex & REX_MODE64)
3996 >            {
3997 >              if (intel_syntax)
3998 >                *obufp++ = 'd';
3999 >              else
4000 >                *obufp++ = 'l';
4001 >            }
4002            else if (sizeflag & DFLAG)
4003              *obufp++ = 'w';
4004            else
4005              *obufp++ = 'b';
4006 <          if (intel_syntax)
2821 <            {
2822 <              if (rex)
2823 <                {
2824 <                  *obufp++ = 'q';
2825 <                  *obufp++ = 'e';
2826 <                }
2827 <              if (sizeflag & DFLAG)
2828 <                {
2829 <                  *obufp++ = 'd';
2830 <                  *obufp++ = 'e';
2831 <                }
2832 <              else
2833 <                {
2834 <                  *obufp++ = 'w';
2835 <                }
2836 <            }
2837 <          if (!rex)
4006 >          if (!(rex & REX_MODE64))
4007              used_prefixes |= (prefixes & PREFIX_DATA);
4008            break;
4009          }
4010 +      alt = 0;
4011      }
4012    *obufp = 0;
4013    return 0;
4014   }
4015  
4016   static void
4017 < oappend (s)
2848 <     const char *s;
4017 > oappend (const char *s)
4018   {
4019    strcpy (obufp, s);
4020    obufp += strlen (s);
4021   }
4022  
4023   static void
4024 < append_seg ()
4024 > append_seg (void)
4025   {
4026    if (prefixes & PREFIX_CS)
4027      {
# Line 2887 | Line 4056 | append_seg ()
4056   }
4057  
4058   static void
4059 < OP_indirE (bytemode, sizeflag)
2891 <     int bytemode;
2892 <     int sizeflag;
4059 > OP_indirE (int bytemode, int sizeflag)
4060   {
4061    if (!intel_syntax)
4062      oappend ("*");
# Line 2897 | Line 4064 | OP_indirE (bytemode, sizeflag)
4064   }
4065  
4066   static void
4067 < print_operand_value (buf, hex, disp)
2901 <  char *buf;
2902 <  int hex;
2903 <  bfd_vma disp;
4067 > print_operand_value (char *buf, int hex, bfd_vma disp)
4068   {
4069 <  if (mode_64bit)
4069 >  if (address_mode == mode_64bit)
4070      {
4071        if (hex)
4072          {
# Line 2957 | Line 4121 | print_operand_value (buf, hex, disp)
4121   }
4122  
4123   static void
4124 < OP_E (bytemode, sizeflag)
4125 <     int bytemode;
4126 <     int sizeflag;
4124 > intel_operand_size (int bytemode, int sizeflag)
4125 > {
4126 >  switch (bytemode)
4127 >    {
4128 >    case b_mode:
4129 >      oappend ("BYTE PTR ");
4130 >      break;
4131 >    case w_mode:
4132 >    case dqw_mode:
4133 >      oappend ("WORD PTR ");
4134 >      break;
4135 >    case stack_v_mode:
4136 >      if (address_mode == mode_64bit && (sizeflag & DFLAG))
4137 >        {
4138 >          oappend ("QWORD PTR ");
4139 >          used_prefixes |= (prefixes & PREFIX_DATA);
4140 >          break;
4141 >        }
4142 >      /* FALLTHRU */
4143 >    case v_mode:
4144 >    case dq_mode:
4145 >      USED_REX (REX_MODE64);
4146 >      if (rex & REX_MODE64)
4147 >        oappend ("QWORD PTR ");
4148 >      else if ((sizeflag & DFLAG) || bytemode == dq_mode)
4149 >        oappend ("DWORD PTR ");
4150 >      else
4151 >        oappend ("WORD PTR ");
4152 >      used_prefixes |= (prefixes & PREFIX_DATA);
4153 >      break;
4154 >    case z_mode:
4155 >      if ((rex & REX_MODE64) || (sizeflag & DFLAG))
4156 >        *obufp++ = 'D';
4157 >      oappend ("WORD PTR ");
4158 >      if (!(rex & REX_MODE64))
4159 >        used_prefixes |= (prefixes & PREFIX_DATA);
4160 >      break;
4161 >    case d_mode:
4162 >      oappend ("DWORD PTR ");
4163 >      break;
4164 >    case q_mode:
4165 >      oappend ("QWORD PTR ");
4166 >      break;
4167 >    case m_mode:
4168 >      if (address_mode == mode_64bit)
4169 >        oappend ("QWORD PTR ");
4170 >      else
4171 >        oappend ("DWORD PTR ");
4172 >      break;
4173 >    case f_mode:
4174 >      if (sizeflag & DFLAG)
4175 >        oappend ("FWORD PTR ");
4176 >      else
4177 >        oappend ("DWORD PTR ");
4178 >      used_prefixes |= (prefixes & PREFIX_DATA);
4179 >      break;
4180 >    case t_mode:
4181 >      oappend ("TBYTE PTR ");
4182 >      break;
4183 >    case x_mode:
4184 >      oappend ("XMMWORD PTR ");
4185 >      break;
4186 >    case o_mode:
4187 >      oappend ("OWORD PTR ");
4188 >      break;
4189 >    default:
4190 >      break;
4191 >    }
4192 > }
4193 >
4194 > static void
4195 > OP_E (int bytemode, int sizeflag)
4196   {
4197    bfd_vma disp;
4198    int add = 0;
# Line 2993 | Line 4226 | OP_E (bytemode, sizeflag)
4226            oappend (names64[rm + add]);
4227            break;
4228          case m_mode:
4229 <          if (mode_64bit)
4229 >          if (address_mode == mode_64bit)
4230              oappend (names64[rm + add]);
4231            else
4232              oappend (names32[rm + add]);
4233            break;
4234 +        case stack_v_mode:
4235 +          if (address_mode == mode_64bit && (sizeflag & DFLAG))
4236 +            {
4237 +              oappend (names64[rm + add]);
4238 +              used_prefixes |= (prefixes & PREFIX_DATA);
4239 +              break;
4240 +            }
4241 +          bytemode = v_mode;
4242 +          /* FALLTHRU */
4243          case v_mode:
4244 +        case dq_mode:
4245 +        case dqw_mode:
4246            USED_REX (REX_MODE64);
4247            if (rex & REX_MODE64)
4248              oappend (names64[rm + add]);
4249 <          else if (sizeflag & DFLAG)
4249 >          else if ((sizeflag & DFLAG) || bytemode != v_mode)
4250              oappend (names32[rm + add]);
4251            else
4252              oappend (names16[rm + add]);
4253            used_prefixes |= (prefixes & PREFIX_DATA);
4254            break;
4255          case 0:
3012          if (!(codep[-2] == 0xAE && codep[-1] == 0xF8 /* sfence */)
3013              && !(codep[-2] == 0xAE && codep[-1] == 0xF0 /* mfence */)
3014              && !(codep[-2] == 0xAE && codep[-1] == 0xe8 /* lfence */))
3015            BadOp ();   /* bad sfence,lea,lds,les,lfs,lgs,lss modrm */
4256            break;
4257          default:
4258            oappend (INTERNAL_DISASSEMBLER_ERROR);
# Line 3022 | Line 4262 | OP_E (bytemode, sizeflag)
4262      }
4263  
4264    disp = 0;
4265 +  if (intel_syntax)
4266 +    intel_operand_size (bytemode, sizeflag);
4267    append_seg ();
4268  
4269 <  if ((sizeflag & AFLAG) || mode_64bit) /* 32 bit address mode */
4269 >  if ((sizeflag & AFLAG) || address_mode == mode_64bit) /* 32 bit address mode */
4270      {
4271        int havesib;
4272        int havebase;
# Line 3040 | Line 4282 | OP_E (bytemode, sizeflag)
4282          {
4283            havesib = 1;
4284            FETCH_DATA (the_info, codep + 1);
3043          scale = (*codep >> 6) & 3;
4285            index = (*codep >> 3) & 7;
4286 +          if (address_mode == mode_64bit || index != 0x4)
4287 +            /* When INDEX == 0x4 in 32 bit mode, SCALE is ignored.  */
4288 +            scale = (*codep >> 6) & 3;
4289            base = *codep & 7;
4290            USED_REX (REX_EXTY);
3047          USED_REX (REX_EXTZ);
4291            if (rex & REX_EXTY)
4292              index += 8;
3050          if (rex & REX_EXTZ)
3051            base += 8;
4293            codep++;
4294          }
4295 +      base += add;
4296  
4297        switch (mod)
4298          {
# Line 3058 | Line 4300 | OP_E (bytemode, sizeflag)
4300            if ((base & 7) == 5)
4301              {
4302                havebase = 0;
4303 <              if (mode_64bit && !havesib && (sizeflag & AFLAG))
4303 >              if (address_mode == mode_64bit && !havesib)
4304                  riprel = 1;
4305                disp = get32s ();
4306              }
# Line 3075 | Line 4317 | OP_E (bytemode, sizeflag)
4317          }
4318  
4319        if (!intel_syntax)
4320 <        if (mod != 0 || (base & 7) == 5)
4321 <          {
4320 >        if (mod != 0 || (base & 7) == 5)
4321 >          {
4322              print_operand_value (scratchbuf, !riprel, disp);
4323 <            oappend (scratchbuf);
4323 >            oappend (scratchbuf);
4324              if (riprel)
4325                {
4326                  set_op (disp, 1);
4327                  oappend ("(%rip)");
4328                }
4329 <          }
4329 >          }
4330  
4331        if (havebase || (havesib && (index != 4 || scale != 0)))
4332          {
3091          if (intel_syntax)
3092            {
3093              switch (bytemode)
3094                {
3095                case b_mode:
3096                  oappend ("BYTE PTR ");
3097                  break;
3098                case w_mode:
3099                  oappend ("WORD PTR ");
3100                  break;
3101                case v_mode:
3102                  oappend ("DWORD PTR ");
3103                  break;
3104                case d_mode:
3105                  oappend ("QWORD PTR ");
3106                  break;
3107                case m_mode:
3108                  if (mode_64bit)
3109                    oappend ("DWORD PTR ");
3110                  else
3111                    oappend ("QWORD PTR ");
3112                  break;
3113                case x_mode:
3114                  oappend ("XWORD PTR ");
3115                  break;
3116                default:
3117                  break;
3118                }
3119             }
4333            *obufp++ = open_char;
4334            if (intel_syntax && riprel)
4335              oappend ("rip + ");
4336 <          *obufp = '\0';
3124 <          USED_REX (REX_EXTZ);
3125 <          if (!havesib && (rex & REX_EXTZ))
3126 <            base += 8;
4336 >          *obufp = '\0';
4337            if (havebase)
4338 <            oappend (mode_64bit && (sizeflag & AFLAG)
4338 >            oappend (address_mode == mode_64bit && (sizeflag & AFLAG)
4339                       ? names64[base] : names32[base]);
4340            if (havesib)
4341              {
4342                if (index != 4)
4343                  {
4344 <                  if (intel_syntax)
4345 <                    {
4346 <                      if (havebase)
4347 <                        {
4348 <                          *obufp++ = separator_char;
4349 <                          *obufp = '\0';
4350 <                        }
4351 <                      sprintf (scratchbuf, "%s",
4352 <                               mode_64bit && (sizeflag & AFLAG)
4353 <                               ? names64[index] : names32[index]);
4354 <                    }
4355 <                  else
4356 <                    sprintf (scratchbuf, ",%s",
3147 <                             mode_64bit && (sizeflag & AFLAG)
3148 <                             ? names64[index] : names32[index]);
4344 >                  if (!intel_syntax || havebase)
4345 >                    {
4346 >                      *obufp++ = separator_char;
4347 >                      *obufp = '\0';
4348 >                    }
4349 >                  oappend (address_mode == mode_64bit && (sizeflag & AFLAG)
4350 >                           ? names64[index] : names32[index]);
4351 >                }
4352 >              if (scale != 0 || (!intel_syntax && index != 4))
4353 >                {
4354 >                  *obufp++ = scale_char;
4355 >                  *obufp = '\0';
4356 >                  sprintf (scratchbuf, "%d", 1 << scale);
4357                    oappend (scratchbuf);
4358                  }
3151              if (!intel_syntax
3152                  || (intel_syntax
3153                      && bytemode != b_mode
3154                      && bytemode != w_mode
3155                      && bytemode != v_mode))
3156                {
3157                  *obufp++ = scale_char;
3158                  *obufp = '\0';
3159                  sprintf (scratchbuf, "%d", 1 << scale);
3160                  oappend (scratchbuf);
3161                }
4359              }
4360 <          if (intel_syntax)
4361 <            if (mod != 0 || (base & 7) == 5)
4362 <              {
4363 <                /* Don't print zero displacements.  */
4364 <                if (disp != 0)
4365 <                  {
4366 <                    if ((bfd_signed_vma) disp > 0)
4367 <                      {
4368 <                        *obufp++ = '+';
4369 <                        *obufp = '\0';
4370 <                      }
4371 <
4372 <                    print_operand_value (scratchbuf, 0, disp);
4373 <                    oappend (scratchbuf);
4374 <                  }
4375 <              }
4360 >          if (intel_syntax && disp)
4361 >            {
4362 >              if ((bfd_signed_vma) disp > 0)
4363 >                {
4364 >                  *obufp++ = '+';
4365 >                  *obufp = '\0';
4366 >                }
4367 >              else if (mod != 1)
4368 >                {
4369 >                  *obufp++ = '-';
4370 >                  *obufp = '\0';
4371 >                  disp = - (bfd_signed_vma) disp;
4372 >                }
4373 >
4374 >              print_operand_value (scratchbuf, mod != 1, disp);
4375 >              oappend (scratchbuf);
4376 >            }
4377  
4378            *obufp++ = close_char;
4379 <          *obufp = '\0';
4379 >          *obufp = '\0';
4380          }
4381        else if (intel_syntax)
4382 <        {
4383 <          if (mod != 0 || (base & 7) == 5)
4384 <            {
4382 >        {
4383 >          if (mod != 0 || (base & 7) == 5)
4384 >            {
4385                if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
4386                                | PREFIX_ES | PREFIX_FS | PREFIX_GS))
4387                  ;
# Line 3193 | Line 4391 | OP_E (bytemode, sizeflag)
4391                    oappend (":");
4392                  }
4393                print_operand_value (scratchbuf, 1, disp);
4394 <              oappend (scratchbuf);
4395 <            }
4396 <        }
4394 >              oappend (scratchbuf);
4395 >            }
4396 >        }
4397      }
4398    else
4399      { /* 16 bit address mode */
4400        switch (mod)
4401          {
4402          case 0:
4403 <          if ((rm & 7) == 6)
4403 >          if (rm == 6)
4404              {
4405                disp = get16 ();
4406                if ((disp & 0x8000) != 0)
# Line 3223 | Line 4421 | OP_E (bytemode, sizeflag)
4421          }
4422  
4423        if (!intel_syntax)
4424 <        if (mod != 0 || (rm & 7) == 6)
4425 <          {
4424 >        if (mod != 0 || rm == 6)
4425 >          {
4426              print_operand_value (scratchbuf, 0, disp);
4427 <            oappend (scratchbuf);
4428 <          }
4427 >            oappend (scratchbuf);
4428 >          }
4429  
4430 <      if (mod != 0 || (rm & 7) != 6)
4430 >      if (mod != 0 || rm != 6)
4431          {
4432            *obufp++ = open_char;
4433 <          *obufp = '\0';
4434 <          oappend (index16[rm + add]);
4435 <          *obufp++ = close_char;
4436 <          *obufp = '\0';
4433 >          *obufp = '\0';
4434 >          oappend (index16[rm]);
4435 >          if (intel_syntax && disp)
4436 >            {
4437 >              if ((bfd_signed_vma) disp > 0)
4438 >                {
4439 >                  *obufp++ = '+';
4440 >                  *obufp = '\0';
4441 >                }
4442 >              else if (mod != 1)
4443 >                {
4444 >                  *obufp++ = '-';
4445 >                  *obufp = '\0';
4446 >                  disp = - (bfd_signed_vma) disp;
4447 >                }
4448 >
4449 >              print_operand_value (scratchbuf, mod != 1, disp);
4450 >              oappend (scratchbuf);
4451 >            }
4452 >
4453 >          *obufp++ = close_char;
4454 >          *obufp = '\0';
4455 >        }
4456 >      else if (intel_syntax)
4457 >        {
4458 >          if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
4459 >                          | PREFIX_ES | PREFIX_FS | PREFIX_GS))
4460 >            ;
4461 >          else
4462 >            {
4463 >              oappend (names_seg[ds_reg - es_reg]);
4464 >              oappend (":");
4465 >            }
4466 >          print_operand_value (scratchbuf, 1, disp & 0xffff);
4467 >          oappend (scratchbuf);
4468          }
4469      }
4470   }
4471  
4472   static void
4473 < OP_G (bytemode, sizeflag)
3245 <     int bytemode;
3246 <     int sizeflag;
4473 > OP_G (int bytemode, int sizeflag)
4474   {
4475    int add = 0;
4476    USED_REX (REX_EXTX);
# Line 3268 | Line 4495 | OP_G (bytemode, sizeflag)
4495        oappend (names64[reg + add]);
4496        break;
4497      case v_mode:
4498 +    case dq_mode:
4499 +    case dqw_mode:
4500        USED_REX (REX_MODE64);
4501        if (rex & REX_MODE64)
4502          oappend (names64[reg + add]);
4503 <      else if (sizeflag & DFLAG)
4503 >      else if ((sizeflag & DFLAG) || bytemode != v_mode)
4504          oappend (names32[reg + add]);
4505        else
4506          oappend (names16[reg + add]);
4507        used_prefixes |= (prefixes & PREFIX_DATA);
4508        break;
4509 +    case m_mode:
4510 +      if (address_mode == mode_64bit)
4511 +        oappend (names64[reg + add]);
4512 +      else
4513 +        oappend (names32[reg + add]);
4514 +      break;
4515      default:
4516        oappend (INTERNAL_DISASSEMBLER_ERROR);
4517        break;
# Line 3284 | Line 4519 | OP_G (bytemode, sizeflag)
4519   }
4520  
4521   static bfd_vma
4522 < get64 ()
4522 > get64 (void)
4523   {
4524    bfd_vma x;
4525   #ifdef BFD64
# Line 3309 | Line 4544 | get64 ()
4544   }
4545  
4546   static bfd_signed_vma
4547 < get32 ()
4547 > get32 (void)
4548   {
4549    bfd_signed_vma x = 0;
4550  
# Line 3322 | Line 4557 | get32 ()
4557   }
4558  
4559   static bfd_signed_vma
4560 < get32s ()
4560 > get32s (void)
4561   {
4562    bfd_signed_vma x = 0;
4563  
# Line 3338 | Line 4573 | get32s ()
4573   }
4574  
4575   static int
4576 < get16 ()
4576 > get16 (void)
4577   {
4578    int x = 0;
4579  
# Line 3349 | Line 4584 | get16 ()
4584   }
4585  
4586   static void
4587 < set_op (op, riprel)
3353 <     bfd_vma op;
3354 <     int riprel;
4587 > set_op (bfd_vma op, int riprel)
4588   {
4589    op_index[op_ad] = op_ad;
4590 <  if (mode_64bit)
4590 >  if (address_mode == mode_64bit)
4591      {
4592        op_address[op_ad] = op;
4593        op_riprel[op_ad] = riprel;
# Line 3368 | Line 4601 | set_op (op, riprel)
4601   }
4602  
4603   static void
4604 < OP_REG (code, sizeflag)
3372 <     int code;
3373 <     int sizeflag;
4604 > OP_REG (int code, int sizeflag)
4605   {
4606    const char *s;
4607    int add = 0;
# Line 3380 | Line 4611 | OP_REG (code, sizeflag)
4611  
4612    switch (code)
4613      {
3383    case indir_dx_reg:
3384      if (intel_syntax)
3385        s = "[dx]";
3386      else
3387        s = "(%dx)";
3388      break;
4614      case ax_reg: case cx_reg: case dx_reg: case bx_reg:
4615      case sp_reg: case bp_reg: case si_reg: case di_reg:
4616        s = names16[code - ax_reg + add];
# Line 3404 | Line 4629 | OP_REG (code, sizeflag)
4629        break;
4630      case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
4631      case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
4632 <      if (mode_64bit)
4632 >      if (address_mode == mode_64bit && (sizeflag & DFLAG))
4633          {
4634            s = names64[code - rAX_reg + add];
4635            break;
# Line 3430 | Line 4655 | OP_REG (code, sizeflag)
4655   }
4656  
4657   static void
4658 < OP_IMREG (code, sizeflag)
3434 <     int code;
3435 <     int sizeflag;
4658 > OP_IMREG (int code, int sizeflag)
4659   {
4660    const char *s;
4661  
# Line 3440 | Line 4663 | OP_IMREG (code, sizeflag)
4663      {
4664      case indir_dx_reg:
4665        if (intel_syntax)
4666 <        s = "[dx]";
4666 >        s = "dx";
4667        else
4668 <        s = "(%dx)";
4668 >        s = "(%dx)";
4669        break;
4670      case ax_reg: case cx_reg: case dx_reg: case bx_reg:
4671      case sp_reg: case bp_reg: case si_reg: case di_reg:
# Line 3471 | Line 4694 | OP_IMREG (code, sizeflag)
4694          s = names16[code - eAX_reg];
4695        used_prefixes |= (prefixes & PREFIX_DATA);
4696        break;
4697 +    case z_mode_ax_reg:
4698 +      if ((rex & REX_MODE64) || (sizeflag & DFLAG))
4699 +        s = *names32;
4700 +      else
4701 +        s = *names16;
4702 +      if (!(rex & REX_MODE64))
4703 +        used_prefixes |= (prefixes & PREFIX_DATA);
4704 +      break;
4705      default:
4706        s = INTERNAL_DISASSEMBLER_ERROR;
4707        break;
# Line 3479 | Line 4710 | OP_IMREG (code, sizeflag)
4710   }
4711  
4712   static void
4713 < OP_I (bytemode, sizeflag)
3483 <     int bytemode;
3484 <     int sizeflag;
4713 > OP_I (int bytemode, int sizeflag)
4714   {
4715    bfd_signed_vma op;
4716    bfd_signed_vma mask = -1;
# Line 3494 | Line 4723 | OP_I (bytemode, sizeflag)
4723        mask = 0xff;
4724        break;
4725      case q_mode:
4726 <      if (mode_64bit)
4726 >      if (address_mode == mode_64bit)
4727          {
4728            op = get32s ();
4729            break;
# Line 3520 | Line 4749 | OP_I (bytemode, sizeflag)
4749        mask = 0xfffff;
4750        op = get16 ();
4751        break;
4752 +    case const_1_mode:
4753 +      if (intel_syntax)
4754 +        oappend ("1");
4755 +      return;
4756      default:
4757        oappend (INTERNAL_DISASSEMBLER_ERROR);
4758        return;
# Line 3533 | Line 4766 | OP_I (bytemode, sizeflag)
4766   }
4767  
4768   static void
4769 < OP_I64 (bytemode, sizeflag)
3537 <     int bytemode;
3538 <     int sizeflag;
4769 > OP_I64 (int bytemode, int sizeflag)
4770   {
4771    bfd_signed_vma op;
4772    bfd_signed_vma mask = -1;
4773  
4774 <  if (!mode_64bit)
4774 >  if (address_mode != mode_64bit)
4775      {
4776        OP_I (bytemode, sizeflag);
4777        return;
# Line 3586 | Line 4817 | OP_I64 (bytemode, sizeflag)
4817   }
4818  
4819   static void
4820 < OP_sI (bytemode, sizeflag)
3590 <     int bytemode;
3591 <     int sizeflag;
4820 > OP_sI (int bytemode, int sizeflag)
4821   {
4822    bfd_signed_vma op;
4823    bfd_signed_vma mask = -1;
# Line 3637 | Line 4866 | OP_sI (bytemode, sizeflag)
4866   }
4867  
4868   static void
4869 < OP_J (bytemode, sizeflag)
3641 <     int bytemode;
3642 <     int sizeflag;
4869 > OP_J (int bytemode, int sizeflag)
4870   {
4871    bfd_vma disp;
4872    bfd_vma mask = -1;
# Line 3653 | Line 4880 | OP_J (bytemode, sizeflag)
4880          disp -= 0x100;
4881        break;
4882      case v_mode:
4883 <      if (sizeflag & DFLAG)
4883 >      if ((sizeflag & DFLAG) || (rex & REX_MODE64))
4884          disp = get32s ();
4885        else
4886          {
# Line 3663 | Line 4890 | OP_J (bytemode, sizeflag)
4890               displacement is added!  */
4891            mask = 0xffff;
4892          }
4893 +      used_prefixes |= (prefixes & PREFIX_DATA);
4894        break;
4895      default:
4896        oappend (INTERNAL_DISASSEMBLER_ERROR);
# Line 3675 | Line 4903 | OP_J (bytemode, sizeflag)
4903   }
4904  
4905   static void
4906 < OP_SEG (dummy, sizeflag)
3679 <     int dummy ATTRIBUTE_UNUSED;
3680 <     int sizeflag ATTRIBUTE_UNUSED;
4906 > OP_SEG (int bytemode, int sizeflag)
4907   {
4908 <  oappend (names_seg[reg]);
4908 >  if (bytemode == w_mode)
4909 >    oappend (names_seg[reg]);
4910 >  else
4911 >    OP_E (mod == 3 ? bytemode : w_mode, sizeflag);
4912   }
4913  
4914   static void
4915 < OP_DIR (dummy, sizeflag)
3687 <     int dummy ATTRIBUTE_UNUSED;
3688 <     int sizeflag;
4915 > OP_DIR (int dummy ATTRIBUTE_UNUSED, int sizeflag)
4916   {
4917    int seg, offset;
4918  
# Line 3701 | Line 4928 | OP_DIR (dummy, sizeflag)
4928      }
4929    used_prefixes |= (prefixes & PREFIX_DATA);
4930    if (intel_syntax)
4931 <    sprintf (scratchbuf, "0x%x,0x%x", seg, offset);
4931 >    sprintf (scratchbuf, "0x%x:0x%x", seg, offset);
4932    else
4933      sprintf (scratchbuf, "$0x%x,$0x%x", seg, offset);
4934    oappend (scratchbuf);
4935   }
4936  
4937   static void
4938 < OP_OFF (bytemode, sizeflag)
3712 <     int bytemode ATTRIBUTE_UNUSED;
3713 <     int sizeflag;
4938 > OP_OFF (int bytemode, int sizeflag)
4939   {
4940    bfd_vma off;
4941  
4942 +  if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
4943 +    intel_operand_size (bytemode, sizeflag);
4944    append_seg ();
4945  
4946 <  if ((sizeflag & AFLAG) || mode_64bit)
4946 >  if ((sizeflag & AFLAG) || address_mode == mode_64bit)
4947      off = get32 ();
4948    else
4949      off = get16 ();
# Line 3724 | Line 4951 | OP_OFF (bytemode, sizeflag)
4951    if (intel_syntax)
4952      {
4953        if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
4954 <                        | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
4954 >                        | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
4955          {
4956            oappend (names_seg[ds_reg - es_reg]);
4957            oappend (":");
# Line 3735 | Line 4962 | OP_OFF (bytemode, sizeflag)
4962   }
4963  
4964   static void
4965 < OP_OFF64 (bytemode, sizeflag)
3739 <     int bytemode ATTRIBUTE_UNUSED;
3740 <     int sizeflag ATTRIBUTE_UNUSED;
4965 > OP_OFF64 (int bytemode, int sizeflag)
4966   {
4967    bfd_vma off;
4968  
4969 <  if (!mode_64bit)
4969 >  if (address_mode != mode_64bit
4970 >      || (prefixes & PREFIX_ADDR))
4971      {
4972        OP_OFF (bytemode, sizeflag);
4973        return;
4974      }
4975  
4976 +  if (intel_syntax && (sizeflag & SUFFIX_ALWAYS))
4977 +    intel_operand_size (bytemode, sizeflag);
4978    append_seg ();
4979  
4980    off = get64 ();
# Line 3754 | Line 4982 | OP_OFF64 (bytemode, sizeflag)
4982    if (intel_syntax)
4983      {
4984        if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
4985 <                        | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
4985 >                        | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
4986          {
4987            oappend (names_seg[ds_reg - es_reg]);
4988            oappend (":");
# Line 3765 | Line 4993 | OP_OFF64 (bytemode, sizeflag)
4993   }
4994  
4995   static void
4996 < ptr_reg (code, sizeflag)
3769 <     int code;
3770 <     int sizeflag;
4996 > ptr_reg (int code, int sizeflag)
4997   {
4998    const char *s;
3773  if (intel_syntax)
3774    oappend ("[");
3775  else
3776    oappend ("(");
4999  
5000 <  USED_REX (REX_MODE64);
5001 <  if (rex & REX_MODE64)
5000 >  *obufp++ = open_char;
5001 >  used_prefixes |= (prefixes & PREFIX_ADDR);
5002 >  if (address_mode == mode_64bit)
5003      {
5004        if (!(sizeflag & AFLAG))
5005 <        s = names32[code - eAX_reg];
5005 >        s = names32[code - eAX_reg];
5006        else
5007 <        s = names64[code - eAX_reg];
5007 >        s = names64[code - eAX_reg];
5008      }
5009    else if (sizeflag & AFLAG)
5010      s = names32[code - eAX_reg];
5011    else
5012      s = names16[code - eAX_reg];
5013    oappend (s);
5014 <  if (intel_syntax)
5015 <    oappend ("]");
3793 <  else
3794 <    oappend (")");
5014 >  *obufp++ = close_char;
5015 >  *obufp = 0;
5016   }
5017  
5018   static void
5019 < OP_ESreg (code, sizeflag)
3799 <     int code;
3800 <     int sizeflag;
5019 > OP_ESreg (int code, int sizeflag)
5020   {
5021 +  if (intel_syntax)
5022 +    {
5023 +      switch (codep[-1])
5024 +        {
5025 +        case 0x6d:      /* insw/insl */
5026 +          intel_operand_size (z_mode, sizeflag);
5027 +          break;
5028 +        case 0xa5:      /* movsw/movsl/movsq */
5029 +        case 0xa7:      /* cmpsw/cmpsl/cmpsq */
5030 +        case 0xab:      /* stosw/stosl */
5031 +        case 0xaf:      /* scasw/scasl */
5032 +          intel_operand_size (v_mode, sizeflag);
5033 +          break;
5034 +        default:
5035 +          intel_operand_size (b_mode, sizeflag);
5036 +        }
5037 +    }
5038    oappend ("%es:" + intel_syntax);
5039    ptr_reg (code, sizeflag);
5040   }
5041  
5042   static void
5043 < OP_DSreg (code, sizeflag)
3808 <     int code;
3809 <     int sizeflag;
5043 > OP_DSreg (int code, int sizeflag)
5044   {
5045 +  if (intel_syntax)
5046 +    {
5047 +      switch (codep[-1])
5048 +        {
5049 +        case 0x6f:      /* outsw/outsl */
5050 +          intel_operand_size (z_mode, sizeflag);
5051 +          break;
5052 +        case 0xa5:      /* movsw/movsl/movsq */
5053 +        case 0xa7:      /* cmpsw/cmpsl/cmpsq */
5054 +        case 0xad:      /* lodsw/lodsl/lodsq */
5055 +          intel_operand_size (v_mode, sizeflag);
5056 +          break;
5057 +        default:
5058 +          intel_operand_size (b_mode, sizeflag);
5059 +        }
5060 +    }
5061    if ((prefixes
5062         & (PREFIX_CS
5063            | PREFIX_DS
# Line 3821 | Line 5071 | OP_DSreg (code, sizeflag)
5071   }
5072  
5073   static void
5074 < OP_C (dummy, sizeflag)
3825 <     int dummy ATTRIBUTE_UNUSED;
3826 <     int sizeflag ATTRIBUTE_UNUSED;
5074 > OP_C (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5075   {
5076    int add = 0;
3829  USED_REX (REX_EXTX);
5077    if (rex & REX_EXTX)
5078 <    add = 8;
5078 >    {
5079 >      USED_REX (REX_EXTX);
5080 >      add = 8;
5081 >    }
5082 >  else if (address_mode != mode_64bit && (prefixes & PREFIX_LOCK))
5083 >    {
5084 >      used_prefixes |= PREFIX_LOCK;
5085 >      add = 8;
5086 >    }
5087    sprintf (scratchbuf, "%%cr%d", reg + add);
5088    oappend (scratchbuf + intel_syntax);
5089   }
5090  
5091   static void
5092 < OP_D (dummy, sizeflag)
3838 <     int dummy ATTRIBUTE_UNUSED;
3839 <     int sizeflag ATTRIBUTE_UNUSED;
5092 > OP_D (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5093   {
5094    int add = 0;
5095    USED_REX (REX_EXTX);
# Line 3850 | Line 5103 | OP_D (dummy, sizeflag)
5103   }
5104  
5105   static void
5106 < OP_T (dummy, sizeflag)
3854 <     int dummy ATTRIBUTE_UNUSED;
3855 <     int sizeflag ATTRIBUTE_UNUSED;
5106 > OP_T (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5107   {
5108    sprintf (scratchbuf, "%%tr%d", reg);
5109    oappend (scratchbuf + intel_syntax);
5110   }
5111  
5112   static void
5113 < OP_Rd (bytemode, sizeflag)
3863 <     int bytemode;
3864 <     int sizeflag;
5113 > OP_Rd (int bytemode, int sizeflag)
5114   {
5115    if (mod == 3)
5116      OP_E (bytemode, sizeflag);
# Line 3870 | Line 5119 | OP_Rd (bytemode, sizeflag)
5119   }
5120  
5121   static void
5122 < OP_MMX (bytemode, sizeflag)
3874 <     int bytemode ATTRIBUTE_UNUSED;
3875 <     int sizeflag ATTRIBUTE_UNUSED;
5122 > OP_MMX (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5123   {
3877  int add = 0;
3878  USED_REX (REX_EXTX);
3879  if (rex & REX_EXTX)
3880    add = 8;
5124    used_prefixes |= (prefixes & PREFIX_DATA);
5125    if (prefixes & PREFIX_DATA)
5126 <    sprintf (scratchbuf, "%%xmm%d", reg + add);
5126 >    {
5127 >      int add = 0;
5128 >      USED_REX (REX_EXTX);
5129 >      if (rex & REX_EXTX)
5130 >        add = 8;
5131 >      sprintf (scratchbuf, "%%xmm%d", reg + add);
5132 >    }
5133    else
5134 <    sprintf (scratchbuf, "%%mm%d", reg + add);
5134 >    sprintf (scratchbuf, "%%mm%d", reg);
5135    oappend (scratchbuf + intel_syntax);
5136   }
5137  
5138   static void
5139 < OP_XMM (bytemode, sizeflag)
3891 <     int bytemode ATTRIBUTE_UNUSED;
3892 <     int sizeflag ATTRIBUTE_UNUSED;
5139 > OP_XMM (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5140   {
5141    int add = 0;
5142    USED_REX (REX_EXTX);
# Line 3900 | Line 5147 | OP_XMM (bytemode, sizeflag)
5147   }
5148  
5149   static void
5150 < OP_EM (bytemode, sizeflag)
3904 <     int bytemode;
3905 <     int sizeflag;
5150 > OP_EM (int bytemode, int sizeflag)
5151   {
3907  int add = 0;
5152    if (mod != 3)
5153      {
5154 +      if (intel_syntax && bytemode == v_mode)
5155 +        {
5156 +          bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
5157 +          used_prefixes |= (prefixes & PREFIX_DATA);
5158 +        }
5159        OP_E (bytemode, sizeflag);
5160        return;
5161      }
3913  USED_REX (REX_EXTZ);
3914  if (rex & REX_EXTZ)
3915    add = 8;
5162  
5163    /* Skip mod/rm byte.  */
5164    MODRM_CHECK;
5165    codep++;
5166    used_prefixes |= (prefixes & PREFIX_DATA);
5167    if (prefixes & PREFIX_DATA)
5168 <    sprintf (scratchbuf, "%%xmm%d", rm + add);
5168 >    {
5169 >      int add = 0;
5170 >
5171 >      USED_REX (REX_EXTZ);
5172 >      if (rex & REX_EXTZ)
5173 >        add = 8;
5174 >      sprintf (scratchbuf, "%%xmm%d", rm + add);
5175 >    }
5176    else
5177 <    sprintf (scratchbuf, "%%mm%d", rm + add);
5177 >    sprintf (scratchbuf, "%%mm%d", rm);
5178    oappend (scratchbuf + intel_syntax);
5179   }
5180  
5181 + /* cvt* are the only instructions in sse2 which have
5182 +   both SSE and MMX operands and also have 0x66 prefix
5183 +   in their opcode. 0x66 was originally used to differentiate
5184 +   between SSE and MMX instruction(operands). So we have to handle the
5185 +   cvt* separately using OP_EMC and OP_MXC */
5186   static void
5187 < OP_EX (bytemode, sizeflag)
5188 <     int bytemode;
5189 <     int sizeflag;
5187 > OP_EMC (int bytemode, int sizeflag)
5188 > {
5189 >  if (mod != 3)
5190 >    {
5191 >      if (intel_syntax && bytemode == v_mode)
5192 >        {
5193 >          bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
5194 >          used_prefixes |= (prefixes & PREFIX_DATA);
5195 >        }
5196 >      OP_E (bytemode, sizeflag);
5197 >      return;
5198 >    }
5199 >  
5200 >  /* Skip mod/rm byte.  */
5201 >  MODRM_CHECK;
5202 >  codep++;
5203 >  used_prefixes |= (prefixes & PREFIX_DATA);
5204 >  sprintf (scratchbuf, "%%mm%d", rm);
5205 >  oappend (scratchbuf + intel_syntax);
5206 > }
5207 >
5208 > static void
5209 > OP_MXC (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5210 > {
5211 >  used_prefixes |= (prefixes & PREFIX_DATA);
5212 >  sprintf (scratchbuf, "%%mm%d", reg);
5213 >  oappend (scratchbuf + intel_syntax);
5214 > }
5215 >
5216 > static void
5217 > OP_EX (int bytemode, int sizeflag)
5218   {
5219    int add = 0;
5220    if (mod != 3)
5221      {
5222 +      if (intel_syntax && bytemode == v_mode)
5223 +        {
5224 +          switch (prefixes & (PREFIX_DATA|PREFIX_REPZ|PREFIX_REPNZ))
5225 +            {
5226 +            case 0:            bytemode = x_mode; break;
5227 +            case PREFIX_REPZ:  bytemode = d_mode; used_prefixes |= PREFIX_REPZ;  break;
5228 +            case PREFIX_DATA:  bytemode = x_mode; used_prefixes |= PREFIX_DATA;  break;
5229 +            case PREFIX_REPNZ: bytemode = q_mode; used_prefixes |= PREFIX_REPNZ; break;
5230 +            default:           bytemode = 0; break;
5231 +            }
5232 +        }
5233        OP_E (bytemode, sizeflag);
5234        return;
5235      }
# Line 3948 | Line 5245 | OP_EX (bytemode, sizeflag)
5245   }
5246  
5247   static void
5248 < OP_MS (bytemode, sizeflag)
3952 <     int bytemode;
3953 <     int sizeflag;
5248 > OP_MS (int bytemode, int sizeflag)
5249   {
5250    if (mod == 3)
5251      OP_EM (bytemode, sizeflag);
# Line 3959 | Line 5254 | OP_MS (bytemode, sizeflag)
5254   }
5255  
5256   static void
5257 < OP_XS (bytemode, sizeflag)
3963 <     int bytemode;
3964 <     int sizeflag;
5257 > OP_XS (int bytemode, int sizeflag)
5258   {
5259    if (mod == 3)
5260      OP_EX (bytemode, sizeflag);
# Line 3969 | Line 5262 | OP_XS (bytemode, sizeflag)
5262      BadOp ();
5263   }
5264  
5265 < static const char *Suffix3DNow[] = {
5265 > static void
5266 > OP_M (int bytemode, int sizeflag)
5267 > {
5268 >  if (mod == 3)
5269 >    /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */
5270 >    BadOp ();
5271 >  else
5272 >    OP_E (bytemode, sizeflag);
5273 > }
5274 >
5275 > static void
5276 > OP_0f07 (int bytemode, int sizeflag)
5277 > {
5278 >  if (mod != 3 || rm != 0)
5279 >    BadOp ();
5280 >  else
5281 >    OP_E (bytemode, sizeflag);
5282 > }
5283 >
5284 > static void
5285 > OP_0fae (int bytemode, int sizeflag)
5286 > {
5287 >  if (mod == 3)
5288 >    {
5289 >      if (reg == 7)
5290 >        strcpy (obuf + strlen (obuf) - sizeof ("clflush") + 1, "sfence");
5291 >
5292 >      if (reg < 5 || rm != 0)
5293 >        {
5294 >          BadOp ();     /* bad sfence, mfence, or lfence */
5295 >          return;
5296 >        }
5297 >    }
5298 >  else if (reg != 7)
5299 >    {
5300 >      BadOp ();         /* bad clflush */
5301 >      return;
5302 >    }
5303 >
5304 >  OP_E (bytemode, sizeflag);
5305 > }
5306 >
5307 > /* NOP is an alias of "xchg %ax,%ax" in 16bit mode, "xchg %eax,%eax" in
5308 >   32bit mode and "xchg %rax,%rax" in 64bit mode.  NOP with REPZ prefix
5309 >   is called PAUSE.  We display "xchg %ax,%ax" instead of "data16 nop".
5310 > */
5311 >
5312 > static void
5313 > NOP_Fixup1 (int bytemode, int sizeflag)
5314 > {
5315 >  if (prefixes == PREFIX_REPZ)
5316 >    strcpy (obuf, "pause");
5317 >  else if (prefixes == PREFIX_DATA
5318 >           || ((rex & REX_MODE64) && rex != 0x48))
5319 >    OP_REG (bytemode, sizeflag);
5320 >  else
5321 >    strcpy (obuf, "nop");
5322 > }
5323 >
5324 > static void
5325 > NOP_Fixup2 (int bytemode, int sizeflag)
5326 > {
5327 >  if (prefixes == PREFIX_DATA
5328 >      || ((rex & REX_MODE64) && rex != 0x48))
5329 >    OP_IMREG (bytemode, sizeflag);
5330 > }
5331 >
5332 > static const char *const Suffix3DNow[] = {
5333   /* 00 */        NULL,           NULL,           NULL,           NULL,
5334   /* 04 */        NULL,           NULL,           NULL,           NULL,
5335   /* 08 */        NULL,           NULL,           NULL,           NULL,
# Line 4037 | Line 5397 | static const char *Suffix3DNow[] = {
5397   };
5398  
5399   static void
5400 < OP_3DNowSuffix (bytemode, sizeflag)
4041 <     int bytemode ATTRIBUTE_UNUSED;
4042 <     int sizeflag ATTRIBUTE_UNUSED;
5400 > OP_3DNowSuffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5401   {
5402    const char *mnemonic;
5403  
# Line 4075 | Line 5433 | static const char *simd_cmp_op[] = {
5433   };
5434  
5435   static void
5436 < OP_SIMD_Suffix (bytemode, sizeflag)
4079 <     int bytemode ATTRIBUTE_UNUSED;
4080 <     int sizeflag ATTRIBUTE_UNUSED;
5436 > OP_SIMD_Suffix (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
5437   {
5438    unsigned int cmp_type;
5439  
# Line 4117 | Line 5473 | OP_SIMD_Suffix (bytemode, sizeflag)
5473   }
5474  
5475   static void
5476 < SIMD_Fixup (extrachar, sizeflag)
4121 <     int extrachar;
4122 <     int sizeflag ATTRIBUTE_UNUSED;
5476 > SIMD_Fixup (int extrachar, int sizeflag ATTRIBUTE_UNUSED)
5477   {
5478    /* Change movlps/movhps to movhlps/movlhps for 2 register operand
5479       forms of these instructions.  */
# Line 4135 | Line 5489 | SIMD_Fixup (extrachar, sizeflag)
5489   }
5490  
5491   static void
5492 + PNI_Fixup (int extrachar ATTRIBUTE_UNUSED, int sizeflag)
5493 + {
5494 +  if (mod == 3 && reg == 1 && rm <= 1)
5495 +    {
5496 +      /* Override "sidt".  */
5497 +      size_t olen = strlen (obuf);
5498 +      char *p = obuf + olen - 4;
5499 +      const char **names = (address_mode == mode_64bit
5500 +                            ? names64 : names32);
5501 +
5502 +      /* We might have a suffix when disassembling with -Msuffix.  */
5503 +      if (*p == 'i')
5504 +        --p;
5505 +
5506 +      /* Remove "addr16/addr32" if we aren't in Intel mode.  */
5507 +      if (!intel_syntax
5508 +          && (prefixes & PREFIX_ADDR)
5509 +          && olen >= (4 + 7)
5510 +          && *(p - 1) == ' '
5511 +          && CONST_STRNEQ (p - 7, "addr")
5512 +          && (CONST_STRNEQ (p - 3, "16")
5513 +              || CONST_STRNEQ (p - 3, "32")))
5514 +        p -= 7;
5515 +
5516 +      if (rm)
5517 +        {
5518 +          /* mwait %eax,%ecx  */
5519 +          strcpy (p, "mwait");
5520 +          if (!intel_syntax)
5521 +            strcpy (op1out, names[0]);
5522 +        }
5523 +      else
5524 +        {
5525 +          /* monitor %eax,%ecx,%edx"  */
5526 +          strcpy (p, "monitor");
5527 +          if (!intel_syntax)
5528 +            {
5529 +              const char **op1_names;
5530 +              if (!(prefixes & PREFIX_ADDR))
5531 +                op1_names = (address_mode == mode_16bit
5532 +                             ? names16 : names);
5533 +              else
5534 +                {
5535 +                  op1_names = (address_mode != mode_32bit
5536 +                               ? names32 : names16);
5537 +                  used_prefixes |= PREFIX_ADDR;
5538 +                }
5539 +              strcpy (op1out, op1_names[0]);
5540 +              strcpy (op3out, names[2]);
5541 +            }
5542 +        }
5543 +      if (!intel_syntax)
5544 +        {
5545 +          strcpy (op2out, names[1]);
5546 +          two_source_ops = 1;
5547 +        }
5548 +
5549 +      codep++;
5550 +    }
5551 +  else
5552 +    OP_M (0, sizeflag);
5553 + }
5554 +
5555 + static void
5556 + SVME_Fixup (int bytemode, int sizeflag)
5557 + {
5558 +  const char *alt;
5559 +  char *p;
5560 +
5561 +  switch (*codep)
5562 +    {
5563 +    case 0xd8:
5564 +      alt = "vmrun";
5565 +      break;
5566 +    case 0xd9:
5567 +      alt = "vmmcall";
5568 +      break;
5569 +    case 0xda:
5570 +      alt = "vmload";
5571 +      break;
5572 +    case 0xdb:
5573 +      alt = "vmsave";
5574 +      break;
5575 +    case 0xdc:
5576 +      alt = "stgi";
5577 +      break;
5578 +    case 0xdd:
5579 +      alt = "clgi";
5580 +      break;
5581 +    case 0xde:
5582 +      alt = "skinit";
5583 +      break;
5584 +    case 0xdf:
5585 +      alt = "invlpga";
5586 +      break;
5587 +    default:
5588 +      OP_M (bytemode, sizeflag);
5589 +      return;
5590 +    }
5591 +  /* Override "lidt".  */
5592 +  p = obuf + strlen (obuf) - 4;
5593 +  /* We might have a suffix.  */
5594 +  if (*p == 'i')
5595 +    --p;
5596 +  strcpy (p, alt);
5597 +  if (!(prefixes & PREFIX_ADDR))
5598 +    {
5599 +      ++codep;
5600 +      return;
5601 +    }
5602 +  used_prefixes |= PREFIX_ADDR;
5603 +  switch (*codep++)
5604 +    {
5605 +    case 0xdf:
5606 +      strcpy (op2out, names32[1]);
5607 +      two_source_ops = 1;
5608 +          /* Fall through.  */
5609 +    case 0xd8:
5610 +    case 0xda:
5611 +    case 0xdb:
5612 +      *obufp++ = open_char;
5613 +      if (address_mode == mode_64bit || (sizeflag & AFLAG))
5614 +        alt = names32[0];
5615 +      else
5616 +        alt = names16[0];
5617 +      strcpy (obufp, alt);
5618 +      obufp += strlen (alt);
5619 +      *obufp++ = close_char;
5620 +      *obufp = '\0';
5621 +      break;
5622 +    }
5623 + }
5624 +
5625 + static void
5626 + INVLPG_Fixup (int bytemode, int sizeflag)
5627 + {
5628 +  const char *alt;
5629 +
5630 +  switch (*codep)
5631 +    {
5632 +    case 0xf8:
5633 +      alt = "swapgs";
5634 +      break;
5635 +    case 0xf9:
5636 +      alt = "rdtscp";
5637 +      break;
5638 +    default:
5639 +      OP_M (bytemode, sizeflag);
5640 +      return;
5641 +    }
5642 +  /* Override "invlpg".  */
5643 +  strcpy (obuf + strlen (obuf) - 6, alt);
5644 +  codep++;
5645 + }
5646 +
5647 + static void
5648   BadOp (void)
5649   {
5650    /* Throw away prefixes and 1st. opcode byte.  */
5651    codep = insn_codep + 1;
5652    oappend ("(bad)");
5653   }
5654 +
5655 + static void
5656 + VMX_Fixup (int extrachar ATTRIBUTE_UNUSED, int sizeflag)
5657 + {
5658 +  if (mod == 3 && reg == 0 && rm >=1 && rm <= 4)
5659 +    {
5660 +      /* Override "sgdt".  */
5661 +      char *p = obuf + strlen (obuf) - 4;
5662 +
5663 +      /* We might have a suffix when disassembling with -Msuffix.  */
5664 +      if (*p == 'g')
5665 +        --p;
5666 +
5667 +      switch (rm)
5668 +        {
5669 +        case 1:
5670 +          strcpy (p, "vmcall");
5671 +          break;
5672 +        case 2:
5673 +          strcpy (p, "vmlaunch");
5674 +          break;
5675 +        case 3:
5676 +          strcpy (p, "vmresume");
5677 +          break;
5678 +        case 4:
5679 +          strcpy (p, "vmxoff");
5680 +          break;
5681 +        }
5682 +
5683 +      codep++;
5684 +    }
5685 +  else
5686 +    OP_E (0, sizeflag);
5687 + }
5688 +
5689 + static void
5690 + OP_VMX (int bytemode, int sizeflag)
5691 + {
5692 +  used_prefixes |= (prefixes & (PREFIX_DATA | PREFIX_REPZ));
5693 +  if (prefixes & PREFIX_DATA)
5694 +    strcpy (obuf, "vmclear");
5695 +  else if (prefixes & PREFIX_REPZ)
5696 +    strcpy (obuf, "vmxon");
5697 +  else
5698 +    strcpy (obuf, "vmptrld");
5699 +  OP_E (bytemode, sizeflag);
5700 + }
5701 +
5702 + static void
5703 + REP_Fixup (int bytemode, int sizeflag)
5704 + {
5705 +  /* The 0xf3 prefix should be displayed as "rep" for ins, outs, movs,
5706 +     lods and stos.  */
5707 +  size_t ilen = 0;
5708 +
5709 +  if (prefixes & PREFIX_REPZ)
5710 +    switch (*insn_codep)
5711 +      {
5712 +      case 0x6e:        /* outsb */
5713 +      case 0x6f:        /* outsw/outsl */
5714 +      case 0xa4:        /* movsb */
5715 +      case 0xa5:        /* movsw/movsl/movsq */
5716 +        if (!intel_syntax)
5717 +          ilen = 5;
5718 +        else
5719 +          ilen = 4;
5720 +        break;
5721 +      case 0xaa:        /* stosb */
5722 +      case 0xab:        /* stosw/stosl/stosq */
5723 +      case 0xac:        /* lodsb */
5724 +      case 0xad:        /* lodsw/lodsl/lodsq */
5725 +        if (!intel_syntax && (sizeflag & SUFFIX_ALWAYS))
5726 +          ilen = 5;
5727 +        else
5728 +          ilen = 4;
5729 +        break;
5730 +      case 0x6c:        /* insb */
5731 +      case 0x6d:        /* insl/insw */
5732 +        if (!intel_syntax)
5733 +          ilen = 4;
5734 +        else
5735 +          ilen = 3;
5736 +        break;
5737 +      default:
5738 +        abort ();
5739 +        break;
5740 +      }
5741 +
5742 +  if (ilen != 0)
5743 +    {
5744 +      size_t olen;
5745 +      char *p;
5746 +
5747 +      olen = strlen (obuf);
5748 +      p = obuf + olen - ilen - 1 - 4;
5749 +      /* Handle "repz [addr16|addr32]".  */
5750 +      if ((prefixes & PREFIX_ADDR))
5751 +        p -= 1 + 6;
5752 +
5753 +      memmove (p + 3, p + 4, olen - (p + 3 - obuf));
5754 +    }
5755 +
5756 +  switch (bytemode)
5757 +    {
5758 +    case al_reg:
5759 +    case eAX_reg:
5760 +    case indir_dx_reg:
5761 +      OP_IMREG (bytemode, sizeflag);
5762 +      break;
5763 +    case eDI_reg:
5764 +      OP_ESreg (bytemode, sizeflag);
5765 +      break;
5766 +    case eSI_reg:
5767 +      OP_DSreg (bytemode, sizeflag);
5768 +      break;
5769 +    default:
5770 +      abort ();
5771 +      break;
5772 +    }
5773 + }
5774 +
5775 + static void
5776 + CMPXCHG8B_Fixup (int bytemode, int sizeflag)
5777 + {
5778 +  USED_REX (REX_MODE64);
5779 +  if (rex & REX_MODE64)
5780 +    {
5781 +      /* Change cmpxchg8b to cmpxchg16b.  */
5782 +      char *p = obuf + strlen (obuf) - 2;
5783 +      strcpy (p, "16b");
5784 +      bytemode = o_mode;
5785 +    }
5786 +  OP_M (bytemode, sizeflag);
5787 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines