Package ghidra.pcode.exec

# Class AbstractBytesPcodeExecutorStatePiece<S extends BytesPcodeExecutorStateSpace<?>>

java.lang.Object
ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece<byte[],byte[],S>
ghidra.pcode.exec.AbstractBytesPcodeExecutorStatePiece<S>

Type Parameters:
  `S` - the type of an executor state space, internally associated with an address space

All Implemented Interfaces:
  `PcodeExecutorStatePiece<byte[],byte[]>`

Direct Known Subclasses:
  `BytesPcodeExecutorStatePiece`

public abstract class AbstractBytesPcodeExecutorStatePiece<S extends BytesPcodeExecutorStateSpace<?>> extends AbstractLongOffsetPcodeExecutorStatePiece<byte[],byte[],S>
An abstract p-code executor state piece for storing and retrieving bytes as arrays

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected class`
  `AbstractBytesPcodeExecutorStatePiece.StateMemBuffer`
  A memory buffer bound to a given space in this state

  ## Nested classes/interfaces inherited from class ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece

  `AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S>, AbstractLongOffsetPcodeExecutorStatePiece.CacheingSpaceMap<B,S>, AbstractLongOffsetPcodeExecutorStatePiece.SimpleSpaceMap<S>`

  ## Nested classes/interfaces inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece

  `PcodeExecutorStatePiece.Reason`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S>`
  `spaceMap`

  ### Fields inherited from class ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece

  `addressArithmetic, arithmetic, language, uniqueSpace`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `AbstractBytesPcodeExecutorStatePiece(Language language)`
  Construct a state for the given language
  `protected`
  `AbstractBytesPcodeExecutorStatePiece(Language language, AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S> spaceMap)`
  ``
  `AbstractBytesPcodeExecutorStatePiece(Language language, PcodeArithmetic<byte[]> arithmetic)`
  Construct a state for the given language
  `protected`
  `AbstractBytesPcodeExecutorStatePiece(Language language, PcodeArithmetic<byte[]> arithmetic, AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S> spaceMap)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Erase the entire state or piece
  `MemBuffer`
  `getConcreteBuffer(Address address, PcodeArithmetic.Purpose purpose)`
  Bind a buffer of concrete bytes at the given start address
  `protected S`
  `getForSpace(AddressSpace space, boolean toWrite)`
  Get the internal space for the given address space
  `protected byte[]`
  `getFromSpace(S space, long offset, int size, PcodeExecutorStatePiece.Reason reason)`
  Get a value from the given space
  `protected Map<Register,byte[]>`
  `getRegisterValuesFromSpace(S s, List<Register> registers)`
  Can the given space for register values, as in `AbstractLongOffsetPcodeExecutorStatePiece.getRegisterValues()`
  `protected abstract AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S>`
  `newSpaceMap()`
  A factory method for this state's space map.
  `protected void`
  `setInSpace(S space, long offset, int size, byte[] val)`
  Set a value in the given space

  ### Methods inherited from class ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece

  `getAddressArithmetic, getArithmetic, getFromNullSpace, getLanguage, getRegisterValues, getUnique, getVar, getVar, setUnique, setVar, setVar`

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

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

  ### Methods inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece

  `checkRange, fork, getVar, getVar, getVar, quantizeOffset, setVar, setVar, setVar`

- ## Field Details

  - ### spaceMap

    protected final AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S extends BytesPcodeExecutorStateSpace<?>> spaceMap

- ## Constructor Details

  - ### AbstractBytesPcodeExecutorStatePiece

    public AbstractBytesPcodeExecutorStatePiece(Language language)
    Construct a state for the given language
    Parameters:
      `language` - the language, used for its memory model and arithmetic

  - ### AbstractBytesPcodeExecutorStatePiece

    protected AbstractBytesPcodeExecutorStatePiece(Language language, AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S> spaceMap)

  - ### AbstractBytesPcodeExecutorStatePiece

    public AbstractBytesPcodeExecutorStatePiece(Language language, PcodeArithmetic<byte[]> arithmetic)
    Construct a state for the given language
    Parameters:
      `language` - the language, used for its memory model
      `arithmetic` - the arithmetic

  - ### AbstractBytesPcodeExecutorStatePiece

    protected AbstractBytesPcodeExecutorStatePiece(Language language, PcodeArithmetic<byte[]> arithmetic, AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S> spaceMap)

- ## Method Details

  - ### newSpaceMap

    protected abstract AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap<S> newSpaceMap()
    A factory method for this state's space map.

    Because most of the special logic for extensions is placed in the "state space," i.e., an object assigned to a particular address space in the state's language, this factory method must provide the map to create and maintain those spaces. That map will in turn be the factory of the spaces themselves, allowing extensions to provide additional read/write logic.

    Returns:
      the new space map

  - ### getForSpace

    protected S getForSpace(AddressSpace space, boolean toWrite)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Get the internal space for the given address space
    Specified by:
      `getForSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],byte[],S extends BytesPcodeExecutorStateSpace<?>>`
    Parameters:
      `space` - the address space
      `toWrite` - in case internal spaces are generated lazily, this indicates the space must be present, because it is going to be written to.
    Returns:
      the space, or `null`
    See Also:
      - `AbstractLongOffsetPcodeExecutorStatePiece.AbstractSpaceMap`

  - ### setInSpace

    protected void setInSpace(S space, long offset, int size, byte[] val)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Set a value in the given space
    Specified by:
      `setInSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],byte[],S extends BytesPcodeExecutorStateSpace<?>>`
    Parameters:
      `space` - the address space
      `offset` - the offset within the space
      `size` - the number of bytes to write (the size of the value)
      `val` - the value to store

  - ### getFromSpace

    protected byte[] getFromSpace(S space, long offset, int size, PcodeExecutorStatePiece.Reason reason)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Get a value from the given space
    Specified by:
      `getFromSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],byte[],S extends BytesPcodeExecutorStateSpace<?>>`
    Parameters:
      `space` - the address space
      `offset` - the offset within the space
      `size` - the number of bytes to read (the size of the value)
      `reason` - the reason for reading state
    Returns:
      the read value

  - ### getRegisterValuesFromSpace

    protected Map<Register,byte[]> getRegisterValuesFromSpace(S s, List<Register> registers)
    Description copied from class: `AbstractLongOffsetPcodeExecutorStatePiece`
    Can the given space for register values, as in `AbstractLongOffsetPcodeExecutorStatePiece.getRegisterValues()`
    Specified by:
      `getRegisterValuesFromSpace` in class `AbstractLongOffsetPcodeExecutorStatePiece<byte[],byte[],S extends BytesPcodeExecutorStateSpace<?>>`
    Parameters:
      `s` - the space to scan
      `registers` - the registers known to be in the corresponding address space
    Returns:
      the map of registers to values

  - ### getConcreteBuffer

    public MemBuffer getConcreteBuffer(Address address, PcodeArithmetic.Purpose purpose)
    Description copied from interface: `PcodeExecutorStatePiece`
    Bind a buffer of concrete bytes at the given start address
    Parameters:
      `address` - the start address
      `purpose` - the reason why the emulator needs a concrete value
    Returns:
      a buffer

  - ### clear

    public void clear()
    Description copied from interface: `PcodeExecutorStatePiece`
    Erase the entire state or piece

    This is generally only useful when the state is itself a cache to another object. This will ensure the state is reading from that object rather than a stale cache. If this is not a cache, this could in fact clear the whole state, and the machine using it will be left in the dark.