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

Cache object: 3c0190b8fe814e83f7f587871603b148


[ 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.