Interface PcodeExecutorStatePiece<A,T>
- Type Parameters:
A
- the type of address offsetsT
- the type of values
- All Known Subinterfaces:
PcodeExecutorState<T>
- All Known Implementing Classes:
AbstractBytesPcodeExecutorStatePiece
,AbstractLongOffsetPcodeExecutorStatePiece
,BytesPcodeExecutorState
,BytesPcodeExecutorStatePiece
,DefaultPcodeExecutorState
,LocationPcodeExecutorStatePiece
,PairedPcodeExecutorState
,PairedPcodeExecutorStatePiece
,ThreadPcodeExecutorState
T
, addressed by offsets of type
A
The typical pattern for implementing a state is to compose it from one or more state pieces. Each
piece must use the same address type and arithmetic. If more than one piece is needed, they are
composed using PairedPcodeExecutorStatePiece
. Once all the pieces are composed, the root
piece can be wrapped to make a state using DefaultPcodeExecutorState
or
PairedPcodeExecutorState
. The latter corrects the address type to be a pair so it matches
the type of values.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Reasons for reading state -
Method Summary
Modifier and TypeMethodDescriptiondefault void
checkRange
(AddressSpace space, long offset, int size) Construct a range, if only to verify the range is validvoid
clear()
Erase the entire state or piecedefault PcodeExecutorStatePiece
<A, T> fork()
Create a deep copy of this stateGet 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 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 all register values known to this statedefault T
getVar
(Address address, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variabledefault T
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 variabledefault T
getVar
(Register reg, PcodeExecutorStatePiece.Reason reason) Get the value of a register variabledefault T
getVar
(Varnode var, PcodeExecutorStatePiece.Reason reason) Get the value of a variabledefault long
quantizeOffset
(AddressSpace space, long offset) Quantize the given offset to the language's "addressable unit"default void
Set the value of a variabledefault void
setVar
(AddressSpace space, long offset, int size, boolean quantize, T val) Set the value of a variablevoid
setVar
(AddressSpace space, A offset, int size, boolean quantize, T val) Set the value of a variabledefault void
Set the value of a register variabledefault void
Set the value of a variable
-
Method Details
-
checkRange
Construct a range, if only to verify the range is valid- Parameters:
space
- the address spaceoffset
- the starting offsetsize
- the length (in bytes) of the range
-
getLanguage
Language getLanguage()Get the language defining the address spaces of this state piece- Returns:
- the language
-
getAddressArithmetic
PcodeArithmetic<A> getAddressArithmetic()Get the arithmetic used to manipulate addresses of the type used by this state- Returns:
- the address (or offset) arithmetic
-
getArithmetic
PcodeArithmetic<T> getArithmetic()Get the arithmetic used to manipulate values of the type stored by this state- Returns:
- the arithmetic
-
fork
Create a deep copy of this state- Returns:
- the copy
-
setVar
Set the value of a register variable- Parameters:
reg
- the registerval
- the value
-
setVar
Set the value of a variable- Parameters:
var
- the variableval
- the value
-
setVar
Set the value of a variable- 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
Set the value of a variable- 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
Set the value of a variable- Parameters:
address
- the address in memorysize
- the size of the variablequantize
- true to quantize to the language's "addressable unit"val
- the value
-
getVar
Get the value of a register variable- Parameters:
reg
- the registerreason
- the reason for reading the register- Returns:
- the value
-
getVar
Get the value of a variable- Parameters:
var
- the variablereason
- the reason for reading the variable- Returns:
- the value
-
getVar
T getVar(AddressSpace space, A offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variable- 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
default T getVar(AddressSpace space, long offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variableThis method is typically used for reading memory variables.
- 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
default T getVar(Address address, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason) Get the value of a variableThis method is typically used for reading memory variables.
- Parameters:
address
- the address of the variablesize
- the size of the variablequantize
- true to quantize to the language's "addressable unit"reason
- the reason for reading the variable- Returns:
- the value
-
getRegisterValues
Get all register values known to this stateWhen the state acts as a cache, it should only return those cached.
- Returns:
- a map of registers and their values
-
getConcreteBuffer
Bind a buffer of concrete bytes at the given start address- Parameters:
address
- the start addresspurpose
- the reason why the emulator needs a concrete value- Returns:
- a buffer
-
quantizeOffset
Quantize the given offset to the language's "addressable unit"- Parameters:
space
- the space where the offset appliesoffset
- the offset- Returns:
- the quantized offset
-
clear
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.
-