int OP_DIR(), OP_OFF(), OP_DSSI(), OP_ESDI(), OP_ONE(), OP_C();
int OP_D(), OP_T(), OP_rm();
+static void dofloat (), putop (), append_prefix (), set_op ();
+static int get16 (), get32 ();
#define b_mode 1
#define v_mode 2
static int prefixes;
+static void
ckprefix ()
{
prefixes = 0;
* 100 bytes is certainly enough, unless symbol printing is added later
* The function returns the length of this instruction in bytes.
*/
+
+int
i386dis (pc, inbuf, stream)
int pc;
unsigned char *inbuf;
FILE *stream;
{
struct dis386 *dp;
- char *p;
int i;
int enter_instruction;
char *first, *second, *third;
},
};
-
+static void
dofloat ()
{
struct dis386 *dp;
}
/* ARGSUSED */
+int
OP_ST (ignore)
+ int ignore;
{
oappend ("%st");
+ return (0);
}
/* ARGSUSED */
+int
OP_STi (ignore)
+ int ignore;
{
sprintf (scratchbuf, "%%st(%d)", rm);
oappend (scratchbuf);
+ return (0);
}
/* capital letters in template are macros */
+static void
putop (template)
char *template;
{
static void
oappend (s)
-char *s;
+ char *s;
{
strcpy (obufp, s);
obufp += strlen (s);
*obufp = 0;
}
+static void
append_prefix ()
{
if (prefixes & PREFIX_CS)
oappend ("%gs:");
}
+int
OP_indirE (bytemode)
+ int bytemode;
{
oappend ("*");
OP_E (bytemode);
+ return (0);
}
+int
OP_E (bytemode)
+ int bytemode;
{
int disp;
int havesib;
- int didoutput = 0;
int base;
int index;
int scale;
oappend ("<bad dis table>");
break;
}
- return;
+ return (0);
}
append_prefix ();
}
oappend (")");
}
+ return (0);
}
+int
OP_G (bytemode)
+ int bytemode;
{
switch (bytemode)
{
oappend ("<internal disassembler error>");
break;
}
+ return (0);
}
+static int
get32 ()
{
int x = 0;
return (x);
}
+static int
get16 ()
{
int x = 0;
return (x);
}
+static void
set_op (op)
-int op;
+ int op;
{
op_index[op_ad] = op_ad;
op_address[op_ad] = op;
}
+int
OP_REG (code)
+ int code;
{
char *s;
break;
}
oappend (s);
+ return (0);
}
+int
OP_I (bytemode)
+ int bytemode;
{
int op;
break;
default:
oappend ("<internal disassembler error>");
- return;
+ return (0);
}
sprintf (scratchbuf, "$0x%x", op);
oappend (scratchbuf);
+ return (0);
}
+int
OP_sI (bytemode)
+ int bytemode;
{
int op;
break;
default:
oappend ("<internal disassembler error>");
- return;
+ return (0);
}
sprintf (scratchbuf, "$0x%x", op);
oappend (scratchbuf);
+ return (0);
}
+int
OP_J (bytemode)
+ int bytemode;
{
int disp;
int mask = -1;
break;
default:
oappend ("<internal disassembler error>");
- return;
+ return (0);
}
disp = (start_pc + codep - start_codep + disp) & mask;
set_op (disp);
sprintf (scratchbuf, "0x%x", disp);
oappend (scratchbuf);
+ return (0);
}
/* ARGSUSED */
+int
OP_SEG (dummy)
+ int dummy;
{
static char *sreg[] = {
"%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
};
oappend (sreg[reg]);
+ return (0);
}
+int
OP_DIR (size)
+ int size;
{
int seg, offset;
oappend ("<internal disassembler error>");
break;
}
+ return (0);
}
/* ARGSUSED */
+int
OP_OFF (bytemode)
+ int bytemode;
{
int off;
sprintf (scratchbuf, "0x%x", off);
oappend (scratchbuf);
+ return (0);
}
/* ARGSUSED */
+int
OP_ESDI (dummy)
+ int dummy;
{
oappend ("%es:(");
oappend (aflag ? "%edi" : "%di");
oappend (")");
+ return (0);
}
/* ARGSUSED */
+int
OP_DSSI (dummy)
+ int dummy;
{
oappend ("%ds:(");
oappend (aflag ? "%esi" : "%si");
oappend (")");
+ return (0);
}
/* ARGSUSED */
+int
OP_ONE (dummy)
+ int dummy;
{
oappend ("1");
+ return (0);
}
/* ARGSUSED */
+int
OP_C (dummy)
+ int dummy;
{
codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%cr%d", reg);
oappend (scratchbuf);
+ return (0);
}
/* ARGSUSED */
+int
OP_D (dummy)
+ int dummy;
{
codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%db%d", reg);
oappend (scratchbuf);
+ return (0);
}
/* ARGSUSED */
+int
OP_T (dummy)
+ int dummy;
{
codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%tr%d", reg);
oappend (scratchbuf);
+ return (0);
}
+int
OP_rm (bytemode)
+ int bytemode;
{
switch (bytemode)
{
oappend (names16[rm]);
break;
}
+ return (0);
}
#define MAXLEN 20
+
+int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
FILE *stream;