Fri Dec 12 19:07:46 2014 UTC ()
Pull up following revision(s) (requested by msaitoh in ticket #313):
	sys/arch/amd64/amd64/db_disasm.c: revision 1.20
	sys/arch/i386/i386/db_disasm.c: revision 1.41
	sys/arch/i386/i386/db_disasm.c: revision 1.42
	sys/arch/i386/i386/db_disasm.c: revision 1.43
	sys/arch/i386/i386/db_disasm.c: revision 1.44
	sys/arch/amd64/amd64/db_disasm.c: revision 1.17
	sys/arch/amd64/amd64/db_disasm.c: revision 1.18
	sys/arch/amd64/amd64/db_disasm.c: revision 1.19
KNF. No binary change.
No functional change.
- 0 -> NULL
- Don't use cast.
- Style fix.
- Fix typos in comment.
Fix bugs:
- aaa and daa were reversed. Same as *BSDs.
- fix operand order of shld and shrd. Same as *BSDs.
Add support for sysenter, sysexit, vmptrld, vmptrst and getsec.


(martin)
diff -r1.16 -r1.16.28.1 src/sys/arch/amd64/amd64/db_disasm.c
diff -r1.40 -r1.40.38.1 src/sys/arch/i386/i386/db_disasm.c

cvs diff -r1.16 -r1.16.28.1 src/sys/arch/amd64/amd64/db_disasm.c (expand / switch to unified diff)

--- src/sys/arch/amd64/amd64/db_disasm.c 2011/07/17 20:54:36 1.16
+++ src/sys/arch/amd64/amd64/db_disasm.c 2014/12/12 19:07:46 1.16.28.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_disasm.c,v 1.16 2011/07/17 20:54:36 joerg Exp $ */ 1/* $NetBSD: db_disasm.c,v 1.16.28.1 2014/12/12 19:07:46 martin Exp $ */
2 2
3/*  3/*
4 * Mach Operating System 4 * Mach Operating System
5 * Copyright (c) 1991,1990 Carnegie Mellon University 5 * Copyright (c) 1991,1990 Carnegie Mellon University
6 * All Rights Reserved. 6 * All Rights Reserved.
7 *  7 *
8 * Permission to use, copy, modify and distribute this software and its 8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright 9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 *  13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * Pittsburgh PA 15213-3890 23 * Pittsburgh PA 15213-3890
24 *  24 *
25 * any improvements or extensions that they make and grant Carnegie the 25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes. 26 * rights to redistribute these changes.
27 * 27 *
28 * Id: db_disasm.c,v 2.3 91/02/05 17:11:03 mrt (CMU) 28 * Id: db_disasm.c,v 2.3 91/02/05 17:11:03 mrt (CMU)
29 */ 29 */
30 30
31/* 31/*
32 * Instruction disassembler. 32 * Instruction disassembler.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.16 2011/07/17 20:54:36 joerg Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.16.28.1 2014/12/12 19:07:46 martin Exp $");
37 37
38#ifndef _KERNEL 38#ifndef _KERNEL
39#include <sys/types.h> 39#include <sys/types.h>
40#include <sys/time.h> 40#include <sys/time.h>
41#include <sys/ksyms.h> 41#include <sys/ksyms.h>
42#endif /* _KERNEL */ 42#endif /* _KERNEL */
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/proc.h> 45#include <sys/proc.h>
46#include <machine/db_machdep.h> 46#include <machine/db_machdep.h>
47 47
48#include <ddb/db_access.h> 48#include <ddb/db_access.h>
49#include <ddb/db_sym.h> 49#include <ddb/db_sym.h>
@@ -98,42 +98,42 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c, @@ -98,42 +98,42 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,
98#define Db 26 /* byte displacement from EIP */ 98#define Db 26 /* byte displacement from EIP */
99#define Dl 27 /* long displacement from EIP */ 99#define Dl 27 /* long displacement from EIP */
100#define o1 28 /* constant 1 */ 100#define o1 28 /* constant 1 */
101#define o3 29 /* constant 3 */ 101#define o3 29 /* constant 3 */
102#define OS 30 /* immediate offset/segment */ 102#define OS 30 /* immediate offset/segment */
103#define ST 31 /* FP stack top */ 103#define ST 31 /* FP stack top */
104#define STI 32 /* FP stack */ 104#define STI 32 /* FP stack */
105#define X 33 /* extended FP op */ 105#define X 33 /* extended FP op */
106#define XA 34 /* for 'fstcw %ax' */ 106#define XA 34 /* for 'fstcw %ax' */
107#define Ed 35 /* address, double size */ 107#define Ed 35 /* address, double size */
108#define Iq 36 /* word immediate, maybe 64bits */ 108#define Iq 36 /* word immediate, maybe 64bits */
109 109
110struct inst { 110struct inst {
111 const char *i_name; /* name */ 111 const char *i_name; /* name */
112 short i_has_modrm; /* has regmodrm byte */ 112 short i_has_modrm; /* has regmodrm byte */
113 short i_size; /* operand size */ 113 short i_size; /* operand size */
114 int i_mode; /* addressing modes */ 114 int i_mode; /* addressing modes */
115 const char *i_extra; /* pointer to extra opcode table */ 115 const void *i_extra; /* pointer to extra opcode table */
116}; 116};
117 117
118#define op1(x) (x) 118#define op1(x) (x)
119#define op2(x,y) ((x)|((y)<<8)) 119#define op2(x,y) ((x)|((y)<<8))
120#define op3(x,y,z) ((x)|((y)<<8)|((z)<<16)) 120#define op3(x,y,z) ((x)|((y)<<8)|((z)<<16))
121 121
122struct finst { 122struct finst {
123 const char *f_name; /* name for memory instruction */ 123 const char *f_name; /* name for memory instruction */
124 int f_size; /* size for memory instruction */ 124 int f_size; /* size for memory instruction */
125 int f_rrmode; /* mode for rr instruction */ 125 int f_rrmode; /* mode for rr instruction */
126 const char *f_rrname; /* name for rr instruction 126 const void *f_rrname; /* name for rr instruction
127 (or pointer to table) */ 127 (or pointer to table) */
128}; 128};
129 129
130const char * const db_Grp6[] = { 130const char * const db_Grp6[] = {
131 "sldt", 131 "sldt",
132 "str", 132 "str",
133 "lldt", 133 "lldt",
134 "ltr", 134 "ltr",
135 "verr", 135 "verr",
136 "verw", 136 "verw",
137 "", 137 "",
138 "" 138 ""
139}; 139};
@@ -157,225 +157,226 @@ const char * const db_Grp8[] = { @@ -157,225 +157,226 @@ const char * const db_Grp8[] = {
157 "bt", 157 "bt",
158 "bts", 158 "bts",
159 "btr", 159 "btr",
160 "btc" 160 "btc"
161}; 161};
162 162
163const char * const db_Grp9[] = { 163const char * const db_Grp9[] = {
164 "", 164 "",
165 "cmpxchg8b", 165 "cmpxchg8b",
166 "", 166 "",
167 "", 167 "",
168 "", 168 "",
169 "", 169 "",
170 "", 170 "vmptrld",
171 "", 171 "vmptrst"
172}; 172};
173 173
174const struct inst db_inst_0f0x[] = { 174const struct inst db_inst_0f0x[] = {
175/*00*/ { "", true, NONE, op1(Ew), (const char *)db_Grp6 }, 175/*00*/ { "", true, NONE, op1(Ew), db_Grp6 },
176/*01*/ { "", true, NONE, op1(Ew), (const char *)db_Grp7 }, 176/*01*/ { "", true, NONE, op1(Ew), db_Grp7 },
177/*02*/ { "lar", true, LONG, op2(E,R), 0 }, 177/*02*/ { "lar", true, LONG, op2(E,R), 0 },
178/*03*/ { "lsl", true, LONG, op2(E,R), 0 }, 178/*03*/ { "lsl", true, LONG, op2(E,R), 0 },
179/*04*/ { "", false, NONE, 0, 0 }, 179/*04*/ { "", false, NONE, 0, 0 },
180/*05*/ { "syscall",false,NONE, 0, 0 }, 180/*05*/ { "syscall",false,NONE, 0, 0 },
181/*06*/ { "clts", false, NONE, 0, 0 }, 181/*06*/ { "clts", false, NONE, 0, 0 },
182/*07*/ { "sysret",false, NONE, 0, 0 }, 182/*07*/ { "sysret",false, NONE, 0, 0 },
183 183
184/*08*/ { "invd", false, NONE, 0, 0 }, 184/*08*/ { "invd", false, NONE, 0, 0 },
185/*09*/ { "wbinvd",false, NONE, 0, 0 }, 185/*09*/ { "wbinvd",false, NONE, 0, 0 },
186/*0a*/ { "", false, NONE, 0, 0 }, 186/*0a*/ { "", false, NONE, 0, 0 },
187/*0b*/ { "ud2", false, NONE, 0, 0 }, 187/*0b*/ { "ud2", false, NONE, 0, 0 },
188/*0c*/ { "", false, NONE, 0, 0 }, 188/*0c*/ { "", false, NONE, 0, 0 },
189/*0d*/ { "prefetch",true,NONE, op2(E,R), 0 }, /* Not 'R' really */ 189/*0d*/ { "prefetch",true,NONE, op2(E,R), 0 }, /* Not 'R' really */
190/*0e*/ { "", false, NONE, 0, 0 }, /* FEMMS (3DNow) */ 190/*0e*/ { "", false, NONE, 0, 0 }, /* FEMMS (3DNow) */
191/*0f*/ { "", false, NONE, 0, 0 }, /* 3DNow */ 191/*0f*/ { "", false, NONE, 0, 0 }, /* 3DNow */
192}; 192};
193 193
194const struct inst db_inst_0f2x[] = { 194const struct inst db_inst_0f2x[] = {
195/*20*/ { "mov", true, LONG, op2(CR,E), 0 }, /* use E for reg */ 195/*20*/ { "mov", true, LONG, op2(CR,E), 0 }, /* use E for reg */
196/*21*/ { "mov", true, LONG, op2(DR,E), 0 }, /* since mod == 11 */ 196/*21*/ { "mov", true, LONG, op2(DR,E), 0 }, /* since mod == 11 */
197/*22*/ { "mov", true, LONG, op2(E,CR), 0 }, 197/*22*/ { "mov", true, LONG, op2(E,CR), 0 },
198/*23*/ { "mov", true, LONG, op2(E,DR), 0 }, 198/*23*/ { "mov", true, LONG, op2(E,DR), 0 },
199/*24*/ { "mov", true, LONG, op2(TR,E), 0 }, 199/*24*/ { "mov", true, LONG, op2(TR,E), 0 },
200/*25*/ { "", false, NONE, 0, 0 }, 200/*25*/ { "", false, NONE, 0, 0 },
201/*26*/ { "mov", true, LONG, op2(E,TR), 0 }, 201/*26*/ { "mov", true, LONG, op2(E,TR), 0 },
202/*27*/ { "", false, NONE, 0, 0 }, 202/*27*/ { "", false, NONE, 0, 0 },
203 203
204/*28*/ { "", false, NONE, 0, 0 }, 204/*28*/ { "", false, NONE, 0, 0 },
205/*29*/ { "", false, NONE, 0, 0 }, 205/*29*/ { "", false, NONE, 0, 0 },
206/*2a*/ { "", false, NONE, 0, 0 }, 206/*2a*/ { "", false, NONE, 0, 0 },
207/*2b*/ { "", false, NONE, 0, 0 }, 207/*2b*/ { "", false, NONE, 0, 0 },
208/*2c*/ { "", false, NONE, 0, 0 }, 208/*2c*/ { "", false, NONE, 0, 0 },
209/*2d*/ { "", false, NONE, 0, 0 }, 209/*2d*/ { "", false, NONE, 0, 0 },
210/*2e*/ { "", false, NONE, 0, 0 }, 210/*2e*/ { "", false, NONE, 0, 0 },
211/*2f*/ { "", false, NONE, 0, 0 }, 211/*2f*/ { "", false, NONE, 0, 0 },
212}; 212};
213 213
214const struct inst db_inst_0f3x[] = { 214const struct inst db_inst_0f3x[] = {
215/*30*/ { "wrmsr", false, NONE, 0, 0 }, 215/*30*/ { "wrmsr", false, NONE, 0, 0 },
216/*31*/ { "rdtsc", false, NONE, 0, 0 }, 216/*31*/ { "rdtsc", false, NONE, 0, 0 },
217/*32*/ { "rdmsr", false, NONE, 0, 0 }, 217/*32*/ { "rdmsr", false, NONE, 0, 0 },
218/*33*/ { "rdpmc", false, NONE, 0, 0 }, 218/*33*/ { "rdpmc", false, NONE, 0, 0 },
219/*34*/ { "sysenter",false,NONE, 0, 0 }, 219/*34*/ { "sysenter",false,NONE, 0, 0 },
220/*35*/ { "sysexit",false, NONE, 0, 0 }, 220/*35*/ { "sysexit",false, NONE, 0, 0 },
221/*36*/ { "", false, NONE, 0, 0 }, 221/*36*/ { "", false, NONE, 0, 0 },
222/*37*/ { "", false, NONE, 0, 0 }, 222/*37*/ { "getsec",false, NONE, 0, 0 },
223 223
224/*38*/ { "", false, NONE, 0, 0 }, 224/*38*/ { "", false, NONE, 0, 0 },
225/*39*/ { "", false, NONE, 0, 0 }, 225/*39*/ { "", false, NONE, 0, 0 },
226/*3a*/ { "", false, NONE, 0, 0 }, 226/*3a*/ { "", false, NONE, 0, 0 },
227/*3v*/ { "", false, NONE, 0, 0 }, 227/*3b*/ { "", false, NONE, 0, 0 },
228/*3c*/ { "", false, NONE, 0, 0 }, 228/*3c*/ { "", false, NONE, 0, 0 },
229/*3d*/ { "", false, NONE, 0, 0 }, 229/*3d*/ { "", false, NONE, 0, 0 },
230/*3e*/ { "", false, NONE, 0, 0 }, 230/*3e*/ { "", false, NONE, 0, 0 },
231/*3f*/ { "", false, NONE, 0, 0 }, 231/*3f*/ { "", false, NONE, 0, 0 },
232}; 232};
233 233
234const struct inst db_inst_0f4x[] = { 234const struct inst db_inst_0f4x[] = {
235/*40*/ { "cmovo", true, LONG, op2(E,R), 0 }, 235/*40*/ { "cmovo", true, LONG, op2(E,R), 0 },
236/*41*/ { "cmovno", true, LONG, op2(E,R), 0 }, 236/*41*/ { "cmovno", true, LONG, op2(E,R), 0 },
237/*42*/ { "cmovc", true, LONG, op2(E,R), 0 }, 237/*42*/ { "cmovc", true, LONG, op2(E,R), 0 },
238/*43*/ { "cmovnc", true, LONG, op2(E,R), 0 }, 238/*43*/ { "cmovnc", true, LONG, op2(E,R), 0 },
239/*44*/ { "cmovz", true, LONG, op2(E,R), 0 }, 239/*44*/ { "cmovz", true, LONG, op2(E,R), 0 },
240/*45*/ { "cmovnz", true, LONG, op2(E,R), 0 }, 240/*45*/ { "cmovnz", true, LONG, op2(E,R), 0 },
241/*46*/ { "cmovbe", true, LONG, op2(E,R), 0 }, 241/*46*/ { "cmovbe", true, LONG, op2(E,R), 0 },
242/*47*/ { "cmovmbe",true, LONG, op2(E,R), 0 }, 242/*47*/ { "cmovmbe",true, LONG, op2(E,R), 0 },
243/*48*/ { "cmovs", true, LONG, op2(E,R), 0 }, 243/*48*/ { "cmovs", true, LONG, op2(E,R), 0 },
244/*49*/ { "cmovns", true, LONG, op2(E,R), 0 }, 244/*49*/ { "cmovns", true, LONG, op2(E,R), 0 },
245/*4a*/ { "cmovp", true, LONG, op2(E,R), 0 }, 245/*4a*/ { "cmovp", true, LONG, op2(E,R), 0 },
246/*4b*/ { "cmovnp", true, LONG, op2(E,R), 0 }, 246/*4b*/ { "cmovnp", true, LONG, op2(E,R), 0 },
247/*4c*/ { "cmovl", true, LONG, op2(E,R), 0 }, 247/*4c*/ { "cmovl", true, LONG, op2(E,R), 0 },
248/*4d*/ { "cmovnl", true, LONG, op2(E,R), 0 }, 248/*4d*/ { "cmovnl", true, LONG, op2(E,R), 0 },
249/*4e*/ { "cmovle", true, LONG, op2(E,R), 0 }, 249/*4e*/ { "cmovle", true, LONG, op2(E,R), 0 },
250/*4f*/ { "cmovnle",true, LONG, op2(E,R), 0 }, 250/*4f*/ { "cmovnle",true, LONG, op2(E,R), 0 },
251}; 251};
252 252
253const struct inst db_inst_0f8x[] = { 253const struct inst db_inst_0f8x[] = {
254/*80*/ { "jo", false, NONE, op1(Dl), 0 }, 254/*80*/ { "jo", false, NONE, op1(Dl), 0 },
255/*81*/ { "jno", false, NONE, op1(Dl), 0 }, 255/*81*/ { "jno", false, NONE, op1(Dl), 0 },
256/*82*/ { "jb", false, NONE, op1(Dl), 0 }, 256/*82*/ { "jb", false, NONE, op1(Dl), 0 },
257/*83*/ { "jnb", false, NONE, op1(Dl), 0 }, 257/*83*/ { "jnb", false, NONE, op1(Dl), 0 },
258/*84*/ { "jz", false, NONE, op1(Dl), 0 }, 258/*84*/ { "jz", false, NONE, op1(Dl), 0 },
259/*85*/ { "jnz", false, NONE, op1(Dl), 0 }, 259/*85*/ { "jnz", false, NONE, op1(Dl), 0 },
260/*86*/ { "jbe", false, NONE, op1(Dl), 0 }, 260/*86*/ { "jbe", false, NONE, op1(Dl), 0 },
261/*87*/ { "jnbe", false, NONE, op1(Dl), 0 }, 261/*87*/ { "jnbe", false, NONE, op1(Dl), 0 },
262 262
263/*88*/ { "js", false, NONE, op1(Dl), 0 }, 263/*88*/ { "js", false, NONE, op1(Dl), 0 },
264/*89*/ { "jns", false, NONE, op1(Dl), 0 }, 264/*89*/ { "jns", false, NONE, op1(Dl), 0 },
265/*8a*/ { "jp", false, NONE, op1(Dl), 0 }, 265/*8a*/ { "jp", false, NONE, op1(Dl), 0 },
266/*8b*/ { "jnp", false, NONE, op1(Dl), 0 }, 266/*8b*/ { "jnp", false, NONE, op1(Dl), 0 },
267/*8c*/ { "jl", false, NONE, op1(Dl), 0 }, 267/*8c*/ { "jl", false, NONE, op1(Dl), 0 },
268/*8d*/ { "jnl", false, NONE, op1(Dl), 0 }, 268/*8d*/ { "jnl", false, NONE, op1(Dl), 0 },
269/*8e*/ { "jle", false, NONE, op1(Dl), 0 }, 269/*8e*/ { "jle", false, NONE, op1(Dl), 0 },
270/*8f*/ { "jnle", false, NONE, op1(Dl), 0 }, 270/*8f*/ { "jnle", false, NONE, op1(Dl), 0 },
271}; 271};
272 272
273const struct inst db_inst_0f9x[] = { 273const struct inst db_inst_0f9x[] = {
274/*90*/ { "seto", true, NONE, op1(Eb), 0 }, 274/*90*/ { "seto", true, NONE, op1(Eb), 0 },
275/*91*/ { "setno", true, NONE, op1(Eb), 0 }, 275/*91*/ { "setno", true, NONE, op1(Eb), 0 },
276/*92*/ { "setb", true, NONE, op1(Eb), 0 }, 276/*92*/ { "setb", true, NONE, op1(Eb), 0 },
277/*93*/ { "setnb", true, NONE, op1(Eb), 0 }, 277/*93*/ { "setnb", true, NONE, op1(Eb), 0 },
278/*94*/ { "setz", true, NONE, op1(Eb), 0 }, 278/*94*/ { "setz", true, NONE, op1(Eb), 0 },
279/*95*/ { "setnz", true, NONE, op1(Eb), 0 }, 279/*95*/ { "setnz", true, NONE, op1(Eb), 0 },
280/*96*/ { "setbe", true, NONE, op1(Eb), 0 }, 280/*96*/ { "setbe", true, NONE, op1(Eb), 0 },
281/*97*/ { "setnbe",true, NONE, op1(Eb), 0 }, 281/*97*/ { "setnbe",true, NONE, op1(Eb), 0 },
282 282
283/*98*/ { "sets", true, NONE, op1(Eb), 0 }, 283/*98*/ { "sets", true, NONE, op1(Eb), 0 },
284/*99*/ { "setns", true, NONE, op1(Eb), 0 }, 284/*99*/ { "setns", true, NONE, op1(Eb), 0 },
285/*9a*/ { "setp", true, NONE, op1(Eb), 0 }, 285/*9a*/ { "setp", true, NONE, op1(Eb), 0 },
286/*9b*/ { "setnp", true, NONE, op1(Eb), 0 }, 286/*9b*/ { "setnp", true, NONE, op1(Eb), 0 },
287/*9c*/ { "setl", true, NONE, op1(Eb), 0 }, 287/*9c*/ { "setl", true, NONE, op1(Eb), 0 },
288/*9d*/ { "setnl", true, NONE, op1(Eb), 0 }, 288/*9d*/ { "setnl", true, NONE, op1(Eb), 0 },
289/*9e*/ { "setle", true, NONE, op1(Eb), 0 }, 289/*9e*/ { "setle", true, NONE, op1(Eb), 0 },
290/*9f*/ { "setnle",true, NONE, op1(Eb), 0 }, 290/*9f*/ { "setnle",true, NONE, op1(Eb), 0 },
291}; 291};
292 292
293const struct inst db_inst_0fax[] = { 293const struct inst db_inst_0fax[] = {
294/*a0*/ { "push", false, NONE, op1(Si), 0 }, 294/*a0*/ { "push", false, NONE, op1(Si), 0 },
295/*a1*/ { "pop", false, NONE, op1(Si), 0 }, 295/*a1*/ { "pop", false, NONE, op1(Si), 0 },
296/*a2*/ { "cpuid", false, NONE, 0, 0 }, 296/*a2*/ { "cpuid", false, NONE, 0, 0 },
297/*a3*/ { "bt", true, LONG, op2(R,E), 0 }, 297/*a3*/ { "bt", true, LONG, op2(R,E), 0 },
298/*a4*/ { "shld", true, LONG, op3(Ib,E,R), 0 }, 298/*a4*/ { "shld", true, LONG, op3(Ib,R,E), 0 },
299/*a5*/ { "shld", true, LONG, op3(CL,E,R), 0 }, 299/*a5*/ { "shld", true, LONG, op3(CL,R,E), 0 },
300/*a6*/ { "", false, NONE, 0, 0 }, 300/*a6*/ { "", false, NONE, 0, 0 },
301/*a7*/ { "", false, NONE, 0, 0 }, 301/*a7*/ { "", false, NONE, 0, 0 },
302 302
303/*a8*/ { "push", false, NONE, op1(Si), 0 }, 303/*a8*/ { "push", false, NONE, op1(Si), 0 },
304/*a9*/ { "pop", false, NONE, op1(Si), 0 }, 304/*a9*/ { "pop", false, NONE, op1(Si), 0 },
305/*aa*/ { "rsm", false, NONE, 0, 0 }, 305/*aa*/ { "rsm", false, NONE, 0, 0 },
306/*ab*/ { "bts", true, LONG, op2(R,E), 0 }, 306/*ab*/ { "bts", true, LONG, op2(R,E), 0 },
307/*ac*/ { "shrd", true, LONG, op3(Ib,E,R), 0 }, 307/*ac*/ { "shrd", true, LONG, op3(Ib,R,E), 0 },
308/*ad*/ { "shrd", true, LONG, op3(CL,E,R), 0 }, 308/*ad*/ { "shrd", true, LONG, op3(CL,R,E), 0 },
309/*ae*/ { "fxsave",true, LONG, 0, 0 }, 309/*ae*/ { "fxsave",true, LONG, 0, 0 },
310/*af*/ { "imul", true, LONG, op2(E,R), 0 }, 310/*af*/ { "imul", true, LONG, op2(E,R), 0 },
311}; 311};
312 312
313const struct inst db_inst_0fbx[] = { 313const struct inst db_inst_0fbx[] = {
314/*b0*/ { "cmpxchg",true, BYTE, op2(R, E), 0 }, 314/*b0*/ { "cmpxchg",true, BYTE, op2(R, E), 0 },
315/*b1*/ { "cmpxchg",true, LONG, op2(R, E), 0 }, 315/*b1*/ { "cmpxchg",true, LONG, op2(R, E), 0 },
316/*b2*/ { "lss", true, LONG, op2(E, R), 0 }, 316/*b2*/ { "lss", true, LONG, op2(E, R), 0 },
317/*b3*/ { "btr", true, LONG, op2(R, E), 0 }, 317/*b3*/ { "btr", true, LONG, op2(R, E), 0 },
318/*b4*/ { "lfs", true, LONG, op2(E, R), 0 }, 318/*b4*/ { "lfs", true, LONG, op2(E, R), 0 },
319/*b5*/ { "lgs", true, LONG, op2(E, R), 0 }, 319/*b5*/ { "lgs", true, LONG, op2(E, R), 0 },
320/*b6*/ { "movzb", true, LONG, op2(E, R), 0 }, 320/*b6*/ { "movzb", true, LONG, op2(E, R), 0 },
321/*b7*/ { "movzw", true, LONG, op2(E, R), 0 }, 321/*b7*/ { "movzw", true, LONG, op2(E, R), 0 },
322 322
323/*b8*/ { "", false, NONE, 0, 0 }, 323/*b8*/ { "", false, NONE, 0, 0 },
324/*b9*/ { "", false, NONE, 0, 0 }, 324/*b9*/ { "", false, NONE, 0, 0 },
325/*ba*/ { "", true, LONG, op2(Ib, E), (const char *)db_Grp8 }, 325/*ba*/ { "", true, LONG, op2(Ib, E), db_Grp8 },
326/*bb*/ { "btc", true, LONG, op2(R, E), 0 }, 326/*bb*/ { "btc", true, LONG, op2(R, E), 0 },
327/*bc*/ { "bsf", true, LONG, op2(E, R), 0 }, 327/*bc*/ { "bsf", true, LONG, op2(E, R), 0 },
328/*bd*/ { "bsr", true, LONG, op2(E, R), 0 }, 328/*bd*/ { "bsr", true, LONG, op2(E, R), 0 },
329/*be*/ { "movsb", true, LONG, op2(E, R), 0 }, 329/*be*/ { "movsb", true, LONG, op2(E, R), 0 },
330/*bf*/ { "movsw", true, LONG, op2(E, R), 0 }, 330/*bf*/ { "movsw", true, LONG, op2(E, R), 0 },
331}; 331};
332 332
333const struct inst db_inst_0fcx[] = { 333const struct inst db_inst_0fcx[] = {
334/*c0*/ { "xadd", true, BYTE, op2(R, E), 0 }, 334/*c0*/ { "xadd", true, BYTE, op2(R, E), 0 },
335/*c1*/ { "xadd", true, LONG, op2(R, E), 0 }, 335/*c1*/ { "xadd", true, LONG, op2(R, E), 0 },
336/*c2*/ { "", false, NONE, 0, 0 }, 336/*c2*/ { "", false, NONE, 0, 0 },
337/*c3*/ { "", false, NONE, 0, 0 }, 337/*c3*/ { "", false, NONE, 0, 0 },
338/*c4*/ { "", false, NONE, 0, 0 }, 338/*c4*/ { "", false, NONE, 0, 0 },
339/*c5*/ { "", false, NONE, 0, 0 }, 339/*c5*/ { "", false, NONE, 0, 0 },
340/*c6*/ { "", false, NONE, 0, 0 }, 340/*c6*/ { "", false, NONE, 0, 0 },
341/*c7*/ { "", true, NONE, op1(E), (const char *)db_Grp9 }, 341/*c7*/ { "", true, NONE, op1(E), db_Grp9 },
 342
342/*c8*/ { "bswap", false, LONG, op1(Ri), 0 }, 343/*c8*/ { "bswap", false, LONG, op1(Ri), 0 },
343/*c9*/ { "bswap", false, LONG, op1(Ri), 0 }, 344/*c9*/ { "bswap", false, LONG, op1(Ri), 0 },
344/*ca*/ { "bswap", false, LONG, op1(Ri), 0 }, 345/*ca*/ { "bswap", false, LONG, op1(Ri), 0 },
345/*cb*/ { "bswap", false, LONG, op1(Ri), 0 }, 346/*cb*/ { "bswap", false, LONG, op1(Ri), 0 },
346/*cc*/ { "bswap", false, LONG, op1(Ri), 0 }, 347/*cc*/ { "bswap", false, LONG, op1(Ri), 0 },
347/*cd*/ { "bswap", false, LONG, op1(Ri), 0 }, 348/*cd*/ { "bswap", false, LONG, op1(Ri), 0 },
348/*ce*/ { "bswap", false, LONG, op1(Ri), 0 }, 349/*ce*/ { "bswap", false, LONG, op1(Ri), 0 },
349/*cf*/ { "bswap", false, LONG, op1(Ri), 0 }, 350/*cf*/ { "bswap", false, LONG, op1(Ri), 0 },
350}; 351};
351 352
352const struct inst * const db_inst_0f[] = { 353const struct inst * const db_inst_0f[] = {
353 db_inst_0f0x, 354 db_inst_0f0x,
354 0, 355 NULL,
355 db_inst_0f2x, 356 db_inst_0f2x,
356 db_inst_0f3x, 357 db_inst_0f3x,
357 db_inst_0f4x, 358 db_inst_0f4x,
358 0, 359 NULL,
359 0, 360 NULL,
360 0, 361 NULL,
361 db_inst_0f8x, 362 db_inst_0f8x,
362 db_inst_0f9x, 363 db_inst_0f9x,
363 db_inst_0fax, 364 db_inst_0fax,
364 db_inst_0fbx, 365 db_inst_0fbx,
365 db_inst_0fcx, 366 db_inst_0fcx,
366 0, 367 NULL,
367 0, 368 NULL,
368 0 369 NULL
369}; 370};
370 371
371const char * const db_Esc92[] = { 372const char * const db_Esc92[] = {
372 "fnop", "", "", "", "", "", "", "" 373 "fnop", "", "", "", "", "", "", ""
373}; 374};
374const char * const db_Esc93[] = { 375const char * const db_Esc93[] = {
375 "", "", "", "", "", "", "", "" 376 "", "", "", "", "", "", "", ""
376}; 377};
377const char * const db_Esc94[] = { 378const char * const db_Esc94[] = {
378 "fchs", "fabs", "", "", "ftst", "fxam", "", "" 379 "fchs", "fabs", "", "", "ftst", "fxam", "", ""
379}; 380};
380const char * const db_Esc95[] = { 381const char * const db_Esc95[] = {
381 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","" 382 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz",""
@@ -408,51 +409,51 @@ const struct finst db_Esc8[] = { @@ -408,51 +409,51 @@ const struct finst db_Esc8[] = {
408/*0*/ { "fadd", SNGL, op2(STI,ST), 0 }, 409/*0*/ { "fadd", SNGL, op2(STI,ST), 0 },
409/*1*/ { "fmul", SNGL, op2(STI,ST), 0 }, 410/*1*/ { "fmul", SNGL, op2(STI,ST), 0 },
410/*2*/ { "fcom", SNGL, op2(STI,ST), 0 }, 411/*2*/ { "fcom", SNGL, op2(STI,ST), 0 },
411/*3*/ { "fcomp", SNGL, op2(STI,ST), 0 }, 412/*3*/ { "fcomp", SNGL, op2(STI,ST), 0 },
412/*4*/ { "fsub", SNGL, op2(STI,ST), 0 }, 413/*4*/ { "fsub", SNGL, op2(STI,ST), 0 },
413/*5*/ { "fsubr", SNGL, op2(STI,ST), 0 }, 414/*5*/ { "fsubr", SNGL, op2(STI,ST), 0 },
414/*6*/ { "fdiv", SNGL, op2(STI,ST), 0 }, 415/*6*/ { "fdiv", SNGL, op2(STI,ST), 0 },
415/*7*/ { "fdivr", SNGL, op2(STI,ST), 0 }, 416/*7*/ { "fdivr", SNGL, op2(STI,ST), 0 },
416}; 417};
417 418
418const struct finst db_Esc9[] = { 419const struct finst db_Esc9[] = {
419/*0*/ { "fld", SNGL, op1(STI), 0 }, 420/*0*/ { "fld", SNGL, op1(STI), 0 },
420/*1*/ { "", NONE, op1(STI), "fxch" }, 421/*1*/ { "", NONE, op1(STI), "fxch" },
421/*2*/ { "fst", SNGL, op1(X), (const char *)db_Esc92 }, 422/*2*/ { "fst", SNGL, op1(X), db_Esc92 },
422/*3*/ { "fstp", SNGL, op1(X), (const char *)db_Esc93 }, 423/*3*/ { "fstp", SNGL, op1(X), db_Esc93 },
423/*4*/ { "fldenv", NONE, op1(X), (const char *)db_Esc94 }, 424/*4*/ { "fldenv", NONE, op1(X), db_Esc94 },
424/*5*/ { "fldcw", NONE, op1(X), (const char *)db_Esc95 }, 425/*5*/ { "fldcw", NONE, op1(X), db_Esc95 },
425/*6*/ { "fnstenv",NONE, op1(X), (const char *)db_Esc96 }, 426/*6*/ { "fnstenv",NONE, op1(X), db_Esc96 },
426/*7*/ { "fnstcw", NONE, op1(X), (const char *)db_Esc97 }, 427/*7*/ { "fnstcw", NONE, op1(X), db_Esc97 },
427}; 428};
428 429
429const struct finst db_Esca[] = { 430const struct finst db_Esca[] = {
430/*0*/ { "fiadd", WORD, 0, 0 }, 431/*0*/ { "fiadd", WORD, 0, 0 },
431/*1*/ { "fimul", WORD, 0, 0 }, 432/*1*/ { "fimul", WORD, 0, 0 },
432/*2*/ { "ficom", WORD, 0, 0 }, 433/*2*/ { "ficom", WORD, 0, 0 },
433/*3*/ { "ficomp", WORD, 0, 0 }, 434/*3*/ { "ficomp", WORD, 0, 0 },
434/*4*/ { "fisub", WORD, op1(X), (const char *)db_Esca4 }, 435/*4*/ { "fisub", WORD, op1(X), db_Esca4 },
435/*5*/ { "fisubr", WORD, 0, 0 }, 436/*5*/ { "fisubr", WORD, 0, 0 },
436/*6*/ { "fidiv", WORD, 0, 0 }, 437/*6*/ { "fidiv", WORD, 0, 0 },
437/*7*/ { "fidivr", WORD, 0, 0 } 438/*7*/ { "fidivr", WORD, 0, 0 }
438}; 439};
439 440
440const struct finst db_Escb[] = { 441const struct finst db_Escb[] = {
441/*0*/ { "fild", WORD, 0, 0 }, 442/*0*/ { "fild", WORD, 0, 0 },
442/*1*/ { "", NONE, 0, 0 }, 443/*1*/ { "", NONE, 0, 0 },
443/*2*/ { "fist", WORD, 0, 0 }, 444/*2*/ { "fist", WORD, 0, 0 },
444/*3*/ { "fistp", WORD, 0, 0 }, 445/*3*/ { "fistp", WORD, 0, 0 },
445/*4*/ { "", WORD, op1(X), (const char *)db_Escb4 }, 446/*4*/ { "", WORD, op1(X), db_Escb4 },
446/*5*/ { "fld", EXTR, 0, 0 }, 447/*5*/ { "fld", EXTR, 0, 0 },
447/*6*/ { "", WORD, 0, 0 }, 448/*6*/ { "", WORD, 0, 0 },
448/*7*/ { "fstp", EXTR, 0, 0 }, 449/*7*/ { "fstp", EXTR, 0, 0 },
449}; 450};
450 451
451const struct finst db_Escc[] = { 452const struct finst db_Escc[] = {
452/*0*/ { "fadd", DBLR, op2(ST,STI), 0 }, 453/*0*/ { "fadd", DBLR, op2(ST,STI), 0 },
453/*1*/ { "fmul", DBLR, op2(ST,STI), 0 }, 454/*1*/ { "fmul", DBLR, op2(ST,STI), 0 },
454/*2*/ { "fcom", DBLR, op2(ST,STI), 0 }, 455/*2*/ { "fcom", DBLR, op2(ST,STI), 0 },
455/*3*/ { "fcomp", DBLR, op2(ST,STI), 0 }, 456/*3*/ { "fcomp", DBLR, op2(ST,STI), 0 },
456/*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" }, 457/*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" },
457/*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" }, 458/*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" },
458/*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" }, 459/*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" },
@@ -464,39 +465,39 @@ const struct finst db_Escd[] = { @@ -464,39 +465,39 @@ const struct finst db_Escd[] = {
464/*1*/ { "", NONE, 0, 0 }, 465/*1*/ { "", NONE, 0, 0 },
465/*2*/ { "fst", DBLR, op1(STI), 0 }, 466/*2*/ { "fst", DBLR, op1(STI), 0 },
466/*3*/ { "fstp", DBLR, op1(STI), 0 }, 467/*3*/ { "fstp", DBLR, op1(STI), 0 },
467/*4*/ { "frstor", NONE, op1(STI), "fucom" }, 468/*4*/ { "frstor", NONE, op1(STI), "fucom" },
468/*5*/ { "", NONE, op1(STI), "fucomp" }, 469/*5*/ { "", NONE, op1(STI), "fucomp" },
469/*6*/ { "fnsave", NONE, 0, 0 }, 470/*6*/ { "fnsave", NONE, 0, 0 },
470/*7*/ { "fnstsw", NONE, 0, 0 }, 471/*7*/ { "fnstsw", NONE, 0, 0 },
471}; 472};
472 473
473const struct finst db_Esce[] = { 474const struct finst db_Esce[] = {
474/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" }, 475/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" },
475/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" }, 476/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" },
476/*2*/ { "ficom", LONG, 0, 0 }, 477/*2*/ { "ficom", LONG, 0, 0 },
477/*3*/ { "ficomp", LONG, op1(X), (const char *)db_Esce3 }, 478/*3*/ { "ficomp", LONG, op1(X), db_Esce3 },
478/*4*/ { "fisub", LONG, op2(ST,STI), "fsubrp" }, 479/*4*/ { "fisub", LONG, op2(ST,STI), "fsubrp" },
479/*5*/ { "fisubr", LONG, op2(ST,STI), "fsubp" }, 480/*5*/ { "fisubr", LONG, op2(ST,STI), "fsubp" },
480/*6*/ { "fidiv", LONG, op2(ST,STI), "fdivrp" }, 481/*6*/ { "fidiv", LONG, op2(ST,STI), "fdivrp" },
481/*7*/ { "fidivr", LONG, op2(ST,STI), "fdivp" }, 482/*7*/ { "fidivr", LONG, op2(ST,STI), "fdivp" },
482}; 483};
483 484
484const struct finst db_Escf[] = { 485const struct finst db_Escf[] = {
485/*0*/ { "fild", LONG, 0, 0 }, 486/*0*/ { "fild", LONG, 0, 0 },
486/*1*/ { "", LONG, 0, 0 }, 487/*1*/ { "", LONG, 0, 0 },
487/*2*/ { "fist", LONG, 0, 0 }, 488/*2*/ { "fist", LONG, 0, 0 },
488/*3*/ { "fistp", LONG, 0, 0 }, 489/*3*/ { "fistp", LONG, 0, 0 },
489/*4*/ { "fbld", NONE, op1(XA), (const char *)db_Escf4 }, 490/*4*/ { "fbld", NONE, op1(XA), db_Escf4 },
490/*5*/ { "fld", QUAD, 0, 0 }, 491/*5*/ { "fld", QUAD, 0, 0 },
491/*6*/ { "fbstp", NONE, 0, 0 }, 492/*6*/ { "fbstp", NONE, 0, 0 },
492/*7*/ { "fstp", QUAD, 0, 0 }, 493/*7*/ { "fstp", QUAD, 0, 0 },
493}; 494};
494 495
495const struct finst * const db_Esc_inst[] = { 496const struct finst * const db_Esc_inst[] = {
496 db_Esc8, db_Esc9, db_Esca, db_Escb, 497 db_Esc8, db_Esc9, db_Esca, db_Escb,
497 db_Escc, db_Escd, db_Esce, db_Escf 498 db_Escc, db_Escd, db_Esce, db_Escf
498}; 499};
499 500
500const char * const db_Grp1[] = { 501const char * const db_Grp1[] = {
501 "add", 502 "add",
502 "or", 503 "or",
@@ -520,46 +521,46 @@ const char * const db_Grp2[] = { @@ -520,46 +521,46 @@ const char * const db_Grp2[] = {
520}; 521};
521 522
522const struct inst db_Grp3[] = { 523const struct inst db_Grp3[] = {
523 { "test", true, NONE, op2(I,E), 0 }, 524 { "test", true, NONE, op2(I,E), 0 },
524 { "test", true, NONE, op2(I,E), 0 }, 525 { "test", true, NONE, op2(I,E), 0 },
525 { "not", true, NONE, op1(E), 0 }, 526 { "not", true, NONE, op1(E), 0 },
526 { "neg", true, NONE, op1(E), 0 }, 527 { "neg", true, NONE, op1(E), 0 },
527 { "mul", true, NONE, op2(E,A), 0 }, 528 { "mul", true, NONE, op2(E,A), 0 },
528 { "imul", true, NONE, op2(E,A), 0 }, 529 { "imul", true, NONE, op2(E,A), 0 },
529 { "div", true, NONE, op2(E,A), 0 }, 530 { "div", true, NONE, op2(E,A), 0 },
530 { "idiv", true, NONE, op2(E,A), 0 }, 531 { "idiv", true, NONE, op2(E,A), 0 },
531}; 532};
532 533
533const struct inst db_Grp4[] = { 534const struct inst db_Grp4[] = {
534 { "inc", true, BYTE, op1(E), 0 }, 535 { "inc", true, BYTE, op1(E), 0 },
535 { "dec", true, BYTE, op1(E), 0 }, 536 { "dec", true, BYTE, op1(E), 0 },
536 { "", true, NONE, 0, 0 }, 537 { "", true, NONE, 0, 0 },
537 { "", true, NONE, 0, 0 }, 538 { "", true, NONE, 0, 0 },
538 { "", true, NONE, 0, 0 }, 539 { "", true, NONE, 0, 0 },
539 { "", true, NONE, 0, 0 }, 540 { "", true, NONE, 0, 0 },
540 { "", true, NONE, 0, 0 }, 541 { "", true, NONE, 0, 0 },
541 { "", true, NONE, 0, 0 } 542 { "", true, NONE, 0, 0 }
542}; 543};
543 544
544const struct inst db_Grp5[] = { 545const struct inst db_Grp5[] = {
545 { "inc", true, LONG, op1(E), 0 }, 546 { "inc", true, LONG, op1(E), 0 },
546 { "dec", true, LONG, op1(E), 0 }, 547 { "dec", true, LONG, op1(E), 0 },
547 { "call", true, NONE, op1(Eind),0 }, 548 { "call", true, NONE, op1(Eind),0 },
548 { "lcall", true, NONE, op1(Eind),0 }, 549 { "lcall", true, NONE, op1(Eind),0 },
549 { "jmp", true, NONE, op1(Eind),0 }, 550 { "jmp", true, NONE, op1(Eind),0 },
550 { "ljmp", true, NONE, op1(Eind),0 }, 551 { "ljmp", true, NONE, op1(Eind),0 },
551 { "push", true, LONG, op1(E), 0 }, 552 { "push", true, LONG, op1(E), 0 },
552 { "", true, NONE, 0, 0 } 553 { "", true, NONE, 0, 0 }
553}; 554};
554 555
555const struct inst db_inst_table[256] = { 556const struct inst db_inst_table[256] = {
556/*00*/ { "add", true, BYTE, op2(R, E), 0 }, 557/*00*/ { "add", true, BYTE, op2(R, E), 0 },
557/*01*/ { "add", true, LONG, op2(R, E), 0 }, 558/*01*/ { "add", true, LONG, op2(R, E), 0 },
558/*02*/ { "add", true, BYTE, op2(E, R), 0 }, 559/*02*/ { "add", true, BYTE, op2(E, R), 0 },
559/*03*/ { "add", true, LONG, op2(E, R), 0 }, 560/*03*/ { "add", true, LONG, op2(E, R), 0 },
560/*04*/ { "add", false, BYTE, op2(Is, A), 0 }, 561/*04*/ { "add", false, BYTE, op2(Is, A), 0 },
561/*05*/ { "add", false, LONG, op2(Is, A), 0 }, 562/*05*/ { "add", false, LONG, op2(Is, A), 0 },
562/*06*/ { "push", false, NONE, op1(Si), 0 }, 563/*06*/ { "push", false, NONE, op1(Si), 0 },
563/*07*/ { "pop", false, NONE, op1(Si), 0 }, 564/*07*/ { "pop", false, NONE, op1(Si), 0 },
564 565
565/*08*/ { "or", true, BYTE, op2(R, E), 0 }, 566/*08*/ { "or", true, BYTE, op2(R, E), 0 },
@@ -586,45 +587,45 @@ const struct inst db_inst_table[256] = { @@ -586,45 +587,45 @@ const struct inst db_inst_table[256] = {
586/*1b*/ { "sbb", true, LONG, op2(E, R), 0 }, 587/*1b*/ { "sbb", true, LONG, op2(E, R), 0 },
587/*1c*/ { "sbb", false, BYTE, op2(Is, A), 0 }, 588/*1c*/ { "sbb", false, BYTE, op2(Is, A), 0 },
588/*1d*/ { "sbb", false, LONG, op2(Is, A), 0 }, 589/*1d*/ { "sbb", false, LONG, op2(Is, A), 0 },
589/*1e*/ { "push", false, NONE, op1(Si), 0 }, 590/*1e*/ { "push", false, NONE, op1(Si), 0 },
590/*1f*/ { "pop", false, NONE, op1(Si), 0 }, 591/*1f*/ { "pop", false, NONE, op1(Si), 0 },
591 592
592/*20*/ { "and", true, BYTE, op2(R, E), 0 }, 593/*20*/ { "and", true, BYTE, op2(R, E), 0 },
593/*21*/ { "and", true, LONG, op2(R, E), 0 }, 594/*21*/ { "and", true, LONG, op2(R, E), 0 },
594/*22*/ { "and", true, BYTE, op2(E, R), 0 }, 595/*22*/ { "and", true, BYTE, op2(E, R), 0 },
595/*23*/ { "and", true, LONG, op2(E, R), 0 }, 596/*23*/ { "and", true, LONG, op2(E, R), 0 },
596/*24*/ { "and", false, BYTE, op2(I, A), 0 }, 597/*24*/ { "and", false, BYTE, op2(I, A), 0 },
597/*25*/ { "and", false, LONG, op2(I, A), 0 }, 598/*25*/ { "and", false, LONG, op2(I, A), 0 },
598/*26*/ { "", false, NONE, 0, 0 }, 599/*26*/ { "", false, NONE, 0, 0 },
599/*27*/ { "aaa", false, NONE, 0, 0 }, 600/*27*/ { "daa", false, NONE, 0, 0 },
600 601
601/*28*/ { "sub", true, BYTE, op2(R, E), 0 }, 602/*28*/ { "sub", true, BYTE, op2(R, E), 0 },
602/*29*/ { "sub", true, LONG, op2(R, E), 0 }, 603/*29*/ { "sub", true, LONG, op2(R, E), 0 },
603/*2a*/ { "sub", true, BYTE, op2(E, R), 0 }, 604/*2a*/ { "sub", true, BYTE, op2(E, R), 0 },
604/*2b*/ { "sub", true, LONG, op2(E, R), 0 }, 605/*2b*/ { "sub", true, LONG, op2(E, R), 0 },
605/*2c*/ { "sub", false, BYTE, op2(Is, A), 0 }, 606/*2c*/ { "sub", false, BYTE, op2(Is, A), 0 },
606/*2d*/ { "sub", false, LONG, op2(Is, A), 0 }, 607/*2d*/ { "sub", false, LONG, op2(Is, A), 0 },
607/*2e*/ { "", false, NONE, 0, 0 }, 608/*2e*/ { "", false, NONE, 0, 0 },
608/*2f*/ { "das", false, NONE, 0, 0 }, 609/*2f*/ { "das", false, NONE, 0, 0 },
609 610
610/*30*/ { "xor", true, BYTE, op2(R, E), 0 }, 611/*30*/ { "xor", true, BYTE, op2(R, E), 0 },
611/*31*/ { "xor", true, LONG, op2(R, E), 0 }, 612/*31*/ { "xor", true, LONG, op2(R, E), 0 },
612/*32*/ { "xor", true, BYTE, op2(E, R), 0 }, 613/*32*/ { "xor", true, BYTE, op2(E, R), 0 },
613/*33*/ { "xor", true, LONG, op2(E, R), 0 }, 614/*33*/ { "xor", true, LONG, op2(E, R), 0 },
614/*34*/ { "xor", false, BYTE, op2(I, A), 0 }, 615/*34*/ { "xor", false, BYTE, op2(I, A), 0 },
615/*35*/ { "xor", false, LONG, op2(I, A), 0 }, 616/*35*/ { "xor", false, LONG, op2(I, A), 0 },
616/*36*/ { "", false, NONE, 0, 0 }, 617/*36*/ { "", false, NONE, 0, 0 },
617/*37*/ { "daa", false, NONE, 0, 0 }, 618/*37*/ { "aaa", false, NONE, 0, 0 },
618 619
619/*38*/ { "cmp", true, BYTE, op2(R, E), 0 }, 620/*38*/ { "cmp", true, BYTE, op2(R, E), 0 },
620/*39*/ { "cmp", true, LONG, op2(R, E), 0 }, 621/*39*/ { "cmp", true, LONG, op2(R, E), 0 },
621/*3a*/ { "cmp", true, BYTE, op2(E, R), 0 }, 622/*3a*/ { "cmp", true, BYTE, op2(E, R), 0 },
622/*3b*/ { "cmp", true, LONG, op2(E, R), 0 }, 623/*3b*/ { "cmp", true, LONG, op2(E, R), 0 },
623/*3c*/ { "cmp", false, BYTE, op2(Is, A), 0 }, 624/*3c*/ { "cmp", false, BYTE, op2(Is, A), 0 },
624/*3d*/ { "cmp", false, LONG, op2(Is, A), 0 }, 625/*3d*/ { "cmp", false, LONG, op2(Is, A), 0 },
625/*3e*/ { "", false, NONE, 0, 0 }, 626/*3e*/ { "", false, NONE, 0, 0 },
626/*3f*/ { "aas", false, NONE, 0, 0 }, 627/*3f*/ { "aas", false, NONE, 0, 0 },
627 628
628/*40*/ { "inc", false, LONG, op1(Ri), 0 }, 629/*40*/ { "inc", false, LONG, op1(Ri), 0 },
629/*41*/ { "inc", false, LONG, op1(Ri), 0 }, 630/*41*/ { "inc", false, LONG, op1(Ri), 0 },
630/*42*/ { "inc", false, LONG, op1(Ri), 0 }, 631/*42*/ { "inc", false, LONG, op1(Ri), 0 },
@@ -692,30 +693,30 @@ const struct inst db_inst_table[256] = { @@ -692,30 +693,30 @@ const struct inst db_inst_table[256] = {
692/*75*/ { "jnz", false, NONE, op1(Db), 0 }, 693/*75*/ { "jnz", false, NONE, op1(Db), 0 },
693/*76*/ { "jbe", false, NONE, op1(Db), 0 }, 694/*76*/ { "jbe", false, NONE, op1(Db), 0 },
694/*77*/ { "jnbe", false, NONE, op1(Db), 0 }, 695/*77*/ { "jnbe", false, NONE, op1(Db), 0 },
695 696
696/*78*/ { "js", false, NONE, op1(Db), 0 }, 697/*78*/ { "js", false, NONE, op1(Db), 0 },
697/*79*/ { "jns", false, NONE, op1(Db), 0 }, 698/*79*/ { "jns", false, NONE, op1(Db), 0 },
698/*7a*/ { "jp", false, NONE, op1(Db), 0 }, 699/*7a*/ { "jp", false, NONE, op1(Db), 0 },
699/*7b*/ { "jnp", false, NONE, op1(Db), 0 }, 700/*7b*/ { "jnp", false, NONE, op1(Db), 0 },
700/*7c*/ { "jl", false, NONE, op1(Db), 0 }, 701/*7c*/ { "jl", false, NONE, op1(Db), 0 },
701/*7d*/ { "jnl", false, NONE, op1(Db), 0 }, 702/*7d*/ { "jnl", false, NONE, op1(Db), 0 },
702/*7e*/ { "jle", false, NONE, op1(Db), 0 }, 703/*7e*/ { "jle", false, NONE, op1(Db), 0 },
703/*7f*/ { "jnle", false, NONE, op1(Db), 0 }, 704/*7f*/ { "jnle", false, NONE, op1(Db), 0 },
704 705
705/*80*/ { "", true, BYTE, op2(I, E), (const char *)db_Grp1 }, 706/*80*/ { "", true, BYTE, op2(I, E), db_Grp1 },
706/*81*/ { "", true, LONG, op2(I, E), (const char *)db_Grp1 }, 707/*81*/ { "", true, LONG, op2(I, E), db_Grp1 },
707/*82*/ { "", true, BYTE, op2(Is,E), (const char *)db_Grp1 }, 708/*82*/ { "", true, BYTE, op2(Is,E), db_Grp1 },
708/*83*/ { "", true, LONG, op2(Ibs,E), (const char *)db_Grp1 }, 709/*83*/ { "", true, LONG, op2(Ibs,E), db_Grp1 },
709/*84*/ { "test", true, BYTE, op2(R, E), 0 }, 710/*84*/ { "test", true, BYTE, op2(R, E), 0 },
710/*85*/ { "test", true, LONG, op2(R, E), 0 }, 711/*85*/ { "test", true, LONG, op2(R, E), 0 },
711/*86*/ { "xchg", true, BYTE, op2(R, E), 0 }, 712/*86*/ { "xchg", true, BYTE, op2(R, E), 0 },
712/*87*/ { "xchg", true, LONG, op2(R, E), 0 }, 713/*87*/ { "xchg", true, LONG, op2(R, E), 0 },
713 714
714/*88*/ { "mov", true, BYTE, op2(R, E), 0 }, 715/*88*/ { "mov", true, BYTE, op2(R, E), 0 },
715/*89*/ { "mov", true, LONG, op2(R, E), 0 }, 716/*89*/ { "mov", true, LONG, op2(R, E), 0 },
716/*8a*/ { "mov", true, BYTE, op2(E, R), 0 }, 717/*8a*/ { "mov", true, BYTE, op2(E, R), 0 },
717/*8b*/ { "mov", true, LONG, op2(E, R), 0 }, 718/*8b*/ { "mov", true, LONG, op2(E, R), 0 },
718/*8c*/ { "mov", true, NONE, op2(S, Ew), 0 }, 719/*8c*/ { "mov", true, NONE, op2(S, Ew), 0 },
719/*8d*/ { "lea", true, LONG, op2(E, R), 0 }, 720/*8d*/ { "lea", true, LONG, op2(E, R), 0 },
720/*8e*/ { "mov", true, NONE, op2(Ew, S), 0 }, 721/*8e*/ { "mov", true, NONE, op2(Ew, S), 0 },
721/*8f*/ { "pop", true, LONG, op1(E), 0 }, 722/*8f*/ { "pop", true, LONG, op1(E), 0 },
@@ -764,100 +765,100 @@ const struct inst db_inst_table[256] = { @@ -764,100 +765,100 @@ const struct inst db_inst_table[256] = {
764/*b5*/ { "mov", false, BYTE, op2(I, Ri), 0 }, 765/*b5*/ { "mov", false, BYTE, op2(I, Ri), 0 },
765/*b6*/ { "mov", false, BYTE, op2(I, Ri), 0 }, 766/*b6*/ { "mov", false, BYTE, op2(I, Ri), 0 },
766/*b7*/ { "mov", false, BYTE, op2(I, Ri), 0 }, 767/*b7*/ { "mov", false, BYTE, op2(I, Ri), 0 },
767 768
768/*b8*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 769/*b8*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
769/*b9*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 770/*b9*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
770/*ba*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 771/*ba*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
771/*bb*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 772/*bb*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
772/*bc*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 773/*bc*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
773/*bd*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 774/*bd*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
774/*be*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 775/*be*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
775/*bf*/ { "mov", false, LONG, op2(Iq, Ri), 0 }, 776/*bf*/ { "mov", false, LONG, op2(Iq, Ri), 0 },
776 777
777/*c0*/ { "", true, BYTE, op2(Ib, E), (const char *)db_Grp2 }, 778/*c0*/ { "", true, BYTE, op2(Ib, E), db_Grp2 },
778/*c1*/ { "", true, LONG, op2(Ib, E), (const char *)db_Grp2 }, 779/*c1*/ { "", true, LONG, op2(Ib, E), db_Grp2 },
779/*c2*/ { "ret", false, NONE, op1(Iw), 0 }, 780/*c2*/ { "ret", false, NONE, op1(Iw), 0 },
780/*c3*/ { "ret", false, NONE, 0, 0 }, 781/*c3*/ { "ret", false, NONE, 0, 0 },
781/*c4*/ { "les", true, LONG, op2(E, R), 0 }, 782/*c4*/ { "les", true, LONG, op2(E, R), 0 },
782/*c5*/ { "lds", true, LONG, op2(E, R), 0 }, 783/*c5*/ { "lds", true, LONG, op2(E, R), 0 },
783/*c6*/ { "mov", true, BYTE, op2(I, E), 0 }, 784/*c6*/ { "mov", true, BYTE, op2(I, E), 0 },
784/*c7*/ { "mov", true, LONG, op2(I, E), 0 }, 785/*c7*/ { "mov", true, LONG, op2(I, E), 0 },
785 786
786/*c8*/ { "enter", false, NONE, op2(Ib, Iw), 0 }, 787/*c8*/ { "enter", false, NONE, op2(Ib, Iw), 0 },
787/*c9*/ { "leave", false, NONE, 0, 0 }, 788/*c9*/ { "leave", false, NONE, 0, 0 },
788/*ca*/ { "lret", false, NONE, op1(Iw), 0 }, 789/*ca*/ { "lret", false, NONE, op1(Iw), 0 },
789/*cb*/ { "lret", false, NONE, 0, 0 }, 790/*cb*/ { "lret", false, NONE, 0, 0 },
790/*cc*/ { "int", false, NONE, op1(o3), 0 }, 791/*cc*/ { "int", false, NONE, op1(o3), 0 },
791/*cd*/ { "int", false, NONE, op1(Ib), 0 }, 792/*cd*/ { "int", false, NONE, op1(Ib), 0 },
792/*ce*/ { "into", false, NONE, 0, 0 }, 793/*ce*/ { "into", false, NONE, 0, 0 },
793/*cf*/ { "iret", false, NONE, 0, 0 }, 794/*cf*/ { "iret", false, NONE, 0, 0 },
794 795
795/*d0*/ { "", true, BYTE, op2(o1, E), (const char *)db_Grp2 }, 796/*d0*/ { "", true, BYTE, op2(o1, E), db_Grp2 },
796/*d1*/ { "", true, LONG, op2(o1, E), (const char *)db_Grp2 }, 797/*d1*/ { "", true, LONG, op2(o1, E), db_Grp2 },
797/*d2*/ { "", true, BYTE, op2(CL, E), (const char *)db_Grp2 }, 798/*d2*/ { "", true, BYTE, op2(CL, E), db_Grp2 },
798/*d3*/ { "", true, LONG, op2(CL, E), (const char *)db_Grp2 }, 799/*d3*/ { "", true, LONG, op2(CL, E), db_Grp2 },
799/*d4*/ { "aam", true, NONE, 0, 0 }, 800/*d4*/ { "aam", true, NONE, 0, 0 },
800/*d5*/ { "aad", true, NONE, 0, 0 }, 801/*d5*/ { "aad", true, NONE, 0, 0 },
801/*d6*/ { "", false, NONE, 0, 0 }, 802/*d6*/ { "", false, NONE, 0, 0 },
802/*d7*/ { "xlat", false, BYTE, op1(BX), 0 }, 803/*d7*/ { "xlat", false, BYTE, op1(BX), 0 },
803 804
804/*d8*/ { "", true, NONE, 0, (const char *)db_Esc8 }, 805/*d8*/ { "", true, NONE, 0, db_Esc8 },
805/*d9*/ { "", true, NONE, 0, (const char *)db_Esc9 }, 806/*d9*/ { "", true, NONE, 0, db_Esc9 },
806/*da*/ { "", true, NONE, 0, (const char *)db_Esca }, 807/*da*/ { "", true, NONE, 0, db_Esca },
807/*db*/ { "", true, NONE, 0, (const char *)db_Escb }, 808/*db*/ { "", true, NONE, 0, db_Escb },
808/*dc*/ { "", true, NONE, 0, (const char *)db_Escc }, 809/*dc*/ { "", true, NONE, 0, db_Escc },
809/*dd*/ { "", true, NONE, 0, (const char *)db_Escd }, 810/*dd*/ { "", true, NONE, 0, db_Escd },
810/*de*/ { "", true, NONE, 0, (const char *)db_Esce }, 811/*de*/ { "", true, NONE, 0, db_Esce },
811/*df*/ { "", true, NONE, 0, (const char *)db_Escf }, 812/*df*/ { "", true, NONE, 0, db_Escf },
812 813
813/*e0*/ { "loopne",false, NONE, op1(Db), 0 }, 814/*e0*/ { "loopne",false, NONE, op1(Db), 0 },
814/*e1*/ { "loope", false, NONE, op1(Db), 0 }, 815/*e1*/ { "loope", false, NONE, op1(Db), 0 },
815/*e2*/ { "loop", false, NONE, op1(Db), 0 }, 816/*e2*/ { "loop", false, NONE, op1(Db), 0 },
816/*e3*/ { "jcxz", false, SDEP, op1(Db), "jecxz" }, 817/*e3*/ { "jcxz", false, SDEP, op1(Db), "jecxz" },
817/*e4*/ { "in", false, BYTE, op2(Ib, A), 0 }, 818/*e4*/ { "in", false, BYTE, op2(Ib, A), 0 },
818/*e5*/ { "in", false, LONG, op2(Ib, A) , 0 }, 819/*e5*/ { "in", false, LONG, op2(Ib, A) , 0 },
819/*e6*/ { "out", false, BYTE, op2(A, Ib), 0 }, 820/*e6*/ { "out", false, BYTE, op2(A, Ib), 0 },
820/*e7*/ { "out", false, LONG, op2(A, Ib) , 0 }, 821/*e7*/ { "out", false, LONG, op2(A, Ib) , 0 },
821 822
822/*e8*/ { "call", false, NONE, op1(Dl), 0 }, 823/*e8*/ { "call", false, NONE, op1(Dl), 0 },
823/*e9*/ { "jmp", false, NONE, op1(Dl), 0 }, 824/*e9*/ { "jmp", false, NONE, op1(Dl), 0 },
824/*ea*/ { "ljmp", false, NONE, op1(OS), 0 }, 825/*ea*/ { "ljmp", false, NONE, op1(OS), 0 },
825/*eb*/ { "jmp", false, NONE, op1(Db), 0 }, 826/*eb*/ { "jmp", false, NONE, op1(Db), 0 },
826/*ec*/ { "in", false, BYTE, op2(DX, A), 0 }, 827/*ec*/ { "in", false, BYTE, op2(DX, A), 0 },
827/*ed*/ { "in", false, LONG, op2(DX, A) , 0 }, 828/*ed*/ { "in", false, LONG, op2(DX, A) , 0 },
828/*ee*/ { "out", false, BYTE, op2(A, DX), 0 }, 829/*ee*/ { "out", false, BYTE, op2(A, DX), 0 },
829/*ef*/ { "out", false, LONG, op2(A, DX) , 0 }, 830/*ef*/ { "out", false, LONG, op2(A, DX) , 0 },
830 831
831/*f0*/ { "", false, NONE, 0, 0 }, 832/*f0*/ { "", false, NONE, 0, 0 },
832/*f1*/ { "", false, NONE, 0, 0 }, 833/*f1*/ { "", false, NONE, 0, 0 },
833/*f2*/ { "", false, NONE, 0, 0 }, 834/*f2*/ { "", false, NONE, 0, 0 },
834/*f3*/ { "", false, NONE, 0, 0 }, 835/*f3*/ { "", false, NONE, 0, 0 },
835/*f4*/ { "hlt", false, NONE, 0, 0 }, 836/*f4*/ { "hlt", false, NONE, 0, 0 },
836/*f5*/ { "cmc", false, NONE, 0, 0 }, 837/*f5*/ { "cmc", false, NONE, 0, 0 },
837/*f6*/ { "", true, BYTE, 0, (const char *)db_Grp3 }, 838/*f6*/ { "", true, BYTE, 0, db_Grp3 },
838/*f7*/ { "", true, LONG, 0, (const char *)db_Grp3 }, 839/*f7*/ { "", true, LONG, 0, db_Grp3 },
839 840
840/*f8*/ { "clc", false, NONE, 0, 0 }, 841/*f8*/ { "clc", false, NONE, 0, 0 },
841/*f9*/ { "stc", false, NONE, 0, 0 }, 842/*f9*/ { "stc", false, NONE, 0, 0 },
842/*fa*/ { "cli", false, NONE, 0, 0 }, 843/*fa*/ { "cli", false, NONE, 0, 0 },
843/*fb*/ { "sti", false, NONE, 0, 0 }, 844/*fb*/ { "sti", false, NONE, 0, 0 },
844/*fc*/ { "cld", false, NONE, 0, 0 }, 845/*fc*/ { "cld", false, NONE, 0, 0 },
845/*fd*/ { "std", false, NONE, 0, 0 }, 846/*fd*/ { "std", false, NONE, 0, 0 },
846/*fe*/ { "", true, NONE, 0, (const char *)db_Grp4 }, 847/*fe*/ { "", true, NONE, 0, db_Grp4 },
847/*ff*/ { "", true, NONE, 0, (const char *)db_Grp5 }, 848/*ff*/ { "", true, NONE, 0, db_Grp5 },
848}; 849};
849 850
850const struct inst db_bad_inst = 851const struct inst db_bad_inst =
851 { "???", false, NONE, 0, 0 } 852 { "???", false, NONE, 0, 0 }
852; 853;
853 854
854#define f_mod(byte) ((byte)>>6) 855#define f_mod(byte) ((byte)>>6)
855#define f_reg(byte) (((byte)>>3)&0x7) 856#define f_reg(byte) (((byte)>>3)&0x7)
856#define f_rm(byte) ((byte)&0x7) 857#define f_rm(byte) ((byte)&0x7)
857 858
858#define sib_ss(byte) ((byte)>>6) 859#define sib_ss(byte) ((byte)>>6)
859#define sib_index(byte) (((byte)>>3)&0x7) 860#define sib_index(byte) (((byte)>>3)&0x7)
860#define sib_base(byte) ((byte)&0x7) 861#define sib_base(byte) ((byte)&0x7)
861 862
862struct i_addr { 863struct i_addr {
863 int is_reg; /* if reg, reg number is in 'disp' */ 864 int is_reg; /* if reg, reg number is in 'disp' */
@@ -952,27 +953,28 @@ const char * const rex_str[0x10] = { @@ -952,27 +953,28 @@ const char * const rex_str[0x10] = {
952 result = db_get_value((loc), (size), (is_signed)); \ 953 result = db_get_value((loc), (size), (is_signed)); \
953 (loc) += (size); \ 954 (loc) += (size); \
954 } while (0) 955 } while (0)
955 956
956 957
957db_addr_t db_read_address(db_addr_t, u_int, int, int, struct i_addr *); 958db_addr_t db_read_address(db_addr_t, u_int, int, int, struct i_addr *);
958void db_print_address(const char *, u_int, int, struct i_addr *); 959void db_print_address(const char *, u_int, int, struct i_addr *);
959db_addr_t db_disasm_esc(db_addr_t, int, u_int, int, int, const char *); 960db_addr_t db_disasm_esc(db_addr_t, int, u_int, int, int, const char *);
960 961
961/* 962/*
962 * Read address at location and return updated location. 963 * Read address at location and return updated location.
963 */ 964 */
964db_addr_t 965db_addr_t
965db_read_address(db_addr_t loc, u_int rex, int short_addr, int regmodrm, struct i_addr *addrp) 966db_read_address(db_addr_t loc, u_int rex, int short_addr, int regmodrm,
 967 struct i_addr *addrp)
966 /* addrp: out */ 968 /* addrp: out */
967{ 969{
968 int mod, rm, sib, index, disp, ext; 970 int mod, rm, sib, index, disp, ext;
969 971
970 mod = f_mod(regmodrm); 972 mod = f_mod(regmodrm);
971 rm = f_rm(regmodrm); 973 rm = f_rm(regmodrm);
972 974
973 if (mod == 3) { 975 if (mod == 3) {
974 addrp->is_reg = true; 976 addrp->is_reg = true;
975 addrp->disp = rm; 977 addrp->disp = rm;
976 return (loc); 978 return (loc);
977 } 979 }
978 addrp->is_reg = false; 980 addrp->is_reg = false;
@@ -982,77 +984,77 @@ db_read_address(db_addr_t loc, u_int rex @@ -982,77 +984,77 @@ db_read_address(db_addr_t loc, u_int rex
982 /* x86_64 32 bit address mode */ 984 /* x86_64 32 bit address mode */
983 if (mod != 3 && rm == 4) { 985 if (mod != 3 && rm == 4) {
984 ext = ((rex & REX_x) != 0); 986 ext = ((rex & REX_x) != 0);
985 get_value_inc(sib, loc, 1, false); 987 get_value_inc(sib, loc, 1, false);
986 rm = sib_base(sib); 988 rm = sib_base(sib);
987 index = sib_index(sib); 989 index = sib_index(sib);
988 if (index != 4) 990 if (index != 4)
989 addrp->index = db_reg[ext][LONG][index]; 991 addrp->index = db_reg[ext][LONG][index];
990 addrp->ss = sib_ss(sib); 992 addrp->ss = sib_ss(sib);
991 } 993 }
992 994
993 ext = ((rex & REX_b) != 0); 995 ext = ((rex & REX_b) != 0);
994 switch (mod) { 996 switch (mod) {
995 case 0: 997 case 0:
996 if (rm == 5) { 998 if (rm == 5) {
997 get_value_inc(addrp->disp, loc, 4, false); 999 get_value_inc(addrp->disp, loc, 4, false);
998 addrp->base = 0; 1000 addrp->base = 0;
999 } else { 1001 } else {
1000 addrp->disp = 0; 1002 addrp->disp = 0;
1001 addrp->base = db_reg[ext][LONG][rm]; 1003 addrp->base = db_reg[ext][LONG][rm];
1002 } 1004 }
1003 break; 1005 break;
1004 case 1: 1006 case 1:
1005 get_value_inc(disp, loc, 1, true); 1007 get_value_inc(disp, loc, 1, true);
1006 addrp->disp = disp; 1008 addrp->disp = disp;
1007 addrp->base = db_reg[ext][LONG][rm]; 1009 addrp->base = db_reg[ext][LONG][rm];
1008 break; 1010 break;
1009 case 2: 1011 case 2:
1010 get_value_inc(disp, loc, 4, false); 1012 get_value_inc(disp, loc, 4, false);
1011 addrp->disp = disp; 1013 addrp->disp = disp;
1012 addrp->base = db_reg[ext][LONG][rm]; 1014 addrp->base = db_reg[ext][LONG][rm];
1013 break; 1015 break;
1014 } 1016 }
1015 } else { 1017 } else {
1016 /* x86_64 64 bit address mode */ 1018 /* x86_64 64 bit address mode */
1017 1019
1018 if (mod != 3 && rm == 4) { 1020 if (mod != 3 && rm == 4) {
1019 ext = ((rex & REX_x) != 0); 1021 ext = ((rex & REX_x) != 0);
1020 get_value_inc(sib, loc, 1, false); 1022 get_value_inc(sib, loc, 1, false);
1021 rm = sib_base(sib); 1023 rm = sib_base(sib);
1022 index = sib_index(sib); 1024 index = sib_index(sib);
1023 if (index != 4) 1025 if (index != 4)
1024 addrp->index = db_reg[ext][QUAD][index]; 1026 addrp->index = db_reg[ext][QUAD][index];
1025 addrp->ss = sib_ss(sib); 1027 addrp->ss = sib_ss(sib);
1026 } 1028 }
1027 1029
1028 ext = ((rex & REX_b) != 0); 1030 ext = ((rex & REX_b) != 0);
1029 switch (mod) { 1031 switch (mod) {
1030 case 0: 1032 case 0:
1031 if (rm == 5) { 1033 if (rm == 5) {
1032 /* x86_64 RIP-relative addressing */ 1034 /* x86_64 RIP-relative addressing */
1033 get_value_inc(addrp->disp, loc, 4, false); 1035 get_value_inc(addrp->disp, loc, 4, false);
1034 addrp->base = "%rip"; 1036 addrp->base = "%rip";
1035 } else { 1037 } else {
1036 addrp->disp = 0; 1038 addrp->disp = 0;
1037 addrp->base = db_reg[ext][QUAD][rm]; 1039 addrp->base = db_reg[ext][QUAD][rm];
1038 } 1040 }
1039 break; 1041 break;
1040 case 1: 1042 case 1:
1041 get_value_inc(disp, loc, 1, true); 1043 get_value_inc(disp, loc, 1, true);
1042 addrp->disp = disp; 1044 addrp->disp = disp;
1043 addrp->base = db_reg[ext][QUAD][rm]; 1045 addrp->base = db_reg[ext][QUAD][rm];
1044 break; 1046 break;
1045 case 2: 1047 case 2:
1046 get_value_inc(disp, loc, 4, false); 1048 get_value_inc(disp, loc, 4, false);
1047 addrp->disp = disp; 1049 addrp->disp = disp;
1048 addrp->base = db_reg[ext][QUAD][rm]; 1050 addrp->base = db_reg[ext][QUAD][rm];
1049 break; 1051 break;
1050 } 1052 }
1051 } 1053 }
1052 return (loc); 1054 return (loc);
1053} 1055}
1054 1056
1055void 1057void
1056db_print_address(const char * seg, u_int rex, int size, struct i_addr *addrp) 1058db_print_address(const char * seg, u_int rex, int size, struct i_addr *addrp)
1057{ 1059{
1058 if (addrp->is_reg) { 1060 if (addrp->is_reg) {
@@ -1071,196 +1073,197 @@ db_print_address(const char * seg, u_int @@ -1071,196 +1073,197 @@ db_print_address(const char * seg, u_int
1071 if (addrp->base) 1073 if (addrp->base)
1072 db_printf("%s", addrp->base); 1074 db_printf("%s", addrp->base);
1073 if (addrp->index) 1075 if (addrp->index)
1074 db_printf(",%s,%d", addrp->index, 1<<addrp->ss); 1076 db_printf(",%s,%d", addrp->index, 1<<addrp->ss);
1075 db_printf(")"); 1077 db_printf(")");
1076 } 1078 }
1077} 1079}
1078 1080
1079/* 1081/*
1080 * Disassemble floating-point ("escape") instruction 1082 * Disassemble floating-point ("escape") instruction
1081 * and return updated location. 1083 * and return updated location.
1082 */ 1084 */
1083db_addr_t 1085db_addr_t
1084db_disasm_esc(db_addr_t loc, int inst, u_int rex, int short_addr, int size, const char * seg) 1086db_disasm_esc(db_addr_t loc, int inst, u_int rex, int short_addr, int size,
 1087 const char * seg)
1085{ 1088{
1086 int regmodrm; 1089 int regmodrm;
1087 const struct finst *fp; 1090 const struct finst *fp;
1088 int mod; 1091 int mod;
1089 struct i_addr address; 1092 struct i_addr address;
1090 const char * name; 1093 const char * name;
1091 1094
1092 get_value_inc(regmodrm, loc, 1, false); 1095 get_value_inc(regmodrm, loc, 1, false);
1093 fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)]; 1096 fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)];
1094 mod = f_mod(regmodrm); 1097 mod = f_mod(regmodrm);
1095 if (mod != 3) { 1098 if (mod != 3) {
1096 /* 1099 /*
1097 * Normal address modes. 1100 * Normal address modes.
1098 */ 1101 */
1099 loc = db_read_address(loc, rex, short_addr, regmodrm, &address); 1102 loc = db_read_address(loc, rex, short_addr, regmodrm, &address);
1100 db_printf("%s", fp->f_name); 1103 db_printf("%s", fp->f_name);
1101 switch(fp->f_size) { 1104 switch (fp->f_size) {
1102 case SNGL: 1105 case SNGL:
1103 db_printf("s"); 1106 db_printf("s");
1104 break; 1107 break;
1105 case DBLR: 1108 case DBLR:
1106 db_printf("l"); 1109 db_printf("l");
1107 break; 1110 break;
1108 case EXTR: 1111 case EXTR:
1109 db_printf("t"); 1112 db_printf("t");
1110 break; 1113 break;
1111 case WORD: 1114 case WORD:
1112 db_printf("s"); 1115 db_printf("s");
1113 break; 1116 break;
1114 case LONG: 1117 case LONG:
1115 db_printf("l"); 1118 db_printf("l");
1116 break; 1119 break;
1117 case QUAD: 1120 case QUAD:
1118 db_printf("q"); 1121 db_printf("q");
1119 break; 1122 break;
1120 default: 1123 default:
1121 break; 1124 break;
1122 } 1125 }
1123 db_printf("\t"); 1126 db_printf("\t");
1124 db_print_address(seg, rex, BYTE, &address); 1127 db_print_address(seg, rex, BYTE, &address);
1125 } else { 1128 } else {
1126 /* 1129 /*
1127 * 'reg-reg' - special formats 1130 * 'reg-reg' - special formats
1128 */ 1131 */
1129 switch (fp->f_rrmode) { 1132 switch (fp->f_rrmode) {
1130 case op2(ST,STI): 1133 case op2(ST,STI):
1131 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name; 1134 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1132 db_printf("%s\t%%st,%%st(%d)",name,f_rm(regmodrm)); 1135 db_printf("%s\t%%st,%%st(%d)", name, f_rm(regmodrm));
1133 break; 1136 break;
1134 case op2(STI,ST): 1137 case op2(STI,ST):
1135 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name; 1138 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1136 db_printf("%s\t%%st(%d),%%st",name, f_rm(regmodrm)); 1139 db_printf("%s\t%%st(%d),%%st", name, f_rm(regmodrm));
1137 break; 1140 break;
1138 case op1(STI): 1141 case op1(STI):
1139 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name; 1142 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1140 db_printf("%s\t%%st(%d)",name, f_rm(regmodrm)); 1143 db_printf("%s\t%%st(%d)", name, f_rm(regmodrm));
1141 break; 1144 break;
1142 case op1(X): 1145 case op1(X):
1143 db_printf("%s", ((const char * const *)fp->f_rrname)[f_rm(regmodrm)]); 1146 db_printf("%s", ((const char * const *)fp->f_rrname)[f_rm(regmodrm)]);
1144 break; 1147 break;
1145 case op1(XA): 1148 case op1(XA):
1146 db_printf("%s\t%%ax", 1149 db_printf("%s\t%%ax",
1147 ((const char * const *)fp->f_rrname)[f_rm(regmodrm)]); 1150 ((const char * const *)fp->f_rrname)[f_rm(regmodrm)]);
1148 break; 1151 break;
1149 default: 1152 default:
1150 db_printf("<bad instruction>"); 1153 db_printf("<bad instruction>");
1151 break; 1154 break;
1152 } 1155 }
1153 } 1156 }
1154 1157
1155 return (loc); 1158 return (loc);
1156} 1159}
1157 1160
1158/* 1161/*
1159 * Disassemble instruction at 'loc'. 'altfmt' specifies an 1162 * Disassemble instruction at 'loc'. 'altfmt' specifies an
1160 * (optional) alternate format. Return address of start of 1163 * (optional) alternate format. Return address of start of
1161 * next instruction. 1164 * next instruction.
1162 */ 1165 */
1163db_addr_t 1166db_addr_t
1164db_disasm(db_addr_t loc, bool altfmt) 1167db_disasm(db_addr_t loc, bool altfmt)
1165{ 1168{
1166 int inst; 1169 int inst;
1167 int size; 1170 int size;
1168 int short_addr; 1171 int short_addr;
1169 const char * seg; 1172 const char *seg;
1170 const struct inst * ip; 1173 const struct inst *ip;
1171 const char * i_name; 1174 const char *i_name;
1172 int i_size; 1175 int i_size;
1173 int i_mode; 1176 int i_mode;
1174 int regmodrm = 0; 1177 int regmodrm = 0;
1175 bool first; 1178 bool first;
1176 int displ; 1179 int displ;
1177 int prefix; 1180 int prefix;
1178 int imm; 1181 int imm;
1179 int imm2; 1182 int imm2;
1180 uint64_t imm64; 1183 uint64_t imm64;
1181 int len; 1184 int len;
1182 struct i_addr address; 1185 struct i_addr address;
1183#ifdef _KERNEL 1186#ifdef _KERNEL
1184 pt_entry_t *pte, *pde; 1187 pt_entry_t *pte, *pde;
1185#endif 1188#endif
1186 u_int rex = 0; 1189 u_int rex = 0;
1187 1190
1188#ifdef _KERNEL 1191#ifdef _KERNEL
1189 /* 1192 /*
1190 * Don't try to disassemble the location if the mapping is invalid. 1193 * Don't try to disassemble the location if the mapping is invalid.
1191 * If we do, we'll fault, and end up debugging the debugger! 1194 * If we do, we'll fault, and end up debugging the debugger!
1192 * in the case of largepages, "pte" is really the pde and "pde" is 1195 * in the case of largepages, "pte" is really the pde and "pde" is
1193 * really the entry for the pdp itself. 1196 * really the entry for the pdp itself.
1194 */ 1197 */
1195 if ((vaddr_t)loc >= VM_MIN_KERNEL_ADDRESS) 1198 if ((vaddr_t)loc >= VM_MIN_KERNEL_ADDRESS)
1196 pte = kvtopte((vaddr_t)loc); 1199 pte = kvtopte((vaddr_t)loc);
1197 else 1200 else
1198 pte = vtopte((vaddr_t)loc); 1201 pte = vtopte((vaddr_t)loc);
1199 pde = vtopte((vaddr_t)pte); 1202 pde = vtopte((vaddr_t)pte);
1200 if ((*pde & PG_V) == 0 || (*pte & PG_V) == 0) { 1203 if ((*pde & PG_V) == 0 || (*pte & PG_V) == 0) {
1201 db_printf("invalid address\n"); 1204 db_printf("invalid address\n");
1202 return (loc); 1205 return (loc);
1203 } 1206 }
1204#endif 1207#endif
1205 1208
1206 get_value_inc(inst, loc, 1, false); 1209 get_value_inc(inst, loc, 1, false);
1207 short_addr = false; 1210 short_addr = false;
1208 size = LONG; 1211 size = LONG;
1209 seg = 0; 1212 seg = 0;
1210 1213
1211 /* 1214 /*
1212 * Get prefixes 1215 * Get prefixes
1213 */ 1216 */
1214 prefix = true; 1217 prefix = true;
1215 do { 1218 do {
1216 if ((inst & 0xf0) == 0x40) {  1219 if ((inst & 0xf0) == 0x40) {
1217 rex |= inst; 1220 rex |= inst;
1218 } else 1221 } else
1219 switch (inst) { 1222 switch (inst) {
1220 case 0x66: /* data16 */ 1223 case 0x66: /* data16 */
1221 size = WORD; 1224 size = WORD;
1222 break; 1225 break;
1223 case 0x67: 1226 case 0x67:
1224 short_addr = true; 1227 short_addr = true;
1225 break; 1228 break;
1226 case 0x26: 1229 case 0x26:
1227 seg = "%es"; 1230 seg = "%es";
1228 break; 1231 break;
1229 case 0x36: 1232 case 0x36:
1230 seg = "%ss"; 1233 seg = "%ss";
1231 break; 1234 break;
1232 case 0x2e: 1235 case 0x2e:
1233 seg = "%cs"; 1236 seg = "%cs";
1234 break; 1237 break;
1235 case 0x3e: 1238 case 0x3e:
1236 seg = "%ds"; 1239 seg = "%ds";
1237 break; 1240 break;
1238 case 0x64: 1241 case 0x64:
1239 seg = "%fs"; 1242 seg = "%fs";
1240 break; 1243 break;
1241 case 0x65: 1244 case 0x65:
1242 seg = "%gs"; 1245 seg = "%gs";
1243 break; 1246 break;
1244 case 0xf0: 1247 case 0xf0:
1245 db_printf("lock "); 1248 db_printf("lock ");
1246 break; 1249 break;
1247 case 0xf2: 1250 case 0xf2:
1248 db_printf("repne "); 1251 db_printf("repne ");
1249 break; 1252 break;
1250 case 0xf3: 1253 case 0xf3:
1251 db_printf("repe "); /* XXX repe VS rep */ 1254 db_printf("repe "); /* XXX repe VS rep */
1252 break; 1255 break;
1253 default: 1256 default:
1254 prefix = false; 1257 prefix = false;
1255 break; 1258 break;
1256 } 1259 }
1257 if (prefix) 1260 if (prefix)
1258 get_value_inc(inst, loc, 1, false); 1261 get_value_inc(inst, loc, 1, false);
1259 } while (prefix); 1262 } while (prefix);
1260 1263
1261 if (rex != 0) { 1264 if (rex != 0) {
1262 if (rex & REX_w) 1265 if (rex & REX_w)
1263 size = QUAD; 1266 size = QUAD;
1264 if (altfmt == true) /* XXX */ 1267 if (altfmt == true) /* XXX */
1265 db_printf("%s", rex_str[rex & 0x0f]); 1268 db_printf("%s", rex_str[rex & 0x0f]);
1266 } 1269 }
@@ -1312,27 +1315,27 @@ db_disasm(db_addr_t loc, bool altfmt) @@ -1312,27 +1315,27 @@ db_disasm(db_addr_t loc, bool altfmt)
1312 } else if (ip->i_extra == (const char *)db_Grp4 || 1315 } else if (ip->i_extra == (const char *)db_Grp4 ||
1313 ip->i_extra == (const char *)db_Grp5) { 1316 ip->i_extra == (const char *)db_Grp5) {
1314 ip = (const struct inst *)ip->i_extra; 1317 ip = (const struct inst *)ip->i_extra;
1315 ip = &ip[f_reg(regmodrm)]; 1318 ip = &ip[f_reg(regmodrm)];
1316 i_name = ip->i_name; 1319 i_name = ip->i_name;
1317 i_mode = ip->i_mode; 1320 i_mode = ip->i_mode;
1318 i_size = ip->i_size; 1321 i_size = ip->i_size;
1319 } 1322 }
1320 1323
1321 if (i_size == SDEP) { 1324 if (i_size == SDEP) {
1322 if (size == WORD) 1325 if (size == WORD)
1323 db_printf("%s", i_name); 1326 db_printf("%s", i_name);
1324 else 1327 else
1325 db_printf("%s", ip->i_extra); 1328 db_printf("%s", (const char *)ip->i_extra);
1326 } else { 1329 } else {
1327 db_printf("%s", i_name); 1330 db_printf("%s", i_name);
1328 if (i_size != NONE) { 1331 if (i_size != NONE) {
1329 if (i_size == BYTE) { 1332 if (i_size == BYTE) {
1330 db_printf("b"); 1333 db_printf("b");
1331 size = BYTE; 1334 size = BYTE;
1332 } else if (i_size == WORD) { 1335 } else if (i_size == WORD) {
1333 db_printf("w"); 1336 db_printf("w");
1334 size = WORD; 1337 size = WORD;
1335 } else if (size == WORD) { 1338 } else if (size == WORD) {
1336 db_printf("w"); 1339 db_printf("w");
1337 } else if (i_size == QUAD) { 1340 } else if (i_size == QUAD) {
1338 db_printf("q"); 1341 db_printf("q");
@@ -1344,162 +1347,162 @@ db_disasm(db_addr_t loc, bool altfmt) @@ -1344,162 +1347,162 @@ db_disasm(db_addr_t loc, bool altfmt)
1344 } 1347 }
1345 } 1348 }
1346 } 1349 }
1347 db_printf("\t"); 1350 db_printf("\t");
1348 for (first = true; 1351 for (first = true;
1349 i_mode != 0; 1352 i_mode != 0;
1350 i_mode >>= 8, first = false) { 1353 i_mode >>= 8, first = false) {
1351 char tbuf[24]; 1354 char tbuf[24];
1352 1355
1353 if (!first) 1356 if (!first)
1354 db_printf(","); 1357 db_printf(",");
1355 1358
1356 switch (i_mode & 0xFF) { 1359 switch (i_mode & 0xFF) {
1357 case E: 1360 case E:
1358 db_print_address(seg, rex, size, &address); 1361 db_print_address(seg, rex, size, &address);
1359 break; 1362 break;
1360 case Eind: 1363 case Eind:
1361 db_printf("*"); 1364 db_printf("*");
1362 db_print_address(seg, rex, size, &address); 1365 db_print_address(seg, rex, size, &address);
1363 break; 1366 break;
1364 case Ed: 1367 case Ed:
1365 db_print_address(seg, rex, LONG, &address); 1368 db_print_address(seg, rex, LONG, &address);
1366 break; 1369 break;
1367 case Ew: 1370 case Ew:
1368 db_print_address(seg, rex, WORD, &address); 1371 db_print_address(seg, rex, WORD, &address);
1369 break; 1372 break;
1370 case Eb: 1373 case Eb:
1371 db_print_address(seg, rex, BYTE, &address); 1374 db_print_address(seg, rex, BYTE, &address);
1372 break; 1375 break;
1373 case R: { 1376 case R: {
1374 int ext = ((rex & REX_r) != 0); 1377 int ext = ((rex & REX_r) != 0);
1375 db_printf("%s", db_reg[ext][size][f_reg(regmodrm)]); 1378 db_printf("%s", db_reg[ext][size][f_reg(regmodrm)]);
1376 break; 1379 break;
1377 } 1380 }
1378 case Rw: { 1381 case Rw: {
1379 int ext = ((rex & REX_r) != 0); 1382 int ext = ((rex & REX_r) != 0);
1380 db_printf("%s", db_reg[ext][WORD][f_reg(regmodrm)]); 1383 db_printf("%s", db_reg[ext][WORD][f_reg(regmodrm)]);
1381 break; 1384 break;
1382 } 1385 }
1383 case Ri: { 1386 case Ri: {
1384 int ext = ((rex & REX_b) != 0); 1387 int ext = ((rex & REX_b) != 0);
1385 db_printf("%s", db_reg[ext][size][f_rm(inst)]); 1388 db_printf("%s", db_reg[ext][size][f_rm(inst)]);
1386 break; 1389 break;
1387 } 1390 }
1388 case S: 1391 case S:
1389 db_printf("%s", db_seg_reg[f_reg(regmodrm)]); 1392 db_printf("%s", db_seg_reg[f_reg(regmodrm)]);
1390 break; 1393 break;
1391 case Si: 1394 case Si:
1392 db_printf("%s", db_seg_reg[f_reg(inst)]); 1395 db_printf("%s", db_seg_reg[f_reg(inst)]);
1393 break; 1396 break;
1394 case A: 1397 case A:
1395 db_printf("%s", db_reg[0][size][0]); /* acc */ 1398 db_printf("%s", db_reg[0][size][0]); /* acc */
1396 break; 1399 break;
1397 case BX: 1400 case BX:
1398 if (seg) 1401 if (seg)
1399 db_printf("%s:", seg); 1402 db_printf("%s:", seg);
1400 db_printf("(%s)", short_addr ? "%ebx" : "%rbx"); 1403 db_printf("(%s)", short_addr ? "%ebx" : "%rbx");
1401 break; 1404 break;
1402 case CL: 1405 case CL:
1403 db_printf("%%cl"); 1406 db_printf("%%cl");
1404 break; 1407 break;
1405 case DX: 1408 case DX:
1406 db_printf("%%dx"); 1409 db_printf("%%dx");
1407 break; 1410 break;
1408 case SI: 1411 case SI:
1409 if (seg) 1412 if (seg)
1410 db_printf("%s:", seg); 1413 db_printf("%s:", seg);
1411 db_printf("(%s)", short_addr ? "%esi" : "%rsi"); 1414 db_printf("(%s)", short_addr ? "%esi" : "%rsi");
1412 break; 1415 break;
1413 case DI: 1416 case DI:
1414 db_printf("%%es:(%s)", short_addr ? "%edi" : "%rdi"); 1417 db_printf("%%es:(%s)", short_addr ? "%edi" : "%rdi");
1415 break; 1418 break;
1416 case CR: 1419 case CR:
1417 db_printf("%%cr%d", f_reg(regmodrm)); 1420 db_printf("%%cr%d", f_reg(regmodrm));
1418 break; 1421 break;
1419 case DR: 1422 case DR:
1420 db_printf("%%dr%d", f_reg(regmodrm)); 1423 db_printf("%%dr%d", f_reg(regmodrm));
1421 break; 1424 break;
1422 case TR: 1425 case TR:
1423 db_printf("%%tr%d", f_reg(regmodrm)); 1426 db_printf("%%tr%d", f_reg(regmodrm));
1424 break; 1427 break;
1425 case Iq: 1428 case Iq:
1426 if (size == QUAD) { 1429 if (size == QUAD) {
1427 get_value_inc(imm64, loc, 8, false); 1430 get_value_inc(imm64, loc, 8, false);
1428 db_format_radix(tbuf, 24, imm64, true); 1431 db_format_radix(tbuf, 24, imm64, true);
1429 db_printf("$%s", tbuf); 1432 db_printf("$%s", tbuf);
1430 break; 1433 break;
1431 } 1434 }
1432 case I: 1435 case I:
1433 len = db_lengths[size]; 1436 len = db_lengths[size];
1434 get_value_inc(imm, loc, len, false);/* unsigned */ 1437 get_value_inc(imm, loc, len, false);/* unsigned */
1435 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1438 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1436 db_printf("$%s", tbuf); 1439 db_printf("$%s", tbuf);
1437 break; 1440 break;
1438 case Is: 1441 case Is:
1439 len = db_lengths[size]; 1442 len = db_lengths[size];
1440 get_value_inc(imm, loc, len, true); /* signed */ 1443 get_value_inc(imm, loc, len, true); /* signed */
1441 db_format_radix(tbuf, 24, imm, true); 1444 db_format_radix(tbuf, 24, imm, true);
1442 db_printf("$%s", tbuf); 1445 db_printf("$%s", tbuf);
1443 break; 1446 break;
1444 case Ib: 1447 case Ib:
1445 get_value_inc(imm, loc, 1, false); /* unsigned */ 1448 get_value_inc(imm, loc, 1, false); /* unsigned */
1446 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1449 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1447 db_printf("$%s", tbuf); 1450 db_printf("$%s", tbuf);
1448 break; 1451 break;
1449 case Ibs: 1452 case Ibs:
1450 get_value_inc(imm, loc, 1, true); /* signed */ 1453 get_value_inc(imm, loc, 1, true); /* signed */
1451 db_format_radix(tbuf, 24, imm, true); 1454 db_format_radix(tbuf, 24, imm, true);
1452 db_printf("$%s", tbuf); 1455 db_printf("$%s", tbuf);
1453 break; 1456 break;
1454 case Iw: 1457 case Iw:
1455 get_value_inc(imm, loc, 2, false); /* unsigned */ 1458 get_value_inc(imm, loc, 2, false); /* unsigned */
1456 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1459 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1457 db_printf("$%s", tbuf); 1460 db_printf("$%s", tbuf);
1458 break; 1461 break;
1459 case Il: 1462 case Il:
1460 get_value_inc(imm, loc, 4, false); 1463 get_value_inc(imm, loc, 4, false);
1461 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1464 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1462 db_printf("$%s", tbuf); 1465 db_printf("$%s", tbuf);
1463 break; 1466 break;
1464 case O: /* Only move %eax to/from absolute address */ 1467 case O: /* Only move %eax to/from absolute address */
1465 if (short_addr) 1468 if (short_addr)
1466 get_value_inc(imm64, loc, 2, true); 1469 get_value_inc(imm64, loc, 2, true);
1467 else 1470 else
1468 get_value_inc(imm64, loc, 8, true); 1471 get_value_inc(imm64, loc, 8, true);
1469 if (seg) { 1472 if (seg) {
1470 db_format_radix(tbuf, 24, imm64, true); 1473 db_format_radix(tbuf, 24, imm64, true);
1471 db_printf("%s:%s", seg, tbuf); 1474 db_printf("%s:%s", seg, tbuf);
1472 } else 1475 } else
1473 db_printsym((db_addr_t)imm64, DB_STGY_ANY, 1476 db_printsym((db_addr_t)imm64, DB_STGY_ANY,
1474 db_printf); 1477 db_printf);
1475 break; 1478 break;
1476 case Db: 1479 case Db:
1477 get_value_inc(displ, loc, 1, true); 1480 get_value_inc(displ, loc, 1, true);
1478 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN, 1481 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN,
1479 db_printf); 1482 db_printf);
1480 break; 1483 break;
1481 case Dl: 1484 case Dl:
1482 get_value_inc(displ, loc, 4, true); 1485 get_value_inc(displ, loc, 4, true);
1483 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN, 1486 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN,
1484 db_printf); 1487 db_printf);
1485 break; 1488 break;
1486 case o1: 1489 case o1:
1487 db_printf("$1"); 1490 db_printf("$1");
1488 break; 1491 break;
1489 case o3: 1492 case o3:
1490 db_printf("$3"); 1493 db_printf("$3");
1491 break; 1494 break;
1492 case OS: 1495 case OS:
1493 get_value_inc(imm, loc, 4, false); /* offset */ 1496 get_value_inc(imm, loc, 4, false); /* offset */
1494 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1497 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1495 db_printf("$%s", tbuf); 1498 db_printf("$%s", tbuf);
1496 get_value_inc(imm2, loc, 2, false); /* segment */ 1499 get_value_inc(imm2, loc, 2, false); /* segment */
1497 db_format_radix(tbuf, 24, (unsigned int)imm2, true); 1500 db_format_radix(tbuf, 24, (unsigned int)imm2, true);
1498 db_printf(",%s", tbuf); 1501 db_printf(",%s", tbuf);
1499 break; 1502 break;
1500 } 1503 }
1501 } 1504 }
1502 1505
1503 db_printf("\n"); 1506 db_printf("\n");
1504 return (loc); 1507 return (loc);
1505} 1508}

cvs diff -r1.40 -r1.40.38.1 src/sys/arch/i386/i386/db_disasm.c (expand / switch to unified diff)

--- src/sys/arch/i386/i386/db_disasm.c 2009/03/14 21:04:10 1.40
+++ src/sys/arch/i386/i386/db_disasm.c 2014/12/12 19:07:46 1.40.38.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: db_disasm.c,v 1.40 2009/03/14 21:04:10 dsl Exp $ */ 1/* $NetBSD: db_disasm.c,v 1.40.38.1 2014/12/12 19:07:46 martin Exp $ */
2 2
3/*  3/*
4 * Mach Operating System 4 * Mach Operating System
5 * Copyright (c) 1991,1990 Carnegie Mellon University 5 * Copyright (c) 1991,1990 Carnegie Mellon University
6 * All Rights Reserved. 6 * All Rights Reserved.
7 *  7 *
8 * Permission to use, copy, modify and distribute this software and its 8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright 9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 *  13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * Pittsburgh PA 15213-3890 23 * Pittsburgh PA 15213-3890
24 *  24 *
25 * any improvements or extensions that they make and grant Carnegie the 25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes. 26 * rights to redistribute these changes.
27 * 27 *
28 * Id: db_disasm.c,v 2.3 91/02/05 17:11:03 mrt (CMU) 28 * Id: db_disasm.c,v 2.3 91/02/05 17:11:03 mrt (CMU)
29 */ 29 */
30 30
31/* 31/*
32 * Instruction disassembler. 32 * Instruction disassembler.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.40 2009/03/14 21:04:10 dsl Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.40.38.1 2014/12/12 19:07:46 martin Exp $");
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/proc.h> 39#include <sys/proc.h>
40#include <machine/db_machdep.h> 40#include <machine/db_machdep.h>
41 41
42#include <ddb/db_access.h> 42#include <ddb/db_access.h>
43#include <ddb/db_sym.h> 43#include <ddb/db_sym.h>
44#include <ddb/db_output.h> 44#include <ddb/db_output.h>
45#include <ddb/db_interface.h> 45#include <ddb/db_interface.h>
46 46
47/* 47/*
48 * Size attributes 48 * Size attributes
49 */ 49 */
@@ -90,38 +90,38 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c, @@ -90,38 +90,38 @@ __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,
90#define o1 28 /* constant 1 */ 90#define o1 28 /* constant 1 */
91#define o3 29 /* constant 3 */ 91#define o3 29 /* constant 3 */
92#define OS 30 /* immediate offset/segment */ 92#define OS 30 /* immediate offset/segment */
93#define ST 31 /* FP stack top */ 93#define ST 31 /* FP stack top */
94#define STI 32 /* FP stack */ 94#define STI 32 /* FP stack */
95#define X 33 /* extended FP op */ 95#define X 33 /* extended FP op */
96#define XA 34 /* for 'fstcw %ax' */ 96#define XA 34 /* for 'fstcw %ax' */
97 97
98struct inst { 98struct inst {
99 const char *i_name; /* name */ 99 const char *i_name; /* name */
100 short i_has_modrm; /* has regmodrm byte */ 100 short i_has_modrm; /* has regmodrm byte */
101 short i_size; /* operand size */ 101 short i_size; /* operand size */
102 int i_mode; /* addressing modes */ 102 int i_mode; /* addressing modes */
103 const char *i_extra; /* pointer to extra opcode table */ 103 const void *i_extra; /* pointer to extra opcode table */
104}; 104};
105 105
106#define op1(x) (x) 106#define op1(x) (x)
107#define op2(x,y) ((x)|((y)<<8)) 107#define op2(x,y) ((x)|((y)<<8))
108#define op3(x,y,z) ((x)|((y)<<8)|((z)<<16)) 108#define op3(x,y,z) ((x)|((y)<<8)|((z)<<16))
109 109
110struct finst { 110struct finst {
111 const char *f_name; /* name for memory instruction */ 111 const char *f_name; /* name for memory instruction */
112 int f_size; /* size for memory instruction */ 112 int f_size; /* size for memory instruction */
113 int f_rrmode; /* mode for rr instruction */ 113 int f_rrmode; /* mode for rr instruction */
114 const char *f_rrname; /* name for rr instruction 114 const void *f_rrname; /* name for rr instruction
115 (or pointer to table) */ 115 (or pointer to table) */
116}; 116};
117 117
118const char * const db_Grp6[] = { 118const char * const db_Grp6[] = {
119 "sldt", 119 "sldt",
120 "str", 120 "str",
121 "lldt", 121 "lldt",
122 "ltr", 122 "ltr",
123 "verr", 123 "verr",
124 "verw", 124 "verw",
125 "", 125 "",
126 "" 126 ""
127}; 127};
@@ -150,220 +150,222 @@ const char * const db_Grp8[] = { @@ -150,220 +150,222 @@ const char * const db_Grp8[] = {
150 150
151const char * const db_Grp9[] = { 151const char * const db_Grp9[] = {
152 "", 152 "",
153 "cmpxchg8b", 153 "cmpxchg8b",
154 "", 154 "",
155 "", 155 "",
156 "", 156 "",
157 "", 157 "",
158 "", 158 "",
159 "", 159 "",
160}; 160};
161 161
162const struct inst db_inst_0f0x[] = { 162const struct inst db_inst_0f0x[] = {
163/*00*/ { "", true, NONE, op1(Ew), (const char *)db_Grp6 }, 163/*00*/ { "", true, NONE, op1(Ew), db_Grp6 },
164/*01*/ { "", true, NONE, op1(Ew), (const char *)db_Grp7 }, 164/*01*/ { "", true, NONE, op1(Ew), db_Grp7 },
165/*02*/ { "lar", true, LONG, op2(E,R), 0 }, 165/*02*/ { "lar", true, LONG, op2(E,R), 0 },
166/*03*/ { "lsl", true, LONG, op2(E,R), 0 }, 166/*03*/ { "lsl", true, LONG, op2(E,R), 0 },
167/*04*/ { "", false, NONE, 0, 0 }, 167/*04*/ { "", false, NONE, 0, 0 },
168/*05*/ { "", false, NONE, 0, 0 }, 168/*05*/ { "", false, NONE, 0, 0 },
169/*06*/ { "clts", false, NONE, 0, 0 }, 169/*06*/ { "clts", false, NONE, 0, 0 },
170/*07*/ { "", false, NONE, 0, 0 }, 170/*07*/ { "", false, NONE, 0, 0 },
171 171
172/*08*/ { "invd", false, NONE, 0, 0 }, 172/*08*/ { "invd", false, NONE, 0, 0 },
173/*09*/ { "wbinvd",false, NONE, 0, 0 }, 173/*09*/ { "wbinvd",false, NONE, 0, 0 },
174/*0a*/ { "", false, NONE, 0, 0 }, 174/*0a*/ { "", false, NONE, 0, 0 },
175/*0b*/ { "", false, NONE, 0, 0 }, 175/*0b*/ { "", false, NONE, 0, 0 },
176/*0c*/ { "", false, NONE, 0, 0 }, 176/*0c*/ { "", false, NONE, 0, 0 },
177/*0d*/ { "", false, NONE, 0, 0 }, 177/*0d*/ { "", false, NONE, 0, 0 },
178/*0e*/ { "", false, NONE, 0, 0 }, 178/*0e*/ { "", false, NONE, 0, 0 },
179/*0f*/ { "", false, NONE, 0, 0 }, 179/*0f*/ { "", false, NONE, 0, 0 },
180}; 180};
181 181
182const struct inst db_inst_0f2x[] = { 182const struct inst db_inst_0f2x[] = {
183/*20*/ { "mov", true, LONG, op2(CR,E), 0 }, /* use E for reg */ 183/*20*/ { "mov", true, LONG, op2(CR,E), 0 }, /* use E for reg */
184/*21*/ { "mov", true, LONG, op2(DR,E), 0 }, /* since mod == 11 */ 184/*21*/ { "mov", true, LONG, op2(DR,E), 0 }, /* since mod == 11 */
185/*22*/ { "mov", true, LONG, op2(E,CR), 0 }, 185/*22*/ { "mov", true, LONG, op2(E,CR), 0 },
186/*23*/ { "mov", true, LONG, op2(E,DR), 0 }, 186/*23*/ { "mov", true, LONG, op2(E,DR), 0 },
187/*24*/ { "mov", true, LONG, op2(TR,E), 0 }, 187/*24*/ { "mov", true, LONG, op2(TR,E), 0 },
188/*25*/ { "", false, NONE, 0, 0 }, 188/*25*/ { "", false, NONE, 0, 0 },
189/*26*/ { "mov", true, LONG, op2(E,TR), 0 }, 189/*26*/ { "mov", true, LONG, op2(E,TR), 0 },
190/*27*/ { "", false, NONE, 0, 0 }, 190/*27*/ { "", false, NONE, 0, 0 },
191 191
192/*28*/ { "", false, NONE, 0, 0 }, 192/*28*/ { "", false, NONE, 0, 0 },
193/*29*/ { "", false, NONE, 0, 0 }, 193/*29*/ { "", false, NONE, 0, 0 },
194/*2a*/ { "", false, NONE, 0, 0 }, 194/*2a*/ { "", false, NONE, 0, 0 },
195/*2b*/ { "", false, NONE, 0, 0 }, 195/*2b*/ { "", false, NONE, 0, 0 },
196/*2c*/ { "", false, NONE, 0, 0 }, 196/*2c*/ { "", false, NONE, 0, 0 },
197/*2d*/ { "", false, NONE, 0, 0 }, 197/*2d*/ { "", false, NONE, 0, 0 },
198/*2e*/ { "", false, NONE, 0, 0 }, 198/*2e*/ { "", false, NONE, 0, 0 },
199/*2f*/ { "", false, NONE, 0, 0 }, 199/*2f*/ { "", false, NONE, 0, 0 },
200}; 200};
201 201
202const struct inst db_inst_0f3x[] = { 202const struct inst db_inst_0f3x[] = {
203/*30*/ { "wrmsr", false, NONE, 0, 0 }, 203/*30*/ { "wrmsr", false, NONE, 0, 0 },
204/*31*/ { "rdtsc", false, NONE, 0, 0 }, 204/*31*/ { "rdtsc", false, NONE, 0, 0 },
205/*32*/ { "rdmsr", false, NONE, 0, 0 }, 205/*32*/ { "rdmsr", false, NONE, 0, 0 },
206/*33*/ { "rdpmc", false, NONE, 0, 0 }, 206/*33*/ { "rdpmc", false, NONE, 0, 0 },
207/*34*/ { "", false, NONE, 0, 0 }, 207/*34*/ { "sysenter",false,NONE, 0, 0 },
208/*35*/ { "", false, NONE, 0, 0 }, 208/*35*/ { "sysexit",false, NONE, 0, 0 },
209/*36*/ { "", false, NONE, 0, 0 }, 209/*36*/ { "", false, NONE, 0, 0 },
210/*37*/ { "", false, NONE, 0, 0 }, 210/*37*/ { "getsec",false, NONE, 0, 0 },
211 211
212/*38*/ { "", false, NONE, 0, 0 }, 212/*38*/ { "", false, NONE, 0, 0 },
213/*39*/ { "", false, NONE, 0, 0 }, 213/*39*/ { "", false, NONE, 0, 0 },
214/*3a*/ { "", false, NONE, 0, 0 }, 214/*3a*/ { "", false, NONE, 0, 0 },
215/*3v*/ { "", false, NONE, 0, 0 }, 215/*3b*/ { "", false, NONE, 0, 0 },
216/*3c*/ { "", false, NONE, 0, 0 }, 216/*3c*/ { "", false, NONE, 0, 0 },
217/*3d*/ { "", false, NONE, 0, 0 }, 217/*3d*/ { "", false, NONE, 0, 0 },
218/*3e*/ { "", false, NONE, 0, 0 }, 218/*3e*/ { "", false, NONE, 0, 0 },
219/*3f*/ { "", false, NONE, 0, 0 }, 219/*3f*/ { "", false, NONE, 0, 0 },
220}; 220};
221 221
222const struct inst db_inst_0f4x[] = { 222const struct inst db_inst_0f4x[] = {
223/*40*/ { "cmovo", true, LONG, op2(E,R), 0 }, 223/*40*/ { "cmovo", true, LONG, op2(E,R), 0 },
224/*41*/ { "cmovno", true, LONG, op2(E,R), 0 }, 224/*41*/ { "cmovno", true, LONG, op2(E,R), 0 },
225/*42*/ { "cmovc", true, LONG, op2(E,R), 0 }, 225/*42*/ { "cmovc", true, LONG, op2(E,R), 0 },
226/*43*/ { "cmovnc", true, LONG, op2(E,R), 0 }, 226/*43*/ { "cmovnc", true, LONG, op2(E,R), 0 },
227/*44*/ { "cmovz", true, LONG, op2(E,R), 0 }, 227/*44*/ { "cmovz", true, LONG, op2(E,R), 0 },
228/*45*/ { "cmovnz", true, LONG, op2(E,R), 0 }, 228/*45*/ { "cmovnz", true, LONG, op2(E,R), 0 },
229/*46*/ { "cmovbe", true, LONG, op2(E,R), 0 }, 229/*46*/ { "cmovbe", true, LONG, op2(E,R), 0 },
230/*47*/ { "cmovmbe",true, LONG, op2(E,R), 0 }, 230/*47*/ { "cmovmbe",true, LONG, op2(E,R), 0 },
 231
231/*48*/ { "cmovs", true, LONG, op2(E,R), 0 }, 232/*48*/ { "cmovs", true, LONG, op2(E,R), 0 },
232/*49*/ { "cmovns", true, LONG, op2(E,R), 0 }, 233/*49*/ { "cmovns", true, LONG, op2(E,R), 0 },
233/*4a*/ { "cmovp", true, LONG, op2(E,R), 0 }, 234/*4a*/ { "cmovp", true, LONG, op2(E,R), 0 },
234/*4b*/ { "cmovnp", true, LONG, op2(E,R), 0 }, 235/*4b*/ { "cmovnp", true, LONG, op2(E,R), 0 },
235/*4c*/ { "cmovl", true, LONG, op2(E,R), 0 }, 236/*4c*/ { "cmovl", true, LONG, op2(E,R), 0 },
236/*4d*/ { "cmovnl", true, LONG, op2(E,R), 0 }, 237/*4d*/ { "cmovnl", true, LONG, op2(E,R), 0 },
237/*4e*/ { "cmovle", true, LONG, op2(E,R), 0 }, 238/*4e*/ { "cmovle", true, LONG, op2(E,R), 0 },
238/*4f*/ { "cmovnle",true, LONG, op2(E,R), 0 }, 239/*4f*/ { "cmovnle",true, LONG, op2(E,R), 0 },
239}; 240};
240 241
241const struct inst db_inst_0f8x[] = { 242const struct inst db_inst_0f8x[] = {
242/*80*/ { "jo", false, NONE, op1(Dl), 0 }, 243/*80*/ { "jo", false, NONE, op1(Dl), 0 },
243/*81*/ { "jno", false, NONE, op1(Dl), 0 }, 244/*81*/ { "jno", false, NONE, op1(Dl), 0 },
244/*82*/ { "jb", false, NONE, op1(Dl), 0 }, 245/*82*/ { "jb", false, NONE, op1(Dl), 0 },
245/*83*/ { "jnb", false, NONE, op1(Dl), 0 }, 246/*83*/ { "jnb", false, NONE, op1(Dl), 0 },
246/*84*/ { "jz", false, NONE, op1(Dl), 0 }, 247/*84*/ { "jz", false, NONE, op1(Dl), 0 },
247/*85*/ { "jnz", false, NONE, op1(Dl), 0 }, 248/*85*/ { "jnz", false, NONE, op1(Dl), 0 },
248/*86*/ { "jbe", false, NONE, op1(Dl), 0 }, 249/*86*/ { "jbe", false, NONE, op1(Dl), 0 },
249/*87*/ { "jnbe", false, NONE, op1(Dl), 0 }, 250/*87*/ { "jnbe", false, NONE, op1(Dl), 0 },
250 251
251/*88*/ { "js", false, NONE, op1(Dl), 0 }, 252/*88*/ { "js", false, NONE, op1(Dl), 0 },
252/*89*/ { "jns", false, NONE, op1(Dl), 0 }, 253/*89*/ { "jns", false, NONE, op1(Dl), 0 },
253/*8a*/ { "jp", false, NONE, op1(Dl), 0 }, 254/*8a*/ { "jp", false, NONE, op1(Dl), 0 },
254/*8b*/ { "jnp", false, NONE, op1(Dl), 0 }, 255/*8b*/ { "jnp", false, NONE, op1(Dl), 0 },
255/*8c*/ { "jl", false, NONE, op1(Dl), 0 }, 256/*8c*/ { "jl", false, NONE, op1(Dl), 0 },
256/*8d*/ { "jnl", false, NONE, op1(Dl), 0 }, 257/*8d*/ { "jnl", false, NONE, op1(Dl), 0 },
257/*8e*/ { "jle", false, NONE, op1(Dl), 0 }, 258/*8e*/ { "jle", false, NONE, op1(Dl), 0 },
258/*8f*/ { "jnle", false, NONE, op1(Dl), 0 }, 259/*8f*/ { "jnle", false, NONE, op1(Dl), 0 },
259}; 260};
260 261
261const struct inst db_inst_0f9x[] = { 262const struct inst db_inst_0f9x[] = {
262/*90*/ { "seto", true, NONE, op1(Eb), 0 }, 263/*90*/ { "seto", true, NONE, op1(Eb), 0 },
263/*91*/ { "setno", true, NONE, op1(Eb), 0 }, 264/*91*/ { "setno", true, NONE, op1(Eb), 0 },
264/*92*/ { "setb", true, NONE, op1(Eb), 0 }, 265/*92*/ { "setb", true, NONE, op1(Eb), 0 },
265/*93*/ { "setnb", true, NONE, op1(Eb), 0 }, 266/*93*/ { "setnb", true, NONE, op1(Eb), 0 },
266/*94*/ { "setz", true, NONE, op1(Eb), 0 }, 267/*94*/ { "setz", true, NONE, op1(Eb), 0 },
267/*95*/ { "setnz", true, NONE, op1(Eb), 0 }, 268/*95*/ { "setnz", true, NONE, op1(Eb), 0 },
268/*96*/ { "setbe", true, NONE, op1(Eb), 0 }, 269/*96*/ { "setbe", true, NONE, op1(Eb), 0 },
269/*97*/ { "setnbe",true, NONE, op1(Eb), 0 }, 270/*97*/ { "setnbe",true, NONE, op1(Eb), 0 },
270 271
271/*98*/ { "sets", true, NONE, op1(Eb), 0 }, 272/*98*/ { "sets", true, NONE, op1(Eb), 0 },
272/*99*/ { "setns", true, NONE, op1(Eb), 0 }, 273/*99*/ { "setns", true, NONE, op1(Eb), 0 },
273/*9a*/ { "setp", true, NONE, op1(Eb), 0 }, 274/*9a*/ { "setp", true, NONE, op1(Eb), 0 },
274/*9b*/ { "setnp", true, NONE, op1(Eb), 0 }, 275/*9b*/ { "setnp", true, NONE, op1(Eb), 0 },
275/*9c*/ { "setl", true, NONE, op1(Eb), 0 }, 276/*9c*/ { "setl", true, NONE, op1(Eb), 0 },
276/*9d*/ { "setnl", true, NONE, op1(Eb), 0 }, 277/*9d*/ { "setnl", true, NONE, op1(Eb), 0 },
277/*9e*/ { "setle", true, NONE, op1(Eb), 0 }, 278/*9e*/ { "setle", true, NONE, op1(Eb), 0 },
278/*9f*/ { "setnle",true, NONE, op1(Eb), 0 }, 279/*9f*/ { "setnle",true, NONE, op1(Eb), 0 },
279}; 280};
280 281
281const struct inst db_inst_0fax[] = { 282const struct inst db_inst_0fax[] = {
282/*a0*/ { "push", false, NONE, op1(Si), 0 }, 283/*a0*/ { "push", false, NONE, op1(Si), 0 },
283/*a1*/ { "pop", false, NONE, op1(Si), 0 }, 284/*a1*/ { "pop", false, NONE, op1(Si), 0 },
284/*a2*/ { "cpuid", false, NONE, 0, 0 }, 285/*a2*/ { "cpuid", false, NONE, 0, 0 },
285/*a3*/ { "bt", true, LONG, op2(R,E), 0 }, 286/*a3*/ { "bt", true, LONG, op2(R,E), 0 },
286/*a4*/ { "shld", true, LONG, op3(Ib,E,R), 0 }, 287/*a4*/ { "shld", true, LONG, op3(Ib,R,E), 0 },
287/*a5*/ { "shld", true, LONG, op3(CL,E,R), 0 }, 288/*a5*/ { "shld", true, LONG, op3(CL,R,E), 0 },
288/*a6*/ { "", false, NONE, 0, 0 }, 289/*a6*/ { "", false, NONE, 0, 0 },
289/*a7*/ { "", false, NONE, 0, 0 }, 290/*a7*/ { "", false, NONE, 0, 0 },
290 291
291/*a8*/ { "push", false, NONE, op1(Si), 0 }, 292/*a8*/ { "push", false, NONE, op1(Si), 0 },
292/*a9*/ { "pop", false, NONE, op1(Si), 0 }, 293/*a9*/ { "pop", false, NONE, op1(Si), 0 },
293/*aa*/ { "rsm", false, NONE, 0, 0 }, 294/*aa*/ { "rsm", false, NONE, 0, 0 },
294/*ab*/ { "bts", true, LONG, op2(R,E), 0 }, 295/*ab*/ { "bts", true, LONG, op2(R,E), 0 },
295/*ac*/ { "shrd", true, LONG, op3(Ib,E,R), 0 }, 296/*ac*/ { "shrd", true, LONG, op3(Ib,R,E), 0 },
296/*ad*/ { "shrd", true, LONG, op3(CL,E,R), 0 }, 297/*ad*/ { "shrd", true, LONG, op3(CL,R,E), 0 },
297/*ae*/ { "fxsave",true, LONG, 0, 0 }, 298/*ae*/ { "fxsave",true, LONG, 0, 0 },
298/*af*/ { "imul", true, LONG, op2(E,R), 0 }, 299/*af*/ { "imul", true, LONG, op2(E,R), 0 },
299}; 300};
300 301
301const struct inst db_inst_0fbx[] = { 302const struct inst db_inst_0fbx[] = {
302/*b0*/ { "cmpxchg",true, BYTE, op2(R, E), 0 }, 303/*b0*/ { "cmpxchg",true, BYTE, op2(R, E), 0 },
303/*b1*/ { "cmpxchg",true, LONG, op2(R, E), 0 }, 304/*b1*/ { "cmpxchg",true, LONG, op2(R, E), 0 },
304/*b2*/ { "lss", true, LONG, op2(E, R), 0 }, 305/*b2*/ { "lss", true, LONG, op2(E, R), 0 },
305/*b3*/ { "btr", true, LONG, op2(R, E), 0 }, 306/*b3*/ { "btr", true, LONG, op2(R, E), 0 },
306/*b4*/ { "lfs", true, LONG, op2(E, R), 0 }, 307/*b4*/ { "lfs", true, LONG, op2(E, R), 0 },
307/*b5*/ { "lgs", true, LONG, op2(E, R), 0 }, 308/*b5*/ { "lgs", true, LONG, op2(E, R), 0 },
308/*b6*/ { "movzb", true, LONG, op2(E, R), 0 }, 309/*b6*/ { "movzb", true, LONG, op2(E, R), 0 },
309/*b7*/ { "movzw", true, LONG, op2(E, R), 0 }, 310/*b7*/ { "movzw", true, LONG, op2(E, R), 0 },
310 311
311/*b8*/ { "", false, NONE, 0, 0 }, 312/*b8*/ { "", false, NONE, 0, 0 },
312/*b9*/ { "", false, NONE, 0, 0 }, 313/*b9*/ { "", false, NONE, 0, 0 },
313/*ba*/ { "", true, LONG, op2(Ib, E), (const char *)db_Grp8 }, 314/*ba*/ { "", true, LONG, op2(Ib, E), db_Grp8 },
314/*bb*/ { "btc", true, LONG, op2(R, E), 0 }, 315/*bb*/ { "btc", true, LONG, op2(R, E), 0 },
315/*bc*/ { "bsf", true, LONG, op2(E, R), 0 }, 316/*bc*/ { "bsf", true, LONG, op2(E, R), 0 },
316/*bd*/ { "bsr", true, LONG, op2(E, R), 0 }, 317/*bd*/ { "bsr", true, LONG, op2(E, R), 0 },
317/*be*/ { "movsb", true, LONG, op2(E, R), 0 }, 318/*be*/ { "movsb", true, LONG, op2(E, R), 0 },
318/*bf*/ { "movsw", true, LONG, op2(E, R), 0 }, 319/*bf*/ { "movsw", true, LONG, op2(E, R), 0 },
319}; 320};
320 321
321const struct inst db_inst_0fcx[] = { 322const struct inst db_inst_0fcx[] = {
322/*c0*/ { "xadd", true, BYTE, op2(R, E), 0 }, 323/*c0*/ { "xadd", true, BYTE, op2(R, E), 0 },
323/*c1*/ { "xadd", true, LONG, op2(R, E), 0 }, 324/*c1*/ { "xadd", true, LONG, op2(R, E), 0 },
324/*c2*/ { "", false, NONE, 0, 0 }, 325/*c2*/ { "", false, NONE, 0, 0 },
325/*c3*/ { "", false, NONE, 0, 0 }, 326/*c3*/ { "", false, NONE, 0, 0 },
326/*c4*/ { "", false, NONE, 0, 0 }, 327/*c4*/ { "", false, NONE, 0, 0 },
327/*c5*/ { "", false, NONE, 0, 0 }, 328/*c5*/ { "", false, NONE, 0, 0 },
328/*c6*/ { "", false, NONE, 0, 0 }, 329/*c6*/ { "", false, NONE, 0, 0 },
329/*c7*/ { "", true, NONE, op1(E), (const char *)db_Grp9 }, 330/*c7*/ { "", true, NONE, op1(E), db_Grp9 },
 331
330/*c8*/ { "bswap", false, LONG, op1(Ri), 0 }, 332/*c8*/ { "bswap", false, LONG, op1(Ri), 0 },
331/*c9*/ { "bswap", false, LONG, op1(Ri), 0 }, 333/*c9*/ { "bswap", false, LONG, op1(Ri), 0 },
332/*ca*/ { "bswap", false, LONG, op1(Ri), 0 }, 334/*ca*/ { "bswap", false, LONG, op1(Ri), 0 },
333/*cb*/ { "bswap", false, LONG, op1(Ri), 0 }, 335/*cb*/ { "bswap", false, LONG, op1(Ri), 0 },
334/*cc*/ { "bswap", false, LONG, op1(Ri), 0 }, 336/*cc*/ { "bswap", false, LONG, op1(Ri), 0 },
335/*cd*/ { "bswap", false, LONG, op1(Ri), 0 }, 337/*cd*/ { "bswap", false, LONG, op1(Ri), 0 },
336/*ce*/ { "bswap", false, LONG, op1(Ri), 0 }, 338/*ce*/ { "bswap", false, LONG, op1(Ri), 0 },
337/*cf*/ { "bswap", false, LONG, op1(Ri), 0 }, 339/*cf*/ { "bswap", false, LONG, op1(Ri), 0 },
338}; 340};
339 341
340const struct inst * const db_inst_0f[] = { 342const struct inst * const db_inst_0f[] = {
341 db_inst_0f0x, 343 db_inst_0f0x,
342 0, 344 NULL,
343 db_inst_0f2x, 345 db_inst_0f2x,
344 db_inst_0f3x, 346 db_inst_0f3x,
345 db_inst_0f4x, 347 db_inst_0f4x,
346 0, 348 NULL,
347 0, 349 NULL,
348 0, 350 NULL,
349 db_inst_0f8x, 351 db_inst_0f8x,
350 db_inst_0f9x, 352 db_inst_0f9x,
351 db_inst_0fax, 353 db_inst_0fax,
352 db_inst_0fbx, 354 db_inst_0fbx,
353 db_inst_0fcx, 355 db_inst_0fcx,
354 0, 356 NULL,
355 0, 357 NULL,
356 0 358 NULL
357}; 359};
358 360
359const char * const db_Esc92[] = { 361const char * const db_Esc92[] = {
360 "fnop", "", "", "", "", "", "", "" 362 "fnop", "", "", "", "", "", "", ""
361}; 363};
362const char * const db_Esc93[] = { 364const char * const db_Esc93[] = {
363 "", "", "", "", "", "", "", "" 365 "", "", "", "", "", "", "", ""
364}; 366};
365const char * const db_Esc94[] = { 367const char * const db_Esc94[] = {
366 "fchs", "fabs", "", "", "ftst", "fxam", "", "" 368 "fchs", "fabs", "", "", "ftst", "fxam", "", ""
367}; 369};
368const char * const db_Esc95[] = { 370const char * const db_Esc95[] = {
369 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","" 371 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz",""
@@ -396,51 +398,51 @@ const struct finst db_Esc8[] = { @@ -396,51 +398,51 @@ const struct finst db_Esc8[] = {
396/*0*/ { "fadd", SNGL, op2(STI,ST), 0 }, 398/*0*/ { "fadd", SNGL, op2(STI,ST), 0 },
397/*1*/ { "fmul", SNGL, op2(STI,ST), 0 }, 399/*1*/ { "fmul", SNGL, op2(STI,ST), 0 },
398/*2*/ { "fcom", SNGL, op2(STI,ST), 0 }, 400/*2*/ { "fcom", SNGL, op2(STI,ST), 0 },
399/*3*/ { "fcomp", SNGL, op2(STI,ST), 0 }, 401/*3*/ { "fcomp", SNGL, op2(STI,ST), 0 },
400/*4*/ { "fsub", SNGL, op2(STI,ST), 0 }, 402/*4*/ { "fsub", SNGL, op2(STI,ST), 0 },
401/*5*/ { "fsubr", SNGL, op2(STI,ST), 0 }, 403/*5*/ { "fsubr", SNGL, op2(STI,ST), 0 },
402/*6*/ { "fdiv", SNGL, op2(STI,ST), 0 }, 404/*6*/ { "fdiv", SNGL, op2(STI,ST), 0 },
403/*7*/ { "fdivr", SNGL, op2(STI,ST), 0 }, 405/*7*/ { "fdivr", SNGL, op2(STI,ST), 0 },
404}; 406};
405 407
406const struct finst db_Esc9[] = { 408const struct finst db_Esc9[] = {
407/*0*/ { "fld", SNGL, op1(STI), 0 }, 409/*0*/ { "fld", SNGL, op1(STI), 0 },
408/*1*/ { "", NONE, op1(STI), "fxch" }, 410/*1*/ { "", NONE, op1(STI), "fxch" },
409/*2*/ { "fst", SNGL, op1(X), (const char *)db_Esc92 }, 411/*2*/ { "fst", SNGL, op1(X), db_Esc92 },
410/*3*/ { "fstp", SNGL, op1(X), (const char *)db_Esc93 }, 412/*3*/ { "fstp", SNGL, op1(X), db_Esc93 },
411/*4*/ { "fldenv", NONE, op1(X), (const char *)db_Esc94 }, 413/*4*/ { "fldenv", NONE, op1(X), db_Esc94 },
412/*5*/ { "fldcw", NONE, op1(X), (const char *)db_Esc95 }, 414/*5*/ { "fldcw", NONE, op1(X), db_Esc95 },
413/*6*/ { "fnstenv",NONE, op1(X), (const char *)db_Esc96 }, 415/*6*/ { "fnstenv",NONE, op1(X), db_Esc96 },
414/*7*/ { "fnstcw", NONE, op1(X), (const char *)db_Esc97 }, 416/*7*/ { "fnstcw", NONE, op1(X), db_Esc97 },
415}; 417};
416 418
417const struct finst db_Esca[] = { 419const struct finst db_Esca[] = {
418/*0*/ { "fiadd", WORD, 0, 0 }, 420/*0*/ { "fiadd", WORD, 0, 0 },
419/*1*/ { "fimul", WORD, 0, 0 }, 421/*1*/ { "fimul", WORD, 0, 0 },
420/*2*/ { "ficom", WORD, 0, 0 }, 422/*2*/ { "ficom", WORD, 0, 0 },
421/*3*/ { "ficomp", WORD, 0, 0 }, 423/*3*/ { "ficomp", WORD, 0, 0 },
422/*4*/ { "fisub", WORD, op1(X), (const char *)db_Esca4 }, 424/*4*/ { "fisub", WORD, op1(X), db_Esca4 },
423/*5*/ { "fisubr", WORD, 0, 0 }, 425/*5*/ { "fisubr", WORD, 0, 0 },
424/*6*/ { "fidiv", WORD, 0, 0 }, 426/*6*/ { "fidiv", WORD, 0, 0 },
425/*7*/ { "fidivr", WORD, 0, 0 } 427/*7*/ { "fidivr", WORD, 0, 0 }
426}; 428};
427 429
428const struct finst db_Escb[] = { 430const struct finst db_Escb[] = {
429/*0*/ { "fild", WORD, 0, 0 }, 431/*0*/ { "fild", WORD, 0, 0 },
430/*1*/ { "", NONE, 0, 0 }, 432/*1*/ { "", NONE, 0, 0 },
431/*2*/ { "fist", WORD, 0, 0 }, 433/*2*/ { "fist", WORD, 0, 0 },
432/*3*/ { "fistp", WORD, 0, 0 }, 434/*3*/ { "fistp", WORD, 0, 0 },
433/*4*/ { "", WORD, op1(X), (const char *)db_Escb4 }, 435/*4*/ { "", WORD, op1(X), db_Escb4 },
434/*5*/ { "fld", EXTR, 0, 0 }, 436/*5*/ { "fld", EXTR, 0, 0 },
435/*6*/ { "", WORD, 0, 0 }, 437/*6*/ { "", WORD, 0, 0 },
436/*7*/ { "fstp", EXTR, 0, 0 }, 438/*7*/ { "fstp", EXTR, 0, 0 },
437}; 439};
438 440
439const struct finst db_Escc[] = { 441const struct finst db_Escc[] = {
440/*0*/ { "fadd", DBLR, op2(ST,STI), 0 }, 442/*0*/ { "fadd", DBLR, op2(ST,STI), 0 },
441/*1*/ { "fmul", DBLR, op2(ST,STI), 0 }, 443/*1*/ { "fmul", DBLR, op2(ST,STI), 0 },
442/*2*/ { "fcom", DBLR, op2(ST,STI), 0 }, 444/*2*/ { "fcom", DBLR, op2(ST,STI), 0 },
443/*3*/ { "fcomp", DBLR, op2(ST,STI), 0 }, 445/*3*/ { "fcomp", DBLR, op2(ST,STI), 0 },
444/*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" }, 446/*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" },
445/*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" }, 447/*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" },
446/*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" }, 448/*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" },
@@ -452,39 +454,39 @@ const struct finst db_Escd[] = { @@ -452,39 +454,39 @@ const struct finst db_Escd[] = {
452/*1*/ { "", NONE, 0, 0 }, 454/*1*/ { "", NONE, 0, 0 },
453/*2*/ { "fst", DBLR, op1(STI), 0 }, 455/*2*/ { "fst", DBLR, op1(STI), 0 },
454/*3*/ { "fstp", DBLR, op1(STI), 0 }, 456/*3*/ { "fstp", DBLR, op1(STI), 0 },
455/*4*/ { "frstor", NONE, op1(STI), "fucom" }, 457/*4*/ { "frstor", NONE, op1(STI), "fucom" },
456/*5*/ { "", NONE, op1(STI), "fucomp" }, 458/*5*/ { "", NONE, op1(STI), "fucomp" },
457/*6*/ { "fnsave", NONE, 0, 0 }, 459/*6*/ { "fnsave", NONE, 0, 0 },
458/*7*/ { "fnstsw", NONE, 0, 0 }, 460/*7*/ { "fnstsw", NONE, 0, 0 },
459}; 461};
460 462
461const struct finst db_Esce[] = { 463const struct finst db_Esce[] = {
462/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" }, 464/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" },
463/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" }, 465/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" },
464/*2*/ { "ficom", LONG, 0, 0 }, 466/*2*/ { "ficom", LONG, 0, 0 },
465/*3*/ { "ficomp", LONG, op1(X), (const char *)db_Esce3 }, 467/*3*/ { "ficomp", LONG, op1(X), db_Esce3 },
466/*4*/ { "fisub", LONG, op2(ST,STI), "fsubrp" }, 468/*4*/ { "fisub", LONG, op2(ST,STI), "fsubrp" },
467/*5*/ { "fisubr", LONG, op2(ST,STI), "fsubp" }, 469/*5*/ { "fisubr", LONG, op2(ST,STI), "fsubp" },
468/*6*/ { "fidiv", LONG, op2(ST,STI), "fdivrp" }, 470/*6*/ { "fidiv", LONG, op2(ST,STI), "fdivrp" },
469/*7*/ { "fidivr", LONG, op2(ST,STI), "fdivp" }, 471/*7*/ { "fidivr", LONG, op2(ST,STI), "fdivp" },
470}; 472};
471 473
472const struct finst db_Escf[] = { 474const struct finst db_Escf[] = {
473/*0*/ { "fild", LONG, 0, 0 }, 475/*0*/ { "fild", LONG, 0, 0 },
474/*1*/ { "", LONG, 0, 0 }, 476/*1*/ { "", LONG, 0, 0 },
475/*2*/ { "fist", LONG, 0, 0 }, 477/*2*/ { "fist", LONG, 0, 0 },
476/*3*/ { "fistp", LONG, 0, 0 }, 478/*3*/ { "fistp", LONG, 0, 0 },
477/*4*/ { "fbld", NONE, op1(XA), (const char *)db_Escf4 }, 479/*4*/ { "fbld", NONE, op1(XA), db_Escf4 },
478/*5*/ { "fld", QUAD, 0, 0 }, 480/*5*/ { "fld", QUAD, 0, 0 },
479/*6*/ { "fbstp", NONE, 0, 0 }, 481/*6*/ { "fbstp", NONE, 0, 0 },
480/*7*/ { "fstp", QUAD, 0, 0 }, 482/*7*/ { "fstp", QUAD, 0, 0 },
481}; 483};
482 484
483const struct finst * const db_Esc_inst[] = { 485const struct finst * const db_Esc_inst[] = {
484 db_Esc8, db_Esc9, db_Esca, db_Escb, 486 db_Esc8, db_Esc9, db_Esca, db_Escb,
485 db_Escc, db_Escd, db_Esce, db_Escf 487 db_Escc, db_Escd, db_Esce, db_Escf
486}; 488};
487 489
488const char * const db_Grp1[] = { 490const char * const db_Grp1[] = {
489 "add", 491 "add",
490 "or", 492 "or",
@@ -508,38 +510,38 @@ const char * const db_Grp2[] = { @@ -508,38 +510,38 @@ const char * const db_Grp2[] = {
508}; 510};
509 511
510const struct inst db_Grp3[] = { 512const struct inst db_Grp3[] = {
511 { "test", true, NONE, op2(I,E), 0 }, 513 { "test", true, NONE, op2(I,E), 0 },
512 { "test", true, NONE, op2(I,E), 0 }, 514 { "test", true, NONE, op2(I,E), 0 },
513 { "not", true, NONE, op1(E), 0 }, 515 { "not", true, NONE, op1(E), 0 },
514 { "neg", true, NONE, op1(E), 0 }, 516 { "neg", true, NONE, op1(E), 0 },
515 { "mul", true, NONE, op2(E,A), 0 }, 517 { "mul", true, NONE, op2(E,A), 0 },
516 { "imul", true, NONE, op2(E,A), 0 }, 518 { "imul", true, NONE, op2(E,A), 0 },
517 { "div", true, NONE, op2(E,A), 0 }, 519 { "div", true, NONE, op2(E,A), 0 },
518 { "idiv", true, NONE, op2(E,A), 0 }, 520 { "idiv", true, NONE, op2(E,A), 0 },
519}; 521};
520 522
521const struct inst db_Grp4[] = { 523const struct inst db_Grp4[] = {
522 { "inc", true, BYTE, op1(E), 0 }, 524 { "inc", true, BYTE, op1(E), 0 },
523 { "dec", true, BYTE, op1(E), 0 }, 525 { "dec", true, BYTE, op1(E), 0 },
524 { "", true, NONE, 0, 0 }, 526 { "", true, NONE, 0, 0 },
525 { "", true, NONE, 0, 0 }, 527 { "", true, NONE, 0, 0 },
526 { "", true, NONE, 0, 0 }, 528 { "", true, NONE, 0, 0 },
527 { "", true, NONE, 0, 0 }, 529 { "", true, NONE, 0, 0 },
528 { "", true, NONE, 0, 0 }, 530 { "", true, NONE, 0, 0 },
529 { "", true, NONE, 0, 0 } 531 { "", true, NONE, 0, 0 }
530}; 532};
531 533
532const struct inst db_Grp5[] = { 534const struct inst db_Grp5[] = {
533 { "inc", true, LONG, op1(E), 0 }, 535 { "inc", true, LONG, op1(E), 0 },
534 { "dec", true, LONG, op1(E), 0 }, 536 { "dec", true, LONG, op1(E), 0 },
535 { "call", true, NONE, op1(Eind),0 }, 537 { "call", true, NONE, op1(Eind),0 },
536 { "lcall", true, NONE, op1(Eind),0 }, 538 { "lcall", true, NONE, op1(Eind),0 },
537 { "jmp", true, NONE, op1(Eind),0 }, 539 { "jmp", true, NONE, op1(Eind),0 },
538 { "ljmp", true, NONE, op1(Eind),0 }, 540 { "ljmp", true, NONE, op1(Eind),0 },
539 { "push", true, LONG, op1(E), 0 }, 541 { "push", true, LONG, op1(E), 0 },
540 { "", true, NONE, 0, 0 } 542 { "", true, NONE, 0, 0 }
541}; 543};
542 544
543const struct inst db_inst_table[256] = { 545const struct inst db_inst_table[256] = {
544/*00*/ { "add", true, BYTE, op2(R, E), 0 }, 546/*00*/ { "add", true, BYTE, op2(R, E), 0 },
545/*01*/ { "add", true, LONG, op2(R, E), 0 }, 547/*01*/ { "add", true, LONG, op2(R, E), 0 },
@@ -574,45 +576,45 @@ const struct inst db_inst_table[256] = { @@ -574,45 +576,45 @@ const struct inst db_inst_table[256] = {
574/*1b*/ { "sbb", true, LONG, op2(E, R), 0 }, 576/*1b*/ { "sbb", true, LONG, op2(E, R), 0 },
575/*1c*/ { "sbb", false, BYTE, op2(Is, A), 0 }, 577/*1c*/ { "sbb", false, BYTE, op2(Is, A), 0 },
576/*1d*/ { "sbb", false, LONG, op2(Is, A), 0 }, 578/*1d*/ { "sbb", false, LONG, op2(Is, A), 0 },
577/*1e*/ { "push", false, NONE, op1(Si), 0 }, 579/*1e*/ { "push", false, NONE, op1(Si), 0 },
578/*1f*/ { "pop", false, NONE, op1(Si), 0 }, 580/*1f*/ { "pop", false, NONE, op1(Si), 0 },
579 581
580/*20*/ { "and", true, BYTE, op2(R, E), 0 }, 582/*20*/ { "and", true, BYTE, op2(R, E), 0 },
581/*21*/ { "and", true, LONG, op2(R, E), 0 }, 583/*21*/ { "and", true, LONG, op2(R, E), 0 },
582/*22*/ { "and", true, BYTE, op2(E, R), 0 }, 584/*22*/ { "and", true, BYTE, op2(E, R), 0 },
583/*23*/ { "and", true, LONG, op2(E, R), 0 }, 585/*23*/ { "and", true, LONG, op2(E, R), 0 },
584/*24*/ { "and", false, BYTE, op2(I, A), 0 }, 586/*24*/ { "and", false, BYTE, op2(I, A), 0 },
585/*25*/ { "and", false, LONG, op2(I, A), 0 }, 587/*25*/ { "and", false, LONG, op2(I, A), 0 },
586/*26*/ { "", false, NONE, 0, 0 }, 588/*26*/ { "", false, NONE, 0, 0 },
587/*27*/ { "aaa", false, NONE, 0, 0 }, 589/*27*/ { "daa", false, NONE, 0, 0 },
588 590
589/*28*/ { "sub", true, BYTE, op2(R, E), 0 }, 591/*28*/ { "sub", true, BYTE, op2(R, E), 0 },
590/*29*/ { "sub", true, LONG, op2(R, E), 0 }, 592/*29*/ { "sub", true, LONG, op2(R, E), 0 },
591/*2a*/ { "sub", true, BYTE, op2(E, R), 0 }, 593/*2a*/ { "sub", true, BYTE, op2(E, R), 0 },
592/*2b*/ { "sub", true, LONG, op2(E, R), 0 }, 594/*2b*/ { "sub", true, LONG, op2(E, R), 0 },
593/*2c*/ { "sub", false, BYTE, op2(Is, A), 0 }, 595/*2c*/ { "sub", false, BYTE, op2(Is, A), 0 },
594/*2d*/ { "sub", false, LONG, op2(Is, A), 0 }, 596/*2d*/ { "sub", false, LONG, op2(Is, A), 0 },
595/*2e*/ { "", false, NONE, 0, 0 }, 597/*2e*/ { "", false, NONE, 0, 0 },
596/*2f*/ { "das", false, NONE, 0, 0 }, 598/*2f*/ { "das", false, NONE, 0, 0 },
597 599
598/*30*/ { "xor", true, BYTE, op2(R, E), 0 }, 600/*30*/ { "xor", true, BYTE, op2(R, E), 0 },
599/*31*/ { "xor", true, LONG, op2(R, E), 0 }, 601/*31*/ { "xor", true, LONG, op2(R, E), 0 },
600/*32*/ { "xor", true, BYTE, op2(E, R), 0 }, 602/*32*/ { "xor", true, BYTE, op2(E, R), 0 },
601/*33*/ { "xor", true, LONG, op2(E, R), 0 }, 603/*33*/ { "xor", true, LONG, op2(E, R), 0 },
602/*34*/ { "xor", false, BYTE, op2(I, A), 0 }, 604/*34*/ { "xor", false, BYTE, op2(I, A), 0 },
603/*35*/ { "xor", false, LONG, op2(I, A), 0 }, 605/*35*/ { "xor", false, LONG, op2(I, A), 0 },
604/*36*/ { "", false, NONE, 0, 0 }, 606/*36*/ { "", false, NONE, 0, 0 },
605/*37*/ { "daa", false, NONE, 0, 0 }, 607/*37*/ { "aaa", false, NONE, 0, 0 },
606 608
607/*38*/ { "cmp", true, BYTE, op2(R, E), 0 }, 609/*38*/ { "cmp", true, BYTE, op2(R, E), 0 },
608/*39*/ { "cmp", true, LONG, op2(R, E), 0 }, 610/*39*/ { "cmp", true, LONG, op2(R, E), 0 },
609/*3a*/ { "cmp", true, BYTE, op2(E, R), 0 }, 611/*3a*/ { "cmp", true, BYTE, op2(E, R), 0 },
610/*3b*/ { "cmp", true, LONG, op2(E, R), 0 }, 612/*3b*/ { "cmp", true, LONG, op2(E, R), 0 },
611/*3c*/ { "cmp", false, BYTE, op2(Is, A), 0 }, 613/*3c*/ { "cmp", false, BYTE, op2(Is, A), 0 },
612/*3d*/ { "cmp", false, LONG, op2(Is, A), 0 }, 614/*3d*/ { "cmp", false, LONG, op2(Is, A), 0 },
613/*3e*/ { "", false, NONE, 0, 0 }, 615/*3e*/ { "", false, NONE, 0, 0 },
614/*3f*/ { "aas", false, NONE, 0, 0 }, 616/*3f*/ { "aas", false, NONE, 0, 0 },
615 617
616/*40*/ { "inc", false, LONG, op1(Ri), 0 }, 618/*40*/ { "inc", false, LONG, op1(Ri), 0 },
617/*41*/ { "inc", false, LONG, op1(Ri), 0 }, 619/*41*/ { "inc", false, LONG, op1(Ri), 0 },
618/*42*/ { "inc", false, LONG, op1(Ri), 0 }, 620/*42*/ { "inc", false, LONG, op1(Ri), 0 },
@@ -643,27 +645,26 @@ const struct inst db_inst_table[256] = { @@ -643,27 +645,26 @@ const struct inst db_inst_table[256] = {
643/*58*/ { "pop", false, LONG, op1(Ri), 0 }, 645/*58*/ { "pop", false, LONG, op1(Ri), 0 },
644/*59*/ { "pop", false, LONG, op1(Ri), 0 }, 646/*59*/ { "pop", false, LONG, op1(Ri), 0 },
645/*5a*/ { "pop", false, LONG, op1(Ri), 0 }, 647/*5a*/ { "pop", false, LONG, op1(Ri), 0 },
646/*5b*/ { "pop", false, LONG, op1(Ri), 0 }, 648/*5b*/ { "pop", false, LONG, op1(Ri), 0 },
647/*5c*/ { "pop", false, LONG, op1(Ri), 0 }, 649/*5c*/ { "pop", false, LONG, op1(Ri), 0 },
648/*5d*/ { "pop", false, LONG, op1(Ri), 0 }, 650/*5d*/ { "pop", false, LONG, op1(Ri), 0 },
649/*5e*/ { "pop", false, LONG, op1(Ri), 0 }, 651/*5e*/ { "pop", false, LONG, op1(Ri), 0 },
650/*5f*/ { "pop", false, LONG, op1(Ri), 0 }, 652/*5f*/ { "pop", false, LONG, op1(Ri), 0 },
651 653
652/*60*/ { "pusha", false, LONG, 0, 0 }, 654/*60*/ { "pusha", false, LONG, 0, 0 },
653/*61*/ { "popa", false, LONG, 0, 0 }, 655/*61*/ { "popa", false, LONG, 0, 0 },
654/*62*/ { "bound", true, LONG, op2(E, R), 0 }, 656/*62*/ { "bound", true, LONG, op2(E, R), 0 },
655/*63*/ { "arpl", true, NONE, op2(Ew,Rw), 0 }, 657/*63*/ { "arpl", true, NONE, op2(Ew,Rw), 0 },
656 
657/*64*/ { "", false, NONE, 0, 0 }, 658/*64*/ { "", false, NONE, 0, 0 },
658/*65*/ { "", false, NONE, 0, 0 }, 659/*65*/ { "", false, NONE, 0, 0 },
659/*66*/ { "", false, NONE, 0, 0 }, 660/*66*/ { "", false, NONE, 0, 0 },
660/*67*/ { "", false, NONE, 0, 0 }, 661/*67*/ { "", false, NONE, 0, 0 },
661 662
662/*68*/ { "push", false, LONG, op1(I), 0 }, 663/*68*/ { "push", false, LONG, op1(I), 0 },
663/*69*/ { "imul", true, LONG, op3(I,E,R), 0 }, 664/*69*/ { "imul", true, LONG, op3(I,E,R), 0 },
664/*6a*/ { "push", false, LONG, op1(Ib), 0 }, 665/*6a*/ { "push", false, LONG, op1(Ib), 0 },
665/*6b*/ { "imul", true, LONG, op3(Ibs,E,R),0 }, 666/*6b*/ { "imul", true, LONG, op3(Ibs,E,R),0 },
666/*6c*/ { "ins", false, BYTE, op2(DX, DI), 0 }, 667/*6c*/ { "ins", false, BYTE, op2(DX, DI), 0 },
667/*6d*/ { "ins", false, LONG, op2(DX, DI), 0 }, 668/*6d*/ { "ins", false, LONG, op2(DX, DI), 0 },
668/*6e*/ { "outs", false, BYTE, op2(SI, DX), 0 }, 669/*6e*/ { "outs", false, BYTE, op2(SI, DX), 0 },
669/*6f*/ { "outs", false, LONG, op2(SI, DX), 0 }, 670/*6f*/ { "outs", false, LONG, op2(SI, DX), 0 },
@@ -676,30 +677,30 @@ const struct inst db_inst_table[256] = { @@ -676,30 +677,30 @@ const struct inst db_inst_table[256] = {
676/*75*/ { "jnz", false, NONE, op1(Db), 0 }, 677/*75*/ { "jnz", false, NONE, op1(Db), 0 },
677/*76*/ { "jbe", false, NONE, op1(Db), 0 }, 678/*76*/ { "jbe", false, NONE, op1(Db), 0 },
678/*77*/ { "jnbe", false, NONE, op1(Db), 0 }, 679/*77*/ { "jnbe", false, NONE, op1(Db), 0 },
679 680
680/*78*/ { "js", false, NONE, op1(Db), 0 }, 681/*78*/ { "js", false, NONE, op1(Db), 0 },
681/*79*/ { "jns", false, NONE, op1(Db), 0 }, 682/*79*/ { "jns", false, NONE, op1(Db), 0 },
682/*7a*/ { "jp", false, NONE, op1(Db), 0 }, 683/*7a*/ { "jp", false, NONE, op1(Db), 0 },
683/*7b*/ { "jnp", false, NONE, op1(Db), 0 }, 684/*7b*/ { "jnp", false, NONE, op1(Db), 0 },
684/*7c*/ { "jl", false, NONE, op1(Db), 0 }, 685/*7c*/ { "jl", false, NONE, op1(Db), 0 },
685/*7d*/ { "jnl", false, NONE, op1(Db), 0 }, 686/*7d*/ { "jnl", false, NONE, op1(Db), 0 },
686/*7e*/ { "jle", false, NONE, op1(Db), 0 }, 687/*7e*/ { "jle", false, NONE, op1(Db), 0 },
687/*7f*/ { "jnle", false, NONE, op1(Db), 0 }, 688/*7f*/ { "jnle", false, NONE, op1(Db), 0 },
688 689
689/*80*/ { "", true, BYTE, op2(I, E), (const char *)db_Grp1 }, 690/*80*/ { "", true, BYTE, op2(I, E), db_Grp1 },
690/*81*/ { "", true, LONG, op2(I, E), (const char *)db_Grp1 }, 691/*81*/ { "", true, LONG, op2(I, E), db_Grp1 },
691/*82*/ { "", true, BYTE, op2(Is,E), (const char *)db_Grp1 }, 692/*82*/ { "", true, BYTE, op2(Is,E), db_Grp1 },
692/*83*/ { "", true, LONG, op2(Ibs,E), (const char *)db_Grp1 }, 693/*83*/ { "", true, LONG, op2(Ibs,E), db_Grp1 },
693/*84*/ { "test", true, BYTE, op2(R, E), 0 }, 694/*84*/ { "test", true, BYTE, op2(R, E), 0 },
694/*85*/ { "test", true, LONG, op2(R, E), 0 }, 695/*85*/ { "test", true, LONG, op2(R, E), 0 },
695/*86*/ { "xchg", true, BYTE, op2(R, E), 0 }, 696/*86*/ { "xchg", true, BYTE, op2(R, E), 0 },
696/*87*/ { "xchg", true, LONG, op2(R, E), 0 }, 697/*87*/ { "xchg", true, LONG, op2(R, E), 0 },
697 698
698/*88*/ { "mov", true, BYTE, op2(R, E), 0 }, 699/*88*/ { "mov", true, BYTE, op2(R, E), 0 },
699/*89*/ { "mov", true, LONG, op2(R, E), 0 }, 700/*89*/ { "mov", true, LONG, op2(R, E), 0 },
700/*8a*/ { "mov", true, BYTE, op2(E, R), 0 }, 701/*8a*/ { "mov", true, BYTE, op2(E, R), 0 },
701/*8b*/ { "mov", true, LONG, op2(E, R), 0 }, 702/*8b*/ { "mov", true, LONG, op2(E, R), 0 },
702/*8c*/ { "mov", true, NONE, op2(S, Ew), 0 }, 703/*8c*/ { "mov", true, NONE, op2(S, Ew), 0 },
703/*8d*/ { "lea", true, LONG, op2(E, R), 0 }, 704/*8d*/ { "lea", true, LONG, op2(E, R), 0 },
704/*8e*/ { "mov", true, NONE, op2(Ew, S), 0 }, 705/*8e*/ { "mov", true, NONE, op2(Ew, S), 0 },
705/*8f*/ { "pop", true, LONG, op1(E), 0 }, 706/*8f*/ { "pop", true, LONG, op1(E), 0 },
@@ -748,100 +749,100 @@ const struct inst db_inst_table[256] = { @@ -748,100 +749,100 @@ const struct inst db_inst_table[256] = {
748/*b5*/ { "mov", false, BYTE, op2(I, Ri), 0 }, 749/*b5*/ { "mov", false, BYTE, op2(I, Ri), 0 },
749/*b6*/ { "mov", false, BYTE, op2(I, Ri), 0 }, 750/*b6*/ { "mov", false, BYTE, op2(I, Ri), 0 },
750/*b7*/ { "mov", false, BYTE, op2(I, Ri), 0 }, 751/*b7*/ { "mov", false, BYTE, op2(I, Ri), 0 },
751 752
752/*b8*/ { "mov", false, LONG, op2(I, Ri), 0 }, 753/*b8*/ { "mov", false, LONG, op2(I, Ri), 0 },
753/*b9*/ { "mov", false, LONG, op2(I, Ri), 0 }, 754/*b9*/ { "mov", false, LONG, op2(I, Ri), 0 },
754/*ba*/ { "mov", false, LONG, op2(I, Ri), 0 }, 755/*ba*/ { "mov", false, LONG, op2(I, Ri), 0 },
755/*bb*/ { "mov", false, LONG, op2(I, Ri), 0 }, 756/*bb*/ { "mov", false, LONG, op2(I, Ri), 0 },
756/*bc*/ { "mov", false, LONG, op2(I, Ri), 0 }, 757/*bc*/ { "mov", false, LONG, op2(I, Ri), 0 },
757/*bd*/ { "mov", false, LONG, op2(I, Ri), 0 }, 758/*bd*/ { "mov", false, LONG, op2(I, Ri), 0 },
758/*be*/ { "mov", false, LONG, op2(I, Ri), 0 }, 759/*be*/ { "mov", false, LONG, op2(I, Ri), 0 },
759/*bf*/ { "mov", false, LONG, op2(I, Ri), 0 }, 760/*bf*/ { "mov", false, LONG, op2(I, Ri), 0 },
760 761
761/*c0*/ { "", true, BYTE, op2(Ib, E), (const char *)db_Grp2 }, 762/*c0*/ { "", true, BYTE, op2(Ib, E), db_Grp2 },
762/*c1*/ { "", true, LONG, op2(Ib, E), (const char *)db_Grp2 }, 763/*c1*/ { "", true, LONG, op2(Ib, E), db_Grp2 },
763/*c2*/ { "ret", false, NONE, op1(Iw), 0 }, 764/*c2*/ { "ret", false, NONE, op1(Iw), 0 },
764/*c3*/ { "ret", false, NONE, 0, 0 }, 765/*c3*/ { "ret", false, NONE, 0, 0 },
765/*c4*/ { "les", true, LONG, op2(E, R), 0 }, 766/*c4*/ { "les", true, LONG, op2(E, R), 0 },
766/*c5*/ { "lds", true, LONG, op2(E, R), 0 }, 767/*c5*/ { "lds", true, LONG, op2(E, R), 0 },
767/*c6*/ { "mov", true, BYTE, op2(I, E), 0 }, 768/*c6*/ { "mov", true, BYTE, op2(I, E), 0 },
768/*c7*/ { "mov", true, LONG, op2(I, E), 0 }, 769/*c7*/ { "mov", true, LONG, op2(I, E), 0 },
769 770
770/*c8*/ { "enter", false, NONE, op2(Ib, Iw), 0 }, 771/*c8*/ { "enter", false, NONE, op2(Ib, Iw), 0 },
771/*c9*/ { "leave", false, NONE, 0, 0 }, 772/*c9*/ { "leave", false, NONE, 0, 0 },
772/*ca*/ { "lret", false, NONE, op1(Iw), 0 }, 773/*ca*/ { "lret", false, NONE, op1(Iw), 0 },
773/*cb*/ { "lret", false, NONE, 0, 0 }, 774/*cb*/ { "lret", false, NONE, 0, 0 },
774/*cc*/ { "int", false, NONE, op1(o3), 0 }, 775/*cc*/ { "int", false, NONE, op1(o3), 0 },
775/*cd*/ { "int", false, NONE, op1(Ib), 0 }, 776/*cd*/ { "int", false, NONE, op1(Ib), 0 },
776/*ce*/ { "into", false, NONE, 0, 0 }, 777/*ce*/ { "into", false, NONE, 0, 0 },
777/*cf*/ { "iret", false, NONE, 0, 0 }, 778/*cf*/ { "iret", false, NONE, 0, 0 },
778 779
779/*d0*/ { "", true, BYTE, op2(o1, E), (const char *)db_Grp2 }, 780/*d0*/ { "", true, BYTE, op2(o1, E), db_Grp2 },
780/*d1*/ { "", true, LONG, op2(o1, E), (const char *)db_Grp2 }, 781/*d1*/ { "", true, LONG, op2(o1, E), db_Grp2 },
781/*d2*/ { "", true, BYTE, op2(CL, E), (const char *)db_Grp2 }, 782/*d2*/ { "", true, BYTE, op2(CL, E), db_Grp2 },
782/*d3*/ { "", true, LONG, op2(CL, E), (const char *)db_Grp2 }, 783/*d3*/ { "", true, LONG, op2(CL, E), db_Grp2 },
783/*d4*/ { "aam", true, NONE, 0, 0 }, 784/*d4*/ { "aam", true, NONE, 0, 0 },
784/*d5*/ { "aad", true, NONE, 0, 0 }, 785/*d5*/ { "aad", true, NONE, 0, 0 },
785/*d6*/ { "", false, NONE, 0, 0 }, 786/*d6*/ { "", false, NONE, 0, 0 },
786/*d7*/ { "xlat", false, BYTE, op1(BX), 0 }, 787/*d7*/ { "xlat", false, BYTE, op1(BX), 0 },
787 788
788/*d8*/ { "", true, NONE, 0, (const char *)db_Esc8 }, 789/*d8*/ { "", true, NONE, 0, db_Esc8 },
789/*d9*/ { "", true, NONE, 0, (const char *)db_Esc9 }, 790/*d9*/ { "", true, NONE, 0, db_Esc9 },
790/*da*/ { "", true, NONE, 0, (const char *)db_Esca }, 791/*da*/ { "", true, NONE, 0, db_Esca },
791/*db*/ { "", true, NONE, 0, (const char *)db_Escb }, 792/*db*/ { "", true, NONE, 0, db_Escb },
792/*dc*/ { "", true, NONE, 0, (const char *)db_Escc }, 793/*dc*/ { "", true, NONE, 0, db_Escc },
793/*dd*/ { "", true, NONE, 0, (const char *)db_Escd }, 794/*dd*/ { "", true, NONE, 0, db_Escd },
794/*de*/ { "", true, NONE, 0, (const char *)db_Esce }, 795/*de*/ { "", true, NONE, 0, db_Esce },
795/*df*/ { "", true, NONE, 0, (const char *)db_Escf }, 796/*df*/ { "", true, NONE, 0, db_Escf },
796 797
797/*e0*/ { "loopne",false, NONE, op1(Db), 0 }, 798/*e0*/ { "loopne",false, NONE, op1(Db), 0 },
798/*e1*/ { "loope", false, NONE, op1(Db), 0 }, 799/*e1*/ { "loope", false, NONE, op1(Db), 0 },
799/*e2*/ { "loop", false, NONE, op1(Db), 0 }, 800/*e2*/ { "loop", false, NONE, op1(Db), 0 },
800/*e3*/ { "jcxz", false, SDEP, op1(Db), "jecxz" }, 801/*e3*/ { "jcxz", false, SDEP, op1(Db), "jecxz" },
801/*e4*/ { "in", false, BYTE, op2(Ib, A), 0 }, 802/*e4*/ { "in", false, BYTE, op2(Ib, A), 0 },
802/*e5*/ { "in", false, LONG, op2(Ib, A) , 0 }, 803/*e5*/ { "in", false, LONG, op2(Ib, A) , 0 },
803/*e6*/ { "out", false, BYTE, op2(A, Ib), 0 }, 804/*e6*/ { "out", false, BYTE, op2(A, Ib), 0 },
804/*e7*/ { "out", false, LONG, op2(A, Ib) , 0 }, 805/*e7*/ { "out", false, LONG, op2(A, Ib) , 0 },
805 806
806/*e8*/ { "call", false, NONE, op1(Dl), 0 }, 807/*e8*/ { "call", false, NONE, op1(Dl), 0 },
807/*e9*/ { "jmp", false, NONE, op1(Dl), 0 }, 808/*e9*/ { "jmp", false, NONE, op1(Dl), 0 },
808/*ea*/ { "ljmp", false, NONE, op1(OS), 0 }, 809/*ea*/ { "ljmp", false, NONE, op1(OS), 0 },
809/*eb*/ { "jmp", false, NONE, op1(Db), 0 }, 810/*eb*/ { "jmp", false, NONE, op1(Db), 0 },
810/*ec*/ { "in", false, BYTE, op2(DX, A), 0 }, 811/*ec*/ { "in", false, BYTE, op2(DX, A), 0 },
811/*ed*/ { "in", false, LONG, op2(DX, A) , 0 }, 812/*ed*/ { "in", false, LONG, op2(DX, A) , 0 },
812/*ee*/ { "out", false, BYTE, op2(A, DX), 0 }, 813/*ee*/ { "out", false, BYTE, op2(A, DX), 0 },
813/*ef*/ { "out", false, LONG, op2(A, DX) , 0 }, 814/*ef*/ { "out", false, LONG, op2(A, DX) , 0 },
814 815
815/*f0*/ { "", false, NONE, 0, 0 }, 816/*f0*/ { "", false, NONE, 0, 0 },
816/*f1*/ { "", false, NONE, 0, 0 }, 817/*f1*/ { "", false, NONE, 0, 0 },
817/*f2*/ { "", false, NONE, 0, 0 }, 818/*f2*/ { "", false, NONE, 0, 0 },
818/*f3*/ { "", false, NONE, 0, 0 }, 819/*f3*/ { "", false, NONE, 0, 0 },
819/*f4*/ { "hlt", false, NONE, 0, 0 }, 820/*f4*/ { "hlt", false, NONE, 0, 0 },
820/*f5*/ { "cmc", false, NONE, 0, 0 }, 821/*f5*/ { "cmc", false, NONE, 0, 0 },
821/*f6*/ { "", true, BYTE, 0, (const char *)db_Grp3 }, 822/*f6*/ { "", true, BYTE, 0, db_Grp3 },
822/*f7*/ { "", true, LONG, 0, (const char *)db_Grp3 }, 823/*f7*/ { "", true, LONG, 0, db_Grp3 },
823 824
824/*f8*/ { "clc", false, NONE, 0, 0 }, 825/*f8*/ { "clc", false, NONE, 0, 0 },
825/*f9*/ { "stc", false, NONE, 0, 0 }, 826/*f9*/ { "stc", false, NONE, 0, 0 },
826/*fa*/ { "cli", false, NONE, 0, 0 }, 827/*fa*/ { "cli", false, NONE, 0, 0 },
827/*fb*/ { "sti", false, NONE, 0, 0 }, 828/*fb*/ { "sti", false, NONE, 0, 0 },
828/*fc*/ { "cld", false, NONE, 0, 0 }, 829/*fc*/ { "cld", false, NONE, 0, 0 },
829/*fd*/ { "std", false, NONE, 0, 0 }, 830/*fd*/ { "std", false, NONE, 0, 0 },
830/*fe*/ { "", true, NONE, 0, (const char *)db_Grp4 }, 831/*fe*/ { "", true, NONE, 0, db_Grp4 },
831/*ff*/ { "", true, NONE, 0, (const char *)db_Grp5 }, 832/*ff*/ { "", true, NONE, 0, db_Grp5 },
832}; 833};
833 834
834const struct inst db_bad_inst = 835const struct inst db_bad_inst =
835 { "???", false, NONE, 0, 0 } 836 { "???", false, NONE, 0, 0 }
836; 837;
837 838
838#define f_mod(byte) ((byte)>>6) 839#define f_mod(byte) ((byte)>>6)
839#define f_reg(byte) (((byte)>>3)&0x7) 840#define f_reg(byte) (((byte)>>3)&0x7)
840#define f_rm(byte) ((byte)&0x7) 841#define f_rm(byte) ((byte)&0x7)
841 842
842#define sib_ss(byte) ((byte)>>6) 843#define sib_ss(byte) ((byte)>>6)
843#define sib_index(byte) (((byte)>>3)&0x7) 844#define sib_index(byte) (((byte)>>3)&0x7)
844#define sib_base(byte) ((byte)&0x7) 845#define sib_base(byte) ((byte)&0x7)
845 846
846struct i_addr { 847struct i_addr {
847 int is_reg; /* if reg, reg number is in 'disp' */ 848 int is_reg; /* if reg, reg number is in 'disp' */
@@ -910,73 +911,73 @@ db_read_address(db_addr_t loc, int short @@ -910,73 +911,73 @@ db_read_address(db_addr_t loc, int short
910 911
911 if (mod == 3) { 912 if (mod == 3) {
912 addrp->is_reg = true; 913 addrp->is_reg = true;
913 addrp->disp = rm; 914 addrp->disp = rm;
914 return (loc); 915 return (loc);
915 } 916 }
916 addrp->is_reg = false; 917 addrp->is_reg = false;
917 addrp->index = 0; 918 addrp->index = 0;
918 919
919 if (short_addr) { 920 if (short_addr) {
920 addrp->index = 0; 921 addrp->index = 0;
921 addrp->ss = 0; 922 addrp->ss = 0;
922 switch (mod) { 923 switch (mod) {
923 case 0: 924 case 0:
924 if (rm == 6) { 925 if (rm == 6) {
925 get_value_inc(disp, loc, 2, true); 926 get_value_inc(disp, loc, 2, true);
926 addrp->disp = disp; 927 addrp->disp = disp;
927 addrp->base = 0; 928 addrp->base = 0;
928 } else { 929 } else {
929 addrp->disp = 0; 930 addrp->disp = 0;
930 addrp->base = db_index_reg_16[rm]; 931 addrp->base = db_index_reg_16[rm];
931 } 932 }
932 break; 933 break;
933 case 1: 934 case 1:
934 get_value_inc(disp, loc, 1, true); 935 get_value_inc(disp, loc, 1, true);
935 addrp->disp = disp; 936 addrp->disp = disp;
936 addrp->base = db_index_reg_16[rm]; 937 addrp->base = db_index_reg_16[rm];
937 break; 938 break;
938 case 2: 939 case 2:
939 get_value_inc(disp, loc, 2, true); 940 get_value_inc(disp, loc, 2, true);
940 addrp->disp = disp; 941 addrp->disp = disp;
941 addrp->base = db_index_reg_16[rm]; 942 addrp->base = db_index_reg_16[rm];
942 break; 943 break;
943 } 944 }
944 } else { 945 } else {
945 if (mod != 3 && rm == 4) { 946 if (mod != 3 && rm == 4) {
946 get_value_inc(sib, loc, 1, false); 947 get_value_inc(sib, loc, 1, false);
947 rm = sib_base(sib); 948 rm = sib_base(sib);
948 index = sib_index(sib); 949 index = sib_index(sib);
949 if (index != 4) 950 if (index != 4)
950 addrp->index = db_reg[LONG][index]; 951 addrp->index = db_reg[LONG][index];
951 addrp->ss = sib_ss(sib); 952 addrp->ss = sib_ss(sib);
952 } 953 }
953 954
954 switch (mod) { 955 switch (mod) {
955 case 0: 956 case 0:
956 if (rm == 5) { 957 if (rm == 5) {
957 get_value_inc(addrp->disp, loc, 4, false); 958 get_value_inc(addrp->disp, loc, 4, false);
958 addrp->base = 0; 959 addrp->base = 0;
959 } else { 960 } else {
960 addrp->disp = 0; 961 addrp->disp = 0;
961 addrp->base = db_reg[LONG][rm]; 962 addrp->base = db_reg[LONG][rm];
962 } 963 }
963 break; 964 break;
964 case 1: 965 case 1:
965 get_value_inc(disp, loc, 1, true); 966 get_value_inc(disp, loc, 1, true);
966 addrp->disp = disp; 967 addrp->disp = disp;
967 addrp->base = db_reg[LONG][rm]; 968 addrp->base = db_reg[LONG][rm];
968 break; 969 break;
969 case 2: 970 case 2:
970 get_value_inc(disp, loc, 4, false); 971 get_value_inc(disp, loc, 4, false);
971 addrp->disp = disp; 972 addrp->disp = disp;
972 addrp->base = db_reg[LONG][rm]; 973 addrp->base = db_reg[LONG][rm];
973 break; 974 break;
974 } 975 }
975 } 976 }
976 return (loc); 977 return (loc);
977} 978}
978 979
979void 980void
980db_print_address(const char * seg, int size, struct i_addr *addrp) 981db_print_address(const char * seg, int size, struct i_addr *addrp)
981{ 982{
982 if (addrp->is_reg) { 983 if (addrp->is_reg) {
@@ -1015,75 +1016,75 @@ db_disasm_esc( @@ -1015,75 +1016,75 @@ db_disasm_esc(
1015 int mod; 1016 int mod;
1016 struct i_addr address; 1017 struct i_addr address;
1017 const char * name; 1018 const char * name;
1018 1019
1019 get_value_inc(regmodrm, loc, 1, false); 1020 get_value_inc(regmodrm, loc, 1, false);
1020 fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)]; 1021 fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)];
1021 mod = f_mod(regmodrm); 1022 mod = f_mod(regmodrm);
1022 if (mod != 3) { 1023 if (mod != 3) {
1023 /* 1024 /*
1024 * Normal address modes. 1025 * Normal address modes.
1025 */ 1026 */
1026 loc = db_read_address(loc, short_addr, regmodrm, &address); 1027 loc = db_read_address(loc, short_addr, regmodrm, &address);
1027 db_printf("%s", fp->f_name); 1028 db_printf("%s", fp->f_name);
1028 switch(fp->f_size) { 1029 switch (fp->f_size) {
1029 case SNGL: 1030 case SNGL:
1030 db_printf("s"); 1031 db_printf("s");
1031 break; 1032 break;
1032 case DBLR: 1033 case DBLR:
1033 db_printf("l"); 1034 db_printf("l");
1034 break; 1035 break;
1035 case EXTR: 1036 case EXTR:
1036 db_printf("t"); 1037 db_printf("t");
1037 break; 1038 break;
1038 case WORD: 1039 case WORD:
1039 db_printf("s"); 1040 db_printf("s");
1040 break; 1041 break;
1041 case LONG: 1042 case LONG:
1042 db_printf("l"); 1043 db_printf("l");
1043 break; 1044 break;
1044 case QUAD: 1045 case QUAD:
1045 db_printf("q"); 1046 db_printf("q");
1046 break; 1047 break;
1047 default: 1048 default:
1048 break; 1049 break;
1049 } 1050 }
1050 db_printf("\t"); 1051 db_printf("\t");
1051 db_print_address(seg, BYTE, &address); 1052 db_print_address(seg, BYTE, &address);
1052 } else { 1053 } else {
1053 /* 1054 /*
1054 * 'reg-reg' - special formats 1055 * 'reg-reg' - special formats
1055 */ 1056 */
1056 switch (fp->f_rrmode) { 1057 switch (fp->f_rrmode) {
1057 case op2(ST,STI): 1058 case op2(ST,STI):
1058 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name; 1059 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1059 db_printf("%s\t%%st,%%st(%d)",name,f_rm(regmodrm)); 1060 db_printf("%s\t%%st,%%st(%d)", name, f_rm(regmodrm));
1060 break; 1061 break;
1061 case op2(STI,ST): 1062 case op2(STI,ST):
1062 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name; 1063 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1063 db_printf("%s\t%%st(%d),%%st",name, f_rm(regmodrm)); 1064 db_printf("%s\t%%st(%d),%%st", name, f_rm(regmodrm));
1064 break; 1065 break;
1065 case op1(STI): 1066 case op1(STI):
1066 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name; 1067 name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
1067 db_printf("%s\t%%st(%d)",name, f_rm(regmodrm)); 1068 db_printf("%s\t%%st(%d)", name, f_rm(regmodrm));
1068 break; 1069 break;
1069 case op1(X): 1070 case op1(X):
1070 db_printf("%s", ((const char *const*)fp->f_rrname)[f_rm(regmodrm)]); 1071 db_printf("%s", ((const char *const*)fp->f_rrname)[f_rm(regmodrm)]);
1071 break; 1072 break;
1072 case op1(XA): 1073 case op1(XA):
1073 db_printf("%s\t%%ax", 1074 db_printf("%s\t%%ax",
1074 ((const char *const*)fp->f_rrname)[f_rm(regmodrm)]); 1075 ((const char *const*)fp->f_rrname)[f_rm(regmodrm)]);
1075 break; 1076 break;
1076 default: 1077 default:
1077 db_printf("<bad instruction>"); 1078 db_printf("<bad instruction>");
1078 break; 1079 break;
1079 } 1080 }
1080 } 1081 }
1081 1082
1082 return (loc); 1083 return (loc);
1083} 1084}
1084 1085
1085/* 1086/*
1086 * Disassemble instruction at 'loc'. 'altfmt' specifies an 1087 * Disassemble instruction at 'loc'. 'altfmt' specifies an
1087 * (optional) alternate format. Return address of start of 1088 * (optional) alternate format. Return address of start of
1088 * next instruction. 1089 * next instruction.
1089 */ 1090 */
@@ -1130,60 +1131,60 @@ db_disasm( @@ -1130,60 +1131,60 @@ db_disasm(
1130#endif 1131#endif
1131 1132
1132 get_value_inc(inst, loc, 1, false); 1133 get_value_inc(inst, loc, 1, false);
1133 short_addr = false; 1134 short_addr = false;
1134 size = LONG; 1135 size = LONG;
1135 seg = 0; 1136 seg = 0;
1136 1137
1137 /* 1138 /*
1138 * Get prefixes 1139 * Get prefixes
1139 */ 1140 */
1140 prefix = true; 1141 prefix = true;
1141 do { 1142 do {
1142 switch (inst) { 1143 switch (inst) {
1143 case 0x66: /* data16 */ 1144 case 0x66: /* data16 */
1144 size = WORD; 1145 size = WORD;
1145 break; 1146 break;
1146 case 0x67: 1147 case 0x67:
1147 short_addr = true; 1148 short_addr = true;
1148 break; 1149 break;
1149 case 0x26: 1150 case 0x26:
1150 seg = "%es"; 1151 seg = "%es";
1151 break; 1152 break;
1152 case 0x36: 1153 case 0x36:
1153 seg = "%ss"; 1154 seg = "%ss";
1154 break; 1155 break;
1155 case 0x2e: 1156 case 0x2e:
1156 seg = "%cs"; 1157 seg = "%cs";
1157 break; 1158 break;
1158 case 0x3e: 1159 case 0x3e:
1159 seg = "%ds"; 1160 seg = "%ds";
1160 break; 1161 break;
1161 case 0x64: 1162 case 0x64:
1162 seg = "%fs"; 1163 seg = "%fs";
1163 break; 1164 break;
1164 case 0x65: 1165 case 0x65:
1165 seg = "%gs"; 1166 seg = "%gs";
1166 break; 1167 break;
1167 case 0xf0: 1168 case 0xf0:
1168 db_printf("lock "); 1169 db_printf("lock ");
1169 break; 1170 break;
1170 case 0xf2: 1171 case 0xf2:
1171 db_printf("repne "); 1172 db_printf("repne ");
1172 break; 1173 break;
1173 case 0xf3: 1174 case 0xf3:
1174 db_printf("repe "); /* XXX repe VS rep */ 1175 db_printf("repe "); /* XXX repe VS rep */
1175 break; 1176 break;
1176 default: 1177 default:
1177 prefix = false; 1178 prefix = false;
1178 break; 1179 break;
1179 } 1180 }
1180 if (prefix) 1181 if (prefix)
1181 get_value_inc(inst, loc, 1, false); 1182 get_value_inc(inst, loc, 1, false);
1182 } while (prefix); 1183 } while (prefix);
1183 1184
1184 if (inst >= 0xd8 && inst <= 0xdf) { 1185 if (inst >= 0xd8 && inst <= 0xdf) {
1185 loc = db_disasm_esc(loc, inst, short_addr, size, seg); 1186 loc = db_disasm_esc(loc, inst, short_addr, size, seg);
1186 db_printf("\n"); 1187 db_printf("\n");
1187 return (loc); 1188 return (loc);
1188 } 1189 }
1189 1190
@@ -1221,173 +1222,173 @@ db_disasm( @@ -1221,173 +1222,173 @@ db_disasm(
1221 } else if (ip->i_extra == (const char *)db_Grp4 || 1222 } else if (ip->i_extra == (const char *)db_Grp4 ||
1222 ip->i_extra == (const char *)db_Grp5) { 1223 ip->i_extra == (const char *)db_Grp5) {
1223 ip = (const struct inst *)ip->i_extra; 1224 ip = (const struct inst *)ip->i_extra;
1224 ip = &ip[f_reg(regmodrm)]; 1225 ip = &ip[f_reg(regmodrm)];
1225 i_name = ip->i_name; 1226 i_name = ip->i_name;
1226 i_mode = ip->i_mode; 1227 i_mode = ip->i_mode;
1227 i_size = ip->i_size; 1228 i_size = ip->i_size;
1228 } 1229 }
1229 1230
1230 if (i_size == SDEP) { 1231 if (i_size == SDEP) {
1231 if (size == WORD) 1232 if (size == WORD)
1232 db_printf("%s", i_name); 1233 db_printf("%s", i_name);
1233 else 1234 else
1234 db_printf("%s", ip->i_extra); 1235 db_printf("%s", (const char *)ip->i_extra);
1235 } else { 1236 } else {
1236 db_printf("%s", i_name); 1237 db_printf("%s", i_name);
1237 if (i_size != NONE) { 1238 if (i_size != NONE) {
1238 if (i_size == BYTE) { 1239 if (i_size == BYTE) {
1239 db_printf("b"); 1240 db_printf("b");
1240 size = BYTE; 1241 size = BYTE;
1241 } else if (i_size == WORD) { 1242 } else if (i_size == WORD) {
1242 db_printf("w"); 1243 db_printf("w");
1243 size = WORD; 1244 size = WORD;
1244 } else if (size == WORD) { 1245 } else if (size == WORD) {
1245 db_printf("w"); 1246 db_printf("w");
1246 } else { 1247 } else {
1247 db_printf("l"); 1248 db_printf("l");
1248 } 1249 }
1249 } 1250 }
1250 } 1251 }
1251 db_printf("\t"); 1252 db_printf("\t");
1252 for (first = true; 1253 for (first = true;
1253 i_mode != 0; 1254 i_mode != 0;
1254 i_mode >>= 8, first = false) { 1255 i_mode >>= 8, first = false) {
1255 char tbuf[24]; 1256 char tbuf[24];
1256 1257
1257 if (!first) 1258 if (!first)
1258 db_printf(","); 1259 db_printf(",");
1259 1260
1260 switch (i_mode & 0xFF) { 1261 switch (i_mode & 0xFF) {
1261 case E: 1262 case E:
1262 db_print_address(seg, size, &address); 1263 db_print_address(seg, size, &address);
1263 break; 1264 break;
1264 case Eind: 1265 case Eind:
1265 db_printf("*"); 1266 db_printf("*");
1266 db_print_address(seg, size, &address); 1267 db_print_address(seg, size, &address);
1267 break; 1268 break;
1268 case Ew: 1269 case Ew:
1269 db_print_address(seg, WORD, &address); 1270 db_print_address(seg, WORD, &address);
1270 break; 1271 break;
1271 case Eb: 1272 case Eb:
1272 db_print_address(seg, BYTE, &address); 1273 db_print_address(seg, BYTE, &address);
1273 break; 1274 break;
1274 case R: 1275 case R:
1275 db_printf("%s", db_reg[size][f_reg(regmodrm)]); 1276 db_printf("%s", db_reg[size][f_reg(regmodrm)]);
1276 break; 1277 break;
1277 case Rw: 1278 case Rw:
1278 db_printf("%s", db_reg[WORD][f_reg(regmodrm)]); 1279 db_printf("%s", db_reg[WORD][f_reg(regmodrm)]);
1279 break; 1280 break;
1280 case Ri: 1281 case Ri:
1281 db_printf("%s", db_reg[size][f_rm(inst)]); 1282 db_printf("%s", db_reg[size][f_rm(inst)]);
1282 break; 1283 break;
1283 case S: 1284 case S:
1284 db_printf("%s", db_seg_reg[f_reg(regmodrm)]); 1285 db_printf("%s", db_seg_reg[f_reg(regmodrm)]);
1285 break; 1286 break;
1286 case Si: 1287 case Si:
1287 db_printf("%s", db_seg_reg[f_reg(inst)]); 1288 db_printf("%s", db_seg_reg[f_reg(inst)]);
1288 break; 1289 break;
1289 case A: 1290 case A:
1290 db_printf("%s", db_reg[size][0]); /* acc */ 1291 db_printf("%s", db_reg[size][0]); /* acc */
1291 break; 1292 break;
1292 case BX: 1293 case BX:
1293 if (seg) 1294 if (seg)
1294 db_printf("%s:", seg); 1295 db_printf("%s:", seg);
1295 db_printf("(%s)", short_addr ? "%bx" : "%ebx"); 1296 db_printf("(%s)", short_addr ? "%bx" : "%ebx");
1296 break; 1297 break;
1297 case CL: 1298 case CL:
1298 db_printf("%%cl"); 1299 db_printf("%%cl");
1299 break; 1300 break;
1300 case DX: 1301 case DX:
1301 db_printf("%%dx"); 1302 db_printf("%%dx");
1302 break; 1303 break;
1303 case SI: 1304 case SI:
1304 if (seg) 1305 if (seg)
1305 db_printf("%s:", seg); 1306 db_printf("%s:", seg);
1306 db_printf("(%s)", short_addr ? "%si" : "%esi"); 1307 db_printf("(%s)", short_addr ? "%si" : "%esi");
1307 break; 1308 break;
1308 case DI: 1309 case DI:
1309 db_printf("%%es:(%s)", short_addr ? "%di" : "%edi"); 1310 db_printf("%%es:(%s)", short_addr ? "%di" : "%edi");
1310 break; 1311 break;
1311 case CR: 1312 case CR:
1312 db_printf("%%cr%d", f_reg(regmodrm)); 1313 db_printf("%%cr%d", f_reg(regmodrm));
1313 break; 1314 break;
1314 case DR: 1315 case DR:
1315 db_printf("%%dr%d", f_reg(regmodrm)); 1316 db_printf("%%dr%d", f_reg(regmodrm));
1316 break; 1317 break;
1317 case TR: 1318 case TR:
1318 db_printf("%%tr%d", f_reg(regmodrm)); 1319 db_printf("%%tr%d", f_reg(regmodrm));
1319 break; 1320 break;
1320 case I: 1321 case I:
1321 len = db_lengths[size]; 1322 len = db_lengths[size];
1322 get_value_inc(imm, loc, len, false);/* unsigned */ 1323 get_value_inc(imm, loc, len, false);/* unsigned */
1323 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1324 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1324 db_printf("$%s", tbuf); 1325 db_printf("$%s", tbuf);
1325 break; 1326 break;
1326 case Is: 1327 case Is:
1327 len = db_lengths[size]; 1328 len = db_lengths[size];
1328 get_value_inc(imm, loc, len, true); /* signed */ 1329 get_value_inc(imm, loc, len, true); /* signed */
1329 db_format_radix(tbuf, 24, imm, true); 1330 db_format_radix(tbuf, 24, imm, true);
1330 db_printf("$%s", tbuf); 1331 db_printf("$%s", tbuf);
1331 break; 1332 break;
1332 case Ib: 1333 case Ib:
1333 get_value_inc(imm, loc, 1, false); /* unsigned */ 1334 get_value_inc(imm, loc, 1, false); /* unsigned */
1334 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1335 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1335 db_printf("$%s", tbuf); 1336 db_printf("$%s", tbuf);
1336 break; 1337 break;
1337 case Ibs: 1338 case Ibs:
1338 get_value_inc(imm, loc, 1, true); /* signed */ 1339 get_value_inc(imm, loc, 1, true); /* signed */
1339 db_format_radix(tbuf, 24, imm, true); 1340 db_format_radix(tbuf, 24, imm, true);
1340 db_printf("$%s", tbuf); 1341 db_printf("$%s", tbuf);
1341 break; 1342 break;
1342 case Iw: 1343 case Iw:
1343 get_value_inc(imm, loc, 2, false); /* unsigned */ 1344 get_value_inc(imm, loc, 2, false); /* unsigned */
1344 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1345 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1345 db_printf("$%s", tbuf); 1346 db_printf("$%s", tbuf);
1346 break; 1347 break;
1347 case Il: 1348 case Il:
1348 get_value_inc(imm, loc, 4, false); 1349 get_value_inc(imm, loc, 4, false);
1349 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1350 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1350 db_printf("$%s", tbuf); 1351 db_printf("$%s", tbuf);
1351 break; 1352 break;
1352 case O: 1353 case O:
1353 if (short_addr) 1354 if (short_addr)
1354 get_value_inc(displ, loc, 2, true); 1355 get_value_inc(displ, loc, 2, true);
1355 else 1356 else
1356 get_value_inc(displ, loc, 4, true); 1357 get_value_inc(displ, loc, 4, true);
1357 if (seg) { 1358 if (seg) {
1358 db_format_radix(tbuf, 24, displ, true); 1359 db_format_radix(tbuf, 24, displ, true);
1359 db_printf("%s:%s", seg, tbuf); 1360 db_printf("%s:%s", seg, tbuf);
1360 } else 1361 } else
1361 db_printsym((db_addr_t)displ, DB_STGY_ANY, 1362 db_printsym((db_addr_t)displ, DB_STGY_ANY,
1362 db_printf); 1363 db_printf);
1363 break; 1364 break;
1364 case Db: 1365 case Db:
1365 get_value_inc(displ, loc, 1, true); 1366 get_value_inc(displ, loc, 1, true);
1366 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN, 1367 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN,
1367 db_printf); 1368 db_printf);
1368 break; 1369 break;
1369 case Dl: 1370 case Dl:
1370 get_value_inc(displ, loc, 4, true); 1371 get_value_inc(displ, loc, 4, true);
1371 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN, 1372 db_printsym((db_addr_t)(displ + loc), DB_STGY_XTRN,
1372 db_printf); 1373 db_printf);
1373 break; 1374 break;
1374 case o1: 1375 case o1:
1375 db_printf("$1"); 1376 db_printf("$1");
1376 break; 1377 break;
1377 case o3: 1378 case o3:
1378 db_printf("$3"); 1379 db_printf("$3");
1379 break; 1380 break;
1380 case OS: 1381 case OS:
1381 get_value_inc(imm, loc, 4, false); /* offset */ 1382 get_value_inc(imm, loc, 4, false); /* offset */
1382 db_format_radix(tbuf, 24, (unsigned int)imm, true); 1383 db_format_radix(tbuf, 24, (unsigned int)imm, true);
1383 db_printf("$%s", tbuf); 1384 db_printf("$%s", tbuf);
1384 get_value_inc(imm2, loc, 2, false); /* segment */ 1385 get_value_inc(imm2, loc, 2, false); /* segment */
1385 db_format_radix(tbuf, 24, (unsigned int)imm2, true); 1386 db_format_radix(tbuf, 24, (unsigned int)imm2, true);
1386 db_printf(",%s", tbuf); 1387 db_printf(",%s", tbuf);
1387 break; 1388 break;
1388 } 1389 }
1389 } 1390 }
1390 1391
1391 db_printf("\n"); 1392 db_printf("\n");
1392 return (loc); 1393 return (loc);
1393} 1394}