public interface Emulator
This interface represents a zSeries emulator.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
This class represents one of the branch relative family of instructions.static interface
This interface is implemented by users who want to receive branch trace events.static interface
Call back interface used by Emulator to call user registered function.static interface
static interface
This interface represents a mutable address space.static interface
The base class of all instructions.static interface
This interface is implemented by users who want to receive trace events. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the current condition code.long
getRegister
(int reg) Returns the current value of the given register.void
registerCallbackFunction
(long address, Emulator.CallbackFunction function) Register a callback function for the given address.void
void
resume()
Resume the emulator.void
run
(Emulator.ImageSpace space, long address) Run the emulator starting at the given address.void
runAllPaths
(Emulator.ImageSpace space, long address) Run all possible paths in the emulator starting at the given address.void
void
setAllowSAC
(boolean allowSAC) Sets whether the emulator should allow the unimplemented (so far) "Set Address Space Control" instruction to do nothing.void
setAllowSVC
(boolean allowSVC) Allow SVC calls (which are just ignored).void
setBranchTraceListener
(Emulator.BranchTraceListener branchTraceListener) Sets a BranchTraceListenervoid
setForkOnBranches
(boolean forkOnBranches) Sets whether the emulator should fork on conditional branches.void
setFunctionReplacer
(Emulator.FunctionReplacer functionReplacer) void
setIgnoreExceptions
(boolean ignoreExceptions) Sets whether the emulator should ignore exceptions caused by bad memory accesses.void
setInvertStores
(boolean invertStores) Turns stores into loads.void
setPswKey
(int key) Sets the four-bit PSW key.void
setRegister
(int reg, int value) Sets the register to the given int value.void
setRegister
(int reg, long value) Sets the register to the given long value.void
setTraceListener
(Emulator.TraceListener traceListener) Sets a TraceListenervoid
stop()
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.
-