This commit is contained in:
jdolecek 2000-12-05 10:45:09 +00:00
parent dae7d6d77c
commit 94e024dc14

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_disasm.c,v 1.24 2000/12/05 10:26:12 jdolecek Exp $ */
/* $NetBSD: db_disasm.c,v 1.25 2000/12/05 10:45:09 jdolecek Exp $ */
/*
* Mach Operating System
@ -111,7 +111,7 @@ struct finst {
(or pointer to table) */
};
char * db_Grp6[] = {
const char * const db_Grp6[] = {
"sldt",
"str",
"lldt",
@ -122,7 +122,7 @@ char * db_Grp6[] = {
""
};
char * db_Grp7[] = {
const char * const db_Grp7[] = {
"sgdt",
"sidt",
"lgdt",
@ -133,7 +133,7 @@ char * db_Grp7[] = {
"invlpg"
};
char * db_Grp8[] = {
const char * const db_Grp8[] = {
"",
"",
"",
@ -144,7 +144,7 @@ char * db_Grp8[] = {
"btc"
};
char * db_Grp9[] = {
const char * const db_Grp9[] = {
"",
"cmpxchg8b",
"",
@ -155,7 +155,7 @@ char * db_Grp9[] = {
"",
};
struct inst db_inst_0f0x[] = {
const struct inst db_inst_0f0x[] = {
/*00*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp6 },
/*01*/ { "", TRUE, NONE, op1(Ew), (char *)db_Grp7 },
/*02*/ { "lar", TRUE, LONG, op2(E,R), 0 },
@ -175,7 +175,7 @@ struct inst db_inst_0f0x[] = {
/*0f*/ { "", FALSE, NONE, 0, 0 },
};
struct inst db_inst_0f2x[] = {
const struct inst db_inst_0f2x[] = {
/*20*/ { "mov", TRUE, LONG, op2(CR,E), 0 }, /* use E for reg */
/*21*/ { "mov", TRUE, LONG, op2(DR,E), 0 }, /* since mod == 11 */
/*22*/ { "mov", TRUE, LONG, op2(E,CR), 0 },
@ -195,7 +195,7 @@ struct inst db_inst_0f2x[] = {
/*2f*/ { "", FALSE, NONE, 0, 0 },
};
struct inst db_inst_0f3x[] = {
const struct inst db_inst_0f3x[] = {
/*30*/ { "wrmsr", FALSE, NONE, 0, 0 },
/*31*/ { "rdtsc", FALSE, NONE, 0, 0 },
/*32*/ { "rdmsr", FALSE, NONE, 0, 0 },
@ -215,7 +215,7 @@ struct inst db_inst_0f3x[] = {
/*3f*/ { "", FALSE, NONE, 0, 0 },
};
struct inst db_inst_0f8x[] = {
const struct inst db_inst_0f8x[] = {
/*80*/ { "jo", FALSE, NONE, op1(Dl), 0 },
/*81*/ { "jno", FALSE, NONE, op1(Dl), 0 },
/*82*/ { "jb", FALSE, NONE, op1(Dl), 0 },
@ -235,7 +235,7 @@ struct inst db_inst_0f8x[] = {
/*8f*/ { "jnle", FALSE, NONE, op1(Dl), 0 },
};
struct inst db_inst_0f9x[] = {
const struct inst db_inst_0f9x[] = {
/*90*/ { "seto", TRUE, NONE, op1(Eb), 0 },
/*91*/ { "setno", TRUE, NONE, op1(Eb), 0 },
/*92*/ { "setb", TRUE, NONE, op1(Eb), 0 },
@ -255,7 +255,7 @@ struct inst db_inst_0f9x[] = {
/*9f*/ { "setnle",TRUE, NONE, op1(Eb), 0 },
};
struct inst db_inst_0fax[] = {
const struct inst db_inst_0fax[] = {
/*a0*/ { "push", FALSE, NONE, op1(Si), 0 },
/*a1*/ { "pop", FALSE, NONE, op1(Si), 0 },
/*a2*/ { "cpuid", FALSE, NONE, 0, 0 },
@ -275,7 +275,7 @@ struct inst db_inst_0fax[] = {
/*a7*/ { "imul", TRUE, LONG, op2(E,R), 0 },
};
struct inst db_inst_0fbx[] = {
const struct inst db_inst_0fbx[] = {
/*b0*/ { "cmpxchg",TRUE, BYTE, op2(R, E), 0 },
/*b1*/ { "cmpxchg",TRUE, LONG, op2(R, E), 0 },
/*b2*/ { "lss", TRUE, LONG, op2(E, R), 0 },
@ -295,7 +295,7 @@ struct inst db_inst_0fbx[] = {
/*bf*/ { "movsw", TRUE, LONG, op2(E, R), 0 },
};
struct inst db_inst_0fcx[] = {
const struct inst db_inst_0fcx[] = {
/*c0*/ { "xadd", TRUE, BYTE, op2(R, E), 0 },
/*c1*/ { "xadd", TRUE, LONG, op2(R, E), 0 },
/*c2*/ { "", FALSE, NONE, 0, 0 },
@ -314,7 +314,7 @@ struct inst db_inst_0fcx[] = {
/*cf*/ { "bswap", FALSE, LONG, op1(Ri), 0 },
};
struct inst *db_inst_0f[] = {
const struct inst * const db_inst_0f[] = {
db_inst_0f0x,
0,
db_inst_0f2x,
@ -333,43 +333,43 @@ struct inst *db_inst_0f[] = {
0
};
char * db_Esc92[] = {
const char * const db_Esc92[] = {
"fnop", "", "", "", "", "", "", ""
};
char * db_Esc93[] = {
const char * const db_Esc93[] = {
"", "", "", "", "", "", "", ""
};
char * db_Esc94[] = {
const char * const db_Esc94[] = {
"fchs", "fabs", "", "", "ftst", "fxam", "", ""
};
char * db_Esc95[] = {
const char * const db_Esc95[] = {
"fld1", "fldl2t","fldl2e","fldpi","fldlg2","fldln2","fldz",""
};
char * db_Esc96[] = {
const char * const db_Esc96[] = {
"f2xm1","fyl2x","fptan","fpatan","fxtract","fprem1","fdecstp",
"fincstp"
};
char * db_Esc97[] = {
const char * const db_Esc97[] = {
"fprem","fyl2xp1","fsqrt","fsincos","frndint","fscale","fsin","fcos"
};
char * db_Esca4[] = {
const char * const db_Esca4[] = {
"", "fucompp","", "", "", "", "", ""
};
char * db_Escb4[] = {
const char * const db_Escb4[] = {
"", "", "fnclex","fninit","", "", "", ""
};
char * db_Esce3[] = {
const char * const db_Esce3[] = {
"", "fcompp","", "", "", "", "", ""
};
char * db_Escf4[] = {
const char * const db_Escf4[] = {
"fnstsw","", "", "", "", "", "", ""
};
struct finst db_Esc8[] = {
const struct finst db_Esc8[] = {
/*0*/ { "fadd", SNGL, op2(STI,ST), 0 },
/*1*/ { "fmul", SNGL, op2(STI,ST), 0 },
/*2*/ { "fcom", SNGL, op2(STI,ST), 0 },
@ -380,7 +380,7 @@ struct finst db_Esc8[] = {
/*7*/ { "fdivr", SNGL, op2(STI,ST), 0 },
};
struct finst db_Esc9[] = {
const struct finst db_Esc9[] = {
/*0*/ { "fld", SNGL, op1(STI), 0 },
/*1*/ { "", NONE, op1(STI), "fxch" },
/*2*/ { "fst", SNGL, op1(X), (char *)db_Esc92 },
@ -391,7 +391,7 @@ struct finst db_Esc9[] = {
/*7*/ { "fnstcw", NONE, op1(X), (char *)db_Esc97 },
};
struct finst db_Esca[] = {
const struct finst db_Esca[] = {
/*0*/ { "fiadd", WORD, 0, 0 },
/*1*/ { "fimul", WORD, 0, 0 },
/*2*/ { "ficom", WORD, 0, 0 },
@ -402,7 +402,7 @@ struct finst db_Esca[] = {
/*7*/ { "fidivr", WORD, 0, 0 }
};
struct finst db_Escb[] = {
const struct finst db_Escb[] = {
/*0*/ { "fild", WORD, 0, 0 },
/*1*/ { "", NONE, 0, 0 },
/*2*/ { "fist", WORD, 0, 0 },
@ -413,7 +413,7 @@ struct finst db_Escb[] = {
/*7*/ { "fstp", EXTR, 0, 0 },
};
struct finst db_Escc[] = {
const struct finst db_Escc[] = {
/*0*/ { "fadd", DBLR, op2(ST,STI), 0 },
/*1*/ { "fmul", DBLR, op2(ST,STI), 0 },
/*2*/ { "fcom", DBLR, op2(ST,STI), 0 },
@ -424,7 +424,7 @@ struct finst db_Escc[] = {
/*7*/ { "fdivr", DBLR, op2(ST,STI), "fdiv" },
};
struct finst db_Escd[] = {
const struct finst db_Escd[] = {
/*0*/ { "fld", DBLR, op1(STI), "ffree" },
/*1*/ { "", NONE, 0, 0 },
/*2*/ { "fst", DBLR, op1(STI), 0 },
@ -435,7 +435,7 @@ struct finst db_Escd[] = {
/*7*/ { "fnstsw", NONE, 0, 0 },
};
struct finst db_Esce[] = {
const struct finst db_Esce[] = {
/*0*/ { "fiadd", LONG, op2(ST,STI), "faddp" },
/*1*/ { "fimul", LONG, op2(ST,STI), "fmulp" },
/*2*/ { "ficom", LONG, 0, 0 },
@ -446,7 +446,7 @@ struct finst db_Esce[] = {
/*7*/ { "fidivr", LONG, op2(ST,STI), "fdivp" },
};
struct finst db_Escf[] = {
const struct finst db_Escf[] = {
/*0*/ { "fild", LONG, 0, 0 },
/*1*/ { "", LONG, 0, 0 },
/*2*/ { "fist", LONG, 0, 0 },
@ -457,12 +457,12 @@ struct finst db_Escf[] = {
/*7*/ { "fstp", QUAD, 0, 0 },
};
struct finst *db_Esc_inst[] = {
const struct finst * const db_Esc_inst[] = {
db_Esc8, db_Esc9, db_Esca, db_Escb,
db_Escc, db_Escd, db_Esce, db_Escf
};
char * db_Grp1[] = {
const char * const db_Grp1[] = {
"add",
"or",
"adc",
@ -473,7 +473,7 @@ char * db_Grp1[] = {
"cmp"
};
char * db_Grp2[] = {
const char * const db_Grp2[] = {
"rol",
"ror",
"rcl",
@ -484,7 +484,7 @@ char * db_Grp2[] = {
"sar"
};
struct inst db_Grp3[] = {
const struct inst db_Grp3[] = {
{ "test", TRUE, NONE, op2(I,E), 0 },
{ "test", TRUE, NONE, op2(I,E), 0 },
{ "not", TRUE, NONE, op1(E), 0 },
@ -495,7 +495,7 @@ struct inst db_Grp3[] = {
{ "idiv", TRUE, NONE, op2(E,A), 0 },
};
struct inst db_Grp4[] = {
const struct inst db_Grp4[] = {
{ "inc", TRUE, BYTE, op1(E), 0 },
{ "dec", TRUE, BYTE, op1(E), 0 },
{ "", TRUE, NONE, 0, 0 },
@ -506,7 +506,7 @@ struct inst db_Grp4[] = {
{ "", TRUE, NONE, 0, 0 }
};
struct inst db_Grp5[] = {
const struct inst db_Grp5[] = {
{ "inc", TRUE, LONG, op1(E), 0 },
{ "dec", TRUE, LONG, op1(E), 0 },
{ "call", TRUE, NONE, op1(Eind),0 },
@ -517,7 +517,7 @@ struct inst db_Grp5[] = {
{ "", TRUE, NONE, 0, 0 }
};
struct inst db_inst_table[256] = {
const struct inst db_inst_table[256] = {
/*00*/ { "add", TRUE, BYTE, op2(R, E), 0 },
/*01*/ { "add", TRUE, LONG, op2(R, E), 0 },
/*02*/ { "add", TRUE, BYTE, op2(E, R), 0 },
@ -808,7 +808,7 @@ struct inst db_inst_table[256] = {
/*ff*/ { "", TRUE, NONE, 0, (char *)db_Grp5 },
};
struct inst db_bad_inst =
const struct inst db_bad_inst =
{ "???", FALSE, NONE, 0, 0 }
;
@ -823,12 +823,12 @@ struct inst db_bad_inst =
struct i_addr {
int is_reg; /* if reg, reg number is in 'disp' */
int disp;
char * base;
char * index;
const char * base;
const char * index;
int ss;
};
char * db_index_reg_16[8] = {
const char * const db_index_reg_16[8] = {
"%bx,%si",
"%bx,%di",
"%bp,%si",
@ -839,20 +839,20 @@ char * db_index_reg_16[8] = {
"%bx"
};
char * db_reg[3][8] = {
const char * const db_reg[3][8] = {
{ "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh" },
{ "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di" },
{ "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi" }
};
char * db_seg_reg[8] = {
const char * const db_seg_reg[8] = {
"%es", "%cs", "%ss", "%ds", "%fs", "%gs", "", ""
};
/*
* lengths for size attributes
*/
int db_lengths[] = {
const int db_lengths[] = {
1, /* BYTE */
2, /* WORD */
4, /* LONG */
@ -994,7 +994,7 @@ db_disasm_esc(loc, inst, short_addr, size, seg)
char * seg;
{
int regmodrm;
struct finst *fp;
const struct finst *fp;
int mod;
struct i_addr address;
char * name;
@ -1079,7 +1079,7 @@ db_disasm(loc, altfmt)
int size;
int short_addr;
char * seg;
struct inst * ip;
const struct inst * ip;
char * i_name;
int i_size;
int i_mode;