Package envi :: Package archs :: Package i386 :: Module emu :: Class IntelEmulator
[hide private]
[frames] | no frames]

Class IntelEmulator

source code

registers.RegisterContext --+    
                            |    
     regs.i386RegisterContext --+
                                |
registers.RegisterContext --+   |
                            |   |
       memory.IMemory --+   |   |
                        |   |   |
      memory.MemoryObject --+   |
                            |   |
                     Emulator --+
                                |
                               IntelEmulator
Known Subclasses:

Instance Methods [hide private]
 
__init__(self)
Hand in a register definition which consists of a list of (<name>, <width>) tuples.
source code
 
_emu_getGpReg(self, reg, tsize)
Automagically map all general purpose register accesses to their tsize equiv.
source code
 
_emu_setGpReg(self, reg, val, tsize)
Automagically map all general purpose register accesses to their tsize equiv.
source code
 
cond_a(self) source code
 
cond_ae(self) source code
 
cond_b(self) source code
 
cond_be(self) source code
 
cond_c(self) source code
 
cond_e(self) source code
 
cond_ecxz(self) source code
 
cond_g(self) source code
 
cond_ge(self) source code
 
cond_l(self) source code
 
cond_le(self) source code
 
cond_na(self) source code
 
cond_nae(self) source code
 
cond_nb(self) source code
 
cond_nbe(self) source code
 
cond_nc(self) source code
 
cond_ne(self) source code
 
cond_ng(self) source code
 
cond_nge(self) source code
 
cond_nl(self) source code
 
cond_nle(self) source code
 
cond_no(self) source code
 
cond_np(self) source code
 
cond_ns(self) source code
 
cond_nz(self) source code
 
cond_o(self) source code
 
cond_p(self) source code
 
cond_pe(self) source code
 
cond_po(self) source code
 
cond_s(self) source code
 
cond_z(self) source code
 
decCounter(self)
A helper to decrement and return the counter
source code
 
doBitTest(self, op) source code
 
doCmps(self, width) source code
 
doPop(self) source code
 
doPush(self, val) source code
 
doRepPrefix(self, meth, op) source code
 
doRepzPrefix(self, meth, op) source code
 
executeOpcode(self, op)
This is the core method for the
source code
 
getFlag(self, which) source code
 
getSegmentIndex(self, op)
The *default* segmentation is none (most arch's will over-ride).
source code
 
i_adc(self, op) source code
 
i_add(self, op) source code
 
i_and(self, op) source code
 
i_arpl(self, op) source code
 
i_bsr(self, op) source code
 
i_bswap(self, op) source code
 
i_bt(self, op) source code
 
i_btc(self, op) source code
 
i_btr(self, op) source code
 
i_bts(self, op) source code
 
i_call(self, op) source code
 
i_cdq(self, op) source code
 
i_clc(self, op) source code
 
i_cld(self, op) source code
 
i_cli(self, op) source code
 
i_cmova(self, op) source code
 
i_cmovae(self, op) source code
 
i_cmovb(self, op) source code
 
i_cmovbe(self, op) source code
 
i_cmovc(self, op) source code
 
i_cmove(self, op) source code
 
i_cmovecxz(self, op) source code
 
i_cmovg(self, op) source code
 
i_cmovge(self, op) source code
 
i_cmovl(self, op) source code
 
i_cmovle(self, op) source code
 
i_cmovna(self, op) source code
 
i_cmovnae(self, op) source code
 
i_cmovnb(self, op) source code
 
i_cmovnbe(self, op) source code
 
i_cmovnc(self, op) source code
 
i_cmovne(self, op) source code
 
i_cmovng(self, op) source code
 
i_cmovnge(self, op) source code
 
i_cmovnl(self, op) source code
 
i_cmovnle(self, op) source code
 
i_cmovno(self, op) source code
 
i_cmovnp(self, op) source code
 
i_cmovns(self, op) source code
 
i_cmovnz(self, op) source code
 
i_cmovo(self, op) source code
 
i_cmovp(self, op) source code
 
i_cmovpe(self, op) source code
 
i_cmovpo(self, op) source code
 
i_cmovs(self, op) source code
 
i_cmovz(self, op) source code
 
i_cmp(self, op) source code
 
i_cmpsb(self, op) source code
 
i_cmpsd(self, op)
Compare the dword pointed at by ds:esi to ds:edi.
source code
 
i_cmpxch8b(self, op) source code
 
i_cmpxchg(self, op) source code
 
i_cpuid(self, op) source code
 
i_cwd(self, op) source code
 
i_dec(self, op) source code
 
i_div(self, op) source code
 
i_enter(self, op) source code
 
i_fild(self, op) source code
 
i_fldz(self, op) source code
 
i_fstp(self, op) source code
 
i_idiv(self, op) source code
 
i_imul(self, op) source code
 
i_in(self, op) source code
 
i_inc(self, op) source code
 
i_int(self, op) source code
 
i_int3(self, op) source code
 
i_ja(self, op) source code
 
i_jae(self, op) source code
 
i_jb(self, op) source code
 
i_jbe(self, op) source code
 
i_jc(self, op) source code
 
i_je(self, op) source code
 
i_jecxz(self, op) source code
 
i_jg(self, op) source code
 
i_jge(self, op) source code
 
i_jl(self, op) source code
 
i_jle(self, op) source code
 
i_jmp(self, op) source code
 
i_jna(self, op) source code
 
i_jnae(self, op) source code
 
i_jnb(self, op) source code
 
i_jnbe(self, op) source code
 
i_jnc(self, op) source code
 
i_jne(self, op) source code
 
i_jng(self, op) source code
 
i_jnge(self, op) source code
 
i_jnl(self, op) source code
 
i_jnle(self, op) source code
 
i_jno(self, op) source code
 
i_jnp(self, op) source code
 
i_jns(self, op) source code
 
i_jnz(self, op) source code
 
i_jo(self, op) source code
 
i_jp(self, op) source code
 
i_jpe(self, op) source code
 
i_jpo(self, op) source code
 
i_js(self, op) source code
 
i_jz(self, op) source code
 
i_lea(self, op) source code
 
i_leave(self, op) source code
 
i_lodsb(self, op) source code
 
i_lodsd(self, op) source code
 
i_loop(self, op) source code
 
i_loope(self, op) source code
 
i_loopne(self, op) source code
 
i_loopnz(self, op) source code
 
i_loopz(self, op) source code
 
i_mov(self, op) source code
 
i_movq(self, op) source code
 
i_movsb(self, op) source code
 
i_movsd(self, op) source code
 
i_movsx(self, op) source code
 
i_movzx(self, op) source code
 
i_mul(self, op) source code
 
i_neg(self, op) source code
 
i_nop(self, op) source code
 
i_not(self, op) source code
 
i_or(self, op) source code
 
i_pop(self, op) source code
 
i_popad(self, op) source code
 
i_popfd(self, op) source code
 
i_push(self, op) source code
 
i_pushad(self, op) source code
 
i_pushfd(self, op) source code
 
i_pxor(self, op) source code
 
i_rcl(self, op) source code
 
i_rcr(self, op) source code
 
i_rdtsc(self, op)
Read the clock cycle counter into edx:eax
source code
 
i_ret(self, op) source code
 
i_rol(self, op) source code
 
i_ror(self, op) source code
 
i_sal(self, op) source code
 
i_sar(self, op) source code
 
i_sbb(self, op) source code
 
i_scasb(self, op) source code
 
i_scasd(self, op) source code
 
i_seta(self, op) source code
 
i_setae(self, op) source code
 
i_setb(self, op) source code
 
i_setbe(self, op) source code
 
i_setc(self, op) source code
 
i_sete(self, op) source code
 
i_setecxz(self, op) source code
 
i_setg(self, op) source code
 
i_setge(self, op) source code
 
i_setl(self, op) source code
 
i_setle(self, op) source code
 
i_setna(self, op) source code
 
i_setnae(self, op) source code
 
i_setnb(self, op) source code
 
i_setnbe(self, op) source code
 
i_setnc(self, op) source code
 
i_setne(self, op) source code
 
i_setng(self, op) source code
 
i_setnge(self, op) source code
 
i_setnl(self, op) source code
 
i_setnle(self, op) source code
 
i_setno(self, op) source code
 
i_setnp(self, op) source code
 
i_setns(self, op) source code
 
i_setnz(self, op) source code
 
i_seto(self, op) source code
 
i_setp(self, op) source code
 
i_setpe(self, op) source code
 
i_setpo(self, op) source code
 
i_sets(self, op) source code
 
i_setz(self, op) source code
 
i_shl(self, op) source code
 
i_shld(self, op) source code
 
i_shr(self, op) source code
 
i_shrd(self, op) source code
 
i_stc(self, op) source code
 
i_std(self, op) source code
 
i_sti(self, op) source code
 
i_stosb(self, op) source code
 
i_stosd(self, op) source code
 
i_sub(self, op) source code
 
i_test(self, op) source code
 
i_wait(self, op) source code
 
i_xadd(self, op) source code
 
i_xchg(self, op) source code
 
i_xor(self, op) source code
 
intSubBase(self, src, dst, ssize, dsize) source code
 
integerSubtraction(self, op)
Do the core of integer subtraction but only *return* the resulting value rather than assigning it.
source code
 
logicalAnd(self, op) source code
 
readMemSignedValue(self, addr, size) source code
 
readMemValue(self, addr, size) source code
 
regsFromCompound(self, val, size) source code
 
setFlag(self, which, state) source code
 
twoRegCompound(self, topreg, botreg, size)
Build a compound value where the value of the top reg is shifted and or'd with the value of the bot reg ( assuming they are size bytes in length).
source code
 
writeMemValue(self, addr, value, size) source code

Inherited from registers.RegisterContext: addMetaRegister, getMetaRegInfo, getProgramCounter, getRegDef, getRegister, getRegisterByName, getRegisterIndex, getRegisterInfo, getRegisterName, getRegisterNameIndexes, getRegisterNames, getRegisterSnap, getRegisterWidth, getRegisters, getStackCounter, isDirty, isMetaRegister, loadRegDef, loadRegMetas, reprRegister, setIsDirty, setProgramCounter, setRegister, setRegisterByName, setRegisterIndexes, setRegisterInfo, setRegisterSnap, setRegisters, setStackCounter

Inherited from Emulator: addCallingConvention, getArchModule, getCallArgs, getCallingConvention, getCallingConventions, getEmuSnap, getOperAddr, getOperValue, getSegmentInfo, hasCallingConvention, run, setEmuSnap, setOperValue, setReturnValue, setSegmentInfo, stepi

Inherited from memory.MemoryObject: addMemoryMap, getByteDef, getMemoryMap, getMemoryMaps, getMemorySnap, readMemory, setMemorySnap, writeMemory

Inherited from memory.IMemory: allocateMemory, getPointerSize, isExecutable, isReadable, isShared, isValidPointer, isWriteable, parseOpcode, probeMemory, protectMemory, readMemoryFormat, searchMemory, searchMemoryRange, writeMemoryFormat

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Hand in a register definition which consists of a list of (<name>, <width>) tuples.

Overrides: memory.IMemory.__init__

_emu_getGpReg(self, reg, tsize)

source code 

Automagically map all general purpose register accesses to their tsize equiv. Helps clean up a lot of code (and makes a nice place for AMD64 to hook ;) )

_emu_setGpReg(self, reg, val, tsize)

source code 

Automagically map all general purpose register accesses to their tsize equiv. Helps clean up a lot of code (and makes a nice place for AMD64 to hook ;) )

executeOpcode(self, op)

source code 

This is the core method for the

Overrides: Emulator.executeOpcode
(inherited documentation)

getSegmentIndex(self, op)

source code 

The *default* segmentation is none (most arch's will over-ride). This method may be implemented to return a segment index based on either emulator state or properties of the particular instruction in question.

Overrides: Emulator.getSegmentIndex
(inherited documentation)

i_cmpsd(self, op)

source code 

Compare the dword pointed at by ds:esi to ds:edi. (if equal, update esi/edi by one acording to DF)

integerSubtraction(self, op)

source code 

Do the core of integer subtraction but only *return* the resulting value rather than assigning it. (allows cmp and sub to use the same code)

readMemValue(self, addr, size)

source code 
Overrides: memory.IMemory.readMemValue

twoRegCompound(self, topreg, botreg, size)

source code 

Build a compound value where the value of the top reg is shifted and or'd with the value of the bot reg ( assuming they are size bytes in length). The return is size * 2 wide (and unsigned).