decompiler  1.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EmulateMemory Class Reference

An abstract Emulate class using a MemoryState object as the backing machine state. More...

#include <emulate.hh>

Inheritance diagram for EmulateMemory:
Emulate EmulatePcodeCache

Public Member Functions

 EmulateMemory (MemoryState *mem)
 Construct given a memory state.
 
MemoryStategetMemoryState (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

MemoryStatememstate
 The memory state of the emulator.
 
PcodeOpRawcurrentOp
 Current op to execute.
 
- Protected Attributes inherited from Emulate
bool emu_halted
 Set to true if the emulator is halted.
 
OpBehaviorcurrentBehave
 Behavior of the next op to execute.
 

Detailed Description

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.

Member Function Documentation

void EmulateMemory::executeBranch ( void  )
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.

bool EmulateMemory::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.

MemoryState * EmulateMemory::getMemoryState ( void  ) const
inline

Get the emulator's memory state.

Returns
the memory state object which this emulator uses

The documentation for this class was generated from the following files: