Emulation based on (existing) PcodeOps and Varnodes.
More...
#include <emulateutil.hh>
|
virtual uintb | getLoadImageValue (AddrSpace *spc, uintb offset, int4 sz) const |
| Pull a value from the load-image given a specific address. More...
|
|
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 bool | executeCbranch (void) |
| Check if the conditional of a CBRANCH is true. More...
|
|
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.
|
|
virtual void | executeBranch (void)=0 |
| Standard behavior for a BRANCH. 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 | fallthruOp (void)=0 |
| Standard p-code fall-thru semantics.
|
|
Emulation based on (existing) PcodeOps and Varnodes.
This is still an abstract class. It does most of the work of emulating p-code using PcodeOp and Varnode objects (as opposed to PcodeOpRaw and VarnodeData). This class leaves implementation of control-flow to the derived class. This class implements most operations by going through new virtual methods:
The default executeLoad() implementation pulls values from the underlying LoadImage object. The following p-code ops are provided NULL implementations, as some tasks don't need hard emulation of them:
◆ EmulatePcodeOp()
◆ executeCbranch()
bool EmulatePcodeOp::executeCbranch |
( |
void |
| ) |
|
|
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.
- Returns
- the boolean state indicated by the condition
Implements Emulate.
◆ getLoadImageValue()
uintb EmulatePcodeOp::getLoadImageValue |
( |
AddrSpace * |
spc, |
|
|
uintb |
offset, |
|
|
int4 |
sz |
|
) |
| const |
|
protectedvirtual |
Pull a value from the load-image given a specific address.
A contiguous chunk of memory is pulled from the load-image and returned as a constant value, respecting the endianess of the address space. The default implementation of this method pulls the value directly from the LoadImage object.
- Parameters
-
spc | is the address space to pull the value from |
offset | is the starting address offset (from within the space) to pull the value from |
sz | is the number of bytes to pull from memory |
- Returns
- indicated bytes arranged as a constant value
◆ getVarnodeValue()
virtual uintb EmulatePcodeOp::getVarnodeValue |
( |
Varnode * |
vn | ) |
const |
|
pure virtual |
Given a specific Varnode, retrieve the current value for it from the machine state.
This is the placeholder internal operation for obtaining a Varnode value during emulation. The value is loaded using the Varnode as the address and storage size.
- Parameters
-
- Returns
- the corresponding value from the machine state
Implemented in EmulateFunction.
◆ setCurrentOp()
void EmulatePcodeOp::setCurrentOp |
( |
PcodeOp * |
op | ) |
|
|
inline |
Establish the current PcodeOp being emulated.
- Parameters
-
◆ setVarnodeValue()
virtual void EmulatePcodeOp::setVarnodeValue |
( |
Varnode * |
vn, |
|
|
uintb |
val |
|
) |
| |
|
pure virtual |
Given a specific Varnode, set the given value for it in the current machine state.
This is the placeholder internal operation for setting a Varnode value during emulation. The value is stored using the Varnode as the address and storage size.
- Parameters
-
vn | is the specific Varnode |
val | is the constant value to store |
Implemented in EmulateFunction.
The documentation for this class was generated from the following files: