Package ghidra.pcode.exec
Class AbstractLongOffsetPcodeExecutorStatePiece<A,T,S>
java.lang.Object
ghidra.pcode.exec.AbstractLongOffsetPcodeExecutorStatePiece<A,T,S>
- Type Parameters:
A- the type used to address contents, convertible to and fromlongT- the type of values storedS- the type of an execute state space, internally associated with an address space
- All Implemented Interfaces:
PcodeExecutorStatePiece<A,T>
- Direct Known Subclasses:
AbstractBytesPcodeExecutorStatePiece
public abstract class AbstractLongOffsetPcodeExecutorStatePiece<A,T,S>
extends Object
implements PcodeExecutorStatePiece<A,T>
An abstract executor state piece which internally uses
long to address contents
This also provides an internal mechanism for breaking the piece down into the spaces defined by a
language. It also provides for the special treatment of the unique space.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA map of address spaces to objects which store or cache state for that spacestatic classUse this when each S is possibly a cache to some other state (backing) objectstatic classUse this when each S contains the complete state for the address spaceNested classes/interfaces inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece
PcodeExecutorStatePiece.Reason -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PcodeArithmetic<A> protected final PcodeArithmetic<T> protected final Languageprotected final AddressSpace -
Constructor Summary
ConstructorsConstructorDescriptionAbstractLongOffsetPcodeExecutorStatePiece(Language language, PcodeArithmetic<A> addressArithmetic, PcodeArithmetic<T> arithmetic) Construct a state piece for the given language and arithmetic -
Method Summary
Modifier and TypeMethodDescriptionGet the arithmetic used to manipulate addresses of the type used by this stateGet the arithmetic used to manipulate values of the type stored by this stateprotected abstract SgetForSpace(AddressSpace space, boolean toWrite) Get the internal space for the given address spaceprotected TgetFromNullSpace(int size, PcodeExecutorStatePiece.Reason reason) In case spaces are generated lazily, and we're reading from a space that doesn't yet exist, "read" a default value.protected abstract TgetFromSpace(S space, long offset, int size, PcodeExecutorStatePiece.Reason reason) Get a value from the given spaceGet the language defining the address spaces of this state pieceGet all register values known to this stategetRegisterValuesFromSpace(S s, List<Register> registers) Can the given space for register values, as ingetRegisterValues()protected TgetUnique(long offset, int size, PcodeExecutorStatePiece.Reason reason) Get a value from the unique space Some state pieces treat unique values in a way that merits a separate implementation.getVar(AddressSpace space, long offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variablegetVar(AddressSpace space, A offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variableprotected abstract voidsetInSpace(S space, long offset, int size, T val) Set a value in the given spaceprotected voidSet a value in the unique spacevoidsetVar(AddressSpace space, long offset, int size, boolean quantize, T val) Set the value of a variablevoidsetVar(AddressSpace space, A offset, int size, boolean quantize, T val) Set the value of a variableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece
checkRange, clear, fork, getConcreteBuffer, getVar, getVar, getVar, quantizeOffset, setVar, setVar, setVar
-
Field Details
-
language
-
addressArithmetic
-
arithmetic
-
uniqueSpace
-
-
Constructor Details
-
AbstractLongOffsetPcodeExecutorStatePiece
public AbstractLongOffsetPcodeExecutorStatePiece(Language language, PcodeArithmetic<A> addressArithmetic, PcodeArithmetic<T> arithmetic) Construct a state piece for the given language and arithmetic- Parameters:
language- the language (used for its memory model)arithmetic- an arithmetic used to generate default values ofT
-
-
Method Details
-
getLanguage
Description copied from interface:PcodeExecutorStatePieceGet the language defining the address spaces of this state piece- Specified by:
getLanguagein interfacePcodeExecutorStatePiece<A,T> - Returns:
- the language
-
getAddressArithmetic
Description copied from interface:PcodeExecutorStatePieceGet the arithmetic used to manipulate addresses of the type used by this state- Specified by:
getAddressArithmeticin interfacePcodeExecutorStatePiece<A,T> - Returns:
- the address (or offset) arithmetic
-
getArithmetic
Description copied from interface:PcodeExecutorStatePieceGet the arithmetic used to manipulate values of the type stored by this state- Specified by:
getArithmeticin interfacePcodeExecutorStatePiece<A,T> - Returns:
- the arithmetic
-
setUnique
Set a value in the unique spaceSome state pieces treat unique values in a way that merits a separate implementation. This permits the standard path to be overridden.
- Parameters:
offset- the offset in unique space to store the valuesize- the number of bytes to write (the size of the value)val- the value to store
-
getUnique
Get a value from the unique space Some state pieces treat unique values in a way that merits a separate implementation. This permits the standard path to be overridden.- Parameters:
offset- the offset in unique space to get the valuesize- the number of bytes to read (the size of the value)reason- the reason for reading state- Returns:
- the read value
-
getForSpace
Get the internal space for the given address space- Parameters:
space- the address spacetoWrite- 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:
-
setInSpace
Set a value in the given space- Parameters:
space- the address spaceoffset- the offset within the spacesize- the number of bytes to write (the size of the value)val- the value to store
-
getFromSpace
protected abstract T getFromSpace(S space, long offset, int size, PcodeExecutorStatePiece.Reason reason) Get a value from the given space- Parameters:
space- the address spaceoffset- the offset within the spacesize- the number of bytes to read (the size of the value)reason- the reason for reading state- Returns:
- the read value
-
getFromNullSpace
In case spaces are generated lazily, and we're reading from a space that doesn't yet exist, "read" a default value.By default, the returned value is 0, which should be reasonable for all implementations.
- Parameters:
size- the number of bytes to read (the size of the value)reason- the reason for reading state- Returns:
- the default value
-
setVar
Description copied from interface:PcodeExecutorStatePieceSet the value of a variable- Specified by:
setVarin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variablequantize- true to quantize to the language's "addressable unit"val- the value
-
setVar
Description copied from interface:PcodeExecutorStatePieceSet the value of a variable- Specified by:
setVarin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variablequantize- true to quantize to the language's "addressable unit"val- the value
-
getVar
public T getVar(AddressSpace space, A offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Description copied from interface:PcodeExecutorStatePieceGet the value of a variable- Specified by:
getVarin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variablequantize- true to quantize to the language's "addressable unit"reason- the reason for reading the variable- Returns:
- the value
-
getVar
public T getVar(AddressSpace space, long offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Description copied from interface:PcodeExecutorStatePieceGet the value of a variableThis method is typically used for reading memory variables.
- Specified by:
getVarin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variablequantize- true to quantize to the language's "addressable unit"reason- the reason for reading the variable- Returns:
- the value
-
getRegisterValuesFromSpace
Can the given space for register values, as ingetRegisterValues()- Parameters:
s- the space to scanregisters- the registers known to be in the corresponding address space- Returns:
- the map of registers to values
-
getRegisterValues
Description copied from interface:PcodeExecutorStatePieceGet all register values known to this stateWhen the state acts as a cache, it should only return those cached.
- Specified by:
getRegisterValuesin interfacePcodeExecutorStatePiece<A,T> - Returns:
- a map of registers and their values
-