19 #ifndef __CPUI_EMULATE__ 20 #define __CPUI_EMULATE__ 84 virtual bool addressCallback(
const Address &addr);
140 map<Address,BreakCallBack *> addresscallback;
141 map<uintb,BreakCallBack *> pcodecallback;
144 void registerPcodeCallback(
const string &nm,
BreakCallBack *func);
172 virtual void executeUnary(
void)=0;
173 virtual void executeBinary(
void)=0;
174 virtual void executeLoad(
void)=0;
175 virtual void executeStore(
void)=0;
182 virtual void executeBranch(
void)=0;
189 virtual bool executeCbranch(
void)=0;
190 virtual void executeBranchind(
void)=0;
191 virtual void executeCall(
void)=0;
192 virtual void executeCallind(
void)=0;
193 virtual void executeCallother(
void)=0;
194 virtual void executeMultiequal(
void)=0;
195 virtual void executeIndirect(
void)=0;
196 virtual void executeSegmentOp(
void)=0;
197 virtual void executeCpoolRef(
void)=0;
198 virtual void executeNew(
void)=0;
199 virtual void fallthruOp(
void)=0;
203 void setHalt(
bool val);
204 bool getHalt(
void)
const;
205 virtual void setExecuteAddress(
const Address &addr)=0;
206 virtual Address getExecuteAddress(
void)
const=0;
207 void executeCurrentOp(
void);
247 virtual void executeUnary(
void);
248 virtual void executeBinary(
void);
249 virtual void executeLoad(
void);
250 virtual void executeStore(
void);
251 virtual void executeBranch(
void);
252 virtual bool executeCbranch(
void);
253 virtual void executeBranchind(
void);
254 virtual void executeCall(
void);
255 virtual void executeCallind(
void);
256 virtual void executeCallother(
void);
257 virtual void executeMultiequal(
void);
258 virtual void executeIndirect(
void);
259 virtual void executeSegmentOp(
void);
260 virtual void executeCpoolRef(
void);
261 virtual void executeNew(
void);
279 vector<PcodeOpRaw *> &opcache;
280 vector<VarnodeData *> &varcache;
281 const vector<OpBehavior *> &inst;
285 PcodeEmitCache(vector<PcodeOpRaw *> &ocache,vector<VarnodeData *> &vcache,
286 const vector<OpBehavior *> &in,uintb uniqReserve);
298 vector<PcodeOpRaw *> opcache;
299 vector<VarnodeData *> varcache;
300 vector<OpBehavior *> inst;
303 bool instruction_start;
305 int4 instruction_length;
306 void clearCache(
void);
307 void createInstruction(
const Address &addr);
308 void establishOp(
void);
310 virtual void fallthruOp(
void);
311 virtual void executeBranch(
void);
312 virtual void executeCallother(
void);
316 bool isInstructionStart(
void)
const;
317 int4 numCurrentOps(
void)
const;
318 int4 getCurrentOpIndex(
void)
const;
320 virtual void setExecuteAddress(
const Address &addr);
321 virtual Address getExecuteAddress(
void)
const;
322 void executeInstruction(
void);
333 return instruction_start;
341 return opcache.size();
367 return current_address;
bool getHalt(void) const
Get the halt state of the emulator.
Definition: emulate.hh:224
int4 numCurrentOps(void) const
Return number of pcode ops in translation of current instruction.
Definition: emulate.hh:338
A basic instantiation of a breakpoint table.
Definition: emulate.hh:137
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
Abstract class for emitting pcode to an application.
Definition: translate.hh:76
void setEmulate(Emulate *emu)
Associate a particular emulator with this breakpoint.
Definition: emulate.hh:123
A collection of breakpoints for the emulator.
Definition: emulate.hh:37
A pcode-based emulator interface.
Definition: emulate.hh:168
EmulateMemory(MemoryState *mem)
Construct given a memory state.
Definition: emulate.hh:264
A breakpoint object.
Definition: emulate.hh:77
int4 getCurrentOpIndex(void) const
Get the index of current pcode op within current instruction.
Definition: emulate.hh:347
BreakTableCallBack(Translate *t)
Basic breaktable constructor.
Definition: emulate.hh:154
PcodeOpRaw * getOpByIndex(int4 i) const
Get pcode op in current instruction translation by index.
Definition: emulate.hh:357
virtual bool doAddressBreak(const Address &addr)=0
Invoke any breakpoints associated with this machine address.
MemoryState * getMemoryState(void) const
Get the emulator's memory state.
Definition: emulate.hh:269
Class encapsulating the action/behavior of specific pcode opcodes.
Definition: opbehavior.hh:42
A low-level representation of a single pcode operation.
Definition: pcoderaw.hh:94
PcodeOpRaw * currentOp
Current op to execute.
Definition: emulate.hh:246
Emulate(void)
generic emulator constructor
Definition: emulate.hh:201
virtual bool addressCallback(const Address &addr)
Call back method for address based breakpoints.
Definition: emulate.hh:115
virtual bool pcodeCallback(PcodeOpRaw *op)
Call back method for pcode based breakpoints.
Definition: emulate.hh:102
An abstract Emulate class using a MemoryState object as the backing machine state.
Definition: emulate.hh:243
A SLEIGH based implementation of the Emulate interface.
Definition: emulate.hh:296
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
void setHalt(bool val)
Set the halt state of the emulator.
Definition: emulate.hh:214
The interface to a translation engine for a processor.
Definition: translate.hh:293
OpBehavior * currentBehave
Behavior of the next op to execute.
Definition: emulate.hh:171
virtual Address getExecuteAddress(void) const
Get current execution address.
Definition: emulate.hh:364
MemoryState * memstate
The memory state of the emulator.
Definition: emulate.hh:245
bool emu_halted
Set to true if the emulator is halted.
Definition: emulate.hh:170
Classes for keeping track of memory state during emulation.
All storage/state for a pcode machine.
Definition: memstate.hh:148
P-code emitter that dumps its raw Varnodes and PcodeOps to an in memory cache.
Definition: emulate.hh:278
virtual bool doPcodeOpBreak(PcodeOpRaw *curop)=0
Invoke any breakpoints associated with this particular pcodeop.
Classes for disassembly and pcode generation.
bool isInstructionStart(void) const
Return true if we are at an instruction start.
Definition: emulate.hh:330
virtual void setEmulate(Emulate *emu)=0
Associate a particular emulator with breakpoints in this table.
Data defining a specific memory location.
Definition: pcoderaw.hh:33
Emulate * emulate
The emulator currently associated with this breakpoint.
Definition: emulate.hh:79
BreakCallBack(void)
Generic breakpoint constructor.
Definition: emulate.hh:90