Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

x86dis Class Reference

#include <x86dis.h>

Inheritance diagram for x86dis:

Disassembler Object x86dis_vxd List of all members.

Public Member Functions

 x86dis ()
 x86dis (int opsize, int addrsize)
virtual ~x86dis ()
virtual dis_insndecode (byte *code, int maxlen, CPU_ADDR addr)
virtual dis_insnduplicateInsn (dis_insn *disasm_insn)
virtual void getOpcodeMetrics (int &min_length, int &max_length, int &min_look_ahead, int &avg_look_ahead, int &addr_align)
virtual char * getName ()
virtual byte getSize (dis_insn *disasm_insn)
int load (ht_object_stream *f)
virtual OBJECT_ID object_id () const
virtual char * str (dis_insn *disasm_insn, int options)
virtual char * strf (dis_insn *disasm_insn, int options, char *format)
virtual void store (ht_object_stream *f)
virtual bool validInsn (dis_insn *disasm_insn)

Public Attributes

int opsize
int addrsize

Protected Member Functions

void decode_insn (x86opc_insn *insn)
void decode_modrm (x86_insn_op *op, char size, int allow_reg, int allow_mem, int mmx)
void decode_op (x86_insn_op *op, x86opc_insn_op *xop)
void decode_sib (x86_insn_op *op, int mod)
int esizeaddr (char c)
int esizeop (char c)
byte getbyte ()
word getword ()
dword getdword ()
int getmodrm ()
int getsib ()
void invalidate ()
int isfloat (char c)
void prefixes ()
int special_param_ambiguity (x86dis_insn *disasm_insn)
void str_format (char **str, char **format, char *p, char *n, char *op[3], int oplen[3], char stopchar, int print)
virtual void str_op (char *opstr, int *opstrlen, x86dis_insn *insn, x86_insn_op *op, bool explicit_params)

Protected Attributes

x86dis_insn insn
char insnstr [256]
unsigned char * codep
unsigned char * ocodep
int seg
int addr
byte c
int modrm
int sib
int maxlen

Constructor & Destructor Documentation

x86dis::x86dis  ) 
 

Definition at line 55 of file x86dis.cc.

x86dis::x86dis int  opsize,
int  addrsize
 

Definition at line 59 of file x86dis.cc.

References addrsize, and opsize.

x86dis::~x86dis  )  [virtual]
 

Definition at line 65 of file x86dis.cc.


Member Function Documentation

dis_insn * x86dis::decode byte *  code,
int  maxlen,
CPU_ADDR  addr
[virtual]
 

Implements Disassembler.

Definition at line 69 of file x86dis.cc.

References addr, CPU_ADDR::addr32, c, codep, decode_insn(), dis_insn, x86dis_insn::eaddrsize, x86dis_insn::eopsize, x86_insn_op::imm, insn, x86dis_insn::invalid, x86dis_insn::lockprefix, maxlen, modrm, x86dis_insn::name, ocodep, x86dis_insn::op, x86dis_insn::opcode, opsize, prefixes(), x86dis_insn::repprefix, seg, x86dis_insn::segprefix, sib, x86_insn_op::size, x86dis_insn::size, x86_insn_op::type, x86_insns, X86_OPTYPE_EMPTY, X86_OPTYPE_IMM, and X86_PREFIX_NO.

Referenced by x86dis_vxd::decode(), and srt_x86().

void x86dis::decode_insn x86opc_insn insn  )  [protected]
 

Definition at line 196 of file x86dis.cc.

References c, x86opc_insn_op_special::data, decode_op(), getbyte(), getmodrm(), x86opc_finsn::group, x86opc_finsn::insn, insn, invalidate(), mkmod, mkreg, mkrm, x86dis_insn::name, x86opc_insn::name, x86dis_insn::op, x86opc_insn::op, x86dis_insn::opcode, x86dis_insn::opcodeclass, SPECIAL_TYPE_FGROUP, SPECIAL_TYPE_GROUP, SPECIAL_TYPE_INVALID, SPECIAL_TYPE_PREFIX, x86opc_insn_op_special::type, x86_float_group_insns, x86_group_insns, x86_insns_ext, x86_modfloat_group_insns, X86DIS_OPCODE_CLASS_EXT, and X86DIS_OPCODE_CLASS_STD.

Referenced by decode().

void x86dis::decode_modrm x86_insn_op op,
char  size,
int  allow_reg,
int  allow_mem,
int  mmx
[protected]
 

Definition at line 105 of file x86dis.cc.

References decode_sib(), x86dis_insn::eaddrsize, esizeop(), getbyte(), getdword(), getmodrm(), getword(), insn, invalidate(), isfloat(), x86_insn_op::mem, mkmod, mkrm, x86_insn_op::mmx, modrm, modrm16_1, modrm16_2, x86_insn_op::reg, size, x86_insn_op::size, x86_insn_op::type, X86_ADDRSIZE16, X86_OPTYPE_MEM, X86_OPTYPE_MMX, X86_OPTYPE_REG, and X86_REG_NO.

Referenced by decode_op().

void x86dis::decode_op x86_insn_op op,
x86opc_insn_op xop
[protected]
 

Definition at line 248 of file x86dis.cc.

References addr, addrsize, x86_insn_op::crx, decode_modrm(), x86_insn_op::drx, x86dis_insn::eaddrsize, esizeop(), x86opc_insn_op::extendedsize, x86opc_insn_op::extra, x86_insn_op::farptr, getbyte(), getdword(), getmodrm(), getword(), x86_insn_op::imm, insn, invalidate(), isfloat(), x86_insn_op::mem, mkreg, mkrm, x86_insn_op::mmx, x86_insn_op::reg, x86_insn_op::seg, x86opc_insn_op::size, x86_insn_op::size, SIZE_P, x86_insn_op::stx, x86_insn_op::trx, x86_insn_op::type, x86opc_insn_op::type, TYPE_0, TYPE_A, TYPE_C, TYPE_D, TYPE_E, TYPE_F, TYPE_Fx, TYPE_G, TYPE_I, TYPE_Is, TYPE_Ix, TYPE_J, TYPE_M, TYPE_O, TYPE_P, TYPE_Q, TYPE_R, TYPE_Rx, TYPE_S, TYPE_Sx, TYPE_T, X86_ADDRSIZE16, X86_ADDRSIZE32, X86_OPTYPE_CRX, X86_OPTYPE_DRX, X86_OPTYPE_FARPTR, X86_OPTYPE_IMM, X86_OPTYPE_MEM, X86_OPTYPE_MMX, X86_OPTYPE_REG, X86_OPTYPE_SEG, X86_OPTYPE_STX, X86_OPTYPE_TRX, and X86_REG_NO.

Referenced by decode_insn().

void x86dis::decode_sib x86_insn_op op,
int  mod
[protected]
 

Definition at line 457 of file x86dis.cc.

References getbyte(), getdword(), getsib(), x86_insn_op::mem, mkbase, mkindex, mkscale, sib, sibbase, sibindex, sibscale, X86_REG_BP, and X86_REG_NO.

Referenced by decode_modrm().

dis_insn * x86dis::duplicateInsn dis_insn disasm_insn  )  [virtual]
 

Implements Disassembler.

Definition at line 494 of file x86dis.cc.

References dis_insn, insn, and malloc().

int x86dis::esizeaddr char  c  )  [protected]
 

Definition at line 501 of file x86dis.cc.

References x86dis_insn::eaddrsize, insn, SIZE_B, SIZE_C, SIZE_D, SIZE_L, SIZE_P, SIZE_Q, SIZE_S, SIZE_T, SIZE_V, SIZE_W, and X86_ADDRSIZE16.

int x86dis::esizeop char  c  )  [protected]
 

Definition at line 528 of file x86dis.cc.

References x86dis_insn::eopsize, insn, SIZE_B, SIZE_C, SIZE_D, SIZE_L, SIZE_P, SIZE_Q, SIZE_S, SIZE_T, SIZE_V, SIZE_W, and X86_OPSIZE16.

Referenced by decode_modrm(), and decode_op().

byte x86dis::getbyte  )  [protected]
 

Definition at line 555 of file x86dis.cc.

References addr, byte, codep, invalidate(), maxlen, and ocodep.

Referenced by decode_insn(), decode_modrm(), decode_op(), decode_sib(), getmodrm(), getsib(), and prefixes().

dword x86dis::getdword  )  [protected]
 

Definition at line 580 of file x86dis.cc.

References addr, codep, dword, invalidate(), maxlen, and ocodep.

Referenced by decode_modrm(), decode_op(), and decode_sib().

int x86dis::getmodrm  )  [protected]
 

Definition at line 603 of file x86dis.cc.

References getbyte(), and modrm.

Referenced by decode_insn(), decode_modrm(), and decode_op().

char * x86dis::getName  )  [virtual]
 

Implements Disassembler.

Definition at line 609 of file x86dis.cc.

void x86dis::getOpcodeMetrics int &  min_length,
int &  max_length,
int &  min_look_ahead,
int &  avg_look_ahead,
int &  addr_align
[virtual]
 

Implements Disassembler.

Definition at line 594 of file x86dis.cc.

int x86dis::getsib  )  [protected]
 

Definition at line 614 of file x86dis.cc.

References getbyte(), and sib.

Referenced by decode_sib().

byte x86dis::getSize dis_insn disasm_insn  )  [virtual]
 

Implements Disassembler.

Definition at line 620 of file x86dis.cc.

References byte, and dis_insn.

Referenced by srt_x86().

word x86dis::getword  )  [protected]
 

Definition at line 566 of file x86dis.cc.

References addr, codep, invalidate(), maxlen, ocodep, and word.

Referenced by decode_modrm(), and decode_op().

void x86dis::invalidate  )  [protected]
 

Definition at line 625 of file x86dis.cc.

References insn, and x86dis_insn::invalid.

Referenced by decode_insn(), decode_modrm(), decode_op(), getbyte(), getdword(), and getword().

int x86dis::isfloat char  c  )  [protected]
 

Definition at line 630 of file x86dis.cc.

References SIZE_L, SIZE_S, and SIZE_T.

Referenced by decode_modrm(), and decode_op().

int x86dis::load ht_object_stream f  )  [virtual]
 

loads object from object stream.

Returns:
ht_stream errorcode

Reimplemented from Object.

Definition at line 641 of file x86dis.cc.

References addrsize, ht_layer_stream::get_error(), GET_INT_HEX, and opsize.

OBJECT_ID x86dis::object_id  )  const [virtual]
 

Returns:
unique object id.

Reimplemented from Object.

Reimplemented in x86dis_vxd.

Definition at line 648 of file x86dis.cc.

References ATOM_DISASM_X86.

void x86dis::prefixes  )  [protected]
 

Definition at line 653 of file x86dis.cc.

References addrsize, c, codep, x86dis_insn::eaddrsize, x86dis_insn::eopsize, getbyte(), insn, x86dis_insn::lockprefix, ocodep, opsize, x86dis_insn::repprefix, x86dis_insn::segprefix, X86_ADDRSIZE16, X86_ADDRSIZE32, X86_OPSIZE16, X86_OPSIZE32, X86_PREFIX_CS, X86_PREFIX_DS, X86_PREFIX_ES, X86_PREFIX_FS, X86_PREFIX_GS, X86_PREFIX_LOCK, X86_PREFIX_NO, X86_PREFIX_REPNZ, X86_PREFIX_REPZ, and X86_PREFIX_SS.

Referenced by decode().

int x86dis::special_param_ambiguity x86dis_insn disasm_insn  )  [protected]
 

Definition at line 701 of file x86dis.cc.

References x86dis_insn::name, x86dis_insn::op, x86_insn_op::type, X86_OPTYPE_CRX, X86_OPTYPE_DRX, X86_OPTYPE_MEM, X86_OPTYPE_MMX, X86_OPTYPE_REG, X86_OPTYPE_SEG, X86_OPTYPE_STX, and X86_OPTYPE_TRX.

Referenced by strf().

void x86dis::store ht_object_stream f  )  [virtual]
 

stores object.

Reimplemented from Object.

Definition at line 1100 of file x86dis.cc.

References addrsize, opsize, and PUT_INT_HEX.

char * x86dis::str dis_insn disasm_insn,
int  options
[virtual]
 

Reimplemented from Disassembler.

Definition at line 1047 of file x86dis.cc.

References dis_insn, DISASM_STRF_DEFAULT_FORMAT, options, and strf().

Referenced by srt_x86().

void x86dis::str_format char **  str,
char **  format,
char *  p,
char *  n,
char *  op[3],
int  oplen[3],
char  stopchar,
int  print
[protected]
 

Definition at line 956 of file x86dis.cc.

References DIS_STYLE_TABSIZE, DISASM_STRF_COND, DISASM_STRF_FIRST, DISASM_STRF_NAME, DISASM_STRF_PREFIX, DISASM_STRF_SECOND, DISASM_STRF_THIRD, DISASM_STRF_VAR, e_cs_default, e_cs_symbol, Disassembler::get_cs(), insnstr, and NULL.

Referenced by strf().

void x86dis::str_op char *  opstr,
int *  opstrlen,
x86dis_insn insn,
x86_insn_op op,
bool  explicit_params
[protected, virtual]
 

Reimplemented in x86dis_vxd.

Definition at line 727 of file x86dis.cc.

References CPU_ADDR::addr32, addr_sym_func, addr_sym_func_context, x86_insn_op::crx, x86_insn_op::drx, dword, e_cs_default, e_cs_number, e_cs_symbol, x86dis_insn::eaddrsize, x86_insn_op::farptr, Disassembler::get_cs(), Disassembler::hexd(), x86_insn_op::imm, x86_insn_op::mem, x86_insn_op::mmx, x86dis_insn::name, NULL, x86_insn_op::reg, x86_insn_op::seg, seg, x86dis_insn::segprefix, x86_insn_op::size, x86_insn_op::stx, x86_insn_op::trx, x86_insn_op::type, X86_ADDRSIZE16, X86_ADDRSIZE32, X86_OPTYPE_CRX, X86_OPTYPE_DRX, X86_OPTYPE_FARPTR, X86_OPTYPE_IMM, X86_OPTYPE_MEM, X86_OPTYPE_MMX, X86_OPTYPE_REG, X86_OPTYPE_SEG, X86_OPTYPE_STX, X86_OPTYPE_TRX, X86_PREFIX_NO, X86_REG_NO, x86_regs, x86_segs, and X86DIS_STYLE_OPTIMIZE_ADDR.

Referenced by x86dis_vxd::str_op(), and strf().

char * x86dis::strf dis_insn disasm_insn,
int  options,
char *  format
[virtual]
 

Implements Disassembler.

Definition at line 1052 of file x86dis.cc.

References dis_insn, DIS_STYLE_HIGHLIGHT, Disassembler::disable_highlighting(), Disassembler::enable_highlighting(), x86dis_insn::eopsize, insn, insnstr, x86dis_insn::lockprefix, x86dis_insn::name, x86dis_insn::op, x86dis_insn::repprefix, special_param_ambiguity(), str_format(), str_op(), X86_OPSIZE16, X86_OPSIZE32, X86_PREFIX_LOCK, X86_PREFIX_REPNZ, X86_PREFIX_REPZ, and X86DIS_STYLE_EXPLICIT_MEMSIZE.

Referenced by str().

bool x86dis::validInsn dis_insn disasm_insn  )  [virtual]
 

Implements Disassembler.

Definition at line 1106 of file x86dis.cc.

References dis_insn.

Referenced by srt_x86().


Member Data Documentation

int x86dis::addr [protected]
 

Definition at line 64 of file x86dis.h.

Referenced by decode(), decode_op(), getbyte(), getdword(), and getword().

int x86dis::addrsize
 

Definition at line 57 of file x86dis.h.

Referenced by decode_op(), load(), prefixes(), store(), and x86dis().

byte x86dis::c [protected]
 

Definition at line 65 of file x86dis.h.

Referenced by decode(), decode_insn(), and prefixes().

unsigned char* x86dis::codep [protected]
 

Definition at line 62 of file x86dis.h.

Referenced by decode(), getbyte(), getdword(), getword(), and prefixes().

x86dis_insn x86dis::insn [protected]
 

Definition at line 59 of file x86dis.h.

Referenced by decode(), decode_insn(), decode_modrm(), decode_op(), duplicateInsn(), esizeaddr(), esizeop(), invalidate(), prefixes(), and strf().

char x86dis::insnstr[256] [protected]
 

Definition at line 60 of file x86dis.h.

Referenced by str_format(), and strf().

int x86dis::maxlen [protected]
 

Definition at line 68 of file x86dis.h.

Referenced by decode(), getbyte(), getdword(), and getword().

int x86dis::modrm [protected]
 

Definition at line 66 of file x86dis.h.

Referenced by decode(), decode_modrm(), and getmodrm().

unsigned char * x86dis::ocodep [protected]
 

Definition at line 62 of file x86dis.h.

Referenced by decode(), getbyte(), getdword(), getword(), and prefixes().

int x86dis::opsize
 

Definition at line 57 of file x86dis.h.

Referenced by decode(), load(), prefixes(), store(), and x86dis().

int x86dis::seg [protected]
 

Definition at line 63 of file x86dis.h.

Referenced by decode(), and str_op().

int x86dis::sib [protected]
 

Definition at line 67 of file x86dis.h.

Referenced by decode(), decode_sib(), and getsib().


The documentation for this class was generated from the following files:
Generated on Fri May 7 21:16:11 2004 by doxygen 1.3.5