db_disasm.c (13446) | db_disasm.c (14887) |
---|---|
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 unchanged lines hidden (view full) --- 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 * | 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 unchanged lines hidden (view full) --- 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 * $Id: db_disasm.c,v 1.12 1995/12/07 12:45:29 davidg Exp $ | 26 * $Id: db_disasm.c,v 1.13 1996/01/15 22:40:17 phk Exp $ |
27 */ 28 29/* 30 * Instruction disassembler. 31 */ 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/proc.h> --- 51 unchanged lines hidden (view full) --- 86#define o3 29 /* constant 3 */ 87#define OS 30 /* immediate offset/segment */ 88#define ST 31 /* FP stack top */ 89#define STI 32 /* FP stack */ 90#define X 33 /* extended FP op */ 91#define XA 34 /* for 'fstcw %ax' */ 92 93struct inst { | 27 */ 28 29/* 30 * Instruction disassembler. 31 */ 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/proc.h> --- 51 unchanged lines hidden (view full) --- 86#define o3 29 /* constant 3 */ 87#define OS 30 /* immediate offset/segment */ 88#define ST 31 /* FP stack top */ 89#define STI 32 /* FP stack */ 90#define X 33 /* extended FP op */ 91#define XA 34 /* for 'fstcw %ax' */ 92 93struct inst { |
94 char * i_name; /* name */ | 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 char * 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 105struct finst { | 95 short i_has_modrm; /* has regmodrm byte */ 96 short i_size; /* operand size */ 97 int i_mode; /* addressing modes */ 98 char * 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 105struct finst { |
106 char * f_name; /* name for memory instruction */ | 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 char * f_rrname; /* name for rr instruction 110 (or pointer to table) */ 111}; 112 | 107 int f_size; /* size for memory instruction */ 108 int f_rrmode; /* mode for rr instruction */ 109 char * f_rrname; /* name for rr instruction 110 (or pointer to table) */ 111}; 112 |
113static char * db_Grp6[] = { | 113static const char * const db_Grp6[] = { |
114 "sldt", 115 "str", 116 "lldt", 117 "ltr", 118 "verr", 119 "verw", 120 "", 121 "" 122}; 123 | 114 "sldt", 115 "str", 116 "lldt", 117 "ltr", 118 "verr", 119 "verw", 120 "", 121 "" 122}; 123 |
124static char * db_Grp7[] = { | 124static const char * const db_Grp7[] = { |
125 "sgdt", 126 "sidt", 127 "lgdt", 128 "lidt", 129 "smsw", 130 "", 131 "lmsw", 132 "invlpg" 133}; 134 | 125 "sgdt", 126 "sidt", 127 "lgdt", 128 "lidt", 129 "smsw", 130 "", 131 "lmsw", 132 "invlpg" 133}; 134 |
135static char * db_Grp8[] = { | 135static const char * const db_Grp8[] = { |
136 "", 137 "", 138 "", 139 "", 140 "bt", 141 "bts", 142 "btr", 143 "btc" 144}; 145 | 136 "", 137 "", 138 "", 139 "", 140 "bt", 141 "bts", 142 "btr", 143 "btc" 144}; 145 |
146static struct inst db_inst_0f0x[] = { | 146static const struct inst db_inst_0f0x[] = { |
147/*00*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp6 }, 148/*01*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp7 }, 149/*02*/ { "lar", TRUE, LONG, op2(E,R), 0 }, 150/*03*/ { "lsl", TRUE, LONG, op2(E,R), 0 }, 151/*04*/ { "", FALSE, NONE, 0, 0 }, 152/*05*/ { "", FALSE, NONE, 0, 0 }, 153/*06*/ { "clts", FALSE, NONE, 0, 0 }, 154/*07*/ { "", FALSE, NONE, 0, 0 }, 155 156/*08*/ { "invd", FALSE, NONE, 0, 0 }, 157/*09*/ { "wbinvd",FALSE, NONE, 0, 0 }, 158/*0a*/ { "", FALSE, NONE, 0, 0 }, 159/*0b*/ { "", FALSE, NONE, 0, 0 }, 160/*0c*/ { "", FALSE, NONE, 0, 0 }, 161/*0d*/ { "", FALSE, NONE, 0, 0 }, 162/*0e*/ { "", FALSE, NONE, 0, 0 }, 163/*0f*/ { "", FALSE, NONE, 0, 0 }, 164}; 165 | 147/*00*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp6 }, 148/*01*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp7 }, 149/*02*/ { "lar", TRUE, LONG, op2(E,R), 0 }, 150/*03*/ { "lsl", TRUE, LONG, op2(E,R), 0 }, 151/*04*/ { "", FALSE, NONE, 0, 0 }, 152/*05*/ { "", FALSE, NONE, 0, 0 }, 153/*06*/ { "clts", FALSE, NONE, 0, 0 }, 154/*07*/ { "", FALSE, NONE, 0, 0 }, 155 156/*08*/ { "invd", FALSE, NONE, 0, 0 }, 157/*09*/ { "wbinvd",FALSE, NONE, 0, 0 }, 158/*0a*/ { "", FALSE, NONE, 0, 0 }, 159/*0b*/ { "", FALSE, NONE, 0, 0 }, 160/*0c*/ { "", FALSE, NONE, 0, 0 }, 161/*0d*/ { "", FALSE, NONE, 0, 0 }, 162/*0e*/ { "", FALSE, NONE, 0, 0 }, 163/*0f*/ { "", FALSE, NONE, 0, 0 }, 164}; 165 |
166static struct inst db_inst_0f2x[] = { | 166static const struct inst db_inst_0f2x[] = { |
167/*20*/ { "mov", TRUE, LONG, op2(CR,E), 0 }, /* use E for reg */ 168/*21*/ { "mov", TRUE, LONG, op2(DR,E), 0 }, /* since mod == 11 */ 169/*22*/ { "mov", TRUE, LONG, op2(E,CR), 0 }, 170/*23*/ { "mov", TRUE, LONG, op2(E,DR), 0 }, 171/*24*/ { "mov", TRUE, LONG, op2(TR,E), 0 }, 172/*25*/ { "", FALSE, NONE, 0, 0 }, 173/*26*/ { "mov", TRUE, LONG, op2(E,TR), 0 }, 174/*27*/ { "", FALSE, NONE, 0, 0 }, 175 176/*28*/ { "", FALSE, NONE, 0, 0 }, 177/*29*/ { "", FALSE, NONE, 0, 0 }, 178/*2a*/ { "", FALSE, NONE, 0, 0 }, 179/*2b*/ { "", FALSE, NONE, 0, 0 }, 180/*2c*/ { "", FALSE, NONE, 0, 0 }, 181/*2d*/ { "", FALSE, NONE, 0, 0 }, 182/*2e*/ { "", FALSE, NONE, 0, 0 }, 183/*2f*/ { "", FALSE, NONE, 0, 0 }, 184}; 185 | 167/*20*/ { "mov", TRUE, LONG, op2(CR,E), 0 }, /* use E for reg */ 168/*21*/ { "mov", TRUE, LONG, op2(DR,E), 0 }, /* since mod == 11 */ 169/*22*/ { "mov", TRUE, LONG, op2(E,CR), 0 }, 170/*23*/ { "mov", TRUE, LONG, op2(E,DR), 0 }, 171/*24*/ { "mov", TRUE, LONG, op2(TR,E), 0 }, 172/*25*/ { "", FALSE, NONE, 0, 0 }, 173/*26*/ { "mov", TRUE, LONG, op2(E,TR), 0 }, 174/*27*/ { "", FALSE, NONE, 0, 0 }, 175 176/*28*/ { "", FALSE, NONE, 0, 0 }, 177/*29*/ { "", FALSE, NONE, 0, 0 }, 178/*2a*/ { "", FALSE, NONE, 0, 0 }, 179/*2b*/ { "", FALSE, NONE, 0, 0 }, 180/*2c*/ { "", FALSE, NONE, 0, 0 }, 181/*2d*/ { "", FALSE, NONE, 0, 0 }, 182/*2e*/ { "", FALSE, NONE, 0, 0 }, 183/*2f*/ { "", FALSE, NONE, 0, 0 }, 184}; 185 |
186static struct inst db_inst_0f8x[] = { | 186static const struct inst db_inst_0f3x[] = { 187/*30*/ { "wrmsr", FALSE, NONE, 0, 0 }, 188/*31*/ { "rdtsc", FALSE, NONE, 0, 0 }, 189/*32*/ { "rdmsr", FALSE, NONE, 0, 0 }, 190/*33*/ { "rdpmc", FALSE, NONE, 0, 0 }, 191/*34*/ { "", FALSE, NONE, 0, 0 }, 192/*35*/ { "", FALSE, NONE, 0, 0 }, 193/*36*/ { "", FALSE, NONE, 0, 0 }, 194/*37*/ { "", FALSE, NONE, 0, 0 }, 195 196/*38*/ { "", FALSE, NONE, 0, 0 }, 197/*39*/ { "", FALSE, NONE, 0, 0 }, 198/*3a*/ { "", FALSE, NONE, 0, 0 }, 199/*3b*/ { "", FALSE, NONE, 0, 0 }, 200/*3c*/ { "", FALSE, NONE, 0, 0 }, 201/*3d*/ { "", FALSE, NONE, 0, 0 }, 202/*3e*/ { "", FALSE, NONE, 0, 0 }, 203/*3f*/ { "", FALSE, NONE, 0, 0 }, 204}; 205 206static const struct inst db_inst_0f8x[] = { |
187/*80*/ { "jo", FALSE, NONE, op1(Dl), 0 }, 188/*81*/ { "jno", FALSE, NONE, op1(Dl), 0 }, 189/*82*/ { "jb", FALSE, NONE, op1(Dl), 0 }, 190/*83*/ { "jnb", FALSE, NONE, op1(Dl), 0 }, 191/*84*/ { "jz", FALSE, NONE, op1(Dl), 0 }, 192/*85*/ { "jnz", FALSE, NONE, op1(Dl), 0 }, 193/*86*/ { "jbe", FALSE, NONE, op1(Dl), 0 }, 194/*87*/ { "jnbe", FALSE, NONE, op1(Dl), 0 }, 195 196/*88*/ { "js", FALSE, NONE, op1(Dl), 0 }, 197/*89*/ { "jns", FALSE, NONE, op1(Dl), 0 }, 198/*8a*/ { "jp", FALSE, NONE, op1(Dl), 0 }, 199/*8b*/ { "jnp", FALSE, NONE, op1(Dl), 0 }, 200/*8c*/ { "jl", FALSE, NONE, op1(Dl), 0 }, 201/*8d*/ { "jnl", FALSE, NONE, op1(Dl), 0 }, 202/*8e*/ { "jle", FALSE, NONE, op1(Dl), 0 }, 203/*8f*/ { "jnle", FALSE, NONE, op1(Dl), 0 }, 204}; 205 | 207/*80*/ { "jo", FALSE, NONE, op1(Dl), 0 }, 208/*81*/ { "jno", FALSE, NONE, op1(Dl), 0 }, 209/*82*/ { "jb", FALSE, NONE, op1(Dl), 0 }, 210/*83*/ { "jnb", FALSE, NONE, op1(Dl), 0 }, 211/*84*/ { "jz", FALSE, NONE, op1(Dl), 0 }, 212/*85*/ { "jnz", FALSE, NONE, op1(Dl), 0 }, 213/*86*/ { "jbe", FALSE, NONE, op1(Dl), 0 }, 214/*87*/ { "jnbe", FALSE, NONE, op1(Dl), 0 }, 215 216/*88*/ { "js", FALSE, NONE, op1(Dl), 0 }, 217/*89*/ { "jns", FALSE, NONE, op1(Dl), 0 }, 218/*8a*/ { "jp", FALSE, NONE, op1(Dl), 0 }, 219/*8b*/ { "jnp", FALSE, NONE, op1(Dl), 0 }, 220/*8c*/ { "jl", FALSE, NONE, op1(Dl), 0 }, 221/*8d*/ { "jnl", FALSE, NONE, op1(Dl), 0 }, 222/*8e*/ { "jle", FALSE, NONE, op1(Dl), 0 }, 223/*8f*/ { "jnle", FALSE, NONE, op1(Dl), 0 }, 224}; 225 |
206static struct inst db_inst_0f9x[] = { | 226static const struct inst db_inst_0f9x[] = { |
207/*90*/ { "seto", TRUE, NONE, op1(Eb), 0 }, 208/*91*/ { "setno", TRUE, NONE, op1(Eb), 0 }, 209/*92*/ { "setb", TRUE, NONE, op1(Eb), 0 }, 210/*93*/ { "setnb", TRUE, NONE, op1(Eb), 0 }, 211/*94*/ { "setz", TRUE, NONE, op1(Eb), 0 }, 212/*95*/ { "setnz", TRUE, NONE, op1(Eb), 0 }, 213/*96*/ { "setbe", TRUE, NONE, op1(Eb), 0 }, 214/*97*/ { "setnbe",TRUE, NONE, op1(Eb), 0 }, 215 216/*98*/ { "sets", TRUE, NONE, op1(Eb), 0 }, 217/*99*/ { "setns", TRUE, NONE, op1(Eb), 0 }, 218/*9a*/ { "setp", TRUE, NONE, op1(Eb), 0 }, 219/*9b*/ { "setnp", TRUE, NONE, op1(Eb), 0 }, 220/*9c*/ { "setl", TRUE, NONE, op1(Eb), 0 }, 221/*9d*/ { "setnl", TRUE, NONE, op1(Eb), 0 }, 222/*9e*/ { "setle", TRUE, NONE, op1(Eb), 0 }, 223/*9f*/ { "setnle",TRUE, NONE, op1(Eb), 0 }, 224}; 225 | 227/*90*/ { "seto", TRUE, NONE, op1(Eb), 0 }, 228/*91*/ { "setno", TRUE, NONE, op1(Eb), 0 }, 229/*92*/ { "setb", TRUE, NONE, op1(Eb), 0 }, 230/*93*/ { "setnb", TRUE, NONE, op1(Eb), 0 }, 231/*94*/ { "setz", TRUE, NONE, op1(Eb), 0 }, 232/*95*/ { "setnz", TRUE, NONE, op1(Eb), 0 }, 233/*96*/ { "setbe", TRUE, NONE, op1(Eb), 0 }, 234/*97*/ { "setnbe",TRUE, NONE, op1(Eb), 0 }, 235 236/*98*/ { "sets", TRUE, NONE, op1(Eb), 0 }, 237/*99*/ { "setns", TRUE, NONE, op1(Eb), 0 }, 238/*9a*/ { "setp", TRUE, NONE, op1(Eb), 0 }, 239/*9b*/ { "setnp", TRUE, NONE, op1(Eb), 0 }, 240/*9c*/ { "setl", TRUE, NONE, op1(Eb), 0 }, 241/*9d*/ { "setnl", TRUE, NONE, op1(Eb), 0 }, 242/*9e*/ { "setle", TRUE, NONE, op1(Eb), 0 }, 243/*9f*/ { "setnle",TRUE, NONE, op1(Eb), 0 }, 244}; 245 |
226static struct inst db_inst_0fax[] = { | 246static const struct inst db_inst_0fax[] = { |
227/*a0*/ { "push", FALSE, NONE, op1(Si), 0 }, 228/*a1*/ { "pop", FALSE, NONE, op1(Si), 0 }, 229/*a2*/ { "", FALSE, NONE, 0, 0 }, 230/*a3*/ { "bt", TRUE, LONG, op2(E,R), 0 }, 231/*a4*/ { "shld", TRUE, LONG, op3(Ib,E,R), 0 }, 232/*a5*/ { "shld", TRUE, LONG, op3(CL,E,R), 0 }, 233/*a6*/ { "", FALSE, NONE, 0, 0 }, 234/*a7*/ { "", FALSE, NONE, 0, 0 }, 235 236/*a8*/ { "push", FALSE, NONE, op1(Si), 0 }, 237/*a9*/ { "pop", FALSE, NONE, op1(Si), 0 }, 238/*aa*/ { "", FALSE, NONE, 0, 0 }, 239/*ab*/ { "bts", TRUE, LONG, op2(E,R), 0 }, 240/*ac*/ { "shrd", TRUE, LONG, op3(Ib,E,R), 0 }, 241/*ad*/ { "shrd", TRUE, LONG, op3(CL,E,R), 0 }, 242/*a6*/ { "", FALSE, NONE, 0, 0 }, 243/*a7*/ { "imul", TRUE, LONG, op2(E,R), 0 }, 244}; 245 | 247/*a0*/ { "push", FALSE, NONE, op1(Si), 0 }, 248/*a1*/ { "pop", FALSE, NONE, op1(Si), 0 }, 249/*a2*/ { "", FALSE, NONE, 0, 0 }, 250/*a3*/ { "bt", TRUE, LONG, op2(E,R), 0 }, 251/*a4*/ { "shld", TRUE, LONG, op3(Ib,E,R), 0 }, 252/*a5*/ { "shld", TRUE, LONG, op3(CL,E,R), 0 }, 253/*a6*/ { "", FALSE, NONE, 0, 0 }, 254/*a7*/ { "", FALSE, NONE, 0, 0 }, 255 256/*a8*/ { "push", FALSE, NONE, op1(Si), 0 }, 257/*a9*/ { "pop", FALSE, NONE, op1(Si), 0 }, 258/*aa*/ { "", FALSE, NONE, 0, 0 }, 259/*ab*/ { "bts", TRUE, LONG, op2(E,R), 0 }, 260/*ac*/ { "shrd", TRUE, LONG, op3(Ib,E,R), 0 }, 261/*ad*/ { "shrd", TRUE, LONG, op3(CL,E,R), 0 }, 262/*a6*/ { "", FALSE, NONE, 0, 0 }, 263/*a7*/ { "imul", TRUE, LONG, op2(E,R), 0 }, 264}; 265 |
246static struct inst db_inst_0fbx[] = { | 266static const struct inst db_inst_0fbx[] = { |
247/*b0*/ { "", FALSE, NONE, 0, 0 }, 248/*b1*/ { "", FALSE, NONE, 0, 0 }, 249/*b2*/ { "lss", TRUE, LONG, op2(E, R), 0 }, 250/*b3*/ { "bts", TRUE, LONG, op2(R, E), 0 }, 251/*b4*/ { "lfs", TRUE, LONG, op2(E, R), 0 }, 252/*b5*/ { "lgs", TRUE, LONG, op2(E, R), 0 }, 253/*b6*/ { "movzb", TRUE, LONG, op2(E, R), 0 }, 254/*b7*/ { "movzw", TRUE, LONG, op2(E, R), 0 }, 255 256/*b8*/ { "", FALSE, NONE, 0, 0 }, 257/*b9*/ { "", FALSE, NONE, 0, 0 }, 258/*ba*/ { "", TRUE, LONG, op2(Ib, E), (char *)db_Grp8 }, 259/*bb*/ { "btc", TRUE, LONG, op2(R, E), 0 }, 260/*bc*/ { "bsf", TRUE, LONG, op2(E, R), 0 }, 261/*bd*/ { "bsr", TRUE, LONG, op2(E, R), 0 }, 262/*be*/ { "movsb", TRUE, LONG, op2(E, R), 0 }, 263/*bf*/ { "movsw", TRUE, LONG, op2(E, R), 0 }, 264}; 265 | 267/*b0*/ { "", FALSE, NONE, 0, 0 }, 268/*b1*/ { "", FALSE, NONE, 0, 0 }, 269/*b2*/ { "lss", TRUE, LONG, op2(E, R), 0 }, 270/*b3*/ { "bts", TRUE, LONG, op2(R, E), 0 }, 271/*b4*/ { "lfs", TRUE, LONG, op2(E, R), 0 }, 272/*b5*/ { "lgs", TRUE, LONG, op2(E, R), 0 }, 273/*b6*/ { "movzb", TRUE, LONG, op2(E, R), 0 }, 274/*b7*/ { "movzw", TRUE, LONG, op2(E, R), 0 }, 275 276/*b8*/ { "", FALSE, NONE, 0, 0 }, 277/*b9*/ { "", FALSE, NONE, 0, 0 }, 278/*ba*/ { "", TRUE, LONG, op2(Ib, E), (char *)db_Grp8 }, 279/*bb*/ { "btc", TRUE, LONG, op2(R, E), 0 }, 280/*bc*/ { "bsf", TRUE, LONG, op2(E, R), 0 }, 281/*bd*/ { "bsr", TRUE, LONG, op2(E, R), 0 }, 282/*be*/ { "movsb", TRUE, LONG, op2(E, R), 0 }, 283/*bf*/ { "movsw", TRUE, LONG, op2(E, R), 0 }, 284}; 285 |
266static struct inst db_inst_0fcx[] = { | 286static const struct inst db_inst_0fcx[] = { |
267/*c0*/ { "xadd", TRUE, BYTE, op2(R, E), 0 }, 268/*c1*/ { "xadd", TRUE, LONG, op2(R, E), 0 }, 269/*c2*/ { "", FALSE, NONE, 0, 0 }, 270/*c3*/ { "", FALSE, NONE, 0, 0 }, 271/*c4*/ { "", FALSE, NONE, 0, 0 }, 272/*c5*/ { "", FALSE, NONE, 0, 0 }, 273/*c6*/ { "", FALSE, NONE, 0, 0 }, 274/*c7*/ { "", FALSE, NONE, 0, 0 }, 275/*c8*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 276/*c9*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 277/*ca*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 278/*cb*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 279/*cc*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 280/*cd*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 281/*ce*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 282/*cf*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 283}; 284 | 287/*c0*/ { "xadd", TRUE, BYTE, op2(R, E), 0 }, 288/*c1*/ { "xadd", TRUE, LONG, op2(R, E), 0 }, 289/*c2*/ { "", FALSE, NONE, 0, 0 }, 290/*c3*/ { "", FALSE, NONE, 0, 0 }, 291/*c4*/ { "", FALSE, NONE, 0, 0 }, 292/*c5*/ { "", FALSE, NONE, 0, 0 }, 293/*c6*/ { "", FALSE, NONE, 0, 0 }, 294/*c7*/ { "", FALSE, NONE, 0, 0 }, 295/*c8*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 296/*c9*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 297/*ca*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 298/*cb*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 299/*cc*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 300/*cd*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 301/*ce*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 302/*cf*/ { "bswap", FALSE, LONG, op1(Ri), 0 }, 303}; 304 |
285static struct inst db_inst_0fdx[] = { | 305static const struct inst db_inst_0fdx[] = { |
286/*c0*/ { "cmpxchg",TRUE, BYTE, op2(R, E), 0 }, 287/*c1*/ { "cmpxchg",TRUE, LONG, op2(R, E), 0 }, 288/*c2*/ { "", FALSE, NONE, 0, 0 }, 289/*c3*/ { "", FALSE, NONE, 0, 0 }, 290/*c4*/ { "", FALSE, NONE, 0, 0 }, 291/*c5*/ { "", FALSE, NONE, 0, 0 }, 292/*c6*/ { "", FALSE, NONE, 0, 0 }, 293/*c7*/ { "", FALSE, NONE, 0, 0 }, 294/*c8*/ { "", FALSE, NONE, 0, 0 }, 295/*c9*/ { "", FALSE, NONE, 0, 0 }, 296/*ca*/ { "", FALSE, NONE, 0, 0 }, 297/*cb*/ { "", FALSE, NONE, 0, 0 }, 298/*cc*/ { "", FALSE, NONE, 0, 0 }, 299/*cd*/ { "", FALSE, NONE, 0, 0 }, 300/*ce*/ { "", FALSE, NONE, 0, 0 }, 301/*cf*/ { "", FALSE, NONE, 0, 0 }, 302}; 303 | 306/*c0*/ { "cmpxchg",TRUE, BYTE, op2(R, E), 0 }, 307/*c1*/ { "cmpxchg",TRUE, LONG, op2(R, E), 0 }, 308/*c2*/ { "", FALSE, NONE, 0, 0 }, 309/*c3*/ { "", FALSE, NONE, 0, 0 }, 310/*c4*/ { "", FALSE, NONE, 0, 0 }, 311/*c5*/ { "", FALSE, NONE, 0, 0 }, 312/*c6*/ { "", FALSE, NONE, 0, 0 }, 313/*c7*/ { "", FALSE, NONE, 0, 0 }, 314/*c8*/ { "", FALSE, NONE, 0, 0 }, 315/*c9*/ { "", FALSE, NONE, 0, 0 }, 316/*ca*/ { "", FALSE, NONE, 0, 0 }, 317/*cb*/ { "", FALSE, NONE, 0, 0 }, 318/*cc*/ { "", FALSE, NONE, 0, 0 }, 319/*cd*/ { "", FALSE, NONE, 0, 0 }, 320/*ce*/ { "", FALSE, NONE, 0, 0 }, 321/*cf*/ { "", FALSE, NONE, 0, 0 }, 322}; 323 |
304static struct inst *db_inst_0f[] = { | 324static const struct inst * const db_inst_0f[] = { |
305 db_inst_0f0x, 306 0, 307 db_inst_0f2x, | 325 db_inst_0f0x, 326 0, 327 db_inst_0f2x, |
328 db_inst_0f3x, |
|
308 0, 309 0, 310 0, 311 0, | 329 0, 330 0, 331 0, 332 0, |
312 0, | |
313 db_inst_0f8x, 314 db_inst_0f9x, 315 db_inst_0fax, 316 db_inst_0fbx, 317 db_inst_0fcx, 318 db_inst_0fdx, 319 0, 320 0 321}; 322 | 333 db_inst_0f8x, 334 db_inst_0f9x, 335 db_inst_0fax, 336 db_inst_0fbx, 337 db_inst_0fcx, 338 db_inst_0fdx, 339 0, 340 0 341}; 342 |
323static char * db_Esc92[] = { | 343static const char * const db_Esc92[] = { |
324 "fnop", "", "", "", "", "", "", "" 325}; | 344 "fnop", "", "", "", "", "", "", "" 345}; |
326static char * db_Esc93[] = { | 346static const char * const db_Esc93[] = { |
327 "", "", "", "", "", "", "", "" 328}; | 347 "", "", "", "", "", "", "", "" 348}; |
329static char * db_Esc94[] = { | 349static const char * const db_Esc94[] = { |
330 "fchs", "fabs", "", "", "ftst", "fxam", "", "" 331}; | 350 "fchs", "fabs", "", "", "ftst", "fxam", "", "" 351}; |
332static char * db_Esc95[] = { | 352static const char *const db_Esc95[] = { |
333 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","" 334}; | 353 "fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz","" 354}; |
335static char * db_Esc96[] = { | 355static const char *const db_Esc96[] = { |
336 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp", 337 "fincstp" 338}; | 356 "f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp", 357 "fincstp" 358}; |
339static char * db_Esc97[] = { | 359static const char * const db_Esc97[] = { |
340 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos" 341}; 342 | 360 "fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos" 361}; 362 |
343static char * db_Esca4[] = { | 363static const char *const db_Esca4[] = { |
344 "", "fucompp","", "", "", "", "", "" 345}; 346 | 364 "", "fucompp","", "", "", "", "", "" 365}; 366 |
347static char * db_Escb4[] = { | 367static const char *const db_Escb4[] = { |
348 "", "", "fnclex","fninit","", "", "", "" 349}; 350 | 368 "", "", "fnclex","fninit","", "", "", "" 369}; 370 |
351static char * db_Esce3[] = { | 371static const char * const db_Esce3[] = { |
352 "", "fcompp","", "", "", "", "", "" 353}; 354 | 372 "", "fcompp","", "", "", "", "", "" 373}; 374 |
355static char * db_Escf4[] = { | 375static const char *const db_Escf4[] = { |
356 "fnstsw","", "", "", "", "", "", "" 357}; 358 | 376 "fnstsw","", "", "", "", "", "", "" 377}; 378 |
359static struct finst db_Esc8[] = { | 379static const struct finst db_Esc8[] = { |
360/*0*/ { "fadd", SNGL, op2(STI,ST), 0 }, 361/*1*/ { "fmul", SNGL, op2(STI,ST), 0 }, 362/*2*/ { "fcom", SNGL, op2(STI,ST), 0 }, 363/*3*/ { "fcomp", SNGL, op2(STI,ST), 0 }, 364/*4*/ { "fsub", SNGL, op2(STI,ST), 0 }, 365/*5*/ { "fsubr", SNGL, op2(STI,ST), 0 }, 366/*6*/ { "fdiv", SNGL, op2(STI,ST), 0 }, 367/*7*/ { "fdivr", SNGL, op2(STI,ST), 0 }, 368}; 369 | 380/*0*/ { "fadd", SNGL, op2(STI,ST), 0 }, 381/*1*/ { "fmul", SNGL, op2(STI,ST), 0 }, 382/*2*/ { "fcom", SNGL, op2(STI,ST), 0 }, 383/*3*/ { "fcomp", SNGL, op2(STI,ST), 0 }, 384/*4*/ { "fsub", SNGL, op2(STI,ST), 0 }, 385/*5*/ { "fsubr", SNGL, op2(STI,ST), 0 }, 386/*6*/ { "fdiv", SNGL, op2(STI,ST), 0 }, 387/*7*/ { "fdivr", SNGL, op2(STI,ST), 0 }, 388}; 389 |
370static struct finst db_Esc9[] = { | 390static const struct finst db_Esc9[] = { |
371/*0*/ { "fld", SNGL, op1(STI), 0 }, 372/*1*/ { "", NONE, op1(STI), "fxch" }, 373/*2*/ { "fst", SNGL, op1(X), (char *)db_Esc92 }, 374/*3*/ { "fstp", SNGL, op1(X), (char *)db_Esc93 }, 375/*4*/ { "fldenv", NONE, op1(X), (char *)db_Esc94 }, 376/*5*/ { "fldcw", NONE, op1(X), (char *)db_Esc95 }, 377/*6*/ { "fnstenv",NONE, op1(X), (char *)db_Esc96 }, 378/*7*/ { "fnstcw", NONE, op1(X), (char *)db_Esc97 }, 379}; 380 | 391/*0*/ { "fld", SNGL, op1(STI), 0 }, 392/*1*/ { "", NONE, op1(STI), "fxch" }, 393/*2*/ { "fst", SNGL, op1(X), (char *)db_Esc92 }, 394/*3*/ { "fstp", SNGL, op1(X), (char *)db_Esc93 }, 395/*4*/ { "fldenv", NONE, op1(X), (char *)db_Esc94 }, 396/*5*/ { "fldcw", NONE, op1(X), (char *)db_Esc95 }, 397/*6*/ { "fnstenv",NONE, op1(X), (char *)db_Esc96 }, 398/*7*/ { "fnstcw", NONE, op1(X), (char *)db_Esc97 }, 399}; 400 |
381static struct finst db_Esca[] = { | 401static const struct finst db_Esca[] = { |
382/*0*/ { "fiadd", WORD, 0, 0 }, 383/*1*/ { "fimul", WORD, 0, 0 }, 384/*2*/ { "ficom", WORD, 0, 0 }, 385/*3*/ { "ficomp", WORD, 0, 0 }, 386/*4*/ { "fisub", WORD, op1(X), (char *)db_Esca4 }, 387/*5*/ { "fisubr", WORD, 0, 0 }, 388/*6*/ { "fidiv", WORD, 0, 0 }, 389/*7*/ { "fidivr", WORD, 0, 0 } 390}; 391 | 402/*0*/ { "fiadd", WORD, 0, 0 }, 403/*1*/ { "fimul", WORD, 0, 0 }, 404/*2*/ { "ficom", WORD, 0, 0 }, 405/*3*/ { "ficomp", WORD, 0, 0 }, 406/*4*/ { "fisub", WORD, op1(X), (char *)db_Esca4 }, 407/*5*/ { "fisubr", WORD, 0, 0 }, 408/*6*/ { "fidiv", WORD, 0, 0 }, 409/*7*/ { "fidivr", WORD, 0, 0 } 410}; 411 |
392static struct finst db_Escb[] = { | 412static const struct finst db_Escb[] = { |
393/*0*/ { "fild", WORD, 0, 0 }, 394/*1*/ { "", NONE, 0, 0 }, 395/*2*/ { "fist", WORD, 0, 0 }, 396/*3*/ { "fistp", WORD, 0, 0 }, 397/*4*/ { "", WORD, op1(X), (char *)db_Escb4 }, 398/*5*/ { "fld", EXTR, 0, 0 }, 399/*6*/ { "", WORD, 0, 0 }, 400/*7*/ { "fstp", EXTR, 0, 0 }, 401}; 402 | 413/*0*/ { "fild", WORD, 0, 0 }, 414/*1*/ { "", NONE, 0, 0 }, 415/*2*/ { "fist", WORD, 0, 0 }, 416/*3*/ { "fistp", WORD, 0, 0 }, 417/*4*/ { "", WORD, op1(X), (char *)db_Escb4 }, 418/*5*/ { "fld", EXTR, 0, 0 }, 419/*6*/ { "", WORD, 0, 0 }, 420/*7*/ { "fstp", EXTR, 0, 0 }, 421}; 422 |
403static struct finst db_Escc[] = { | 423static const struct finst db_Escc[] = { |
404/*0*/ { "fadd", DBLR, op2(ST,STI), 0 }, 405/*1*/ { "fmul", DBLR, op2(ST,STI), 0 }, 406/*2*/ { "fcom", DBLR, op2(ST,STI), 0 }, 407/*3*/ { "fcomp", DBLR, op2(ST,STI), 0 }, 408/*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" }, 409/*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" }, 410/*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" }, 411/*7*/ { "fdivr", DBLR, op2(ST,STI), "fdiv" }, 412}; 413 | 424/*0*/ { "fadd", DBLR, op2(ST,STI), 0 }, 425/*1*/ { "fmul", DBLR, op2(ST,STI), 0 }, 426/*2*/ { "fcom", DBLR, op2(ST,STI), 0 }, 427/*3*/ { "fcomp", DBLR, op2(ST,STI), 0 }, 428/*4*/ { "fsub", DBLR, op2(ST,STI), "fsubr" }, 429/*5*/ { "fsubr", DBLR, op2(ST,STI), "fsub" }, 430/*6*/ { "fdiv", DBLR, op2(ST,STI), "fdivr" }, 431/*7*/ { "fdivr", DBLR, op2(ST,STI), "fdiv" }, 432}; 433 |
414static struct finst db_Escd[] = { | 434static const struct finst db_Escd[] = { |
415/*0*/ { "fld", DBLR, op1(STI), "ffree" }, 416/*1*/ { "", NONE, 0, 0 }, 417/*2*/ { "fst", DBLR, op1(STI), 0 }, 418/*3*/ { "fstp", DBLR, op1(STI), 0 }, 419/*4*/ { "frstor", NONE, op1(STI), "fucom" }, 420/*5*/ { "", NONE, op1(STI), "fucomp" }, 421/*6*/ { "fnsave", NONE, 0, 0 }, 422/*7*/ { "fnstsw", NONE, 0, 0 }, 423}; 424 | 435/*0*/ { "fld", DBLR, op1(STI), "ffree" }, 436/*1*/ { "", NONE, 0, 0 }, 437/*2*/ { "fst", DBLR, op1(STI), 0 }, 438/*3*/ { "fstp", DBLR, op1(STI), 0 }, 439/*4*/ { "frstor", NONE, op1(STI), "fucom" }, 440/*5*/ { "", NONE, op1(STI), "fucomp" }, 441/*6*/ { "fnsave", NONE, 0, 0 }, 442/*7*/ { "fnstsw", NONE, 0, 0 }, 443}; 444 |
425static struct finst db_Esce[] = { | 445static const struct finst db_Esce[] = { |
426/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" }, 427/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" }, 428/*2*/ { "ficom", LONG, 0, 0 }, 429/*3*/ { "ficomp", LONG, op1(X), (char *)db_Esce3 }, 430/*4*/ { "fisub", LONG, op2(ST,STI), "fsubrp" }, 431/*5*/ { "fisubr", LONG, op2(ST,STI), "fsubp" }, 432/*6*/ { "fidiv", LONG, op2(ST,STI), "fdivrp" }, 433/*7*/ { "fidivr", LONG, op2(ST,STI), "fdivp" }, 434}; 435 | 446/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" }, 447/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" }, 448/*2*/ { "ficom", LONG, 0, 0 }, 449/*3*/ { "ficomp", LONG, op1(X), (char *)db_Esce3 }, 450/*4*/ { "fisub", LONG, op2(ST,STI), "fsubrp" }, 451/*5*/ { "fisubr", LONG, op2(ST,STI), "fsubp" }, 452/*6*/ { "fidiv", LONG, op2(ST,STI), "fdivrp" }, 453/*7*/ { "fidivr", LONG, op2(ST,STI), "fdivp" }, 454}; 455 |
436static struct finst db_Escf[] = { | 456static const struct finst db_Escf[] = { |
437/*0*/ { "fild", LONG, 0, 0 }, 438/*1*/ { "", LONG, 0, 0 }, 439/*2*/ { "fist", LONG, 0, 0 }, 440/*3*/ { "fistp", LONG, 0, 0 }, 441/*4*/ { "fbld", NONE, op1(XA), (char *)db_Escf4 }, 442/*5*/ { "fld", QUAD, 0, 0 }, 443/*6*/ { "fbstp", NONE, 0, 0 }, 444/*7*/ { "fstp", QUAD, 0, 0 }, 445}; 446 | 457/*0*/ { "fild", LONG, 0, 0 }, 458/*1*/ { "", LONG, 0, 0 }, 459/*2*/ { "fist", LONG, 0, 0 }, 460/*3*/ { "fistp", LONG, 0, 0 }, 461/*4*/ { "fbld", NONE, op1(XA), (char *)db_Escf4 }, 462/*5*/ { "fld", QUAD, 0, 0 }, 463/*6*/ { "fbstp", NONE, 0, 0 }, 464/*7*/ { "fstp", QUAD, 0, 0 }, 465}; 466 |
447static struct finst *db_Esc_inst[] = { | 467static const struct finst *const db_Esc_inst[] = { |
448 db_Esc8, db_Esc9, db_Esca, db_Escb, 449 db_Escc, db_Escd, db_Esce, db_Escf 450}; 451 | 468 db_Esc8, db_Esc9, db_Esca, db_Escb, 469 db_Escc, db_Escd, db_Esce, db_Escf 470}; 471 |
452static char * db_Grp1[] = { | 472static const char * const db_Grp1[] = { |
453 "add", 454 "or", 455 "adc", 456 "sbb", 457 "and", 458 "sub", 459 "xor", 460 "cmp" 461}; 462 | 473 "add", 474 "or", 475 "adc", 476 "sbb", 477 "and", 478 "sub", 479 "xor", 480 "cmp" 481}; 482 |
463static char * db_Grp2[] = { | 483static const char * const db_Grp2[] = { |
464 "rol", 465 "ror", 466 "rcl", 467 "rcr", 468 "shl", 469 "shr", 470 "shl", 471 "sar" 472}; 473 | 484 "rol", 485 "ror", 486 "rcl", 487 "rcr", 488 "shl", 489 "shr", 490 "shl", 491 "sar" 492}; 493 |
474static struct inst db_Grp3[] = { | 494static const struct inst db_Grp3[] = { |
475 { "test", TRUE, NONE, op2(I,E), 0 }, 476 { "test", TRUE, NONE, op2(I,E), 0 }, 477 { "not", TRUE, NONE, op1(E), 0 }, 478 { "neg", TRUE, NONE, op1(E), 0 }, 479 { "mul", TRUE, NONE, op2(E,A), 0 }, 480 { "imul", TRUE, NONE, op2(E,A), 0 }, 481 { "div", TRUE, NONE, op2(E,A), 0 }, 482 { "idiv", TRUE, NONE, op2(E,A), 0 }, 483}; 484 | 495 { "test", TRUE, NONE, op2(I,E), 0 }, 496 { "test", TRUE, NONE, op2(I,E), 0 }, 497 { "not", TRUE, NONE, op1(E), 0 }, 498 { "neg", TRUE, NONE, op1(E), 0 }, 499 { "mul", TRUE, NONE, op2(E,A), 0 }, 500 { "imul", TRUE, NONE, op2(E,A), 0 }, 501 { "div", TRUE, NONE, op2(E,A), 0 }, 502 { "idiv", TRUE, NONE, op2(E,A), 0 }, 503}; 504 |
485static struct inst db_Grp4[] = { | 505static const struct inst db_Grp4[] = { |
486 { "inc", TRUE, BYTE, op1(E), 0 }, 487 { "dec", TRUE, BYTE, op1(E), 0 }, 488 { "", TRUE, NONE, 0, 0 }, 489 { "", TRUE, NONE, 0, 0 }, 490 { "", TRUE, NONE, 0, 0 }, 491 { "", TRUE, NONE, 0, 0 }, 492 { "", TRUE, NONE, 0, 0 }, 493 { "", TRUE, NONE, 0, 0 } 494}; 495 | 506 { "inc", TRUE, BYTE, op1(E), 0 }, 507 { "dec", TRUE, BYTE, op1(E), 0 }, 508 { "", TRUE, NONE, 0, 0 }, 509 { "", TRUE, NONE, 0, 0 }, 510 { "", TRUE, NONE, 0, 0 }, 511 { "", TRUE, NONE, 0, 0 }, 512 { "", TRUE, NONE, 0, 0 }, 513 { "", TRUE, NONE, 0, 0 } 514}; 515 |
496static struct inst db_Grp5[] = { | 516static const struct inst db_Grp5[] = { |
497 { "inc", TRUE, LONG, op1(E), 0 }, 498 { "dec", TRUE, LONG, op1(E), 0 }, 499 { "call", TRUE, NONE, op1(Eind),0 }, 500 { "lcall", TRUE, NONE, op1(Eind),0 }, 501 { "jmp", TRUE, NONE, op1(Eind),0 }, 502 { "ljmp", TRUE, NONE, op1(Eind),0 }, 503 { "push", TRUE, LONG, op1(E), 0 }, 504 { "", TRUE, NONE, 0, 0 } 505}; 506 | 517 { "inc", TRUE, LONG, op1(E), 0 }, 518 { "dec", TRUE, LONG, op1(E), 0 }, 519 { "call", TRUE, NONE, op1(Eind),0 }, 520 { "lcall", TRUE, NONE, op1(Eind),0 }, 521 { "jmp", TRUE, NONE, op1(Eind),0 }, 522 { "ljmp", TRUE, NONE, op1(Eind),0 }, 523 { "push", TRUE, LONG, op1(E), 0 }, 524 { "", TRUE, NONE, 0, 0 } 525}; 526 |
507static struct inst db_inst_table[256] = { | 527static const struct inst db_inst_table[256] = { |
508/*00*/ { "add", TRUE, BYTE, op2(R, E), 0 }, 509/*01*/ { "add", TRUE, LONG, op2(R, E), 0 }, 510/*02*/ { "add", TRUE, BYTE, op2(E, R), 0 }, 511/*03*/ { "add", TRUE, LONG, op2(E, R), 0 }, 512/*04*/ { "add", FALSE, BYTE, op2(Is, A), 0 }, 513/*05*/ { "add", FALSE, LONG, op2(Is, A), 0 }, 514/*06*/ { "push", FALSE, NONE, op1(Si), 0 }, 515/*07*/ { "pop", FALSE, NONE, op1(Si), 0 }, --- 274 unchanged lines hidden (view full) --- 790/*fa*/ { "cli", FALSE, NONE, 0, 0 }, 791/*fb*/ { "sti", FALSE, NONE, 0, 0 }, 792/*fc*/ { "cld", FALSE, NONE, 0, 0 }, 793/*fd*/ { "std", FALSE, NONE, 0, 0 }, 794/*fe*/ { "", TRUE, NONE, 0, (char *)db_Grp4 }, 795/*ff*/ { "", TRUE, NONE, 0, (char *)db_Grp5 }, 796}; 797 | 528/*00*/ { "add", TRUE, BYTE, op2(R, E), 0 }, 529/*01*/ { "add", TRUE, LONG, op2(R, E), 0 }, 530/*02*/ { "add", TRUE, BYTE, op2(E, R), 0 }, 531/*03*/ { "add", TRUE, LONG, op2(E, R), 0 }, 532/*04*/ { "add", FALSE, BYTE, op2(Is, A), 0 }, 533/*05*/ { "add", FALSE, LONG, op2(Is, A), 0 }, 534/*06*/ { "push", FALSE, NONE, op1(Si), 0 }, 535/*07*/ { "pop", FALSE, NONE, op1(Si), 0 }, --- 274 unchanged lines hidden (view full) --- 810/*fa*/ { "cli", FALSE, NONE, 0, 0 }, 811/*fb*/ { "sti", FALSE, NONE, 0, 0 }, 812/*fc*/ { "cld", FALSE, NONE, 0, 0 }, 813/*fd*/ { "std", FALSE, NONE, 0, 0 }, 814/*fe*/ { "", TRUE, NONE, 0, (char *)db_Grp4 }, 815/*ff*/ { "", TRUE, NONE, 0, (char *)db_Grp5 }, 816}; 817 |
798static struct inst db_bad_inst = | 818static const struct inst db_bad_inst = |
799 { "???", FALSE, NONE, 0, 0 } 800; 801 802#define f_mod(byte) ((byte)>>6) 803#define f_reg(byte) (((byte)>>3)&0x7) 804#define f_rm(byte) ((byte)&0x7) 805 806#define sib_ss(byte) ((byte)>>6) 807#define sib_index(byte) (((byte)>>3)&0x7) 808#define sib_base(byte) ((byte)&0x7) 809 810struct i_addr { 811 int is_reg; /* if reg, reg number is in 'disp' */ 812 int disp; | 819 { "???", FALSE, NONE, 0, 0 } 820; 821 822#define f_mod(byte) ((byte)>>6) 823#define f_reg(byte) (((byte)>>3)&0x7) 824#define f_rm(byte) ((byte)&0x7) 825 826#define sib_ss(byte) ((byte)>>6) 827#define sib_index(byte) (((byte)>>3)&0x7) 828#define sib_base(byte) ((byte)&0x7) 829 830struct i_addr { 831 int is_reg; /* if reg, reg number is in 'disp' */ 832 int disp; |
813 char * base; 814 char * index; | 833 const char * base; 834 const char * index; |
815 int ss; 816}; 817 | 835 int ss; 836}; 837 |
818static char * db_index_reg_16[8] = { | 838static const char * const db_index_reg_16[8] = { |
819 "%bx,%si", 820 "%bx,%di", 821 "%bp,%si", 822 "%bp,%di", 823 "%si", 824 "%di", 825 "%bp", 826 "%bx" 827}; 828 | 839 "%bx,%si", 840 "%bx,%di", 841 "%bp,%si", 842 "%bp,%di", 843 "%si", 844 "%di", 845 "%bp", 846 "%bx" 847}; 848 |
829static char * db_reg[3][8] = { | 849static const char * const db_reg[3][8] = { |
830 "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh", 831 "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di", 832 "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi" 833}; 834 | 850 "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh", 851 "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di", 852 "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi" 853}; 854 |
835static char * db_seg_reg[8] = { | 855static const char *const db_seg_reg[8] = { |
836 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "", "" 837}; 838 839/* 840 * lengths for size attributes 841 */ | 856 "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "", "" 857}; 858 859/* 860 * lengths for size attributes 861 */ |
842static int db_lengths[] = { | 862static const int db_lengths[] = { |
843 1, /* BYTE */ 844 2, /* WORD */ 845 4, /* LONG */ 846 8, /* QUAD */ 847 4, /* SNGL */ 848 8, /* DBLR */ 849 10, /* EXTR */ 850}; --- 133 unchanged lines hidden (view full) --- 984db_disasm_esc(loc, inst, short_addr, size, seg) 985 db_addr_t loc; 986 int inst; 987 int short_addr; 988 int size; 989 char * seg; 990{ 991 int regmodrm; | 863 1, /* BYTE */ 864 2, /* WORD */ 865 4, /* LONG */ 866 8, /* QUAD */ 867 4, /* SNGL */ 868 8, /* DBLR */ 869 10, /* EXTR */ 870}; --- 133 unchanged lines hidden (view full) --- 1004db_disasm_esc(loc, inst, short_addr, size, seg) 1005 db_addr_t loc; 1006 int inst; 1007 int short_addr; 1008 int size; 1009 char * seg; 1010{ 1011 int regmodrm; |
992 struct finst *fp; | 1012 const struct finst *fp; |
993 int mod; 994 struct i_addr address; | 1013 int mod; 1014 struct i_addr address; |
995 char * name; | 1015 const char * name; |
996 997 get_value_inc(regmodrm, loc, 1, FALSE); 998 fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)]; 999 mod = f_mod(regmodrm); 1000 if (mod != 3) { 1001 /* 1002 * Normal address modes. 1003 */ --- 66 unchanged lines hidden (view full) --- 1070db_disasm(loc, altfmt) 1071 db_addr_t loc; 1072 boolean_t altfmt; 1073{ 1074 int inst; 1075 int size; 1076 int short_addr; 1077 char * seg; | 1016 1017 get_value_inc(regmodrm, loc, 1, FALSE); 1018 fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)]; 1019 mod = f_mod(regmodrm); 1020 if (mod != 3) { 1021 /* 1022 * Normal address modes. 1023 */ --- 66 unchanged lines hidden (view full) --- 1090db_disasm(loc, altfmt) 1091 db_addr_t loc; 1092 boolean_t altfmt; 1093{ 1094 int inst; 1095 int size; 1096 int short_addr; 1097 char * seg; |
1078 struct inst * ip; 1079 char * i_name; | 1098 const struct inst * ip; 1099 const char * i_name; |
1080 int i_size; 1081 int i_mode; 1082 int regmodrm = 0; 1083 boolean_t first; 1084 int displ; 1085 int prefix; 1086 int imm; 1087 int imm2; --- 299 unchanged lines hidden --- | 1100 int i_size; 1101 int i_mode; 1102 int regmodrm = 0; 1103 boolean_t first; 1104 int displ; 1105 int prefix; 1106 int imm; 1107 int imm2; --- 299 unchanged lines hidden --- |