|
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. More... | |
| virtual Address | getExecuteAddress (void) const =0 |
| Get the address of the current instruction being executed. More... | |
| void | executeCurrentOp (void) |
| Do a single pcode op step. More... | |
Protected Member Functions | |
| virtual void | executeUnary (void) |
| Execute a unary arithmetic/logical operation. More... | |
| virtual void | executeBinary (void) |
| Execute a binary arithmetic/logical operation. More... | |
| virtual void | executeLoad (void) |
| Standard behavior for a p-code LOAD. More... | |
| virtual void | executeStore (void) |
| Standard behavior for a p-code STORE. More... | |
| 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. More... | |
| virtual void | executeCall (void) |
| Standard behavior for a p-code CALL. More... | |
| virtual void | executeCallind (void) |
| Standard behavior for a CALLIND. More... | |
| virtual void | executeCallother (void) |
| Standard behavior for a user-defined p-code op. More... | |
| virtual void | executeMultiequal (void) |
| Standard behavior for a MULTIEQUAL (phi-node) More... | |
| virtual void | executeIndirect (void) |
| Standard behavior for an INDIRECT op. More... | |
| virtual void | executeSegmentOp (void) |
| Behavior for a SEGMENTOP. More... | |
| virtual void | executeCpoolRef (void) |
| Standard behavior for a CPOOLREF (constant pool reference) op. More... | |
| virtual void | executeNew (void) |
| Standard behavior for (low-level) NEW op. More... | |
Protected Member Functions inherited from Emulate | |
| virtual void | executeUnary (void)=0 |
| Execute a unary arithmetic/logical operation. More... | |
| virtual void | executeBinary (void)=0 |
| Execute a binary arithmetic/logical operation. More... | |
| virtual void | executeLoad (void)=0 |
| Standard behavior for a p-code LOAD. More... | |
| virtual void | executeStore (void)=0 |
| Standard behavior for a p-code STORE. More... | |
| 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. More... | |
| virtual void | executeCall (void)=0 |
| Standard behavior for a p-code CALL. More... | |
| virtual void | executeCallind (void)=0 |
| Standard behavior for a CALLIND. More... | |
| virtual void | executeCallother (void)=0 |
| Standard behavior for a user-defined p-code op. More... | |
| virtual void | executeMultiequal (void)=0 |
| Standard behavior for a MULTIEQUAL (phi-node) More... | |
| virtual void | executeIndirect (void)=0 |
| Standard behavior for an INDIRECT op. More... | |
| virtual void | executeSegmentOp (void)=0 |
| Behavior for a SEGMENTOP. More... | |
| virtual void | executeCpoolRef (void)=0 |
| Standard behavior for a CPOOLREF (constant pool reference) op. More... | |
| virtual void | executeNew (void)=0 |
| Standard behavior for (low-level) NEW op. More... | |
| virtual void | fallthruOp (void)=0 |
| Standard p-code fall-thru semantics. More... | |
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 |
Execute a binary arithmetic/logical operation.
Implements Emulate.
References Emulate::currentBehave, currentOp, OpBehavior::evaluateBinary(), PcodeOpRaw::getInput(), PcodeOpRaw::getOutput(), MemoryState::getValue(), memstate, MemoryState::setValue(), and VarnodeData::size.
|
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 |
Standard behavior for a BRANCHIND.
Implements Emulate.
References currentOp, PcodeOpRaw::getAddr(), PcodeOpRaw::getInput(), Address::getSpace(), MemoryState::getValue(), memstate, and Emulate::setExecuteAddress().
|
protectedvirtual |
Standard behavior for a p-code CALL.
Implements Emulate.
References currentOp, VarnodeData::getAddr(), PcodeOpRaw::getInput(), and Emulate::setExecuteAddress().
|
protectedvirtual |
Standard behavior for a CALLIND.
Implements Emulate.
References currentOp, PcodeOpRaw::getAddr(), PcodeOpRaw::getInput(), Address::getSpace(), MemoryState::getValue(), memstate, and Emulate::setExecuteAddress().
|
protectedvirtual |
Standard behavior for a user-defined p-code op.
Implements Emulate.
Reimplemented in EmulatePcodeCache.
|
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.
|
protectedvirtual |
Standard behavior for a CPOOLREF (constant pool reference) op.
Implements Emulate.
|
protectedvirtual |
Standard behavior for an INDIRECT op.
Implements Emulate.
|
protectedvirtual |
Standard behavior for a p-code LOAD.
Implements Emulate.
References AddrSpace::addressToByte(), currentOp, VarnodeData::getAddr(), PcodeOpRaw::getInput(), PcodeOpRaw::getOutput(), Address::getSpaceFromConst(), MemoryState::getValue(), AddrSpace::getWordSize(), memstate, MemoryState::setValue(), and VarnodeData::size.
|
protectedvirtual |
Standard behavior for a MULTIEQUAL (phi-node)
Implements Emulate.
|
protectedvirtual |
Standard behavior for (low-level) NEW op.
Implements Emulate.
|
protectedvirtual |
Behavior for a SEGMENTOP.
Implements Emulate.
|
protectedvirtual |
Standard behavior for a p-code STORE.
Implements Emulate.
References AddrSpace::addressToByte(), currentOp, VarnodeData::getAddr(), PcodeOpRaw::getInput(), Address::getSpaceFromConst(), MemoryState::getValue(), AddrSpace::getWordSize(), memstate, MemoryState::setValue(), and VarnodeData::size.
|
protectedvirtual |
Execute a unary arithmetic/logical operation.
Implements Emulate.
References Emulate::currentBehave, currentOp, OpBehavior::evaluateUnary(), PcodeOpRaw::getInput(), PcodeOpRaw::getOutput(), MemoryState::getValue(), memstate, MemoryState::setValue(), and VarnodeData::size.
|
inline |
Get the emulator's memory state.
References memstate.