Class 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,AddressesReadTracePcodeExecutorStatePiece,TaintPcodeExecutorStatePiece,TraceMemoryStatePcodeExecutorStatePiece
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 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 PcodeStateCallbacksprotected final Languageprotected final AddressSpace -
Constructor Summary
ConstructorsConstructorDescriptionAbstractLongOffsetPcodeExecutorStatePiece(Language language, PcodeArithmetic<A> addressArithmetic, PcodeArithmetic<T> arithmetic, PcodeStateCallbacks cb) Construct a state piece for the given language and arithmetic -
Method Summary
Modifier and TypeMethodDescriptionprotected TCheck that the size of the value matches that givenprotected static <S> voidforkMap(Map<AddressSpace, S> into, Map<AddressSpace, S> from, Function<S, S> forker) Get 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, PcodeStateCallbacks cb) 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, PcodeStateCallbacks cb) 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, PcodeStateCallbacks cb) 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 TgetVarInternal(AddressSpace space, long offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb) getVarInternal(AddressSpace space, long offset, int size, PcodeExecutorStatePiece.Reason reason) Get the value of a variable without issuing callbacksgetVarInternal(AddressSpace space, A offset, int size, PcodeExecutorStatePiece.Reason reason) Get the value of a variable without issuing callbacksprotected abstract voidsetInSpace(S space, long offset, int size, T val, PcodeStateCallbacks cb) Set a value in the given spaceprotected voidsetUnique(long offset, int size, T val, PcodeStateCallbacks cb) Set 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 variableprotected voidsetVarInternal(AddressSpace space, long offset, int size, boolean quantize, T val, PcodeStateCallbacks cb) voidsetVarInternal(AddressSpace space, long offset, int size, T val) Set the value of a variable without issuing callbacksvoidsetVarInternal(AddressSpace space, A offset, int size, T val) Set the value of a variable without issuing callbacksStream over the pieces within.Methods 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, getNextEntryInternal, getNextEntryInternal, getVar, getVar, getVar, inspectBigInteger, inspectByte, inspectConcrete, inspectInt, inspectLong, inspectRegisterValue, inspectShort, quantizeOffset, setBigInteger, setByte, setConcrete, setInt, setLong, setRegisterValue, setRegisterValue, setShort, setVar, setVar, setVar
-
Field Details
-
language
-
addressArithmetic
-
arithmetic
-
cb
-
uniqueSpace
-
-
Constructor Details
-
AbstractLongOffsetPcodeExecutorStatePiece
public AbstractLongOffsetPcodeExecutorStatePiece(Language language, PcodeArithmetic<A> addressArithmetic, PcodeArithmetic<T> arithmetic, PcodeStateCallbacks cb) Construct a state piece for the given language and arithmetic- Parameters:
language- the language (used for its memory model)addressArithmetic- an arithmetic used to generate default values ofAarithmetic- an arithmetic used to generate default values ofT. It must be able to derive concrete sizes, i.e.,PcodeArithmetic.sizeOf(Object)must always return the correct value.cb- callbacks to receive emulation events
-
-
Method Details
-
forkMap
protected static <S> void forkMap(Map<AddressSpace, S> into, Map<AddressSpace, S> from, Function<S, S> forker) -
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
-
streamPieces
Description copied from interface:PcodeExecutorStatePieceStream over the pieces within.If this piece is not a composition of others, then simply stream this piece in a singleton. Otherwise, stream the component pieces. (Do not include the composition itself, just the component pieces.)
- Specified by:
streamPiecesin interfacePcodeExecutorStatePiece<A,T> - Returns:
- the stream
-
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 storecb- callbacks to receive emulation events
-
getUnique
protected T getUnique(long offset, int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb) 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 statecb- callbacks to receive emulation events- 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
-
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 storecb- callbacks to receive emulation events
-
getFromSpace
protected abstract T getFromSpace(S space, long offset, int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb) 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 statecb- callbacks to receive emulation events- Returns:
- the read value
-
getFromNullSpace
protected T getFromNullSpace(int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb) 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 statecb- callbacks to receive emulation events- Returns:
- the default value
-
setVarInternal
protected void setVarInternal(AddressSpace space, long offset, int size, boolean quantize, T val, PcodeStateCallbacks cb) -
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
-
setVarInternal
Description copied from interface:PcodeExecutorStatePieceSet the value of a variable without issuing callbacks- Specified by:
setVarInternalin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variableval- the value
-
checkSize
Check that the size of the value matches that givenExtensions may override this and do nothing when the abstract type has no defined size
- Parameters:
size- the size in bytesval- the value- Returns:
- the value, possibly adjusted
-
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
-
setVarInternal
Description copied from interface:PcodeExecutorStatePieceSet the value of a variable without issuing callbacks- Specified by:
setVarInternalin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variableval- the value
-
getVarInternal
protected T getVarInternal(AddressSpace space, long offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb) -
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
-
getVarInternal
public T getVarInternal(AddressSpace space, A offset, int size, PcodeExecutorStatePiece.Reason reason) Description copied from interface:PcodeExecutorStatePieceGet the value of a variable without issuing callbacks- Specified by:
getVarInternalin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variablereason- 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
-
getVarInternal
public T getVarInternal(AddressSpace space, long offset, int size, PcodeExecutorStatePiece.Reason reason) Description copied from interface:PcodeExecutorStatePieceGet the value of a variable without issuing callbacks- Specified by:
getVarInternalin interfacePcodeExecutorStatePiece<A,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variablereason- 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
-