Class BytesPcodeExecutorStateSpace

java.lang.Object
ghidra.pcode.exec.BytesPcodeExecutorStateSpace
Direct Known Subclasses:
JitBytesPcodeExecutorStatePiece.JitBytesPcodeExecutorStateSpace

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

  • Constructor Details

  • Method Details

    • fork

    • write

      public void write(long offset, byte[] val, int srcOffset, int length, PcodeStateCallbacks cb)
      Write a value at the given offset
      Parameters:
      offset - the offset
      val - the value
      srcOffset - offset within val to start
      length - the number of bytes to write
      cb - callbacks to receive emulation events
    • readUninitializedFromBacking

      @Deprecated(forRemoval=true) protected ULongSpan.ULongSpanSet readUninitializedFromBacking(ULongSpan.ULongSpanSet uninitialized)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Please use the PcodeEmulationCallbacks and/or PcodeStateCallbacks instead
      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
      Implementation Notes:
      This only remains because of AdaptedEmulator. Perhaps that should be refactored to use callbacks, too. That's only supposed to exist as an interim, though, so is it worth the effort? We could remove the entire backing concept if we did, though.
    • 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)
    • addInPlace

      protected AddressSet addInPlace(AddressSet set, ULongSpan.ULongSpanSet spanSet)
    • 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(AddressSetView uninitialized)
    • computeUninitialized

      protected AddressSetView computeUninitialized(long offset, int size)
      Compute the uninitialized span set, considering possible wrap-around
      Parameters:
      offset - the offset
      size - the number of bytes
      Returns:
      the uninitialized offset ranges
    • read

      public byte[] read(long offset, int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb)
      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
      cb - callbacks to receive emulation events
      Returns:
      the bytes read
    • getRegisterValues

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

      public void clear()