Bug Summary

File:obj-scan-build/../i386/i386/db_disasm.c
Location:line 958, column 6
Description:Branch condition evaluates to a garbage value

Annotated Source Code

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