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

Cache object: 7a6e64ec6c2c7113e92ac591c004e430


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