Class ThreadPcodeExecutorState<T>
- Type Parameters:
T- the type of values stored in the states
- All Implemented Interfaces:
PcodeExecutorState<T>,PcodeExecutorStatePiece<T,T>
- Direct Known Subclasses:
JitThreadBytesPcodeExecutorState
-
Nested Class Summary
Nested classes/interfaces inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece
PcodeExecutorStatePiece.Reason -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PcodeArithmetic<T> protected final PcodeExecutorState<T> protected final PcodeExecutorState<T> -
Constructor Summary
ConstructorsConstructorDescriptionThreadPcodeExecutorState(PcodeExecutorState<T> sharedState, PcodeExecutorState<T> localState) Create a multiplexed state -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Erase the entire state or pieceCreate a deep copy of this stateGet the arithmetic used to manipulate values of the type stored by this stategetConcreteBuffer(Address address, PcodeArithmetic.Purpose purpose) Bind a buffer of concrete bytes at the given start addressGet the language defining the address spaces of this state pieceGet the thread-local stateGet all register values known to this stateGet the shared stategetVar(AddressSpace space, long offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variablegetVar(AddressSpace space, T offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variablegetVarInternal(AddressSpace space, long offset, int size, PcodeExecutorStatePiece.Reason reason) Get the value of a variable without issuing callbacksgetVarInternal(AddressSpace space, T offset, int size, PcodeExecutorStatePiece.Reason reason) Get the value of a variable without issuing callbacksprotected booleanisThreadLocalSpace(AddressSpace space) Decide whether or not access to the given space is directed to thread-local statevoidsetVar(AddressSpace space, long offset, int size, boolean quantize, T val) Set the value of a variablevoidsetVar(AddressSpace space, T offset, int size, boolean quantize, T val) Set the value of a variablevoidsetVarInternal(AddressSpace space, long offset, int size, T val) Set the value of a variable without issuing callbacksvoidsetVarInternal(AddressSpace space, T 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.PcodeExecutorState
getAddressArithmetic, pairedMethods inherited from interface ghidra.pcode.exec.PcodeExecutorStatePiece
checkRange, 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
-
localState
-
arithmetic
-
Constructor Details
-
ThreadPcodeExecutorState
public ThreadPcodeExecutorState(PcodeExecutorState<T> sharedState, PcodeExecutorState<T> localState) Create a multiplexed state- Parameters:
sharedState- the shared part of the statelocalState- the thread-local part of the state- See Also:
-
-
Method Details
-
getLanguage
Description copied from interface:PcodeExecutorStatePieceGet the language defining the address spaces of this state piece- Specified by:
getLanguagein interfacePcodeExecutorStatePiece<T,T> - Returns:
- the language
-
getArithmetic
Description copied from interface:PcodeExecutorStatePieceGet the arithmetic used to manipulate values of the type stored by this state- Specified by:
getArithmeticin interfacePcodeExecutorStatePiece<T,T> - Returns:
- the arithmetic
-
streamPieces
Stream 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.)
This will only include the pieces in the thread's local state.
- Specified by:
streamPiecesin interfacePcodeExecutorStatePiece<T,T> - Returns:
- the stream
-
fork
Description copied from interface:PcodeExecutorStatePieceCreate a deep copy of this state- Specified by:
forkin interfacePcodeExecutorState<T>- Specified by:
forkin interfacePcodeExecutorStatePiece<T,T> - Parameters:
cb- callbacks to receive emulation events- Returns:
- the copy
-
isThreadLocalSpace
Decide whether or not access to the given space is directed to thread-local state- Parameters:
space- the space- Returns:
- true for thread-local state, false for shared state
-
setVar
Description copied from interface:PcodeExecutorStatePieceSet the value of a variable- Specified by:
setVarin interfacePcodeExecutorStatePiece<T,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<T,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variableval- the value
-
setVar
Description copied from interface:PcodeExecutorStatePieceSet the value of a variable- Specified by:
setVarin interfacePcodeExecutorStatePiece<T,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<T,T> - Parameters:
space- the address spaceoffset- the offset within the spacesize- the size of the variableval- the value
-
getVar
public T getVar(AddressSpace space, T offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Description copied from interface:PcodeExecutorStatePieceGet the value of a variable- Specified by:
getVarin interfacePcodeExecutorStatePiece<T,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, T offset, int size, PcodeExecutorStatePiece.Reason reason) Description copied from interface:PcodeExecutorStatePieceGet the value of a variable without issuing callbacks- Specified by:
getVarInternalin interfacePcodeExecutorStatePiece<T,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<T,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<T,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
-
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<T,T> - Returns:
- a map of registers and their values
-
getConcreteBuffer
Description copied from interface:PcodeExecutorStatePieceBind a buffer of concrete bytes at the given start address- Specified by:
getConcreteBufferin interfacePcodeExecutorStatePiece<T,T> - Parameters:
address- the start addresspurpose- the reason why the emulator needs a concrete value- Returns:
- a buffer
-
getLocalState
Get the thread-local state- Returns:
- the thread-local state
-
clear
public void clear()Erase the entire state or pieceThis 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.
This will only clear the thread's local state, lest we invoke clear on the shared state for every thread. Instead, if necessary, the machine should clear its shared state then clear each thread's local state.
- Specified by:
clearin interfacePcodeExecutorStatePiece<T,T>
-