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

srt_x86.cc File Reference

#include <string.h>
#include "htctrl.h"
#include "htexcept.h"
#include "htiobox.h"
#include "srt_x86.h"
#include "x86dis.h"

Go to the source code of this file.

Classes

struct  CPU
struct  ecmd
class  sym_int_reg_x86

Defines

#define X86_FLAG_CARRY   0
#define X86_FLAG_PARITY   1
#define X86_FLAG_AUX   2
#define X86_FLAG_ZERO   3
#define X86_FLAG_SIGNED   4
#define X86_FLAG_OVERFLOW   5
#define X86_FLAGS   6
#define MAX_INSNS   20

Typedefs

typedef void(* ecmd_handler )(CPU *cpu, ht_list *rm, x86dis_insn *insn)

Functions

char * srt_x86_idx2reg (UINT idx)
void srt_x86_setreg (CPU *cpu, UINT idx, Object *o)
state_modsrt_x86_flag (UINT flagidx, sym_bool_token *value)
state_modsrt_x86_reg (UINT regidx, sym_int_token *value)
void srt_x86_flags_std (ht_list *rm, x86dis_insn *insn, sym_int *cond)
void srt_x86_flags_carry (ht_list *rm, x86dis_insn *insn, sym_int *cond, sym_bool *carry)
sym_intsrt_x86_mkreg (CPU *cpu, UINT regidx)
sym_int_tokensrt_x86_mkaddr (CPU *cpu, x86_insn_op *o)
void srt_x86_mkdest (CPU *cpu, state_mod *m, x86_insn_op *d)
sym_intsrt_x86_mkvalue (CPU *cpu, x86_insn_op *o)
void srt_x86_destmod (CPU *cpu, ht_list *rm, x86_insn_op *op, sym_int_token *value)
void srt_x86_add (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_and (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_cmp (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_dec (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_div (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_inc (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_lea (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_mov (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_mul (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_or (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_pop (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_push (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_sub (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_shl (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_shr (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_test (CPU *cpu, ht_list *rm, x86dis_insn *insn)
void srt_x86_xor (CPU *cpu, ht_list *rm, x86dis_insn *insn)
ht_listsrt_x86_single (CPU *cpu, x86dis_insn *i)
void create_cpu (CPU *cpu)
void destroy_cpu (CPU *cpu)
void srt_x86 (Analyser *analy, Address *addr)

Variables

char * srt_x86_flags [X86_FLAGS]
ecmd ecmds []


Define Documentation

#define MAX_INSNS   20
 

Referenced by srt_x86().

#define X86_FLAG_AUX   2
 

Definition at line 31 of file srt_x86.cc.

#define X86_FLAG_CARRY   0
 

Definition at line 29 of file srt_x86.cc.

Referenced by srt_x86_flags_carry(), and srt_x86_xor().

#define X86_FLAG_OVERFLOW   5
 

Definition at line 34 of file srt_x86.cc.

Referenced by srt_x86_xor().

#define X86_FLAG_PARITY   1
 

Definition at line 30 of file srt_x86.cc.

#define X86_FLAG_SIGNED   4
 

Definition at line 33 of file srt_x86.cc.

Referenced by srt_x86_flags_std().

#define X86_FLAG_ZERO   3
 

Definition at line 32 of file srt_x86.cc.

Referenced by srt_x86_flags_std().

#define X86_FLAGS   6
 

Definition at line 36 of file srt_x86.cc.

Referenced by create_cpu(), destroy_cpu(), srt_x86_idx2reg(), and srt_x86_setreg().


Typedef Documentation

typedef void(* ecmd_handler)(CPU *cpu, ht_list *rm, x86dis_insn *insn)
 

Definition at line 582 of file srt_x86.cc.


Function Documentation

void create_cpu CPU cpu  ) 
 

Definition at line 626 of file srt_x86.cc.

References CPU::flags, Object::init(), CPU::regs, sym_bool::set(), sym_int::set(), srt_x86_idx2reg(), UINT, and X86_FLAGS.

Referenced by srt_x86().

void destroy_cpu CPU cpu  ) 
 

Definition at line 645 of file srt_x86.cc.

References Object::done(), CPU::flags, CPU::regs, UINT, and X86_FLAGS.

Referenced by srt_x86().

void srt_x86 Analyser analy,
Address addr
 

Definition at line 658 of file srt_x86.cc.

References Address::add(), app, ht_listbox::attachTitle(), buf, Analyser::bufPtr(), button_ok, byte, ht_list::count(), create_cpu(), x86dis::decode(), state_mod::dest, destroy_cpu(), dis_insn, DIS_STYLE_HEX_ASMSTYLE, DIS_STYLE_HEX_NOZEROPAD, Analyser::disasm, ht_dialog::done(), errorbox, FS_KILLER, FS_MOVE, FS_TITLE, ht_list::get(), ht_view::getbounds(), x86dis::getSize(), ht_dialog::init(), ht_listbox_title::init(), ht_window::insert(), ht_text_listbox::insert_str(), state_mod::isbool, state_mod::ismem, MAX_INSNS, NULL, Address::putIntoCPUAddress(), ht_dialog::run(), scinitialized, ht_listbox_title::setText(), srt_endian_to_str(), srt_x86_idx2reg(), srt_x86_setreg(), srt_x86_single(), x86dis::str(), UINT, ht_text_listbox::update(), Analyser::validAddress(), x86dis::validInsn(), and state_mod::value.

Referenced by test_srt().

void srt_x86_add CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 319 of file srt_x86.cc.

References b_add, sym_int::b_operate(), c_lt, sym_int::duplicate(), x86dis_insn::op, sym_bool::set(), srt_x86_destmod(), srt_x86_flags_carry(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_and CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 336 of file srt_x86.cc.

References b_and, sym_int::b_operate(), x86dis_insn::op, srt_x86_destmod(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_cmp CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 346 of file srt_x86.cc.

References sym_int::b_operate(), b_sub, c_lt, x86dis_insn::op, sym_bool::set(), srt_x86_flags_carry(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_dec CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 361 of file srt_x86.cc.

References sym_int::b_operate(), b_sub, x86dis_insn::op, srt_x86_destmod(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_destmod CPU cpu,
ht_list rm,
x86_insn_op op,
sym_int_token value
 

Definition at line 306 of file srt_x86.cc.

References ht_list::insert(), state_mod::isbool, srt_x86_mkdest(), value, and state_mod::value.

Referenced by srt_x86_add(), srt_x86_and(), srt_x86_dec(), srt_x86_div(), srt_x86_inc(), srt_x86_mul(), srt_x86_or(), srt_x86_shl(), srt_x86_shr(), srt_x86_sub(), and srt_x86_xor().

void srt_x86_div CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 371 of file srt_x86.cc.

References b_div, b_mod, sym_int::b_operate(), state_mod::dest, ht_list::insert(), state_mod::isbool, state_mod::ismem, x86dis_insn::op, srt_x86_destmod(), srt_x86_flags_std(), srt_x86_mkvalue(), state_mod::value, and X86_REG_DX.

state_mod* srt_x86_flag UINT  flagidx,
sym_bool_token value
 

Definition at line 98 of file srt_x86.cc.

References state_mod::dest, state_mod::isbool, state_mod::ismem, UINT, value, and state_mod::value.

Referenced by srt_x86_xor().

void srt_x86_flags_carry ht_list rm,
x86dis_insn insn,
sym_int cond,
sym_bool carry
 

Definition at line 177 of file srt_x86.cc.

References b_and, sym_int::b_operate(), c_ne, state_mod::dest, sym_bool::duplicate(), sym_int::duplicate(), ht_list::insert(), state_mod::isbool, state_mod::ismem, x86dis_insn::op, sym_bool::set(), x86_insn_op::size, state_mod::value, and X86_FLAG_CARRY.

Referenced by srt_x86_add(), srt_x86_cmp(), and srt_x86_sub().

void srt_x86_flags_std ht_list rm,
x86dis_insn insn,
sym_int cond
 

Definition at line 118 of file srt_x86.cc.

References b_and, sym_int::b_operate(), c_eq, c_ne, state_mod::dest, sym_int::duplicate(), ht_list::insert(), state_mod::isbool, state_mod::ismem, x86dis_insn::op, sym_bool::set(), x86_insn_op::size, state_mod::value, X86_FLAG_SIGNED, and X86_FLAG_ZERO.

Referenced by srt_x86_add(), srt_x86_and(), srt_x86_cmp(), srt_x86_dec(), srt_x86_div(), srt_x86_inc(), srt_x86_mul(), srt_x86_or(), srt_x86_shl(), srt_x86_shr(), srt_x86_sub(), srt_x86_test(), and srt_x86_xor().

char* srt_x86_idx2reg UINT  idx  ) 
 

Definition at line 48 of file srt_x86.cc.

References srt_x86_flags, UINT, X86_FLAGS, and x86_regs.

Referenced by create_cpu(), sym_int_reg_x86::nstrfy(), and srt_x86().

void srt_x86_inc CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 399 of file srt_x86.cc.

References b_add, sym_int::b_operate(), x86dis_insn::op, srt_x86_destmod(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_lea CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 409 of file srt_x86.cc.

References ht_io_exception, ht_list::insert(), state_mod::isbool, x86dis_insn::op, srt_x86_mkaddr(), srt_x86_mkdest(), x86_insn_op::type, state_mod::value, and X86_OPTYPE_MEM.

sym_int_token* srt_x86_mkaddr CPU cpu,
x86_insn_op o
 

Definition at line 243 of file srt_x86.cc.

References b_add, b_invalid, b_mul, b_op, sym_int::b_operate(), b_sub, D, dword, x86_insn_op::mem, srt_x86_mkreg(), and X86_REG_NO.

Referenced by srt_x86_lea(), srt_x86_mkdest(), and srt_x86_mkvalue().

void srt_x86_mkdest CPU cpu,
state_mod m,
x86_insn_op d
 

Definition at line 267 of file srt_x86.cc.

References state_mod::dest, ht_io_exception, state_mod::ismem, x86_insn_op::reg, x86_insn_op::size, srt_x86_mkaddr(), srte_le, x86_insn_op::type, X86_OPTYPE_MEM, and X86_OPTYPE_REG.

Referenced by srt_x86_destmod(), srt_x86_lea(), srt_x86_mov(), and srt_x86_pop().

sym_int* srt_x86_mkreg CPU cpu,
UINT  regidx
 

Definition at line 238 of file srt_x86.cc.

References sym_int::duplicate(), CPU::regs, and UINT.

Referenced by srt_x86_mkaddr(), srt_x86_mkvalue(), srt_x86_pop(), and srt_x86_push().

sym_int* srt_x86_mkvalue CPU cpu,
x86_insn_op o
 

Definition at line 285 of file srt_x86.cc.

References ht_io_exception, x86_insn_op::imm, x86_insn_op::reg, sym_int::set(), x86_insn_op::size, srt_x86_mkaddr(), srt_x86_mkreg(), srte_le, x86_insn_op::type, X86_OPTYPE_IMM, X86_OPTYPE_MEM, and X86_OPTYPE_REG.

Referenced by srt_x86_add(), srt_x86_and(), srt_x86_cmp(), srt_x86_dec(), srt_x86_div(), srt_x86_inc(), srt_x86_mov(), srt_x86_mul(), srt_x86_or(), srt_x86_push(), srt_x86_shl(), srt_x86_shr(), srt_x86_sub(), srt_x86_test(), and srt_x86_xor().

void srt_x86_mov CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 419 of file srt_x86.cc.

References ht_list::insert(), state_mod::isbool, x86dis_insn::op, srt_x86_mkdest(), srt_x86_mkvalue(), and state_mod::value.

void srt_x86_mul CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 428 of file srt_x86.cc.

References b_mul, sym_int::b_operate(), x86dis_insn::op, srt_x86_destmod(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_or CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 453 of file srt_x86.cc.

References sym_int::b_operate(), b_or, x86dis_insn::op, srt_x86_destmod(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_pop CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 463 of file srt_x86.cc.

References b_add, sym_int::b_operate(), state_mod::dest, ht_list::insert(), state_mod::isbool, state_mod::ismem, x86dis_insn::op, size, srt_x86_mkdest(), srt_x86_mkreg(), srte_le, state_mod::value, and X86_REG_SP.

void srt_x86_push CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 489 of file srt_x86.cc.

References sym_int::b_operate(), b_sub, state_mod::dest, sym_int::duplicate(), ht_list::insert(), state_mod::isbool, state_mod::ismem, x86dis_insn::op, size, srt_x86_mkreg(), srt_x86_mkvalue(), srte_le, state_mod::value, and X86_REG_SP.

state_mod* srt_x86_reg UINT  regidx,
sym_int_token value
 

Definition at line 108 of file srt_x86.cc.

References state_mod::dest, state_mod::isbool, state_mod::ismem, UINT, value, and state_mod::value.

void srt_x86_setreg CPU cpu,
UINT  idx,
Object o
 

Definition at line 56 of file srt_x86.cc.

References Object::done(), CPU::flags, CPU::regs, UINT, and X86_FLAGS.

Referenced by srt_x86().

void srt_x86_shl CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 533 of file srt_x86.cc.

References b_mul, sym_int::b_operate(), sym_int::evaluate(), ht_io_exception, x86dis_insn::op, S, srt_x86_destmod(), srt_x86_flags_std(), srt_x86_mkvalue(), and UINT.

void srt_x86_shr CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 548 of file srt_x86.cc.

References b_div, sym_int::b_operate(), sym_int::evaluate(), ht_io_exception, x86dis_insn::op, S, srt_x86_destmod(), srt_x86_flags_std(), srt_x86_mkvalue(), and UINT.

ht_list* srt_x86_single CPU cpu,
x86dis_insn i
 

Definition at line 610 of file srt_x86.cc.

References ecmds, ecmd::h, ht_io_exception, ht_clist::init(), x86dis_insn::name, and ecmd::name.

Referenced by srt_x86().

void srt_x86_sub CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 516 of file srt_x86.cc.

References sym_int::b_operate(), b_sub, c_lt, x86dis_insn::op, sym_bool::set(), srt_x86_destmod(), srt_x86_flags_carry(), srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_test CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 563 of file srt_x86.cc.

References b_and, sym_int::b_operate(), x86dis_insn::op, srt_x86_flags_std(), and srt_x86_mkvalue().

void srt_x86_xor CPU cpu,
ht_list rm,
x86dis_insn insn
 

Definition at line 570 of file srt_x86.cc.

References sym_int::b_operate(), b_xor, ht_list::insert(), x86dis_insn::op, srt_x86_destmod(), srt_x86_flag(), srt_x86_flags_std(), srt_x86_mkvalue(), X86_FLAG_CARRY, and X86_FLAG_OVERFLOW.


Variable Documentation

ecmd ecmds[]
 

Initial value:

 {
        {"add",  srt_x86_add},
        {"and",  srt_x86_and},
        {"cmp",  srt_x86_cmp},
        {"dec",  srt_x86_dec},
        {"div",  srt_x86_div},
        {"inc",  srt_x86_inc},
        {"lea",  srt_x86_lea},
        {"mov",  srt_x86_mov},
        {"mul",  srt_x86_mul},
        {"or",   srt_x86_or},
        {"push", srt_x86_push},
        {"pop",  srt_x86_pop},
        {"sub",  srt_x86_sub},
        {"shl",  srt_x86_shl},
        {"shr",  srt_x86_shr},
        {"test", srt_x86_test},
        {"xor",  srt_x86_xor},
        {NULL, NULL}
}

Definition at line 589 of file srt_x86.cc.

Referenced by srt_x86_single().

char* srt_x86_flags[X86_FLAGS]
 

Initial value:

 {
        "carry", "parity", "aux",
        "zero", "signed", "overflow"
}

Definition at line 38 of file srt_x86.cc.

Referenced by srt_x86_idx2reg().


Generated on Fri May 7 21:15:52 2004 by doxygen 1.3.5