Class BytesPcodeExecutorStateSpace<B>

java.lang.Object
ghidra.pcode.exec.BytesPcodeExecutorStateSpace<B>
Type Parameters:
B - if this space is a cache, the type of object backing this space

public class BytesPcodeExecutorStateSpace<B> extends Object
A p-code executor state space for storing and retrieving bytes as arrays
  • Field Details

    • EMPTY

      protected static final byte[] EMPTY
    • bytes

      protected final SemisparseByteArray bytes
    • language

      protected final Language language
    • space

      protected final AddressSpace space
    • backing

      protected final B backing
  • Constructor Details

    • BytesPcodeExecutorStateSpace

      public BytesPcodeExecutorStateSpace(Language language, AddressSpace space, B backing)
      Construct an internal space for the given address space
      Parameters:
      language - the language, for logging diagnostics
      space - the address space
      backing - the backing object, possibly null
    • BytesPcodeExecutorStateSpace

      protected BytesPcodeExecutorStateSpace(Language language, AddressSpace space, B backing, SemisparseByteArray bytes)
  • Method Details

    • fork

    • write

      public void write(long offset, byte[] val, int srcOffset, int length)
      Write a value at the given offset
      Parameters:
      offset - the offset
      val - the value
    • readUninitializedFromBacking

      protected ULongSpan.ULongSpanSet readUninitializedFromBacking(ULongSpan.ULongSpanSet uninitialized)
      Extension point: Read from backing into this space, when acting as a cache.
      Parameters:
      uninitialized - the ranges which need to be read.
      Returns:
      the ranges which remain uninitialized
    • readBytes

      protected byte[] readBytes(long offset, int size, PcodeExecutorStatePiece.Reason reason)
      Read a value from cache (or raw space if not acting as a cache) at the given offset
      Parameters:
      offset - the offset
      size - the number of bytes to read (the size of the value)
      Returns:
      the bytes read
    • addrRng

      protected AddressRange addrRng(ULongSpan span)
    • spanRng

      protected ULongSpan spanRng(AddressRange range)
    • addrSet

      protected AddressSet addrSet(ULongSpan.ULongSpanSet set)
    • spanSet

      protected ULongSpan.ULongSpanSet spanSet(AddressSetView set)
      This assumes without assertion that the set is contained in this space
      Parameters:
      set - the address set
      Returns:
      the unsigned long span set
    • getRegs

      protected Set<Register> getRegs(AddressSetView set)
    • warnAddressSet

      protected void warnAddressSet(String message, AddressSetView set)
    • warnUninit

      protected void warnUninit(ULongSpan.ULongSpanSet uninit)
    • read

      public byte[] read(long offset, int size, PcodeExecutorStatePiece.Reason reason)
      Read a value from the space at the given offset

      If this space is not acting as a cache, this simply delegates to readBytes(long, int, Reason). Otherwise, it will first ensure the cache covers the requested value.

      Parameters:
      offset - the offset
      size - the number of bytes to read (the size of the value)
      reason - the reason for reading state
      Returns:
      the bytes read
    • getRegisterValues

      public Map<Register,byte[]> getRegisterValues(List<Register> registers)
    • clear

      public void clear()