xref: /minix3/minix/commands/swifi/db_disasm.c (revision 875abb872412bde4d3ba5da66423f55431e19dcf)
1*433d6423SLionel Sambuc /*
2*433d6423SLionel Sambuc  * Mach Operating System
3*433d6423SLionel Sambuc  * Copyright (c) 1991,1990 Carnegie Mellon University
4*433d6423SLionel Sambuc  * All Rights Reserved.
5*433d6423SLionel Sambuc  *
6*433d6423SLionel Sambuc  * Permission to use, copy, modify and distribute this software and its
7*433d6423SLionel Sambuc  * documentation is hereby granted, provided that both the copyright
8*433d6423SLionel Sambuc  * notice and this permission notice appear in all copies of the
9*433d6423SLionel Sambuc  * software, derivative works or modified versions, and any portions
10*433d6423SLionel Sambuc  * thereof, and that both notices appear in supporting documentation.
11*433d6423SLionel Sambuc  *
12*433d6423SLionel Sambuc  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
13*433d6423SLionel Sambuc  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14*433d6423SLionel Sambuc  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15*433d6423SLionel Sambuc  *
16*433d6423SLionel Sambuc  * Carnegie Mellon requests users of this software to return to
17*433d6423SLionel Sambuc  *
18*433d6423SLionel Sambuc  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
19*433d6423SLionel Sambuc  *  School of Computer Science
20*433d6423SLionel Sambuc  *  Carnegie Mellon University
21*433d6423SLionel Sambuc  *  Pittsburgh PA 15213-3890
22*433d6423SLionel Sambuc  *
23*433d6423SLionel Sambuc  * any improvements or extensions that they make and grant Carnegie the
24*433d6423SLionel Sambuc  * rights to redistribute these changes.
25*433d6423SLionel Sambuc  */
26*433d6423SLionel Sambuc 
27*433d6423SLionel Sambuc /*
28*433d6423SLionel Sambuc  * Instruction disassembler.
29*433d6423SLionel Sambuc  */
30*433d6423SLionel Sambuc 
31*433d6423SLionel Sambuc #include "ddb.h"
32*433d6423SLionel Sambuc 
33*433d6423SLionel Sambuc #include "db_access.h"
34*433d6423SLionel Sambuc #include "db_sym.h"
35*433d6423SLionel Sambuc 
36*433d6423SLionel Sambuc /*
37*433d6423SLionel Sambuc  * Size attributes
38*433d6423SLionel Sambuc  */
39*433d6423SLionel Sambuc #define	BYTE	0
40*433d6423SLionel Sambuc #define	WORD	1
41*433d6423SLionel Sambuc #define	LONG	2
42*433d6423SLionel Sambuc #define	QUAD	3
43*433d6423SLionel Sambuc #define	SNGL	4
44*433d6423SLionel Sambuc #define	DBLR	5
45*433d6423SLionel Sambuc #define	EXTR	6
46*433d6423SLionel Sambuc #define	SDEP	7
47*433d6423SLionel Sambuc #define	NONE	8
48*433d6423SLionel Sambuc 
49*433d6423SLionel Sambuc /*
50*433d6423SLionel Sambuc  * Addressing modes
51*433d6423SLionel Sambuc  */
52*433d6423SLionel Sambuc #define	E	1			/* general effective address */
53*433d6423SLionel Sambuc #define	Eind	2			/* indirect address (jump, call) */
54*433d6423SLionel Sambuc #define	Ew	3			/* address, word size */
55*433d6423SLionel Sambuc #define	Eb	4			/* address, byte size */
56*433d6423SLionel Sambuc #define	R	5			/* register, in 'reg' field */
57*433d6423SLionel Sambuc #define	Rw	6			/* word register, in 'reg' field */
58*433d6423SLionel Sambuc #define	Ri	7			/* register in instruction */
59*433d6423SLionel Sambuc #define	S	8			/* segment reg, in 'reg' field */
60*433d6423SLionel Sambuc #define	Si	9			/* segment reg, in instruction */
61*433d6423SLionel Sambuc #define	A	10			/* accumulator */
62*433d6423SLionel Sambuc #define	BX	11			/* (bx) */
63*433d6423SLionel Sambuc #define	CL	12			/* cl, for shifts */
64*433d6423SLionel Sambuc #define	DX	13			/* dx, for IO */
65*433d6423SLionel Sambuc #define	SI	14			/* si */
66*433d6423SLionel Sambuc #define	DI	15			/* di */
67*433d6423SLionel Sambuc #define	CR	16			/* control register */
68*433d6423SLionel Sambuc #define	DR	17			/* debug register */
69*433d6423SLionel Sambuc #define	TR	18			/* test register */
70*433d6423SLionel Sambuc #define	I	19			/* immediate, unsigned */
71*433d6423SLionel Sambuc #define	Is	20			/* immediate, signed */
72*433d6423SLionel Sambuc #define	Ib	21			/* byte immediate, unsigned */
73*433d6423SLionel Sambuc #define	Ibs	22			/* byte immediate, signed */
74*433d6423SLionel Sambuc #define	Iw	23			/* word immediate, unsigned */
75*433d6423SLionel Sambuc #define	O	25			/* direct address */
76*433d6423SLionel Sambuc #define	Db	26			/* byte displacement from EIP */
77*433d6423SLionel Sambuc #define	Dl	27			/* long displacement from EIP */
78*433d6423SLionel Sambuc #define	o1	28			/* constant 1 */
79*433d6423SLionel Sambuc #define	o3	29			/* constant 3 */
80*433d6423SLionel Sambuc #define	OS	30			/* immediate offset/segment */
81*433d6423SLionel Sambuc #define	ST	31			/* FP stack top */
82*433d6423SLionel Sambuc #define	STI	32			/* FP stack */
83*433d6423SLionel Sambuc #define	X	33			/* extended FP op */
84*433d6423SLionel Sambuc #define	XA	34			/* for 'fstcw %ax' */
85*433d6423SLionel Sambuc #define	El	35			/* address, long size */
86*433d6423SLionel Sambuc #define	Ril	36			/* long register in instruction */
87*433d6423SLionel Sambuc #define	Iba	37			/* byte immediate, don't print if 0xa */
88*433d6423SLionel Sambuc 
89*433d6423SLionel Sambuc struct inst {
90*433d6423SLionel Sambuc 	const char *	i_name;		/* name */
91*433d6423SLionel Sambuc 	short	i_has_modrm;		/* has regmodrm byte */
92*433d6423SLionel Sambuc 	short	i_size;			/* operand size */
93*433d6423SLionel Sambuc 	int	i_mode;			/* addressing modes */
94*433d6423SLionel Sambuc 	const void *	i_extra;	/* pointer to extra opcode table */
95*433d6423SLionel Sambuc };
96*433d6423SLionel Sambuc 
97*433d6423SLionel Sambuc #define	op1(x)		(x)
98*433d6423SLionel Sambuc #define	op2(x,y)	((x)|((y)<<8))
99*433d6423SLionel Sambuc #define	op3(x,y,z)	((x)|((y)<<8)|((z)<<16))
100*433d6423SLionel Sambuc 
101*433d6423SLionel Sambuc struct finst {
102*433d6423SLionel Sambuc 	const char *	f_name;		/* name for memory instruction */
103*433d6423SLionel Sambuc 	int	f_size;			/* size for memory instruction */
104*433d6423SLionel Sambuc 	int	f_rrmode;		/* mode for rr instruction */
105*433d6423SLionel Sambuc 	const void *	f_rrname;	/* name for rr instruction
106*433d6423SLionel Sambuc 					   (or pointer to table) */
107*433d6423SLionel Sambuc };
108*433d6423SLionel Sambuc 
109*433d6423SLionel Sambuc static const char * const db_Grp6[] = {
110*433d6423SLionel Sambuc 	"sldt",
111*433d6423SLionel Sambuc 	"str",
112*433d6423SLionel Sambuc 	"lldt",
113*433d6423SLionel Sambuc 	"ltr",
114*433d6423SLionel Sambuc 	"verr",
115*433d6423SLionel Sambuc 	"verw",
116*433d6423SLionel Sambuc 	"",
117*433d6423SLionel Sambuc 	""
118*433d6423SLionel Sambuc };
119*433d6423SLionel Sambuc 
120*433d6423SLionel Sambuc static const char * const db_Grp7[] = {
121*433d6423SLionel Sambuc 	"sgdt",
122*433d6423SLionel Sambuc 	"sidt",
123*433d6423SLionel Sambuc 	"lgdt",
124*433d6423SLionel Sambuc 	"lidt",
125*433d6423SLionel Sambuc 	"smsw",
126*433d6423SLionel Sambuc 	"",
127*433d6423SLionel Sambuc 	"lmsw",
128*433d6423SLionel Sambuc 	"invlpg"
129*433d6423SLionel Sambuc };
130*433d6423SLionel Sambuc 
131*433d6423SLionel Sambuc static const char * const db_Grp8[] = {
132*433d6423SLionel Sambuc 	"",
133*433d6423SLionel Sambuc 	"",
134*433d6423SLionel Sambuc 	"",
135*433d6423SLionel Sambuc 	"",
136*433d6423SLionel Sambuc 	"bt",
137*433d6423SLionel Sambuc 	"bts",
138*433d6423SLionel Sambuc 	"btr",
139*433d6423SLionel Sambuc 	"btc"
140*433d6423SLionel Sambuc };
141*433d6423SLionel Sambuc 
142*433d6423SLionel Sambuc static const char * const db_Grp9[] = {
143*433d6423SLionel Sambuc 	"",
144*433d6423SLionel Sambuc 	"cmpxchg8b",
145*433d6423SLionel Sambuc 	"",
146*433d6423SLionel Sambuc 	"",
147*433d6423SLionel Sambuc 	"",
148*433d6423SLionel Sambuc 	"",
149*433d6423SLionel Sambuc 	"",
150*433d6423SLionel Sambuc 	""
151*433d6423SLionel Sambuc };
152*433d6423SLionel Sambuc 
153*433d6423SLionel Sambuc static const struct inst db_inst_0f0x[] = {
154*433d6423SLionel Sambuc /*00*/	{ "",	   TRUE,  NONE,  op1(Ew),     db_Grp6 },
155*433d6423SLionel Sambuc /*01*/	{ "",	   TRUE,  NONE,  op1(Ew),     db_Grp7 },
156*433d6423SLionel Sambuc /*02*/	{ "lar",   TRUE,  LONG,  op2(E,R),    0 },
157*433d6423SLionel Sambuc /*03*/	{ "lsl",   TRUE,  LONG,  op2(E,R),    0 },
158*433d6423SLionel Sambuc /*04*/	{ "",      FALSE, NONE,  0,	      0 },
159*433d6423SLionel Sambuc /*05*/	{ "",      FALSE, NONE,  0,	      0 },
160*433d6423SLionel Sambuc /*06*/	{ "clts",  FALSE, NONE,  0,	      0 },
161*433d6423SLionel Sambuc /*07*/	{ "",      FALSE, NONE,  0,	      0 },
162*433d6423SLionel Sambuc 
163*433d6423SLionel Sambuc /*08*/	{ "invd",  FALSE, NONE,  0,	      0 },
164*433d6423SLionel Sambuc /*09*/	{ "wbinvd",FALSE, NONE,  0,	      0 },
165*433d6423SLionel Sambuc /*0a*/	{ "",      FALSE, NONE,  0,	      0 },
166*433d6423SLionel Sambuc /*0b*/	{ "",      FALSE, NONE,  0,	      0 },
167*433d6423SLionel Sambuc /*0c*/	{ "",      FALSE, NONE,  0,	      0 },
168*433d6423SLionel Sambuc /*0d*/	{ "",      FALSE, NONE,  0,	      0 },
169*433d6423SLionel Sambuc /*0e*/	{ "",      FALSE, NONE,  0,	      0 },
170*433d6423SLionel Sambuc /*0f*/	{ "",      FALSE, NONE,  0,	      0 },
171*433d6423SLionel Sambuc };
172*433d6423SLionel Sambuc 
173*433d6423SLionel Sambuc static const struct inst db_inst_0f2x[] = {
174*433d6423SLionel Sambuc /*20*/	{ "mov",   TRUE,  LONG,  op2(CR,El),  0 },
175*433d6423SLionel Sambuc /*21*/	{ "mov",   TRUE,  LONG,  op2(DR,El),  0 },
176*433d6423SLionel Sambuc /*22*/	{ "mov",   TRUE,  LONG,  op2(El,CR),  0 },
177*433d6423SLionel Sambuc /*23*/	{ "mov",   TRUE,  LONG,  op2(El,DR),  0 },
178*433d6423SLionel Sambuc /*24*/	{ "mov",   TRUE,  LONG,  op2(TR,El),  0 },
179*433d6423SLionel Sambuc /*25*/	{ "",      FALSE, NONE,  0,	      0 },
180*433d6423SLionel Sambuc /*26*/	{ "mov",   TRUE,  LONG,  op2(El,TR),  0 },
181*433d6423SLionel Sambuc /*27*/	{ "",      FALSE, NONE,  0,	      0 },
182*433d6423SLionel Sambuc 
183*433d6423SLionel Sambuc /*28*/	{ "",      FALSE, NONE,  0,	      0 },
184*433d6423SLionel Sambuc /*29*/	{ "",      FALSE, NONE,  0,	      0 },
185*433d6423SLionel Sambuc /*2a*/	{ "",      FALSE, NONE,  0,	      0 },
186*433d6423SLionel Sambuc /*2b*/	{ "",      FALSE, NONE,  0,	      0 },
187*433d6423SLionel Sambuc /*2c*/	{ "",      FALSE, NONE,  0,	      0 },
188*433d6423SLionel Sambuc /*2d*/	{ "",      FALSE, NONE,  0,	      0 },
189*433d6423SLionel Sambuc /*2e*/	{ "",      FALSE, NONE,  0,	      0 },
190*433d6423SLionel Sambuc /*2f*/	{ "",      FALSE, NONE,  0,	      0 },
191*433d6423SLionel Sambuc };
192*433d6423SLionel Sambuc 
193*433d6423SLionel Sambuc static const struct inst db_inst_0f3x[] = {
194*433d6423SLionel Sambuc /*30*/	{ "wrmsr", FALSE, NONE,  0,	      0 },
195*433d6423SLionel Sambuc /*31*/	{ "rdtsc", FALSE, NONE,  0,	      0 },
196*433d6423SLionel Sambuc /*32*/	{ "rdmsr", FALSE, NONE,  0,	      0 },
197*433d6423SLionel Sambuc /*33*/	{ "rdpmc", FALSE, NONE,  0,	      0 },
198*433d6423SLionel Sambuc /*34*/	{ "",	   FALSE, NONE,  0,	      0 },
199*433d6423SLionel Sambuc /*35*/	{ "",	   FALSE, NONE,  0,	      0 },
200*433d6423SLionel Sambuc /*36*/	{ "",	   FALSE, NONE,  0,	      0 },
201*433d6423SLionel Sambuc /*37*/	{ "",	   FALSE, NONE,  0,	      0 },
202*433d6423SLionel Sambuc 
203*433d6423SLionel Sambuc /*38*/	{ "",	   FALSE, NONE,  0,	      0 },
204*433d6423SLionel Sambuc /*39*/	{ "",	   FALSE, NONE,  0,	      0 },
205*433d6423SLionel Sambuc /*3a*/	{ "",	   FALSE, NONE,  0,	      0 },
206*433d6423SLionel Sambuc /*3b*/	{ "",	   FALSE, NONE,  0,	      0 },
207*433d6423SLionel Sambuc /*3c*/	{ "",	   FALSE, NONE,  0,	      0 },
208*433d6423SLionel Sambuc /*3d*/	{ "",	   FALSE, NONE,  0,	      0 },
209*433d6423SLionel Sambuc /*3e*/	{ "",	   FALSE, NONE,  0,	      0 },
210*433d6423SLionel Sambuc /*3f*/	{ "",	   FALSE, NONE,  0,	      0 },
211*433d6423SLionel Sambuc };
212*433d6423SLionel Sambuc 
213*433d6423SLionel Sambuc static const struct inst db_inst_0f8x[] = {
214*433d6423SLionel Sambuc /*80*/	{ "jo",    FALSE, NONE,  op1(Dl),     0 },
215*433d6423SLionel Sambuc /*81*/	{ "jno",   FALSE, NONE,  op1(Dl),     0 },
216*433d6423SLionel Sambuc /*82*/	{ "jb",    FALSE, NONE,  op1(Dl),     0 },
217*433d6423SLionel Sambuc /*83*/	{ "jnb",   FALSE, NONE,  op1(Dl),     0 },
218*433d6423SLionel Sambuc /*84*/	{ "jz",    FALSE, NONE,  op1(Dl),     0 },
219*433d6423SLionel Sambuc /*85*/	{ "jnz",   FALSE, NONE,  op1(Dl),     0 },
220*433d6423SLionel Sambuc /*86*/	{ "jbe",   FALSE, NONE,  op1(Dl),     0 },
221*433d6423SLionel Sambuc /*87*/	{ "jnbe",  FALSE, NONE,  op1(Dl),     0 },
222*433d6423SLionel Sambuc 
223*433d6423SLionel Sambuc /*88*/	{ "js",    FALSE, NONE,  op1(Dl),     0 },
224*433d6423SLionel Sambuc /*89*/	{ "jns",   FALSE, NONE,  op1(Dl),     0 },
225*433d6423SLionel Sambuc /*8a*/	{ "jp",    FALSE, NONE,  op1(Dl),     0 },
226*433d6423SLionel Sambuc /*8b*/	{ "jnp",   FALSE, NONE,  op1(Dl),     0 },
227*433d6423SLionel Sambuc /*8c*/	{ "jl",    FALSE, NONE,  op1(Dl),     0 },
228*433d6423SLionel Sambuc /*8d*/	{ "jnl",   FALSE, NONE,  op1(Dl),     0 },
229*433d6423SLionel Sambuc /*8e*/	{ "jle",   FALSE, NONE,  op1(Dl),     0 },
230*433d6423SLionel Sambuc /*8f*/	{ "jnle",  FALSE, NONE,  op1(Dl),     0 },
231*433d6423SLionel Sambuc };
232*433d6423SLionel Sambuc 
233*433d6423SLionel Sambuc static const struct inst db_inst_0f9x[] = {
234*433d6423SLionel Sambuc /*90*/	{ "seto",  TRUE,  NONE,  op1(Eb),     0 },
235*433d6423SLionel Sambuc /*91*/	{ "setno", TRUE,  NONE,  op1(Eb),     0 },
236*433d6423SLionel Sambuc /*92*/	{ "setb",  TRUE,  NONE,  op1(Eb),     0 },
237*433d6423SLionel Sambuc /*93*/	{ "setnb", TRUE,  NONE,  op1(Eb),     0 },
238*433d6423SLionel Sambuc /*94*/	{ "setz",  TRUE,  NONE,  op1(Eb),     0 },
239*433d6423SLionel Sambuc /*95*/	{ "setnz", TRUE,  NONE,  op1(Eb),     0 },
240*433d6423SLionel Sambuc /*96*/	{ "setbe", TRUE,  NONE,  op1(Eb),     0 },
241*433d6423SLionel Sambuc /*97*/	{ "setnbe",TRUE,  NONE,  op1(Eb),     0 },
242*433d6423SLionel Sambuc 
243*433d6423SLionel Sambuc /*98*/	{ "sets",  TRUE,  NONE,  op1(Eb),     0 },
244*433d6423SLionel Sambuc /*99*/	{ "setns", TRUE,  NONE,  op1(Eb),     0 },
245*433d6423SLionel Sambuc /*9a*/	{ "setp",  TRUE,  NONE,  op1(Eb),     0 },
246*433d6423SLionel Sambuc /*9b*/	{ "setnp", TRUE,  NONE,  op1(Eb),     0 },
247*433d6423SLionel Sambuc /*9c*/	{ "setl",  TRUE,  NONE,  op1(Eb),     0 },
248*433d6423SLionel Sambuc /*9d*/	{ "setnl", TRUE,  NONE,  op1(Eb),     0 },
249*433d6423SLionel Sambuc /*9e*/	{ "setle", TRUE,  NONE,  op1(Eb),     0 },
250*433d6423SLionel Sambuc /*9f*/	{ "setnle",TRUE,  NONE,  op1(Eb),     0 },
251*433d6423SLionel Sambuc };
252*433d6423SLionel Sambuc 
253*433d6423SLionel Sambuc static const struct inst db_inst_0fax[] = {
254*433d6423SLionel Sambuc /*a0*/	{ "push",  FALSE, NONE,  op1(Si),     0 },
255*433d6423SLionel Sambuc /*a1*/	{ "pop",   FALSE, NONE,  op1(Si),     0 },
256*433d6423SLionel Sambuc /*a2*/	{ "cpuid", FALSE, NONE,  0,	      0 },
257*433d6423SLionel Sambuc /*a3*/	{ "bt",    TRUE,  LONG,  op2(R,E),    0 },
258*433d6423SLionel Sambuc /*a4*/	{ "shld",  TRUE,  LONG,  op3(Ib,R,E), 0 },
259*433d6423SLionel Sambuc /*a5*/	{ "shld",  TRUE,  LONG,  op3(CL,R,E), 0 },
260*433d6423SLionel Sambuc /*a6*/	{ "",      FALSE, NONE,  0,	      0 },
261*433d6423SLionel Sambuc /*a7*/	{ "",      FALSE, NONE,  0,	      0 },
262*433d6423SLionel Sambuc 
263*433d6423SLionel Sambuc /*a8*/	{ "push",  FALSE, NONE,  op1(Si),     0 },
264*433d6423SLionel Sambuc /*a9*/	{ "pop",   FALSE, NONE,  op1(Si),     0 },
265*433d6423SLionel Sambuc /*aa*/	{ "rsm",   FALSE, NONE,  0,	      0 },
266*433d6423SLionel Sambuc /*ab*/	{ "bts",   TRUE,  LONG,  op2(R,E),    0 },
267*433d6423SLionel Sambuc /*ac*/	{ "shrd",  TRUE,  LONG,  op3(Ib,R,E), 0 },
268*433d6423SLionel Sambuc /*ad*/	{ "shrd",  TRUE,  LONG,  op3(CL,R,E), 0 },
269*433d6423SLionel Sambuc /*a6*/	{ "",      FALSE, NONE,  0,	      0 },
270*433d6423SLionel Sambuc /*a7*/	{ "imul",  TRUE,  LONG,  op2(E,R),    0 },
271*433d6423SLionel Sambuc };
272*433d6423SLionel Sambuc 
273*433d6423SLionel Sambuc static const struct inst db_inst_0fbx[] = {
274*433d6423SLionel Sambuc /*b0*/	{ "cmpxchg",TRUE, BYTE,	 op2(R, E),   0 },
275*433d6423SLionel Sambuc /*b0*/	{ "cmpxchg",TRUE, LONG,	 op2(R, E),   0 },
276*433d6423SLionel Sambuc /*b2*/	{ "lss",   TRUE,  LONG,  op2(E, R),   0 },
277*433d6423SLionel Sambuc /*b3*/	{ "btr",   TRUE,  LONG,  op2(R, E),   0 },
278*433d6423SLionel Sambuc /*b4*/	{ "lfs",   TRUE,  LONG,  op2(E, R),   0 },
279*433d6423SLionel Sambuc /*b5*/	{ "lgs",   TRUE,  LONG,  op2(E, R),   0 },
280*433d6423SLionel Sambuc /*b6*/	{ "movzb", TRUE,  LONG,  op2(Eb, R),  0 },
281*433d6423SLionel Sambuc /*b7*/	{ "movzw", TRUE,  LONG,  op2(Ew, R),  0 },
282*433d6423SLionel Sambuc 
283*433d6423SLionel Sambuc /*b8*/	{ "",      FALSE, NONE,  0,	      0 },
284*433d6423SLionel Sambuc /*b9*/	{ "",      FALSE, NONE,  0,	      0 },
285*433d6423SLionel Sambuc /*ba*/	{ "",      TRUE,  LONG,  op2(Ib, E),  db_Grp8 },
286*433d6423SLionel Sambuc /*bb*/	{ "btc",   TRUE,  LONG,  op2(R, E),   0 },
287*433d6423SLionel Sambuc /*bc*/	{ "bsf",   TRUE,  LONG,  op2(E, R),   0 },
288*433d6423SLionel Sambuc /*bd*/	{ "bsr",   TRUE,  LONG,  op2(E, R),   0 },
289*433d6423SLionel Sambuc /*be*/	{ "movsb", TRUE,  LONG,  op2(Eb, R),  0 },
290*433d6423SLionel Sambuc /*bf*/	{ "movsw", TRUE,  LONG,  op2(Ew, R),  0 },
291*433d6423SLionel Sambuc };
292*433d6423SLionel Sambuc 
293*433d6423SLionel Sambuc static const struct inst db_inst_0fcx[] = {
294*433d6423SLionel Sambuc /*c0*/	{ "xadd",  TRUE,  BYTE,	 op2(R, E),   0 },
295*433d6423SLionel Sambuc /*c1*/	{ "xadd",  TRUE,  LONG,	 op2(R, E),   0 },
296*433d6423SLionel Sambuc /*c2*/	{ "",	   FALSE, NONE,	 0,	      0 },
297*433d6423SLionel Sambuc /*c3*/	{ "",	   FALSE, NONE,	 0,	      0 },
298*433d6423SLionel Sambuc /*c4*/	{ "",	   FALSE, NONE,	 0,	      0 },
299*433d6423SLionel Sambuc /*c5*/	{ "",	   FALSE, NONE,	 0,	      0 },
300*433d6423SLionel Sambuc /*c6*/	{ "",	   FALSE, NONE,	 0,	      0 },
301*433d6423SLionel Sambuc /*c7*/	{ "",	   TRUE,  NONE,  op1(E),      db_Grp9 },
302*433d6423SLionel Sambuc /*c8*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
303*433d6423SLionel Sambuc /*c9*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
304*433d6423SLionel Sambuc /*ca*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
305*433d6423SLionel Sambuc /*cb*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
306*433d6423SLionel Sambuc /*cc*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
307*433d6423SLionel Sambuc /*cd*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
308*433d6423SLionel Sambuc /*ce*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
309*433d6423SLionel Sambuc /*cf*/	{ "bswap", FALSE, LONG,  op1(Ril),    0 },
310*433d6423SLionel Sambuc };
311*433d6423SLionel Sambuc 
312*433d6423SLionel Sambuc static const struct inst * const db_inst_0f[] = {
313*433d6423SLionel Sambuc 	db_inst_0f0x,
314*433d6423SLionel Sambuc 	0,
315*433d6423SLionel Sambuc 	db_inst_0f2x,
316*433d6423SLionel Sambuc 	db_inst_0f3x,
317*433d6423SLionel Sambuc 	0,
318*433d6423SLionel Sambuc 	0,
319*433d6423SLionel Sambuc 	0,
320*433d6423SLionel Sambuc 	0,
321*433d6423SLionel Sambuc 	db_inst_0f8x,
322*433d6423SLionel Sambuc 	db_inst_0f9x,
323*433d6423SLionel Sambuc 	db_inst_0fax,
324*433d6423SLionel Sambuc 	db_inst_0fbx,
325*433d6423SLionel Sambuc 	db_inst_0fcx,
326*433d6423SLionel Sambuc 	0,
327*433d6423SLionel Sambuc 	0,
328*433d6423SLionel Sambuc 	0
329*433d6423SLionel Sambuc };
330*433d6423SLionel Sambuc 
331*433d6423SLionel Sambuc static const char * const db_Esc92[] = {
332*433d6423SLionel Sambuc 	"fnop",	"",	"",	"",	"",	"",	"",	""
333*433d6423SLionel Sambuc };
334*433d6423SLionel Sambuc static const char * const db_Esc94[] = {
335*433d6423SLionel Sambuc 	"fchs",	"fabs",	"",	"",	"ftst",	"fxam",	"",	""
336*433d6423SLionel Sambuc };
337*433d6423SLionel Sambuc static const char * const db_Esc95[] = {
338*433d6423SLionel Sambuc 	"fld1",	"fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz",""
339*433d6423SLionel Sambuc };
340*433d6423SLionel Sambuc static const char * const db_Esc96[] = {
341*433d6423SLionel Sambuc 	"f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp",
342*433d6423SLionel Sambuc 	"fincstp"
343*433d6423SLionel Sambuc };
344*433d6423SLionel Sambuc static const char * const db_Esc97[] = {
345*433d6423SLionel Sambuc 	"fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos"
346*433d6423SLionel Sambuc };
347*433d6423SLionel Sambuc 
348*433d6423SLionel Sambuc static const char * const db_Esca5[] = {
349*433d6423SLionel Sambuc 	"",	"fucompp","",	"",	"",	"",	"",	""
350*433d6423SLionel Sambuc };
351*433d6423SLionel Sambuc 
352*433d6423SLionel Sambuc static const char * const db_Escb4[] = {
353*433d6423SLionel Sambuc 	"fneni","fndisi",	"fnclex","fninit","fsetpm",	"",	"",	""
354*433d6423SLionel Sambuc };
355*433d6423SLionel Sambuc 
356*433d6423SLionel Sambuc static const char * const db_Esce3[] = {
357*433d6423SLionel Sambuc 	"",	"fcompp","",	"",	"",	"",	"",	""
358*433d6423SLionel Sambuc };
359*433d6423SLionel Sambuc 
360*433d6423SLionel Sambuc static const char * const db_Escf4[] = {
361*433d6423SLionel Sambuc 	"fnstsw","",	"",	"",	"",	"",	"",	""
362*433d6423SLionel Sambuc };
363*433d6423SLionel Sambuc 
364*433d6423SLionel Sambuc static const struct finst db_Esc8[] = {
365*433d6423SLionel Sambuc /*0*/	{ "fadd",   SNGL,  op2(STI,ST),	0 },
366*433d6423SLionel Sambuc /*1*/	{ "fmul",   SNGL,  op2(STI,ST),	0 },
367*433d6423SLionel Sambuc /*2*/	{ "fcom",   SNGL,  op2(STI,ST),	0 },
368*433d6423SLionel Sambuc /*3*/	{ "fcomp",  SNGL,  op2(STI,ST),	0 },
369*433d6423SLionel Sambuc /*4*/	{ "fsub",   SNGL,  op2(STI,ST),	0 },
370*433d6423SLionel Sambuc /*5*/	{ "fsubr",  SNGL,  op2(STI,ST),	0 },
371*433d6423SLionel Sambuc /*6*/	{ "fdiv",   SNGL,  op2(STI,ST),	0 },
372*433d6423SLionel Sambuc /*7*/	{ "fdivr",  SNGL,  op2(STI,ST),	0 },
373*433d6423SLionel Sambuc };
374*433d6423SLionel Sambuc 
375*433d6423SLionel Sambuc static const struct finst db_Esc9[] = {
376*433d6423SLionel Sambuc /*0*/	{ "fld",    SNGL,  op1(STI),	0 },
377*433d6423SLionel Sambuc /*1*/	{ "",       NONE,  op1(STI),	"fxch" },
378*433d6423SLionel Sambuc /*2*/	{ "fst",    SNGL,  op1(X),	db_Esc92 },
379*433d6423SLionel Sambuc /*3*/	{ "fstp",   SNGL,  0,		0 },
380*433d6423SLionel Sambuc /*4*/	{ "fldenv", NONE,  op1(X),	db_Esc94 },
381*433d6423SLionel Sambuc /*5*/	{ "fldcw",  NONE,  op1(X),	db_Esc95 },
382*433d6423SLionel Sambuc /*6*/	{ "fnstenv",NONE,  op1(X),	db_Esc96 },
383*433d6423SLionel Sambuc /*7*/	{ "fnstcw", NONE,  op1(X),	db_Esc97 },
384*433d6423SLionel Sambuc };
385*433d6423SLionel Sambuc 
386*433d6423SLionel Sambuc static const struct finst db_Esca[] = {
387*433d6423SLionel Sambuc /*0*/	{ "fiadd",  LONG,  0,		0 },
388*433d6423SLionel Sambuc /*1*/	{ "fimul",  LONG,  0,		0 },
389*433d6423SLionel Sambuc /*2*/	{ "ficom",  LONG,  0,		0 },
390*433d6423SLionel Sambuc /*3*/	{ "ficomp", LONG,  0,		0 },
391*433d6423SLionel Sambuc /*4*/	{ "fisub",  LONG,  0,		0 },
392*433d6423SLionel Sambuc /*5*/	{ "fisubr", LONG,  op1(X),	db_Esca5 },
393*433d6423SLionel Sambuc /*6*/	{ "fidiv",  LONG,  0,		0 },
394*433d6423SLionel Sambuc /*7*/	{ "fidivr", LONG,  0,		0 }
395*433d6423SLionel Sambuc };
396*433d6423SLionel Sambuc 
397*433d6423SLionel Sambuc static const struct finst db_Escb[] = {
398*433d6423SLionel Sambuc /*0*/	{ "fild",   LONG,  0,		0 },
399*433d6423SLionel Sambuc /*1*/	{ "",       NONE,  0,		0 },
400*433d6423SLionel Sambuc /*2*/	{ "fist",   LONG,  0,		0 },
401*433d6423SLionel Sambuc /*3*/	{ "fistp",  LONG,  0,		0 },
402*433d6423SLionel Sambuc /*4*/	{ "",       WORD,  op1(X),	db_Escb4 },
403*433d6423SLionel Sambuc /*5*/	{ "fld",    EXTR,  0,		0 },
404*433d6423SLionel Sambuc /*6*/	{ "",       WORD,  0,		0 },
405*433d6423SLionel Sambuc /*7*/	{ "fstp",   EXTR,  0,		0 },
406*433d6423SLionel Sambuc };
407*433d6423SLionel Sambuc 
408*433d6423SLionel Sambuc static const struct finst db_Escc[] = {
409*433d6423SLionel Sambuc /*0*/	{ "fadd",   DBLR,  op2(ST,STI),	0 },
410*433d6423SLionel Sambuc /*1*/	{ "fmul",   DBLR,  op2(ST,STI),	0 },
411*433d6423SLionel Sambuc /*2*/	{ "fcom",   DBLR,  0,		0 },
412*433d6423SLionel Sambuc /*3*/	{ "fcomp",  DBLR,  0,		0 },
413*433d6423SLionel Sambuc /*4*/	{ "fsub",   DBLR,  op2(ST,STI),	"fsubr" },
414*433d6423SLionel Sambuc /*5*/	{ "fsubr",  DBLR,  op2(ST,STI),	"fsub" },
415*433d6423SLionel Sambuc /*6*/	{ "fdiv",   DBLR,  op2(ST,STI),	"fdivr" },
416*433d6423SLionel Sambuc /*7*/	{ "fdivr",  DBLR,  op2(ST,STI),	"fdiv" },
417*433d6423SLionel Sambuc };
418*433d6423SLionel Sambuc 
419*433d6423SLionel Sambuc static const struct finst db_Escd[] = {
420*433d6423SLionel Sambuc /*0*/	{ "fld",    DBLR,  op1(STI),	"ffree" },
421*433d6423SLionel Sambuc /*1*/	{ "",       NONE,  0,		0 },
422*433d6423SLionel Sambuc /*2*/	{ "fst",    DBLR,  op1(STI),	0 },
423*433d6423SLionel Sambuc /*3*/	{ "fstp",   DBLR,  op1(STI),	0 },
424*433d6423SLionel Sambuc /*4*/	{ "frstor", NONE,  op1(STI),	"fucom" },
425*433d6423SLionel Sambuc /*5*/	{ "",       NONE,  op1(STI),	"fucomp" },
426*433d6423SLionel Sambuc /*6*/	{ "fnsave", NONE,  0,		0 },
427*433d6423SLionel Sambuc /*7*/	{ "fnstsw", NONE,  0,		0 },
428*433d6423SLionel Sambuc };
429*433d6423SLionel Sambuc 
430*433d6423SLionel Sambuc static const struct finst db_Esce[] = {
431*433d6423SLionel Sambuc /*0*/	{ "fiadd",  WORD,  op2(ST,STI),	"faddp" },
432*433d6423SLionel Sambuc /*1*/	{ "fimul",  WORD,  op2(ST,STI),	"fmulp" },
433*433d6423SLionel Sambuc /*2*/	{ "ficom",  WORD,  0,		0 },
434*433d6423SLionel Sambuc /*3*/	{ "ficomp", WORD,  op1(X),	db_Esce3 },
435*433d6423SLionel Sambuc /*4*/	{ "fisub",  WORD,  op2(ST,STI),	"fsubrp" },
436*433d6423SLionel Sambuc /*5*/	{ "fisubr", WORD,  op2(ST,STI),	"fsubp" },
437*433d6423SLionel Sambuc /*6*/	{ "fidiv",  WORD,  op2(ST,STI),	"fdivrp" },
438*433d6423SLionel Sambuc /*7*/	{ "fidivr", WORD,  op2(ST,STI),	"fdivp" },
439*433d6423SLionel Sambuc };
440*433d6423SLionel Sambuc 
441*433d6423SLionel Sambuc static const struct finst db_Escf[] = {
442*433d6423SLionel Sambuc /*0*/	{ "fild",   WORD,  0,		0 },
443*433d6423SLionel Sambuc /*1*/	{ "",       NONE,  0,		0 },
444*433d6423SLionel Sambuc /*2*/	{ "fist",   WORD,  0,		0 },
445*433d6423SLionel Sambuc /*3*/	{ "fistp",  WORD,  0,		0 },
446*433d6423SLionel Sambuc /*4*/	{ "fbld",   NONE,  op1(XA),	db_Escf4 },
447*433d6423SLionel Sambuc /*5*/	{ "fild",   QUAD,  0,		0 },
448*433d6423SLionel Sambuc /*6*/	{ "fbstp",  NONE,  0,		0 },
449*433d6423SLionel Sambuc /*7*/	{ "fistp",  QUAD,  0,		0 },
450*433d6423SLionel Sambuc };
451*433d6423SLionel Sambuc 
452*433d6423SLionel Sambuc static const struct finst * const db_Esc_inst[] = {
453*433d6423SLionel Sambuc 	db_Esc8, db_Esc9, db_Esca, db_Escb,
454*433d6423SLionel Sambuc 	db_Escc, db_Escd, db_Esce, db_Escf
455*433d6423SLionel Sambuc };
456*433d6423SLionel Sambuc 
457*433d6423SLionel Sambuc static const char * const db_Grp1[] = {
458*433d6423SLionel Sambuc 	"add",
459*433d6423SLionel Sambuc 	"or",
460*433d6423SLionel Sambuc 	"adc",
461*433d6423SLionel Sambuc 	"sbb",
462*433d6423SLionel Sambuc 	"and",
463*433d6423SLionel Sambuc 	"sub",
464*433d6423SLionel Sambuc 	"xor",
465*433d6423SLionel Sambuc 	"cmp"
466*433d6423SLionel Sambuc };
467*433d6423SLionel Sambuc 
468*433d6423SLionel Sambuc static const char * const db_Grp2[] = {
469*433d6423SLionel Sambuc 	"rol",
470*433d6423SLionel Sambuc 	"ror",
471*433d6423SLionel Sambuc 	"rcl",
472*433d6423SLionel Sambuc 	"rcr",
473*433d6423SLionel Sambuc 	"shl",
474*433d6423SLionel Sambuc 	"shr",
475*433d6423SLionel Sambuc 	"shl",
476*433d6423SLionel Sambuc 	"sar"
477*433d6423SLionel Sambuc };
478*433d6423SLionel Sambuc 
479*433d6423SLionel Sambuc static const struct inst db_Grp3[] = {
480*433d6423SLionel Sambuc 	{ "test",  TRUE, NONE, op2(I,E), 0 },
481*433d6423SLionel Sambuc 	{ "test",  TRUE, NONE, op2(I,E), 0 },
482*433d6423SLionel Sambuc 	{ "not",   TRUE, NONE, op1(E),   0 },
483*433d6423SLionel Sambuc 	{ "neg",   TRUE, NONE, op1(E),   0 },
484*433d6423SLionel Sambuc 	{ "mul",   TRUE, NONE, op2(E,A), 0 },
485*433d6423SLionel Sambuc 	{ "imul",  TRUE, NONE, op2(E,A), 0 },
486*433d6423SLionel Sambuc 	{ "div",   TRUE, NONE, op2(E,A), 0 },
487*433d6423SLionel Sambuc 	{ "idiv",  TRUE, NONE, op2(E,A), 0 },
488*433d6423SLionel Sambuc };
489*433d6423SLionel Sambuc 
490*433d6423SLionel Sambuc static const struct inst db_Grp4[] = {
491*433d6423SLionel Sambuc 	{ "inc",   TRUE, BYTE, op1(E),   0 },
492*433d6423SLionel Sambuc 	{ "dec",   TRUE, BYTE, op1(E),   0 },
493*433d6423SLionel Sambuc 	{ "",      TRUE, NONE, 0,	 0 },
494*433d6423SLionel Sambuc 	{ "",      TRUE, NONE, 0,	 0 },
495*433d6423SLionel Sambuc 	{ "",      TRUE, NONE, 0,	 0 },
496*433d6423SLionel Sambuc 	{ "",      TRUE, NONE, 0,	 0 },
497*433d6423SLionel Sambuc 	{ "",      TRUE, NONE, 0,	 0 },
498*433d6423SLionel Sambuc 	{ "",      TRUE, NONE, 0,	 0 }
499*433d6423SLionel Sambuc };
500*433d6423SLionel Sambuc 
501*433d6423SLionel Sambuc static const struct inst db_Grp5[] = {
502*433d6423SLionel Sambuc 	{ "inc",   TRUE, LONG, op1(E),   0 },
503*433d6423SLionel Sambuc 	{ "dec",   TRUE, LONG, op1(E),   0 },
504*433d6423SLionel Sambuc 	{ "call",  TRUE, LONG, op1(Eind),0 },
505*433d6423SLionel Sambuc 	{ "lcall", TRUE, LONG, op1(Eind),0 },
506*433d6423SLionel Sambuc 	{ "jmp",   TRUE, LONG, op1(Eind),0 },
507*433d6423SLionel Sambuc 	{ "ljmp",  TRUE, LONG, op1(Eind),0 },
508*433d6423SLionel Sambuc 	{ "push",  TRUE, LONG, op1(E),   0 },
509*433d6423SLionel Sambuc 	{ "",      TRUE, NONE, 0,	 0 }
510*433d6423SLionel Sambuc };
511*433d6423SLionel Sambuc 
512*433d6423SLionel Sambuc static const struct inst db_inst_table[256] = {
513*433d6423SLionel Sambuc /*00*/	{ "add",   TRUE,  BYTE,  op2(R, E),  0 },
514*433d6423SLionel Sambuc /*01*/	{ "add",   TRUE,  LONG,  op2(R, E),  0 },
515*433d6423SLionel Sambuc /*02*/	{ "add",   TRUE,  BYTE,  op2(E, R),  0 },
516*433d6423SLionel Sambuc /*03*/	{ "add",   TRUE,  LONG,  op2(E, R),  0 },
517*433d6423SLionel Sambuc /*04*/	{ "add",   FALSE, BYTE,  op2(I, A),  0 },
518*433d6423SLionel Sambuc /*05*/	{ "add",   FALSE, LONG,  op2(Is, A), 0 },
519*433d6423SLionel Sambuc /*06*/	{ "push",  FALSE, NONE,  op1(Si),    0 },
520*433d6423SLionel Sambuc /*07*/	{ "pop",   FALSE, NONE,  op1(Si),    0 },
521*433d6423SLionel Sambuc 
522*433d6423SLionel Sambuc /*08*/	{ "or",    TRUE,  BYTE,  op2(R, E),  0 },
523*433d6423SLionel Sambuc /*09*/	{ "or",    TRUE,  LONG,  op2(R, E),  0 },
524*433d6423SLionel Sambuc /*0a*/	{ "or",    TRUE,  BYTE,  op2(E, R),  0 },
525*433d6423SLionel Sambuc /*0b*/	{ "or",    TRUE,  LONG,  op2(E, R),  0 },
526*433d6423SLionel Sambuc /*0c*/	{ "or",    FALSE, BYTE,  op2(I, A),  0 },
527*433d6423SLionel Sambuc /*0d*/	{ "or",    FALSE, LONG,  op2(I, A),  0 },
528*433d6423SLionel Sambuc /*0e*/	{ "push",  FALSE, NONE,  op1(Si),    0 },
529*433d6423SLionel Sambuc /*0f*/	{ "",      FALSE, NONE,  0,	     0 },
530*433d6423SLionel Sambuc 
531*433d6423SLionel Sambuc /*10*/	{ "adc",   TRUE,  BYTE,  op2(R, E),  0 },
532*433d6423SLionel Sambuc /*11*/	{ "adc",   TRUE,  LONG,  op2(R, E),  0 },
533*433d6423SLionel Sambuc /*12*/	{ "adc",   TRUE,  BYTE,  op2(E, R),  0 },
534*433d6423SLionel Sambuc /*13*/	{ "adc",   TRUE,  LONG,  op2(E, R),  0 },
535*433d6423SLionel Sambuc /*14*/	{ "adc",   FALSE, BYTE,  op2(I, A),  0 },
536*433d6423SLionel Sambuc /*15*/	{ "adc",   FALSE, LONG,  op2(Is, A), 0 },
537*433d6423SLionel Sambuc /*16*/	{ "push",  FALSE, NONE,  op1(Si),    0 },
538*433d6423SLionel Sambuc /*17*/	{ "pop",   FALSE, NONE,  op1(Si),    0 },
539*433d6423SLionel Sambuc 
540*433d6423SLionel Sambuc /*18*/	{ "sbb",   TRUE,  BYTE,  op2(R, E),  0 },
541*433d6423SLionel Sambuc /*19*/	{ "sbb",   TRUE,  LONG,  op2(R, E),  0 },
542*433d6423SLionel Sambuc /*1a*/	{ "sbb",   TRUE,  BYTE,  op2(E, R),  0 },
543*433d6423SLionel Sambuc /*1b*/	{ "sbb",   TRUE,  LONG,  op2(E, R),  0 },
544*433d6423SLionel Sambuc /*1c*/	{ "sbb",   FALSE, BYTE,  op2(I, A),  0 },
545*433d6423SLionel Sambuc /*1d*/	{ "sbb",   FALSE, LONG,  op2(Is, A), 0 },
546*433d6423SLionel Sambuc /*1e*/	{ "push",  FALSE, NONE,  op1(Si),    0 },
547*433d6423SLionel Sambuc /*1f*/	{ "pop",   FALSE, NONE,  op1(Si),    0 },
548*433d6423SLionel Sambuc 
549*433d6423SLionel Sambuc /*20*/	{ "and",   TRUE,  BYTE,  op2(R, E),  0 },
550*433d6423SLionel Sambuc /*21*/	{ "and",   TRUE,  LONG,  op2(R, E),  0 },
551*433d6423SLionel Sambuc /*22*/	{ "and",   TRUE,  BYTE,  op2(E, R),  0 },
552*433d6423SLionel Sambuc /*23*/	{ "and",   TRUE,  LONG,  op2(E, R),  0 },
553*433d6423SLionel Sambuc /*24*/	{ "and",   FALSE, BYTE,  op2(I, A),  0 },
554*433d6423SLionel Sambuc /*25*/	{ "and",   FALSE, LONG,  op2(I, A),  0 },
555*433d6423SLionel Sambuc /*26*/	{ "",      FALSE, NONE,  0,	     0 },
556*433d6423SLionel Sambuc /*27*/	{ "daa",   FALSE, NONE,  0,	     0 },
557*433d6423SLionel Sambuc 
558*433d6423SLionel Sambuc /*28*/	{ "sub",   TRUE,  BYTE,  op2(R, E),  0 },
559*433d6423SLionel Sambuc /*29*/	{ "sub",   TRUE,  LONG,  op2(R, E),  0 },
560*433d6423SLionel Sambuc /*2a*/	{ "sub",   TRUE,  BYTE,  op2(E, R),  0 },
561*433d6423SLionel Sambuc /*2b*/	{ "sub",   TRUE,  LONG,  op2(E, R),  0 },
562*433d6423SLionel Sambuc /*2c*/	{ "sub",   FALSE, BYTE,  op2(I, A),  0 },
563*433d6423SLionel Sambuc /*2d*/	{ "sub",   FALSE, LONG,  op2(Is, A), 0 },
564*433d6423SLionel Sambuc /*2e*/	{ "",      FALSE, NONE,  0,	     0 },
565*433d6423SLionel Sambuc /*2f*/	{ "das",   FALSE, NONE,  0,	     0 },
566*433d6423SLionel Sambuc 
567*433d6423SLionel Sambuc /*30*/	{ "xor",   TRUE,  BYTE,  op2(R, E),  0 },
568*433d6423SLionel Sambuc /*31*/	{ "xor",   TRUE,  LONG,  op2(R, E),  0 },
569*433d6423SLionel Sambuc /*32*/	{ "xor",   TRUE,  BYTE,  op2(E, R),  0 },
570*433d6423SLionel Sambuc /*33*/	{ "xor",   TRUE,  LONG,  op2(E, R),  0 },
571*433d6423SLionel Sambuc /*34*/	{ "xor",   FALSE, BYTE,  op2(I, A),  0 },
572*433d6423SLionel Sambuc /*35*/	{ "xor",   FALSE, LONG,  op2(I, A),  0 },
573*433d6423SLionel Sambuc /*36*/	{ "",      FALSE, NONE,  0,	     0 },
574*433d6423SLionel Sambuc /*37*/	{ "aaa",   FALSE, NONE,  0,	     0 },
575*433d6423SLionel Sambuc 
576*433d6423SLionel Sambuc /*38*/	{ "cmp",   TRUE,  BYTE,  op2(R, E),  0 },
577*433d6423SLionel Sambuc /*39*/	{ "cmp",   TRUE,  LONG,  op2(R, E),  0 },
578*433d6423SLionel Sambuc /*3a*/	{ "cmp",   TRUE,  BYTE,  op2(E, R),  0 },
579*433d6423SLionel Sambuc /*3b*/	{ "cmp",   TRUE,  LONG,  op2(E, R),  0 },
580*433d6423SLionel Sambuc /*3c*/	{ "cmp",   FALSE, BYTE,  op2(I, A),  0 },
581*433d6423SLionel Sambuc /*3d*/	{ "cmp",   FALSE, LONG,  op2(Is, A), 0 },
582*433d6423SLionel Sambuc /*3e*/	{ "",      FALSE, NONE,  0,	     0 },
583*433d6423SLionel Sambuc /*3f*/	{ "aas",   FALSE, NONE,  0,	     0 },
584*433d6423SLionel Sambuc 
585*433d6423SLionel Sambuc /*40*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
586*433d6423SLionel Sambuc /*41*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
587*433d6423SLionel Sambuc /*42*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
588*433d6423SLionel Sambuc /*43*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
589*433d6423SLionel Sambuc /*44*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
590*433d6423SLionel Sambuc /*45*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
591*433d6423SLionel Sambuc /*46*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
592*433d6423SLionel Sambuc /*47*/	{ "inc",   FALSE, LONG,  op1(Ri),    0 },
593*433d6423SLionel Sambuc 
594*433d6423SLionel Sambuc /*48*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
595*433d6423SLionel Sambuc /*49*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
596*433d6423SLionel Sambuc /*4a*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
597*433d6423SLionel Sambuc /*4b*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
598*433d6423SLionel Sambuc /*4c*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
599*433d6423SLionel Sambuc /*4d*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
600*433d6423SLionel Sambuc /*4e*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
601*433d6423SLionel Sambuc /*4f*/	{ "dec",   FALSE, LONG,  op1(Ri),    0 },
602*433d6423SLionel Sambuc 
603*433d6423SLionel Sambuc /*50*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
604*433d6423SLionel Sambuc /*51*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
605*433d6423SLionel Sambuc /*52*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
606*433d6423SLionel Sambuc /*53*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
607*433d6423SLionel Sambuc /*54*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
608*433d6423SLionel Sambuc /*55*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
609*433d6423SLionel Sambuc /*56*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
610*433d6423SLionel Sambuc /*57*/	{ "push",  FALSE, LONG,  op1(Ri),    0 },
611*433d6423SLionel Sambuc 
612*433d6423SLionel Sambuc /*58*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
613*433d6423SLionel Sambuc /*59*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
614*433d6423SLionel Sambuc /*5a*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
615*433d6423SLionel Sambuc /*5b*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
616*433d6423SLionel Sambuc /*5c*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
617*433d6423SLionel Sambuc /*5d*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
618*433d6423SLionel Sambuc /*5e*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
619*433d6423SLionel Sambuc /*5f*/	{ "pop",   FALSE, LONG,  op1(Ri),    0 },
620*433d6423SLionel Sambuc 
621*433d6423SLionel Sambuc /*60*/	{ "pusha", FALSE, LONG,  0,	     0 },
622*433d6423SLionel Sambuc /*61*/	{ "popa",  FALSE, LONG,  0,	     0 },
623*433d6423SLionel Sambuc /*62*/  { "bound", TRUE,  LONG,  op2(E, R),  0 },
624*433d6423SLionel Sambuc /*63*/	{ "arpl",  TRUE,  NONE,  op2(Rw,Ew), 0 },
625*433d6423SLionel Sambuc 
626*433d6423SLionel Sambuc /*64*/	{ "",      FALSE, NONE,  0,	     0 },
627*433d6423SLionel Sambuc /*65*/	{ "",      FALSE, NONE,  0,	     0 },
628*433d6423SLionel Sambuc /*66*/	{ "",      FALSE, NONE,  0,	     0 },
629*433d6423SLionel Sambuc /*67*/	{ "",      FALSE, NONE,  0,	     0 },
630*433d6423SLionel Sambuc 
631*433d6423SLionel Sambuc /*68*/	{ "push",  FALSE, LONG,  op1(I),     0 },
632*433d6423SLionel Sambuc /*69*/  { "imul",  TRUE,  LONG,  op3(I,E,R), 0 },
633*433d6423SLionel Sambuc /*6a*/	{ "push",  FALSE, LONG,  op1(Ibs),   0 },
634*433d6423SLionel Sambuc /*6b*/  { "imul",  TRUE,  LONG,  op3(Ibs,E,R),0 },
635*433d6423SLionel Sambuc /*6c*/	{ "ins",   FALSE, BYTE,  op2(DX, DI), 0 },
636*433d6423SLionel Sambuc /*6d*/	{ "ins",   FALSE, LONG,  op2(DX, DI), 0 },
637*433d6423SLionel Sambuc /*6e*/	{ "outs",  FALSE, BYTE,  op2(SI, DX), 0 },
638*433d6423SLionel Sambuc /*6f*/	{ "outs",  FALSE, LONG,  op2(SI, DX), 0 },
639*433d6423SLionel Sambuc 
640*433d6423SLionel Sambuc /*70*/	{ "jo",    FALSE, NONE,  op1(Db),     0 },
641*433d6423SLionel Sambuc /*71*/	{ "jno",   FALSE, NONE,  op1(Db),     0 },
642*433d6423SLionel Sambuc /*72*/	{ "jb",    FALSE, NONE,  op1(Db),     0 },
643*433d6423SLionel Sambuc /*73*/	{ "jnb",   FALSE, NONE,  op1(Db),     0 },
644*433d6423SLionel Sambuc /*74*/	{ "jz",    FALSE, NONE,  op1(Db),     0 },
645*433d6423SLionel Sambuc /*75*/	{ "jnz",   FALSE, NONE,  op1(Db),     0 },
646*433d6423SLionel Sambuc /*76*/	{ "jbe",   FALSE, NONE,  op1(Db),     0 },
647*433d6423SLionel Sambuc /*77*/	{ "jnbe",  FALSE, NONE,  op1(Db),     0 },
648*433d6423SLionel Sambuc 
649*433d6423SLionel Sambuc /*78*/	{ "js",    FALSE, NONE,  op1(Db),     0 },
650*433d6423SLionel Sambuc /*79*/	{ "jns",   FALSE, NONE,  op1(Db),     0 },
651*433d6423SLionel Sambuc /*7a*/	{ "jp",    FALSE, NONE,  op1(Db),     0 },
652*433d6423SLionel Sambuc /*7b*/	{ "jnp",   FALSE, NONE,  op1(Db),     0 },
653*433d6423SLionel Sambuc /*7c*/	{ "jl",    FALSE, NONE,  op1(Db),     0 },
654*433d6423SLionel Sambuc /*7d*/	{ "jnl",   FALSE, NONE,  op1(Db),     0 },
655*433d6423SLionel Sambuc /*7e*/	{ "jle",   FALSE, NONE,  op1(Db),     0 },
656*433d6423SLionel Sambuc /*7f*/	{ "jnle",  FALSE, NONE,  op1(Db),     0 },
657*433d6423SLionel Sambuc 
658*433d6423SLionel Sambuc /*80*/  { "",	   TRUE,  BYTE,  op2(I, E),   db_Grp1 },
659*433d6423SLionel Sambuc /*81*/  { "",	   TRUE,  LONG,  op2(I, E),   db_Grp1 },
660*433d6423SLionel Sambuc /*82*/  { "",	   TRUE,  BYTE,  op2(I, E),   db_Grp1 },
661*433d6423SLionel Sambuc /*83*/  { "",	   TRUE,  LONG,  op2(Ibs,E),  db_Grp1 },
662*433d6423SLionel Sambuc /*84*/	{ "test",  TRUE,  BYTE,  op2(R, E),   0 },
663*433d6423SLionel Sambuc /*85*/	{ "test",  TRUE,  LONG,  op2(R, E),   0 },
664*433d6423SLionel Sambuc /*86*/	{ "xchg",  TRUE,  BYTE,  op2(R, E),   0 },
665*433d6423SLionel Sambuc /*87*/	{ "xchg",  TRUE,  LONG,  op2(R, E),   0 },
666*433d6423SLionel Sambuc 
667*433d6423SLionel Sambuc /*88*/	{ "mov",   TRUE,  BYTE,  op2(R, E),   0 },
668*433d6423SLionel Sambuc /*89*/	{ "mov",   TRUE,  LONG,  op2(R, E),   0 },
669*433d6423SLionel Sambuc /*8a*/	{ "mov",   TRUE,  BYTE,  op2(E, R),   0 },
670*433d6423SLionel Sambuc /*8b*/	{ "mov",   TRUE,  LONG,  op2(E, R),   0 },
671*433d6423SLionel Sambuc /*8c*/  { "mov",   TRUE,  NONE,  op2(S, Ew),  0 },
672*433d6423SLionel Sambuc /*8d*/	{ "lea",   TRUE,  LONG,  op2(E, R),   0 },
673*433d6423SLionel Sambuc /*8e*/	{ "mov",   TRUE,  NONE,  op2(Ew, S),  0 },
674*433d6423SLionel Sambuc /*8f*/	{ "pop",   TRUE,  LONG,  op1(E),      0 },
675*433d6423SLionel Sambuc 
676*433d6423SLionel Sambuc /*90*/	{ "nop",   FALSE, NONE,  0,	      0 },
677*433d6423SLionel Sambuc /*91*/	{ "xchg",  FALSE, LONG,  op2(A, Ri),  0 },
678*433d6423SLionel Sambuc /*92*/	{ "xchg",  FALSE, LONG,  op2(A, Ri),  0 },
679*433d6423SLionel Sambuc /*93*/	{ "xchg",  FALSE, LONG,  op2(A, Ri),  0 },
680*433d6423SLionel Sambuc /*94*/	{ "xchg",  FALSE, LONG,  op2(A, Ri),  0 },
681*433d6423SLionel Sambuc /*95*/	{ "xchg",  FALSE, LONG,  op2(A, Ri),  0 },
682*433d6423SLionel Sambuc /*96*/	{ "xchg",  FALSE, LONG,  op2(A, Ri),  0 },
683*433d6423SLionel Sambuc /*97*/	{ "xchg",  FALSE, LONG,  op2(A, Ri),  0 },
684*433d6423SLionel Sambuc 
685*433d6423SLionel Sambuc /*98*/	{ "cbw",   FALSE, SDEP,  0,	      "cwde" },	/* cbw/cwde */
686*433d6423SLionel Sambuc /*99*/	{ "cwd",   FALSE, SDEP,  0,	      "cdq"  },	/* cwd/cdq */
687*433d6423SLionel Sambuc /*9a*/	{ "lcall", FALSE, NONE,  op1(OS),     0 },
688*433d6423SLionel Sambuc /*9b*/	{ "wait",  FALSE, NONE,  0,	      0 },
689*433d6423SLionel Sambuc /*9c*/	{ "pushf", FALSE, LONG,  0,	      0 },
690*433d6423SLionel Sambuc /*9d*/	{ "popf",  FALSE, LONG,  0,	      0 },
691*433d6423SLionel Sambuc /*9e*/	{ "sahf",  FALSE, NONE,  0,	      0 },
692*433d6423SLionel Sambuc /*9f*/	{ "lahf",  FALSE, NONE,  0,	      0 },
693*433d6423SLionel Sambuc 
694*433d6423SLionel Sambuc /*a0*/	{ "mov",   FALSE, BYTE,  op2(O, A),   0 },
695*433d6423SLionel Sambuc /*a1*/	{ "mov",   FALSE, LONG,  op2(O, A),   0 },
696*433d6423SLionel Sambuc /*a2*/	{ "mov",   FALSE, BYTE,  op2(A, O),   0 },
697*433d6423SLionel Sambuc /*a3*/	{ "mov",   FALSE, LONG,  op2(A, O),   0 },
698*433d6423SLionel Sambuc /*a4*/	{ "movs",  FALSE, BYTE,  op2(SI,DI),  0 },
699*433d6423SLionel Sambuc /*a5*/	{ "movs",  FALSE, LONG,  op2(SI,DI),  0 },
700*433d6423SLionel Sambuc /*a6*/	{ "cmps",  FALSE, BYTE,  op2(SI,DI),  0 },
701*433d6423SLionel Sambuc /*a7*/	{ "cmps",  FALSE, LONG,  op2(SI,DI),  0 },
702*433d6423SLionel Sambuc 
703*433d6423SLionel Sambuc /*a8*/	{ "test",  FALSE, BYTE,  op2(I, A),   0 },
704*433d6423SLionel Sambuc /*a9*/	{ "test",  FALSE, LONG,  op2(I, A),   0 },
705*433d6423SLionel Sambuc /*aa*/	{ "stos",  FALSE, BYTE,  op1(DI),     0 },
706*433d6423SLionel Sambuc /*ab*/	{ "stos",  FALSE, LONG,  op1(DI),     0 },
707*433d6423SLionel Sambuc /*ac*/	{ "lods",  FALSE, BYTE,  op1(SI),     0 },
708*433d6423SLionel Sambuc /*ad*/	{ "lods",  FALSE, LONG,  op1(SI),     0 },
709*433d6423SLionel Sambuc /*ae*/	{ "scas",  FALSE, BYTE,  op1(SI),     0 },
710*433d6423SLionel Sambuc /*af*/	{ "scas",  FALSE, LONG,  op1(SI),     0 },
711*433d6423SLionel Sambuc 
712*433d6423SLionel Sambuc /*b0*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
713*433d6423SLionel Sambuc /*b1*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
714*433d6423SLionel Sambuc /*b2*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
715*433d6423SLionel Sambuc /*b3*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
716*433d6423SLionel Sambuc /*b4*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
717*433d6423SLionel Sambuc /*b5*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
718*433d6423SLionel Sambuc /*b6*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
719*433d6423SLionel Sambuc /*b7*/	{ "mov",   FALSE, BYTE,  op2(I, Ri),  0 },
720*433d6423SLionel Sambuc 
721*433d6423SLionel Sambuc /*b8*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
722*433d6423SLionel Sambuc /*b9*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
723*433d6423SLionel Sambuc /*ba*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
724*433d6423SLionel Sambuc /*bb*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
725*433d6423SLionel Sambuc /*bc*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
726*433d6423SLionel Sambuc /*bd*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
727*433d6423SLionel Sambuc /*be*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
728*433d6423SLionel Sambuc /*bf*/	{ "mov",   FALSE, LONG,  op2(I, Ri),  0 },
729*433d6423SLionel Sambuc 
730*433d6423SLionel Sambuc /*c0*/	{ "",	   TRUE,  BYTE,  op2(Ib, E),  db_Grp2 },
731*433d6423SLionel Sambuc /*c1*/	{ "",	   TRUE,  LONG,  op2(Ib, E),  db_Grp2 },
732*433d6423SLionel Sambuc /*c2*/	{ "ret",   FALSE, NONE,  op1(Iw),     0 },
733*433d6423SLionel Sambuc /*c3*/	{ "ret",   FALSE, NONE,  0,	      0 },
734*433d6423SLionel Sambuc /*c4*/	{ "les",   TRUE,  LONG,  op2(E, R),   0 },
735*433d6423SLionel Sambuc /*c5*/	{ "lds",   TRUE,  LONG,  op2(E, R),   0 },
736*433d6423SLionel Sambuc /*c6*/	{ "mov",   TRUE,  BYTE,  op2(I, E),   0 },
737*433d6423SLionel Sambuc /*c7*/	{ "mov",   TRUE,  LONG,  op2(I, E),   0 },
738*433d6423SLionel Sambuc 
739*433d6423SLionel Sambuc /*c8*/	{ "enter", FALSE, NONE,  op2(Iw, Ib), 0 },
740*433d6423SLionel Sambuc /*c9*/	{ "leave", FALSE, NONE,  0,           0 },
741*433d6423SLionel Sambuc /*ca*/	{ "lret",  FALSE, NONE,  op1(Iw),     0 },
742*433d6423SLionel Sambuc /*cb*/	{ "lret",  FALSE, NONE,  0,	      0 },
743*433d6423SLionel Sambuc /*cc*/	{ "int",   FALSE, NONE,  op1(o3),     0 },
744*433d6423SLionel Sambuc /*cd*/	{ "int",   FALSE, NONE,  op1(Ib),     0 },
745*433d6423SLionel Sambuc /*ce*/	{ "into",  FALSE, NONE,  0,	      0 },
746*433d6423SLionel Sambuc /*cf*/	{ "iret",  FALSE, NONE,  0,	      0 },
747*433d6423SLionel Sambuc 
748*433d6423SLionel Sambuc /*d0*/	{ "",	   TRUE,  BYTE,  op2(o1, E),  db_Grp2 },
749*433d6423SLionel Sambuc /*d1*/	{ "",	   TRUE,  LONG,  op2(o1, E),  db_Grp2 },
750*433d6423SLionel Sambuc /*d2*/	{ "",	   TRUE,  BYTE,  op2(CL, E),  db_Grp2 },
751*433d6423SLionel Sambuc /*d3*/	{ "",	   TRUE,  LONG,  op2(CL, E),  db_Grp2 },
752*433d6423SLionel Sambuc /*d4*/	{ "aam",   FALSE, NONE,  op1(Iba),    0 },
753*433d6423SLionel Sambuc /*d5*/	{ "aad",   FALSE, NONE,  op1(Iba),    0 },
754*433d6423SLionel Sambuc /*d6*/	{ ".byte\t0xd6", FALSE, NONE, 0,      0 },
755*433d6423SLionel Sambuc /*d7*/	{ "xlat",  FALSE, BYTE,  op1(BX),     0 },
756*433d6423SLionel Sambuc 
757*433d6423SLionel Sambuc /*d8*/  { "",      TRUE,  NONE,  0,	      db_Esc8 },
758*433d6423SLionel Sambuc /*d9*/  { "",      TRUE,  NONE,  0,	      db_Esc9 },
759*433d6423SLionel Sambuc /*da*/  { "",      TRUE,  NONE,  0,	      db_Esca },
760*433d6423SLionel Sambuc /*db*/  { "",      TRUE,  NONE,  0,	      db_Escb },
761*433d6423SLionel Sambuc /*dc*/  { "",      TRUE,  NONE,  0,	      db_Escc },
762*433d6423SLionel Sambuc /*dd*/  { "",      TRUE,  NONE,  0,	      db_Escd },
763*433d6423SLionel Sambuc /*de*/  { "",      TRUE,  NONE,  0,	      db_Esce },
764*433d6423SLionel Sambuc /*df*/  { "",      TRUE,  NONE,  0,	      db_Escf },
765*433d6423SLionel Sambuc 
766*433d6423SLionel Sambuc /*e0*/	{ "loopne",FALSE, NONE,  op1(Db),     0 },
767*433d6423SLionel Sambuc /*e1*/	{ "loope", FALSE, NONE,  op1(Db),     0 },
768*433d6423SLionel Sambuc /*e2*/	{ "loop",  FALSE, NONE,  op1(Db),     0 },
769*433d6423SLionel Sambuc /*e3*/	{ "jcxz",  FALSE, SDEP,  op1(Db),     "jecxz" },
770*433d6423SLionel Sambuc /*e4*/	{ "in",    FALSE, BYTE,  op2(Ib, A),  0 },
771*433d6423SLionel Sambuc /*e5*/	{ "in",    FALSE, LONG,  op2(Ib, A) , 0 },
772*433d6423SLionel Sambuc /*e6*/	{ "out",   FALSE, BYTE,  op2(A, Ib),  0 },
773*433d6423SLionel Sambuc /*e7*/	{ "out",   FALSE, LONG,  op2(A, Ib) , 0 },
774*433d6423SLionel Sambuc 
775*433d6423SLionel Sambuc /*e8*/	{ "call",  FALSE, NONE,  op1(Dl),     0 },
776*433d6423SLionel Sambuc /*e9*/	{ "jmp",   FALSE, NONE,  op1(Dl),     0 },
777*433d6423SLionel Sambuc /*ea*/	{ "ljmp",  FALSE, NONE,  op1(OS),     0 },
778*433d6423SLionel Sambuc /*eb*/	{ "jmp",   FALSE, NONE,  op1(Db),     0 },
779*433d6423SLionel Sambuc /*ec*/	{ "in",    FALSE, BYTE,  op2(DX, A),  0 },
780*433d6423SLionel Sambuc /*ed*/	{ "in",    FALSE, LONG,  op2(DX, A) , 0 },
781*433d6423SLionel Sambuc /*ee*/	{ "out",   FALSE, BYTE,  op2(A, DX),  0 },
782*433d6423SLionel Sambuc /*ef*/	{ "out",   FALSE, LONG,  op2(A, DX) , 0 },
783*433d6423SLionel Sambuc 
784*433d6423SLionel Sambuc /*f0*/	{ "",      FALSE, NONE,  0,	     0 },
785*433d6423SLionel Sambuc /*f1*/	{ ".byte\t0xf1", FALSE, NONE, 0,     0 },
786*433d6423SLionel Sambuc /*f2*/	{ "",      FALSE, NONE,  0,	     0 },
787*433d6423SLionel Sambuc /*f3*/	{ "",      FALSE, NONE,  0,	     0 },
788*433d6423SLionel Sambuc /*f4*/	{ "hlt",   FALSE, NONE,  0,	     0 },
789*433d6423SLionel Sambuc /*f5*/	{ "cmc",   FALSE, NONE,  0,	     0 },
790*433d6423SLionel Sambuc /*f6*/	{ "",      TRUE,  BYTE,  0,	     db_Grp3 },
791*433d6423SLionel Sambuc /*f7*/	{ "",	   TRUE,  LONG,  0,	     db_Grp3 },
792*433d6423SLionel Sambuc 
793*433d6423SLionel Sambuc /*f8*/	{ "clc",   FALSE, NONE,  0,	     0 },
794*433d6423SLionel Sambuc /*f9*/	{ "stc",   FALSE, NONE,  0,	     0 },
795*433d6423SLionel Sambuc /*fa*/	{ "cli",   FALSE, NONE,  0,	     0 },
796*433d6423SLionel Sambuc /*fb*/	{ "sti",   FALSE, NONE,  0,	     0 },
797*433d6423SLionel Sambuc /*fc*/	{ "cld",   FALSE, NONE,  0,	     0 },
798*433d6423SLionel Sambuc /*fd*/	{ "std",   FALSE, NONE,  0,	     0 },
799*433d6423SLionel Sambuc /*fe*/	{ "",	   TRUE,  NONE,  0,	     db_Grp4 },
800*433d6423SLionel Sambuc /*ff*/	{ "",	   TRUE,  NONE,  0,	     db_Grp5 },
801*433d6423SLionel Sambuc };
802*433d6423SLionel Sambuc 
803*433d6423SLionel Sambuc static const struct inst db_bad_inst =
804*433d6423SLionel Sambuc 	{ "???",   FALSE, NONE,  0,	      0 }
805*433d6423SLionel Sambuc ;
806*433d6423SLionel Sambuc 
807*433d6423SLionel Sambuc #define	f_mod(byte)	((byte)>>6)
808*433d6423SLionel Sambuc #define	f_reg(byte)	(((byte)>>3)&0x7)
809*433d6423SLionel Sambuc #define	f_rm(byte)	((byte)&0x7)
810*433d6423SLionel Sambuc 
811*433d6423SLionel Sambuc #define	sib_ss(byte)	((byte)>>6)
812*433d6423SLionel Sambuc #define	sib_index(byte)	(((byte)>>3)&0x7)
813*433d6423SLionel Sambuc #define	sib_base(byte)	((byte)&0x7)
814*433d6423SLionel Sambuc 
815*433d6423SLionel Sambuc struct i_addr {
816*433d6423SLionel Sambuc 	int		is_reg;	/* if reg, reg number is in 'disp' */
817*433d6423SLionel Sambuc 	int		disp;
818*433d6423SLionel Sambuc 	const char *	base;
819*433d6423SLionel Sambuc 	const char *	index;
820*433d6423SLionel Sambuc 	int		ss;
821*433d6423SLionel Sambuc };
822*433d6423SLionel Sambuc 
823*433d6423SLionel Sambuc static const char * const db_index_reg_16[8] = {
824*433d6423SLionel Sambuc 	"%bx,%si",
825*433d6423SLionel Sambuc 	"%bx,%di",
826*433d6423SLionel Sambuc 	"%bp,%si",
827*433d6423SLionel Sambuc 	"%bp,%di",
828*433d6423SLionel Sambuc 	"%si",
829*433d6423SLionel Sambuc 	"%di",
830*433d6423SLionel Sambuc 	"%bp",
831*433d6423SLionel Sambuc 	"%bx"
832*433d6423SLionel Sambuc };
833*433d6423SLionel Sambuc 
834*433d6423SLionel Sambuc static const char * const db_reg[3][8] = {
835*433d6423SLionel Sambuc   {"%al",  "%cl",  "%dl",  "%bl",  "%ah",  "%ch",  "%dh",  "%bh"},
836*433d6423SLionel Sambuc   {"%ax",  "%cx",  "%dx",  "%bx",  "%sp",  "%bp",  "%si",  "%di"},
837*433d6423SLionel Sambuc   {"%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi"}
838*433d6423SLionel Sambuc };
839*433d6423SLionel Sambuc 
840*433d6423SLionel Sambuc static const char * const db_seg_reg[8] = {
841*433d6423SLionel Sambuc 	"%es", "%cs", "%ss", "%ds", "%fs", "%gs", "", ""
842*433d6423SLionel Sambuc };
843*433d6423SLionel Sambuc 
844*433d6423SLionel Sambuc /*
845*433d6423SLionel Sambuc  * lengths for size attributes
846*433d6423SLionel Sambuc  */
847*433d6423SLionel Sambuc static const int db_lengths[] = {
848*433d6423SLionel Sambuc 	1,	/* BYTE */
849*433d6423SLionel Sambuc 	2,	/* WORD */
850*433d6423SLionel Sambuc 	4,	/* LONG */
851*433d6423SLionel Sambuc 	8,	/* QUAD */
852*433d6423SLionel Sambuc 	4,	/* SNGL */
853*433d6423SLionel Sambuc 	8,	/* DBLR */
854*433d6423SLionel Sambuc 	10,	/* EXTR */
855*433d6423SLionel Sambuc };
856*433d6423SLionel Sambuc 
857*433d6423SLionel Sambuc #define	get_value_inc(result, loc, size, is_signed) \
858*433d6423SLionel Sambuc 	result = db_get_value((loc), (size), (is_signed)); \
859*433d6423SLionel Sambuc 	(loc) += (size);
860*433d6423SLionel Sambuc 
861*433d6423SLionel Sambuc static db_addr_t
862*433d6423SLionel Sambuc 		db_read_address __P((db_addr_t loc, int short_addr,
863*433d6423SLionel Sambuc 				     int regmodrm, struct i_addr *addrp));
864*433d6423SLionel Sambuc 
865*433d6423SLionel Sambuc /*
866*433d6423SLionel Sambuc  * Read address at location and return updated location.
867*433d6423SLionel Sambuc  */
868*433d6423SLionel Sambuc static db_addr_t
db_read_address(loc,short_addr,regmodrm,addrp)869*433d6423SLionel Sambuc db_read_address(loc, short_addr, regmodrm, addrp)
870*433d6423SLionel Sambuc 	db_addr_t	loc;
871*433d6423SLionel Sambuc 	int		short_addr;
872*433d6423SLionel Sambuc 	int		regmodrm;
873*433d6423SLionel Sambuc 	struct i_addr *	addrp;		/* out */
874*433d6423SLionel Sambuc {
875*433d6423SLionel Sambuc 	int		mod, rm, sib, index, disp;
876*433d6423SLionel Sambuc 
877*433d6423SLionel Sambuc 	mod = f_mod(regmodrm);
878*433d6423SLionel Sambuc 	rm  = f_rm(regmodrm);
879*433d6423SLionel Sambuc 
880*433d6423SLionel Sambuc 	if (mod == 3) {
881*433d6423SLionel Sambuc 	    addrp->is_reg = TRUE;
882*433d6423SLionel Sambuc 	    addrp->disp = rm;
883*433d6423SLionel Sambuc 	    return (loc);
884*433d6423SLionel Sambuc 	}
885*433d6423SLionel Sambuc 	addrp->is_reg = FALSE;
886*433d6423SLionel Sambuc 	addrp->index = 0;
887*433d6423SLionel Sambuc 
888*433d6423SLionel Sambuc 	if (short_addr) {
889*433d6423SLionel Sambuc 	    addrp->index = 0;
890*433d6423SLionel Sambuc 	    addrp->ss = 0;
891*433d6423SLionel Sambuc 	    switch (mod) {
892*433d6423SLionel Sambuc 		case 0:
893*433d6423SLionel Sambuc 		    if (rm == 6) {
894*433d6423SLionel Sambuc 			get_value_inc(disp, loc, 2, FALSE);
895*433d6423SLionel Sambuc 			addrp->disp = disp;
896*433d6423SLionel Sambuc 			addrp->base = 0;
897*433d6423SLionel Sambuc 		    }
898*433d6423SLionel Sambuc 		    else {
899*433d6423SLionel Sambuc 			addrp->disp = 0;
900*433d6423SLionel Sambuc 			addrp->base = db_index_reg_16[rm];
901*433d6423SLionel Sambuc 		    }
902*433d6423SLionel Sambuc 		    break;
903*433d6423SLionel Sambuc 		case 1:
904*433d6423SLionel Sambuc 		    get_value_inc(disp, loc, 1, TRUE);
905*433d6423SLionel Sambuc 		    disp &= 0xFFFF;
906*433d6423SLionel Sambuc 		    addrp->disp = disp;
907*433d6423SLionel Sambuc 		    addrp->base = db_index_reg_16[rm];
908*433d6423SLionel Sambuc 		    break;
909*433d6423SLionel Sambuc 		case 2:
910*433d6423SLionel Sambuc 		    get_value_inc(disp, loc, 2, FALSE);
911*433d6423SLionel Sambuc 		    addrp->disp = disp;
912*433d6423SLionel Sambuc 		    addrp->base = db_index_reg_16[rm];
913*433d6423SLionel Sambuc 		    break;
914*433d6423SLionel Sambuc 	    }
915*433d6423SLionel Sambuc 	}
916*433d6423SLionel Sambuc 	else {
917*433d6423SLionel Sambuc 	    if (mod != 3 && rm == 4) {
918*433d6423SLionel Sambuc 		get_value_inc(sib, loc, 1, FALSE);
919*433d6423SLionel Sambuc 		rm = sib_base(sib);
920*433d6423SLionel Sambuc 		index = sib_index(sib);
921*433d6423SLionel Sambuc 		if (index != 4)
922*433d6423SLionel Sambuc 		    addrp->index = db_reg[LONG][index];
923*433d6423SLionel Sambuc 		addrp->ss = sib_ss(sib);
924*433d6423SLionel Sambuc 	    }
925*433d6423SLionel Sambuc 
926*433d6423SLionel Sambuc 	    switch (mod) {
927*433d6423SLionel Sambuc 		case 0:
928*433d6423SLionel Sambuc 		    if (rm == 5) {
929*433d6423SLionel Sambuc 			get_value_inc(addrp->disp, loc, 4, FALSE);
930*433d6423SLionel Sambuc 			addrp->base = 0;
931*433d6423SLionel Sambuc 		    }
932*433d6423SLionel Sambuc 		    else {
933*433d6423SLionel Sambuc 			addrp->disp = 0;
934*433d6423SLionel Sambuc 			addrp->base = db_reg[LONG][rm];
935*433d6423SLionel Sambuc 		    }
936*433d6423SLionel Sambuc 		    break;
937*433d6423SLionel Sambuc 
938*433d6423SLionel Sambuc 		case 1:
939*433d6423SLionel Sambuc 		    get_value_inc(disp, loc, 1, TRUE);
940*433d6423SLionel Sambuc 		    addrp->disp = disp;
941*433d6423SLionel Sambuc 		    addrp->base = db_reg[LONG][rm];
942*433d6423SLionel Sambuc 		    break;
943*433d6423SLionel Sambuc 
944*433d6423SLionel Sambuc 		case 2:
945*433d6423SLionel Sambuc 		    get_value_inc(disp, loc, 4, FALSE);
946*433d6423SLionel Sambuc 		    addrp->disp = disp;
947*433d6423SLionel Sambuc 		    addrp->base = db_reg[LONG][rm];
948*433d6423SLionel Sambuc 		    break;
949*433d6423SLionel Sambuc 	    }
950*433d6423SLionel Sambuc 	}
951*433d6423SLionel Sambuc 	return (loc);
952*433d6423SLionel Sambuc }
953*433d6423SLionel Sambuc 
954*433d6423SLionel Sambuc /*
955*433d6423SLionel Sambuc  * NWT: fault injection routine only. disasm floating-point instruction
956*433d6423SLionel Sambuc  * and return updated location.
957*433d6423SLionel Sambuc  */
958*433d6423SLionel Sambuc static db_addr_t
my_disasm_esc(db_addr_t loc,int inst,int short_addr,int size,const char * seg)959*433d6423SLionel Sambuc my_disasm_esc(
960*433d6423SLionel Sambuc 	      db_addr_t	loc,
961*433d6423SLionel Sambuc 	      int		inst,
962*433d6423SLionel Sambuc 	      int		short_addr,
963*433d6423SLionel Sambuc 	      int		size,
964*433d6423SLionel Sambuc 	      const char *	seg)
965*433d6423SLionel Sambuc {
966*433d6423SLionel Sambuc 	int		regmodrm;
967*433d6423SLionel Sambuc 	const struct finst *	fp;
968*433d6423SLionel Sambuc 	int		mod;
969*433d6423SLionel Sambuc 	struct i_addr	address;
970*433d6423SLionel Sambuc 	const char *	name;
971*433d6423SLionel Sambuc 
972*433d6423SLionel Sambuc 	get_value_inc(regmodrm, loc, 1, FALSE);
973*433d6423SLionel Sambuc 	fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)];
974*433d6423SLionel Sambuc 	mod = f_mod(regmodrm);
975*433d6423SLionel Sambuc 	if (mod != 3) {
976*433d6423SLionel Sambuc 	    if (*fp->f_name == '\0') {
977*433d6423SLionel Sambuc 		return (loc);
978*433d6423SLionel Sambuc 	    }
979*433d6423SLionel Sambuc 	    /*
980*433d6423SLionel Sambuc 	     * Normal address modes.
981*433d6423SLionel Sambuc 	     */
982*433d6423SLionel Sambuc 	    loc = db_read_address(loc, short_addr, regmodrm, &address);
983*433d6423SLionel Sambuc 	    switch(fp->f_size) {
984*433d6423SLionel Sambuc 		case SNGL:
985*433d6423SLionel Sambuc 		    break;
986*433d6423SLionel Sambuc 		case DBLR:
987*433d6423SLionel Sambuc 		    break;
988*433d6423SLionel Sambuc 		case EXTR:
989*433d6423SLionel Sambuc 		    break;
990*433d6423SLionel Sambuc 		case WORD:
991*433d6423SLionel Sambuc 		    break;
992*433d6423SLionel Sambuc 		case LONG:
993*433d6423SLionel Sambuc 		    break;
994*433d6423SLionel Sambuc 		case QUAD:
995*433d6423SLionel Sambuc 		    break;
996*433d6423SLionel Sambuc 		default:
997*433d6423SLionel Sambuc 		    break;
998*433d6423SLionel Sambuc 	    }
999*433d6423SLionel Sambuc 	}
1000*433d6423SLionel Sambuc 	else {
1001*433d6423SLionel Sambuc 	    /*
1002*433d6423SLionel Sambuc 	     * 'reg-reg' - special formats
1003*433d6423SLionel Sambuc 	     */
1004*433d6423SLionel Sambuc 	    switch (fp->f_rrmode) {
1005*433d6423SLionel Sambuc 		case op2(ST,STI):
1006*433d6423SLionel Sambuc 		    name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1007*433d6423SLionel Sambuc 		    break;
1008*433d6423SLionel Sambuc 		case op2(STI,ST):
1009*433d6423SLionel Sambuc 		    name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1010*433d6423SLionel Sambuc 		    break;
1011*433d6423SLionel Sambuc 		case op1(STI):
1012*433d6423SLionel Sambuc 		    name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1013*433d6423SLionel Sambuc 		    break;
1014*433d6423SLionel Sambuc 		case op1(X):
1015*433d6423SLionel Sambuc 		    name = ((const char * const *)fp->f_rrname)[f_rm(regmodrm)];
1016*433d6423SLionel Sambuc 		    if (*name == '\0')
1017*433d6423SLionel Sambuc 			goto bad;
1018*433d6423SLionel Sambuc 		    break;
1019*433d6423SLionel Sambuc 		case op1(XA):
1020*433d6423SLionel Sambuc 		    name = ((const char * const *)fp->f_rrname)[f_rm(regmodrm)];
1021*433d6423SLionel Sambuc 		    if (*name == '\0')
1022*433d6423SLionel Sambuc 			goto bad;
1023*433d6423SLionel Sambuc 		    break;
1024*433d6423SLionel Sambuc 		default:
1025*433d6423SLionel Sambuc 		bad:
1026*433d6423SLionel Sambuc 		    break;
1027*433d6423SLionel Sambuc 	    }
1028*433d6423SLionel Sambuc 	}
1029*433d6423SLionel Sambuc 
1030*433d6423SLionel Sambuc 	return (loc);
1031*433d6423SLionel Sambuc }
1032*433d6423SLionel Sambuc /*
1033*433d6423SLionel Sambuc  * Disassemble instruction at 'loc'.  'altfmt' specifies an
1034*433d6423SLionel Sambuc  * (optional) alternate format.  Return address of start of
1035*433d6423SLionel Sambuc  * next instruction.
1036*433d6423SLionel Sambuc  */
1037*433d6423SLionel Sambuc db_addr_t
my_disasm(db_addr_t loc,boolean_t altfmt)1038*433d6423SLionel Sambuc my_disasm(db_addr_t	loc,
1039*433d6423SLionel Sambuc 	  boolean_t	altfmt)
1040*433d6423SLionel Sambuc {
1041*433d6423SLionel Sambuc 	int	inst;
1042*433d6423SLionel Sambuc 	int	size;
1043*433d6423SLionel Sambuc 	int	short_addr;
1044*433d6423SLionel Sambuc 	const char *	seg;
1045*433d6423SLionel Sambuc 	const struct inst *	ip;
1046*433d6423SLionel Sambuc 	const char *	i_name;
1047*433d6423SLionel Sambuc 	int	i_size;
1048*433d6423SLionel Sambuc 	int	i_mode;
1049*433d6423SLionel Sambuc 	int	regmodrm = 0;
1050*433d6423SLionel Sambuc 	boolean_t	first;
1051*433d6423SLionel Sambuc 	int	displ;
1052*433d6423SLionel Sambuc 	int	prefix;
1053*433d6423SLionel Sambuc 	int	imm;
1054*433d6423SLionel Sambuc 	int	imm2;
1055*433d6423SLionel Sambuc 	int	len;
1056*433d6423SLionel Sambuc 	struct i_addr	address;
1057*433d6423SLionel Sambuc 
1058*433d6423SLionel Sambuc 	get_value_inc(inst, loc, 1, FALSE);
1059*433d6423SLionel Sambuc 	short_addr = FALSE;
1060*433d6423SLionel Sambuc 	size = LONG;
1061*433d6423SLionel Sambuc 	seg = 0;
1062*433d6423SLionel Sambuc 
1063*433d6423SLionel Sambuc 	/*
1064*433d6423SLionel Sambuc 	 * Get prefixes
1065*433d6423SLionel Sambuc 	 */
1066*433d6423SLionel Sambuc 	prefix = TRUE;
1067*433d6423SLionel Sambuc 	do {
1068*433d6423SLionel Sambuc 	    switch (inst) {
1069*433d6423SLionel Sambuc 		case 0x66:		/* data16 */
1070*433d6423SLionel Sambuc 		    size = WORD;
1071*433d6423SLionel Sambuc 		    break;
1072*433d6423SLionel Sambuc 		case 0x67:
1073*433d6423SLionel Sambuc 		    short_addr = TRUE;
1074*433d6423SLionel Sambuc 		    break;
1075*433d6423SLionel Sambuc 		case 0x26:
1076*433d6423SLionel Sambuc 		    seg = "%es";
1077*433d6423SLionel Sambuc 		    break;
1078*433d6423SLionel Sambuc 		case 0x36:
1079*433d6423SLionel Sambuc 		    seg = "%ss";
1080*433d6423SLionel Sambuc 		    break;
1081*433d6423SLionel Sambuc 		case 0x2e:
1082*433d6423SLionel Sambuc 		    seg = "%cs";
1083*433d6423SLionel Sambuc 		    break;
1084*433d6423SLionel Sambuc 		case 0x3e:
1085*433d6423SLionel Sambuc 		    seg = "%ds";
1086*433d6423SLionel Sambuc 		    break;
1087*433d6423SLionel Sambuc 		case 0x64:
1088*433d6423SLionel Sambuc 		    seg = "%fs";
1089*433d6423SLionel Sambuc 		    break;
1090*433d6423SLionel Sambuc 		case 0x65:
1091*433d6423SLionel Sambuc 		    seg = "%gs";
1092*433d6423SLionel Sambuc 		    break;
1093*433d6423SLionel Sambuc 		case 0xf0:
1094*433d6423SLionel Sambuc #if 0
1095*433d6423SLionel Sambuc 		    // db_printf("lock ");
1096*433d6423SLionel Sambuc #endif
1097*433d6423SLionel Sambuc 		    break;
1098*433d6423SLionel Sambuc 		case 0xf2:
1099*433d6423SLionel Sambuc #if 0
1100*433d6423SLionel Sambuc 		    // db_printf("repne ");
1101*433d6423SLionel Sambuc #endif
1102*433d6423SLionel Sambuc 		    break;
1103*433d6423SLionel Sambuc 		case 0xf3:
1104*433d6423SLionel Sambuc #if 0
1105*433d6423SLionel Sambuc 		    // db_printf("repe ");	/* XXX repe VS rep */
1106*433d6423SLionel Sambuc #endif
1107*433d6423SLionel Sambuc 		    break;
1108*433d6423SLionel Sambuc 		default:
1109*433d6423SLionel Sambuc 		    prefix = FALSE;
1110*433d6423SLionel Sambuc 		    break;
1111*433d6423SLionel Sambuc 	    }
1112*433d6423SLionel Sambuc 	    if (prefix) {
1113*433d6423SLionel Sambuc 		get_value_inc(inst, loc, 1, FALSE);
1114*433d6423SLionel Sambuc 	    }
1115*433d6423SLionel Sambuc 	} while (prefix);
1116*433d6423SLionel Sambuc 
1117*433d6423SLionel Sambuc 	if (inst >= 0xd8 && inst <= 0xdf) {
1118*433d6423SLionel Sambuc 	    loc = my_disasm_esc(loc, inst, short_addr, size, seg);
1119*433d6423SLionel Sambuc 	    return (loc);
1120*433d6423SLionel Sambuc 	}
1121*433d6423SLionel Sambuc 
1122*433d6423SLionel Sambuc 	if (inst == 0x0f) {
1123*433d6423SLionel Sambuc 	    get_value_inc(inst, loc, 1, FALSE);
1124*433d6423SLionel Sambuc 	    ip = db_inst_0f[inst>>4];
1125*433d6423SLionel Sambuc 	    if (ip == 0) {
1126*433d6423SLionel Sambuc 		ip = &db_bad_inst;
1127*433d6423SLionel Sambuc 	    }
1128*433d6423SLionel Sambuc 	    else {
1129*433d6423SLionel Sambuc 		ip = &ip[inst&0xf];
1130*433d6423SLionel Sambuc 	    }
1131*433d6423SLionel Sambuc 	}
1132*433d6423SLionel Sambuc 	else
1133*433d6423SLionel Sambuc 	    ip = &db_inst_table[inst];
1134*433d6423SLionel Sambuc 
1135*433d6423SLionel Sambuc 	if (ip->i_has_modrm) {
1136*433d6423SLionel Sambuc 	    unsigned long prev_loc=loc;
1137*433d6423SLionel Sambuc 	    extern unsigned long modAddr;
1138*433d6423SLionel Sambuc 
1139*433d6423SLionel Sambuc 	    get_value_inc(regmodrm, loc, 1, FALSE);
1140*433d6423SLionel Sambuc 	    loc = db_read_address(loc, short_addr, regmodrm, &address);
1141*433d6423SLionel Sambuc 		modAddr=prev_loc;
1142*433d6423SLionel Sambuc #if 0
1143*433d6423SLionel Sambuc //	    printf("modrm at %x, offset %d\n", loc, loc-prev_loc);
1144*433d6423SLionel Sambuc #endif
1145*433d6423SLionel Sambuc 	}
1146*433d6423SLionel Sambuc 
1147*433d6423SLionel Sambuc 	i_name = ip->i_name;
1148*433d6423SLionel Sambuc 	i_size = ip->i_size;
1149*433d6423SLionel Sambuc 	i_mode = ip->i_mode;
1150*433d6423SLionel Sambuc 
1151*433d6423SLionel Sambuc 	if (ip->i_extra == db_Grp1 || ip->i_extra == db_Grp2 ||
1152*433d6423SLionel Sambuc 	    ip->i_extra == db_Grp6 || ip->i_extra == db_Grp7 ||
1153*433d6423SLionel Sambuc 	    ip->i_extra == db_Grp8 || ip->i_extra == db_Grp9) {
1154*433d6423SLionel Sambuc 	    i_name = ((const char * const *)ip->i_extra)[f_reg(regmodrm)];
1155*433d6423SLionel Sambuc 	}
1156*433d6423SLionel Sambuc 	else if (ip->i_extra == db_Grp3) {
1157*433d6423SLionel Sambuc 	    ip = ip->i_extra;
1158*433d6423SLionel Sambuc 	    ip = &ip[f_reg(regmodrm)];
1159*433d6423SLionel Sambuc 	    i_name = ip->i_name;
1160*433d6423SLionel Sambuc 	    i_mode = ip->i_mode;
1161*433d6423SLionel Sambuc 	}
1162*433d6423SLionel Sambuc 	else if (ip->i_extra == db_Grp4 || ip->i_extra == db_Grp5) {
1163*433d6423SLionel Sambuc 	    ip = ip->i_extra;
1164*433d6423SLionel Sambuc 	    ip = &ip[f_reg(regmodrm)];
1165*433d6423SLionel Sambuc 	    i_name = ip->i_name;
1166*433d6423SLionel Sambuc 	    i_mode = ip->i_mode;
1167*433d6423SLionel Sambuc 	    i_size = ip->i_size;
1168*433d6423SLionel Sambuc 	}
1169*433d6423SLionel Sambuc 
1170*433d6423SLionel Sambuc 	if (i_size == SDEP) {
1171*433d6423SLionel Sambuc 	}
1172*433d6423SLionel Sambuc 	else {
1173*433d6423SLionel Sambuc 	    if (i_size != NONE) {
1174*433d6423SLionel Sambuc 		if (i_size == BYTE) {
1175*433d6423SLionel Sambuc 		    size = BYTE;
1176*433d6423SLionel Sambuc 		}
1177*433d6423SLionel Sambuc 		else if (i_size == WORD) {
1178*433d6423SLionel Sambuc 		    size = WORD;
1179*433d6423SLionel Sambuc 		}
1180*433d6423SLionel Sambuc 	    }
1181*433d6423SLionel Sambuc 	}
1182*433d6423SLionel Sambuc 	for (first = TRUE;
1183*433d6423SLionel Sambuc 	     i_mode != 0;
1184*433d6423SLionel Sambuc 	     i_mode >>= 8, first = FALSE)
1185*433d6423SLionel Sambuc 	{
1186*433d6423SLionel Sambuc 
1187*433d6423SLionel Sambuc 	    switch (i_mode & 0xFF) {
1188*433d6423SLionel Sambuc 
1189*433d6423SLionel Sambuc 		case E:
1190*433d6423SLionel Sambuc #if 0
1191*433d6423SLionel Sambuc 		    // db_print_address(seg, size, &address);
1192*433d6423SLionel Sambuc #endif
1193*433d6423SLionel Sambuc 		    break;
1194*433d6423SLionel Sambuc 
1195*433d6423SLionel Sambuc 		case Eind:
1196*433d6423SLionel Sambuc #if 0
1197*433d6423SLionel Sambuc 		    // db_print_address(seg, size, &address);
1198*433d6423SLionel Sambuc #endif
1199*433d6423SLionel Sambuc 		    break;
1200*433d6423SLionel Sambuc 
1201*433d6423SLionel Sambuc 		case El:
1202*433d6423SLionel Sambuc #if 0
1203*433d6423SLionel Sambuc 		    // db_print_address(seg, LONG, &address);
1204*433d6423SLionel Sambuc #endif
1205*433d6423SLionel Sambuc 		    break;
1206*433d6423SLionel Sambuc 
1207*433d6423SLionel Sambuc 		case Ew:
1208*433d6423SLionel Sambuc #if 0
1209*433d6423SLionel Sambuc 		    // db_print_address(seg, WORD, &address);
1210*433d6423SLionel Sambuc #endif
1211*433d6423SLionel Sambuc 		    break;
1212*433d6423SLionel Sambuc 
1213*433d6423SLionel Sambuc 		case Eb:
1214*433d6423SLionel Sambuc #if 0
1215*433d6423SLionel Sambuc 		    // db_print_address(seg, BYTE, &address);
1216*433d6423SLionel Sambuc #endif
1217*433d6423SLionel Sambuc 		    break;
1218*433d6423SLionel Sambuc 
1219*433d6423SLionel Sambuc 		case R:
1220*433d6423SLionel Sambuc #if 0
1221*433d6423SLionel Sambuc 		    // db_printf("%s", db_reg[size][f_reg(regmodrm)]);
1222*433d6423SLionel Sambuc #endif
1223*433d6423SLionel Sambuc 		    break;
1224*433d6423SLionel Sambuc 
1225*433d6423SLionel Sambuc 		case Rw:
1226*433d6423SLionel Sambuc #if 0
1227*433d6423SLionel Sambuc 		    // db_printf("%s", db_reg[WORD][f_reg(regmodrm)]);
1228*433d6423SLionel Sambuc #endif
1229*433d6423SLionel Sambuc 		    break;
1230*433d6423SLionel Sambuc 
1231*433d6423SLionel Sambuc 		case Ri:
1232*433d6423SLionel Sambuc #if 0
1233*433d6423SLionel Sambuc 		    // db_printf("%s", db_reg[size][f_rm(inst)]);
1234*433d6423SLionel Sambuc #endif
1235*433d6423SLionel Sambuc 		    break;
1236*433d6423SLionel Sambuc 
1237*433d6423SLionel Sambuc 		case Ril:
1238*433d6423SLionel Sambuc #if 0
1239*433d6423SLionel Sambuc 		    // db_printf("%s", db_reg[LONG][f_rm(inst)]);
1240*433d6423SLionel Sambuc #endif
1241*433d6423SLionel Sambuc 		    break;
1242*433d6423SLionel Sambuc 
1243*433d6423SLionel Sambuc 		case S:
1244*433d6423SLionel Sambuc #if 0
1245*433d6423SLionel Sambuc 		    // db_printf("%s", db_seg_reg[f_reg(regmodrm)]);
1246*433d6423SLionel Sambuc #endif
1247*433d6423SLionel Sambuc 		    break;
1248*433d6423SLionel Sambuc 
1249*433d6423SLionel Sambuc 		case Si:
1250*433d6423SLionel Sambuc #if 0
1251*433d6423SLionel Sambuc 		    // db_printf("%s", db_seg_reg[f_reg(inst)]);
1252*433d6423SLionel Sambuc #endif
1253*433d6423SLionel Sambuc 		    break;
1254*433d6423SLionel Sambuc 
1255*433d6423SLionel Sambuc 		case A:
1256*433d6423SLionel Sambuc #if 0
1257*433d6423SLionel Sambuc 		    // db_printf("%s", db_reg[size][0]);	/* acc */
1258*433d6423SLionel Sambuc #endif
1259*433d6423SLionel Sambuc 		    break;
1260*433d6423SLionel Sambuc 
1261*433d6423SLionel Sambuc 		case BX:
1262*433d6423SLionel Sambuc 		    break;
1263*433d6423SLionel Sambuc 
1264*433d6423SLionel Sambuc 		case CL:
1265*433d6423SLionel Sambuc 		    break;
1266*433d6423SLionel Sambuc 
1267*433d6423SLionel Sambuc 		case DX:
1268*433d6423SLionel Sambuc 		    break;
1269*433d6423SLionel Sambuc 
1270*433d6423SLionel Sambuc 		case SI:
1271*433d6423SLionel Sambuc 		    break;
1272*433d6423SLionel Sambuc 
1273*433d6423SLionel Sambuc 		case DI:
1274*433d6423SLionel Sambuc 		    break;
1275*433d6423SLionel Sambuc 
1276*433d6423SLionel Sambuc 		case CR:
1277*433d6423SLionel Sambuc 		    break;
1278*433d6423SLionel Sambuc 
1279*433d6423SLionel Sambuc 		case DR:
1280*433d6423SLionel Sambuc 		    break;
1281*433d6423SLionel Sambuc 
1282*433d6423SLionel Sambuc 		case TR:
1283*433d6423SLionel Sambuc 		    break;
1284*433d6423SLionel Sambuc 
1285*433d6423SLionel Sambuc 		case I:
1286*433d6423SLionel Sambuc 		    len = db_lengths[size];
1287*433d6423SLionel Sambuc 		    get_value_inc(imm, loc, len, FALSE);
1288*433d6423SLionel Sambuc 		    break;
1289*433d6423SLionel Sambuc 
1290*433d6423SLionel Sambuc 		case Is:
1291*433d6423SLionel Sambuc 		    len = db_lengths[size];
1292*433d6423SLionel Sambuc 		    get_value_inc(imm, loc, len, FALSE);
1293*433d6423SLionel Sambuc 		    /*
1294*433d6423SLionel Sambuc 		     * XXX the + in this format doesn't seem to work right.
1295*433d6423SLionel Sambuc 		     * `Is' is equivalent to `I'.
1296*433d6423SLionel Sambuc 		     */
1297*433d6423SLionel Sambuc 		    break;
1298*433d6423SLionel Sambuc 
1299*433d6423SLionel Sambuc 		case Ib:
1300*433d6423SLionel Sambuc 		    get_value_inc(imm, loc, 1, FALSE);
1301*433d6423SLionel Sambuc 		    break;
1302*433d6423SLionel Sambuc 
1303*433d6423SLionel Sambuc 		case Iba:
1304*433d6423SLionel Sambuc 		    get_value_inc(imm, loc, 1, FALSE);
1305*433d6423SLionel Sambuc 		    break;
1306*433d6423SLionel Sambuc 
1307*433d6423SLionel Sambuc 		case Ibs:
1308*433d6423SLionel Sambuc 		    get_value_inc(imm, loc, 1, TRUE);
1309*433d6423SLionel Sambuc 		    if (size == WORD)
1310*433d6423SLionel Sambuc 			imm &= 0xFFFF;
1311*433d6423SLionel Sambuc 		    break;
1312*433d6423SLionel Sambuc 
1313*433d6423SLionel Sambuc 		case Iw:
1314*433d6423SLionel Sambuc 		    get_value_inc(imm, loc, 2, FALSE);
1315*433d6423SLionel Sambuc 		    break;
1316*433d6423SLionel Sambuc 
1317*433d6423SLionel Sambuc 		case O:
1318*433d6423SLionel Sambuc 		    len = (short_addr ? 2 : 4);
1319*433d6423SLionel Sambuc 		    get_value_inc(displ, loc, len, FALSE);
1320*433d6423SLionel Sambuc 		    if (seg) ;
1321*433d6423SLionel Sambuc 		    else
1322*433d6423SLionel Sambuc #if 0
1323*433d6423SLionel Sambuc //			db_printsym((db_addr_t)displ, DB_STGY_ANY);
1324*433d6423SLionel Sambuc #endif
1325*433d6423SLionel Sambuc 		    break;
1326*433d6423SLionel Sambuc 
1327*433d6423SLionel Sambuc 		case Db:
1328*433d6423SLionel Sambuc 		    get_value_inc(displ, loc, 1, TRUE);
1329*433d6423SLionel Sambuc 		    displ += loc;
1330*433d6423SLionel Sambuc 		    if (size == WORD)
1331*433d6423SLionel Sambuc 			displ &= 0xFFFF;
1332*433d6423SLionel Sambuc #if 0
1333*433d6423SLionel Sambuc //		    db_printsym((db_addr_t)displ, DB_STGY_XTRN);
1334*433d6423SLionel Sambuc #endif
1335*433d6423SLionel Sambuc 		    break;
1336*433d6423SLionel Sambuc 
1337*433d6423SLionel Sambuc 		case Dl:
1338*433d6423SLionel Sambuc 		    len = db_lengths[size];
1339*433d6423SLionel Sambuc 		    get_value_inc(displ, loc, len, FALSE);
1340*433d6423SLionel Sambuc 		    displ += loc;
1341*433d6423SLionel Sambuc 		    if (size == WORD)
1342*433d6423SLionel Sambuc 			displ &= 0xFFFF;
1343*433d6423SLionel Sambuc #if 0
1344*433d6423SLionel Sambuc //		    db_printsym((db_addr_t)displ, DB_STGY_XTRN);
1345*433d6423SLionel Sambuc #endif
1346*433d6423SLionel Sambuc 		    break;
1347*433d6423SLionel Sambuc 
1348*433d6423SLionel Sambuc 		case o1:
1349*433d6423SLionel Sambuc 		    break;
1350*433d6423SLionel Sambuc 
1351*433d6423SLionel Sambuc 		case o3:
1352*433d6423SLionel Sambuc 		    break;
1353*433d6423SLionel Sambuc 
1354*433d6423SLionel Sambuc 		case OS:
1355*433d6423SLionel Sambuc 		    len = db_lengths[size];
1356*433d6423SLionel Sambuc 		    get_value_inc(imm, loc, len, FALSE);	/* offset */
1357*433d6423SLionel Sambuc 		    get_value_inc(imm2, loc, 2, FALSE);	/* segment */
1358*433d6423SLionel Sambuc 		    break;
1359*433d6423SLionel Sambuc 	    }
1360*433d6423SLionel Sambuc 	}
1361*433d6423SLionel Sambuc #if 0
1362*433d6423SLionel Sambuc //	db_printf("\n");
1363*433d6423SLionel Sambuc #endif
1364*433d6423SLionel Sambuc 	return (loc);
1365*433d6423SLionel Sambuc }
1366