decompiler
1.0.0
|
A pcode-based emulator interface. More...
#include <emulate.hh>
Public Member Functions | |
Emulate (void) | |
generic emulator constructor | |
void | setHalt (bool val) |
Set the halt state of the emulator. More... | |
bool | getHalt (void) const |
Get the halt state of the emulator. More... | |
virtual void | setExecuteAddress (const Address &addr)=0 |
Set the address of the next instruction to emulate. | |
virtual Address | getExecuteAddress (void) const =0 |
Get the address of the current instruction being executed. | |
void | executeCurrentOp (void) |
Do a single pcode op step. More... | |
Protected Member Functions | |
virtual void | executeUnary (void)=0 |
Execute a unary arithmetic/logical operation. | |
virtual void | executeBinary (void)=0 |
Execute a binary arithmetic/logical operation. | |
virtual void | executeLoad (void)=0 |
Standard behavior for a p-code LOAD. | |
virtual void | executeStore (void)=0 |
Standard behavior for a p-code STORE. | |
virtual void | executeBranch (void)=0 |
Standard behavior for a BRANCH. More... | |
virtual bool | executeCbranch (void)=0 |
Check if the conditional of a CBRANCH is true. More... | |
virtual void | executeBranchind (void)=0 |
Standard behavior for a BRANCHIND. | |
virtual void | executeCall (void)=0 |
Standard behavior for a p-code CALL. | |
virtual void | executeCallind (void)=0 |
Standard behavior for a CALLIND. | |
virtual void | executeCallother (void)=0 |
Standard behavior for a user-defined p-code op. | |
virtual void | executeMultiequal (void)=0 |
Standard behavior for a MULTIEQUAL (phi-node) | |
virtual void | executeIndirect (void)=0 |
Standard behavior for an INDIRECT op. | |
virtual void | executeSegmentOp (void)=0 |
Behavior for a SEGMENTOP. | |
virtual void | executeCpoolRef (void)=0 |
Standard behavior for a CPOOLREF (constant pool reference) op. | |
virtual void | executeNew (void)=0 |
Standard behavior for (low-level) NEW op. | |
virtual void | fallthruOp (void)=0 |
Standard p-code fall-thru semantics. | |
Protected Attributes | |
bool | emu_halted |
Set to true if the emulator is halted. | |
OpBehavior * | currentBehave |
Behavior of the next op to execute. | |
A pcode-based emulator interface.
The interface expects that the underlying emulation engine operates on individual pcode operations as its atomic operation. The interface allows execution stepping through individual pcode operations. The interface allows querying of the current pcode op, the current machine address, and the rest of the machine state.
|
protectedpure virtual |
Standard behavior for a BRANCH.
This routine performs a standard p-code BRANCH operation on the memory state. This same routine is used for CBRANCH operations if the condition has evaluated to true.
Implemented in EmulatePcodeCache, EmulateMemory, EmulateSnippet, and EmulateFunction.
Referenced by executeCurrentOp().
|
protectedpure virtual |
Check if the conditional of a CBRANCH is true.
This routine only checks if the condition for a p-code CBRANCH is true. It does not perform the actual branch.
Implemented in EmulateMemory, EmulateSnippet, and EmulatePcodeOp.
Referenced by executeCurrentOp().
void Emulate::executeCurrentOp | ( | void | ) |
Do a single pcode op step.
This method executes a single pcode operation, the current one (returned by getCurrentOp()). The MemoryState of the emulator is queried and changed as needed to accomplish this.
References CPUI_BRANCH, CPUI_BRANCHIND, CPUI_CALL, CPUI_CALLIND, CPUI_CALLOTHER, CPUI_CBRANCH, CPUI_CPOOLREF, CPUI_INDIRECT, CPUI_LOAD, CPUI_MULTIEQUAL, CPUI_NEW, CPUI_RETURN, CPUI_SEGMENTOP, CPUI_STORE, currentBehave, executeBinary(), executeBranch(), executeBranchind(), executeCall(), executeCallind(), executeCallother(), executeCbranch(), executeCpoolRef(), executeIndirect(), executeLoad(), executeMultiequal(), executeNew(), executeSegmentOp(), executeStore(), executeUnary(), fallthruOp(), OpBehavior::getOpcode(), OpBehavior::isSpecial(), and OpBehavior::isUnary().
Referenced by ExecutablePcode::evaluate(), and EmulatePcodeCache::executeInstruction().
|
inline |
Get the halt state of the emulator.
Applications and breakpoints can use this method and its companion setHalt() to terminate and restart the main emulator loop as needed. The emulator itself makes no use of this routine or the associated state variable emu_halted.
References emu_halted.
Referenced by ExecutablePcode::evaluate().
|
inline |
Set the halt state of the emulator.
Applications and breakpoints can use this method and its companion getHalt() to terminate and restart the main emulator loop as needed. The emulator itself makes no use of this routine or the associated state variable emu_halted.
val | is what the halt state of the emulator should be set to |
References emu_halted.