Module openj9.dtfj

Interface Emulator


public interface Emulator
This interface represents a zSeries emulator.
  • Method Details

    • registerCallbackFunction

      void registerCallbackFunction(long address, Emulator.CallbackFunction function)
      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

      void setTraceListener(Emulator.TraceListener traceListener)
      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

      void setBranchTraceListener(Emulator.BranchTraceListener branchTraceListener)
      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

      void setFunctionReplacer(Emulator.FunctionReplacer functionReplacer)
    • 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

      void run(Emulator.ImageSpace space, long address) throws IOException
      Run the emulator starting at the given address.
      Parameters:
      space - an instance of Emulator.ImageSpace.
      address - the address of the first instruction to execute. Normally this would be at the start of a function.
      Throws:
      IOException
    • runAllPaths

      void runAllPaths(Emulator.ImageSpace space, long address) throws IOException
      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 of Emulator.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.