decompiler
1.0.0
|
An abstract Emulate class using a MemoryState object as the backing machine state. More...
#include <emulate.hh>
Public Member Functions | |
EmulateMemory (MemoryState *mem) | |
Construct given a memory state. | |
MemoryState * | getMemoryState (void) const |
Get the emulator's memory state. More... | |
Public Member Functions inherited from Emulate | |
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) |
Execute a unary arithmetic/logical operation. | |
virtual void | executeBinary (void) |
Execute a binary arithmetic/logical operation. | |
virtual void | executeLoad (void) |
Standard behavior for a p-code LOAD. | |
virtual void | executeStore (void) |
Standard behavior for a p-code STORE. | |
virtual void | executeBranch (void) |
Standard behavior for a BRANCH. More... | |
virtual bool | executeCbranch (void) |
Check if the conditional of a CBRANCH is true. More... | |
virtual void | executeBranchind (void) |
Standard behavior for a BRANCHIND. | |
virtual void | executeCall (void) |
Standard behavior for a p-code CALL. | |
virtual void | executeCallind (void) |
Standard behavior for a CALLIND. | |
virtual void | executeCallother (void) |
Standard behavior for a user-defined p-code op. | |
virtual void | executeMultiequal (void) |
Standard behavior for a MULTIEQUAL (phi-node) | |
virtual void | executeIndirect (void) |
Standard behavior for an INDIRECT op. | |
virtual void | executeSegmentOp (void) |
Behavior for a SEGMENTOP. | |
virtual void | executeCpoolRef (void) |
Standard behavior for a CPOOLREF (constant pool reference) op. | |
virtual void | executeNew (void) |
Standard behavior for (low-level) NEW op. | |
Protected Member Functions inherited from Emulate | |
virtual void | fallthruOp (void)=0 |
Standard p-code fall-thru semantics. | |
Protected Attributes | |
MemoryState * | memstate |
The memory state of the emulator. | |
PcodeOpRaw * | currentOp |
Current op to execute. | |
Protected Attributes inherited from Emulate | |
bool | emu_halted |
Set to true if the emulator is halted. | |
OpBehavior * | currentBehave |
Behavior of the next op to execute. | |
An abstract Emulate class using a MemoryState object as the backing machine state.
Most p-code operations are implemented using the MemoryState to fetch and store values. Control-flow is implemented partially in that setExecuteAddress() is called to indicate which instruction is being executed. The derived class must provide
The following p-code operations are stubbed out and will throw an exception: CALLOTHER, MULTIEQUAL, INDIRECT, CPOOLREF, SEGMENTOP, and NEW. Of course the derived class can override these.
|
protectedvirtual |
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.
Implements Emulate.
Reimplemented in EmulatePcodeCache.
References currentOp, VarnodeData::getAddr(), PcodeOpRaw::getInput(), and Emulate::setExecuteAddress().
|
protectedvirtual |
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.
Implements Emulate.
References currentOp, PcodeOpRaw::getInput(), MemoryState::getValue(), and memstate.
|
inline |
Get the emulator's memory state.
References memstate.