Package ghidra.pcode.emulate

# Class EmulateInstructionStateModifier

java.lang.Object
ghidra.pcode.emulate.EmulateInstructionStateModifier

public abstract class EmulateInstructionStateModifier extends Object
`EmulateInstructionStateModifier` defines a language specific handler to assist emulation with adjusting the current execution state, providing support for custom pcodeop's (i.e., CALLOTHER). The implementation of this interface must provide a public constructor which takes a single Emulate argument.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final Emulate`
  `emu`
  `protected final Language`
  `language`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `EmulateInstructionStateModifier(Emulate emu)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `executeCallOther(PcodeOp op)`
  Execute a CALLOTHER op
  `Map<Integer,OpBehaviorOther>`
  `getPcodeOpMap()`
  Get the map of registered pcode userop behaviors
  `void`
  `initialExecuteCallback(Emulate emulate, Address current_address, RegisterValue contextRegisterValue)`
  Emulation callback immediately before the first instruction is executed.
  `void`
  `postExecuteCallback(Emulate emulate, Address lastExecuteAddress, PcodeOp[] lastExecutePcode, int lastPcodeIndex, Address currentAddress)`
  Emulation callback immediately following execution of the lastExecuteAddress.
  `protected final void`
  `registerPcodeOpBehavior(String opName, OpBehaviorOther pcodeOpBehavior)`
  Register a pcodeop behavior corresponding to a CALLOTHER opcode.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### emu

    protected final Emulate emu

  - ### language

    protected final Language language

- ## Constructor Details

  - ### EmulateInstructionStateModifier

    protected EmulateInstructionStateModifier(Emulate emu)

- ## Method Details

  - ### registerPcodeOpBehavior

    protected final void registerPcodeOpBehavior(String opName, OpBehaviorOther pcodeOpBehavior)
    Register a pcodeop behavior corresponding to a CALLOTHER opcode.
    Parameters:
      `opName` - name as defined within language via "define pcodeop"
      `pcodeOpBehavior` -

  - ### executeCallOther

    public final boolean executeCallOther(PcodeOp op) throws LowlevelError
    Execute a CALLOTHER op
    Parameters:
      `op` -
    Returns:
      true if corresponding pcodeop was registered and emulation support is performed, or false if corresponding pcodeop is not supported by this class.
    Throws:
      `LowlevelError`

  - ### initialExecuteCallback

    public void initialExecuteCallback(Emulate emulate, Address current_address, RegisterValue contextRegisterValue) throws LowlevelError
    Emulation callback immediately before the first instruction is executed. This callback permits any language specific initializations to be performed.
    Parameters:
      `emulate` -
      `current_address` - intial execute address
      `contextRegisterValue` - initial context value or null if not applicable or unknown
    Throws:
      `LowlevelError`

  - ### postExecuteCallback

    public void postExecuteCallback(Emulate emulate, Address lastExecuteAddress, PcodeOp[] lastExecutePcode, int lastPcodeIndex, Address currentAddress) throws LowlevelError
    Emulation callback immediately following execution of the lastExecuteAddress. One use of this callback is to modify the flowing/future context state.
    Parameters:
      `emulate` -
      `lastExecuteAddress` -
      `lastExecutePcode` -
      `lastPcodeIndex` - pcode index of last op or -1 if no pcode or fall-through occurred.
      `currentAddress` -
    Throws:
      `LowlevelError`

  - ### getPcodeOpMap

    public Map<Integer,OpBehaviorOther> getPcodeOpMap()
    Get the map of registered pcode userop behaviors
    Returns:
      the map, by userop index.