Package ghidra.pcode.emu

# Interface PcodeStateInitializer

All Superinterfaces:
  `ExtensionPoint`

public interface PcodeStateInitializer extends ExtensionPoint
An extension for preparing execution state for sleigh emulation

As much as possible, it's highly-recommended to use Sleigh execution to perform any modifications. This will help it remain agnostic to various state types.

TODO: Implement annotation-based `isApplicable(Language)`?

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default <T> void`
  `initializeMachine(PcodeMachine<T> machine)`
  The machine's memory state has just been initialized, and additional initialization is needed for Sleigh execution
  `default <T> void`
  `initializeThread(PcodeThread<T> thread)`
  The thread's register state has just been initialized, and additional initialization is needed for Sleigh execution
  `boolean`
  `isApplicable(Language language)`
  Check if this initializer applies to the given language

- ## Method Details

  - ### isApplicable

    boolean isApplicable(Language language)
    Check if this initializer applies to the given language
    Parameters:
      `language` - the language to check
    Returns:
      true if it applies, false otherwise

  - ### initializeMachine

    default <T> void initializeMachine(PcodeMachine<T> machine)
    The machine's memory state has just been initialized, and additional initialization is needed for Sleigh execution

    There's probably not much preparation of memory

    Type Parameters:
      `T` - the type of values in the machine state
    Parameters:
      `machine` - the newly-initialized machine

  - ### initializeThread

    default <T> void initializeThread(PcodeThread<T> thread)
    The thread's register state has just been initialized, and additional initialization is needed for Sleigh execution

    Initialization generally consists of setting "virtual" registers using data from the real ones. Virtual registers are those specified in the Sleigh, but which don't actually exist on the target processor. Often, they exist to simplify static analysis, but unfortunately cause a minor headache for dynamic execution.

    Type Parameters:
      `T` - the type of values in the machine state
    Parameters:
      `thread` - the newly-initialized thread