The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/i386/db_disasm.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 907d29a522d4d22e9647c51d4b7d5012


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.