emu_cpu.h File Reference

#include <inttypes.h>
Include dependency graph for emu_cpu.h:

Go to the source code of this file.

Enumerations

enum  emu_reg32 {
  eax = 0, ecx, edx, ebx,
  esp, ebp, esi, edi
}
enum  emu_reg16 {
  ax = 0, cx, dx, bx,
  sp, bp, si, di
}
enum  emu_reg8 {
  al = 0, cl, dl, bl,
  ah, ch, dh, bh
}

Functions

struct emu_cpuemu_cpu_new (struct emu *e)
uint32_t emu_cpu_reg32_get (struct emu_cpu *cpu_p, enum emu_reg32 reg)
void emu_cpu_reg32_set (struct emu_cpu *cpu_p, enum emu_reg32 reg, uint32_t val)
uint16_t emu_cpu_reg16_get (struct emu_cpu *cpu_p, enum emu_reg16 reg)
void emu_cpu_reg16_set (struct emu_cpu *cpu_p, enum emu_reg16 reg, uint16_t val)
uint8_t emu_cpu_reg8_get (struct emu_cpu *cpu_p, enum emu_reg8 reg)
void emu_cpu_reg8_set (struct emu_cpu *cpu_p, enum emu_reg8 reg, uint8_t val)
uint32_t emu_cpu_eflags_get (struct emu_cpu *c)
void emu_cpu_eflags_set (struct emu_cpu *c, uint32_t val)
void emu_cpu_eip_set (struct emu_cpu *c, uint32_t eip)
uint32_t emu_cpu_eip_get (struct emu_cpu *c)
int32_t emu_cpu_parse (struct emu_cpu *c)
int32_t emu_cpu_step (struct emu_cpu *c)
int32_t emu_cpu_run (struct emu_cpu *c)
void emu_cpu_free (struct emu_cpu *c)
void emu_cpu_debug_print (struct emu_cpu *c)
void emu_cpu_debugflag_set (struct emu_cpu *c, uint8_t flag)
void emu_cpu_debugflag_unset (struct emu_cpu *c, uint8_t flag)

Enumeration Type Documentation

enum emu_reg16
Enumerator:
ax 
cx 
dx 
bx 
sp 
bp 
si 
di 
enum emu_reg32
Enumerator:
eax 
ecx 
edx 
ebx 
esp 
ebp 
esi 
edi 
enum emu_reg8
Enumerator:
al 
cl 
dl 
bl 
ah 
ch 
dh 
bh 

Function Documentation

void emu_cpu_debug_print ( struct emu_cpu c  ) 

References CPU_FLAG_ISSET, eax, ebp, ebx, ecx, edi, edx, eflagm, emu_cpu::eip, emu_cpu::emu, emu_memory_read_dword(), esi, esp, logDebug, emu_cpu::mem, and emu_cpu::reg.

Here is the call graph for this function:

void emu_cpu_debugflag_set ( struct emu_cpu c,
uint8_t  flag 
)

References CPU_DEBUG_FLAG_SET.

void emu_cpu_debugflag_unset ( struct emu_cpu c,
uint8_t  flag 
)

References CPU_DEBUG_FLAG_UNSET.

uint32_t emu_cpu_eflags_get ( struct emu_cpu c  ) 

References emu_cpu::eflags.

void emu_cpu_eflags_set ( struct emu_cpu c,
uint32_t  val 
)
uint32_t emu_cpu_eip_get ( struct emu_cpu c  ) 

get the cpu's EIP

Parameters:
c the cpu
Returns:
EIP

References emu_cpu::eip.

Referenced by emu_env_w32_eip_check(), and emu_shellcode_run_and_track().

void emu_cpu_eip_set ( struct emu_cpu c,
uint32_t  eip 
)
void emu_cpu_free ( struct emu_cpu c  ) 

References emu_cpu::instr_string.

Referenced by emu_free().

struct emu_cpu* emu_cpu_new ( struct emu e  )  [read]

References emu_memory_get(), init_prefix_map(), and logDebug.

Referenced by emu_new().

Here is the call graph for this function:

int32_t emu_cpu_parse ( struct emu_cpu c  ) 

parse a instruction at EIP

Parameters:
c the cpu
Returns:
on success: 0 on errror : -1, check emu_errno and emu_strerror

References emu_instruction::cpu, CPU_DEBUG_FLAG_ISSET, emu_cpu::cpu_instr_info, dasm_print_instruction(), emu_cpu_instruction::disp, emu_cpu_instruction_info::disp_data, emu_fpu_instruction::ea, emu_cpu_instruction::ea, ebp, emu_tracking_info::eflags, emu_cpu::eip, emu_cpu::emu, emu_errno_set(), emu_memory_read_block(), emu_memory_read_byte(), emu_memory_read_dword(), emu_memory_read_word(), emu_strerror_set(), emu_cpu_instruction_info::format, emu_instruction::fpu, emu_tracking_info::fpu, emu_fpu_instruction::fpu_data, emu_cpu_instruction_info::fpu_info, FPU_MOD, FPU_RM, emu_cpu_instruction_info::function, emu_instruction::has_cond_pos, II_DISP16, II_DISP32, II_DISP8, II_DISPF, II_IMM, II_IMM16, II_IMM32, II_IMM8, II_MOD_REG_RM, II_MOD_YYY_RM, ii_onebyte, ii_twobyte, II_XX_REG1_REG2, emu_cpu_instruction::imm, emu_cpu_instruction::imm16, emu_cpu_instruction::imm8, emu_cpu_instruction_info::imm_data, emu_instruction::init, emu_cpu::instr, emu_cpu::instr_string, instruction_size, instruction_string, emu_instruction::is_fpu, emu_cpu::last_fpu_instr, logDebug, emu_cpu::mem, emu_cpu_instruction::mod, emu_cpu_instruction::modrm, emu_cpu_instruction_info::modrm_byte, MODRM_MOD, MODRM_REGOPC, MODRM_RM, emu_instruction::need, emu_cpu_instruction::opc, emu_instruction::opc, emu_cpu_instruction::opc_2nd, emu_cpu_instruction::operand_size, OPSIZE_16, OPSIZE_32, OPSIZE_8, prefix_fn(), prefix_map, PREFIX_OPSIZE, emu_fpu_instruction::prefixes, emu_cpu_instruction::prefixes, emu_instruction::prefixes, emu_cpu::reg, emu_tracking_info::reg, emu_cpu::repeat_current_instr, emu_cpu_instruction::rm, emu_cpu_instruction::s_bit, scalem, emu_cpu_instruction::sib, SIB_BASE, SIB_INDEX, SIB_SCALE, emu_instruction::source, SOURCE_NORM_POS, emu_instruction::track, TRACK_NEED_REG32, emu_cpu_instruction_info::type, emu_cpu_instruction_info::w_bit, and emu_cpu_instruction::w_bit.

Referenced by emu_cpu_run(), emu_getpc_check(), emu_shellcode_run_and_track(), and emu_source_instruction_graph_create().

Here is the call graph for this function:

uint16_t emu_cpu_reg16_get ( struct emu_cpu cpu_p,
enum emu_reg16  reg 
) [inline]

References emu_cpu::reg16.

void emu_cpu_reg16_set ( struct emu_cpu cpu_p,
enum emu_reg16  reg,
uint16_t  val 
) [inline]

References emu_cpu::reg16.

uint32_t emu_cpu_reg32_get ( struct emu_cpu cpu_p,
enum emu_reg32  reg 
) [inline]

References emu_cpu::reg.

Referenced by emu_getpc_check().

void emu_cpu_reg32_set ( struct emu_cpu cpu_p,
enum emu_reg32  reg,
uint32_t  val 
) [inline]
uint8_t emu_cpu_reg8_get ( struct emu_cpu cpu_p,
enum emu_reg8  reg 
) [inline]

References emu_cpu::reg8.

void emu_cpu_reg8_set ( struct emu_cpu cpu_p,
enum emu_reg8  reg,
uint8_t  val 
) [inline]

References emu_cpu::reg8.

int32_t emu_cpu_run ( struct emu_cpu c  ) 

References emu_cpu_parse(), and emu_cpu_step().

Here is the call graph for this function:

int32_t emu_cpu_step ( struct emu_cpu c  ) 

Generated on Sun Jan 9 16:47:49 2011 for libemu by  doxygen 1.6.1