public interface Emulator
This interface represents a zSeries emulator.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThis class represents one of the branch relative family of instructions.static interfaceThis interface is implemented by users who want to receive branch trace events.static interfaceCall back interface used by Emulator to call user registered function.static interfacestatic interfaceThis interface represents a mutable address space.static interfaceThe base class of all instructions.static interfaceThis interface is implemented by users who want to receive trace events. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the current condition code.longgetRegister(int reg) Returns the current value of the given register.voidregisterCallbackFunction(long address, Emulator.CallbackFunction function) Register a callback function for the given address.voidvoidresume()Resume the emulator.voidrun(Emulator.ImageSpace space, long address) Run the emulator starting at the given address.voidrunAllPaths(Emulator.ImageSpace space, long address) Run all possible paths in the emulator starting at the given address.voidvoidsetAllowSAC(boolean allowSAC) Sets whether the emulator should allow the unimplemented (so far) "Set Address Space Control" instruction to do nothing.voidsetAllowSVC(boolean allowSVC) Allow SVC calls (which are just ignored).voidsetBranchTraceListener(Emulator.BranchTraceListener branchTraceListener) Sets a BranchTraceListenervoidsetForkOnBranches(boolean forkOnBranches) Sets whether the emulator should fork on conditional branches.voidsetFunctionReplacer(Emulator.FunctionReplacer functionReplacer) voidsetIgnoreExceptions(boolean ignoreExceptions) Sets whether the emulator should ignore exceptions caused by bad memory accesses.voidsetInvertStores(boolean invertStores) Turns stores into loads.voidsetPswKey(int key) Sets the four-bit PSW key.voidsetRegister(int reg, int value) Sets the register to the given int value.voidsetRegister(int reg, long value) Sets the register to the given long value.voidsetTraceListener(Emulator.TraceListener traceListener) Sets a TraceListenervoidstop()Stop the emulator.
-
Method Details
-
registerCallbackFunction
Register a callback function for the given address. When the emulator encounters a branch to this address it will call the given callback instruction rather than the branch to the address itself. For a branch and save this results in the entire target subroutine being skipped with the supplied function being called in its place. Upon return, execution continues at the current instruction address plus 4 (for a branch and save - for a simple branch it is assumed that this is only used for exit from the emulator). -
saveState
void saveState() -
restoreState
void restoreState() -
stop
void stop()Stop the emulator. -
resume
void resume()Resume the emulator. -
setTraceListener
Sets a TraceListener- Parameters:
traceListener- used to inform the user of each instruction as it is executed. If null then no tracing is performed.
-
setAllowSVC
void setAllowSVC(boolean allowSVC) Allow SVC calls (which are just ignored). The default is to throw an IOException when they are encountered. -
setBranchTraceListener
Sets a BranchTraceListener- Parameters:
branchTraceListener- used to inform the user of each branch instruction as it is executed. If null then no tracing is performed.
-
setFunctionReplacer
-
setInvertStores
void setInvertStores(boolean invertStores) Turns stores into loads. Special convenience mode for disassembly. -
setIgnoreExceptions
void setIgnoreExceptions(boolean ignoreExceptions) Sets whether the emulator should ignore exceptions caused by bad memory accesses. This can be useful when using the emulator as a disassembler. -
setAllowSAC
void setAllowSAC(boolean allowSAC) Sets whether the emulator should allow the unimplemented (so far) "Set Address Space Control" instruction to do nothing. If not set the emulator will throw an unrecognized instruction exception. -
setForkOnBranches
void setForkOnBranches(boolean forkOnBranches) Sets whether the emulator should fork on conditional branches. This puts the emulator in a special mode where it will execute all possible paths. A given path is only executed once. Useful when using the emulator as a disassembler. XXX Note that callback functions will still be called to enable return from a function. -
run
Run the emulator starting at the given address.- Parameters:
space- an instance ofEmulator.ImageSpace.address- the address of the first instruction to execute. Normally this would be at the start of a function.- Throws:
IOException
-
runAllPaths
Run all possible paths in the emulator starting at the given address. (For disassembler use). This also sets ignoreExceptions and forkOnBranches.- Parameters:
space- an instance ofEmulator.ImageSpace.address- the address of the first instruction to execute. Normally this would be at the start of a function.- Throws:
IOException
-
getRegister
long getRegister(int reg) Returns the current value of the given register. -
setRegister
void setRegister(int reg, int value) Sets the register to the given int value. -
setRegister
void setRegister(int reg, long value) Sets the register to the given long value. -
setPswKey
void setPswKey(int key) Sets the four-bit PSW key. -
getConditionCode
int getConditionCode()Returns the current condition code.
-