Class PairedPcodeExecutorState<L,R>

java.lang.Object
ghidra.pcode.exec.PairedPcodeExecutorState<L,R>
Type Parameters:
L - the type of values for the "left" state
R - the type of values for the "right" state
All Implemented Interfaces:
PcodeExecutorState<org.apache.commons.lang3.tuple.Pair<L,R>>, PcodeExecutorStatePiece<org.apache.commons.lang3.tuple.Pair<L,R>,org.apache.commons.lang3.tuple.Pair<L,R>>

public class PairedPcodeExecutorState<L,R> extends Object implements PcodeExecutorState<org.apache.commons.lang3.tuple.Pair<L,R>>
A paired executor state

This composes a delegate state and piece "left" and "write" creating a single state which instead stores pairs of values, where the left component has the value type of the left state, and the right component has the value type of the right state. Note that both states are addressed using only the left "control" component. Otherwise, every operation on this state is decomposed into operations upon the delegate states, and the final result composed from the results of those operations.

Where a response cannot be composed of both states, the paired state defers to the left. In this way, the left state controls the machine, while the right is computed in tandem. The right never directly controls the machine

See PairedPcodeExecutorStatePiece regarding the composition of three or more pieces.

  • Constructor Details

  • Method Details

    • getLanguage

      public Language getLanguage()
      Description copied from interface: PcodeExecutorStatePiece
      Get the language defining the address spaces of this state piece
      Specified by:
      getLanguage in interface PcodeExecutorStatePiece<L,R>
      Returns:
      the language
    • getArithmetic

      public PcodeArithmetic<org.apache.commons.lang3.tuple.Pair<L,R>> getArithmetic()
      Description copied from interface: PcodeExecutorStatePiece
      Get the arithmetic used to manipulate values of the type stored by this state
      Specified by:
      getArithmetic in interface PcodeExecutorStatePiece<L,R>
      Returns:
      the arithmetic
    • getRegisterValues

      public Map<Register,org.apache.commons.lang3.tuple.Pair<L,R>> getRegisterValues()
      Description copied from interface: PcodeExecutorStatePiece
      Get all register values known to this state

      When the state acts as a cache, it should only return those cached.

      Specified by:
      getRegisterValues in interface PcodeExecutorStatePiece<L,R>
      Returns:
      a map of registers and their values
    • fork

      public PairedPcodeExecutorState<L,R> fork()
      Description copied from interface: PcodeExecutorStatePiece
      Create a deep copy of this state
      Specified by:
      fork in interface PcodeExecutorState<L>
      Specified by:
      fork in interface PcodeExecutorStatePiece<L,R>
      Returns:
      the copy
    • 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
      Specified by:
      getConcreteBuffer in interface PcodeExecutorStatePiece<L,R>
      Parameters:
      address - the start address
      purpose - the reason why the emulator needs a concrete value
      Returns:
      a buffer
    • getLeft

      public PcodeExecutorStatePiece<L,L> getLeft()
      Get the delegate backing the left side of paired values
      Returns:
      the left state
    • getRight

      public PcodeExecutorStatePiece<L,R> getRight()
      Get the delegate backing the right side of paired values
      Returns:
      the right state
    • setVar

      public void setVar(AddressSpace space, org.apache.commons.lang3.tuple.Pair<L,R> offset, int size, boolean quantize, org.apache.commons.lang3.tuple.Pair<L,R> val)
      Description copied from interface: PcodeExecutorStatePiece
      Set the value of a variable
      Specified by:
      setVar in interface PcodeExecutorStatePiece<L,R>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      quantize - true to quantize to the language's "addressable unit"
      val - the value
    • getVar

      public org.apache.commons.lang3.tuple.Pair<L,R> getVar(AddressSpace space, org.apache.commons.lang3.tuple.Pair<L,R> offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason)
      Description copied from interface: PcodeExecutorStatePiece
      Get the value of a variable
      Specified by:
      getVar in interface PcodeExecutorStatePiece<L,R>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      quantize - true to quantize to the language's "addressable unit"
      reason - the reason for reading the variable
      Returns:
      the value
    • 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.

      Specified by:
      clear in interface PcodeExecutorStatePiece<L,R>