Class JitBytesPcodeExecutorStatePiece.JitBytesPcodeExecutorStateSpace

java.lang.Object
ghidra.pcode.exec.BytesPcodeExecutorStateSpace<Void>
ghidra.pcode.emu.jit.JitBytesPcodeExecutorStatePiece.JitBytesPcodeExecutorStateSpace
Enclosing class:
JitBytesPcodeExecutorStatePiece

public class JitBytesPcodeExecutorStatePiece.JitBytesPcodeExecutorStateSpace extends BytesPcodeExecutorStateSpace<Void>
An object to manage state for a specific AddressSpace
  • Constructor Details

    • JitBytesPcodeExecutorStateSpace

      public JitBytesPcodeExecutorStateSpace(Language language, AddressSpace space, Void backing)
      Construct a state space
      Parameters:
      language - the emulation target language
      space - the address space
      backing - any extra read-through backing (not used)
  • Method Details

    • getDirect

      public byte[] getDirect(long offset)
      Pre-fetch the byte array for the block (page) containing the given offset

      A translated passage is likely to call this several times in its constructor to pre-fetch the byte arrays for variables (ram, register, and unique) that it accesses directly, i.e., with a fixed offset. The generated code will then access the byte array directly to read and write the variable values in the emulator's state.

      Parameters:
      offset - the offset within this address space.
      Returns:
      the byte array for the containing block
    • read

      public byte[] read(long offset, int size)
      Read a variable from this (pre-fetched) state space

      A translated passage is likely to call JitBytesPcodeExecutorStatePiece.getForSpace(AddressSpace, boolean) once or twice in its constructor to pre-fetch the per-space backing of any indirect memory variables that it accesses, i.e., variables with a dynamic offset. These are usually required for PcodeOp.LOAD and PcodeOp.STORE ops. The generated code will then invoke this method (and write) passing in the offset to access variables in the emulator's state at runtime.

      Parameters:
      offset - the offset (known at runtime)
      size - the size of the variable
      Returns:
      the value of the variable as a byte array