Interface PcodeStateCallbacks
- All Known Implementing Classes:
PcodeEmulationCallbacks.Wrapper,PcodeStateCallbacks.NoPcodeStateCallbacks
When dealing with emulation (as opposed to just p-code execution), consider
PcodeEmulationCallbacks instead. See PcodeEmulator for advice regarding extension
versus integration. In particular, these callbacks were introduced to avert the need to extend
PcodeExecutorStates and/or PcodeExecutorStatePieces just to introduce
integration-driven behaviors. E.g., to lazily load state from an external machine-state snapshot,
the client should implement the
readUninitialized(PcodeExecutorStatePiece, AddressSetView) or
PcodeEmulationCallbacks.readUninitialized(PcodeThread, PcodeExecutorStatePiece, AddressSetView)
callback rather than extending BytesPcodeExecutorStatePiece.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumA singleton implementation of the callbacks that does nothing. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <A,T> PcodeExecutorStatePiece <A, T> checkValueDomain(PcodeExecutorStatePiece<A, ?> piece, Class<T> domain) Check that the given piece has a required value domaindefault <A,T> void dataWritten(PcodeExecutorStatePiece<A, T> piece, Address address, int length, T value) Data was written into the given state piece (concrete addressing).default <A,T> void dataWritten(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length, T value) Data was written into the given state piece (abstract addressing.)default <A,T> void delegateDataWritten(PcodeExecutorStatePiece<A, T> piece, Address address, int length, T value) Typically used from withindataWritten(PcodeExecutorStatePiece, Address, int, Object)to forward the call to the callback for abstract addressingdataWritten(PcodeExecutorStatePiece, AddressSpace, Object, int, Object).default <A,T> void delegateDataWritten(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length, T value) Typically used from withindataWritten(PcodeExecutorStatePiece, AddressSpace, Object, int, Object)to forward the call to the callback for concrete addressingdataWritten(PcodeExecutorStatePiece, Address, int, Object).default <A,T> AddressSetView delegateReadUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSetView set) Typically used from withinreadUninitialized(PcodeExecutorStatePiece, AddressSetView)to forward to the callback for abstract addressingreadUninitialized(PcodeExecutorStatePiece, AddressSpace, Object, int).default <A,T> int delegateReadUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length) Typically used from withinreadUninitialized(PcodeExecutorStatePiece, AddressSpace, Object, int)to forward to the callback for concrete addressingreadUninitialized(PcodeExecutorStatePiece, AddressSetView).default <A,T> AddressSetView readUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSetView set) The executor is preparing to read from uninitialized portions of the given state piece (concrete addressing).default <A,T> int readUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length) The executor is preparing to read from uninitialized portions of the given state piece (abstract addressing).static AddressSetrngSet(AddressSpace space, long offset, int length) A convenience for constructing an address set from a varnode-like triple
-
Field Details
-
NONE
Callbacks that do nothing
-
-
Method Details
-
rngSet
A convenience for constructing an address set from a varnode-like triple- Parameters:
space- the address spaceoffset- the offsetlength- the size in bytes, at least 1- Returns:
- the address set
-
checkValueDomain
static <A,T> PcodeExecutorStatePiece<A,T> checkValueDomain(PcodeExecutorStatePiece<A, ?> piece, Class<T> domain) Check that the given piece has a required value domain- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the piecedomain- the required value domain- Returns:
- the piece cast to the required value domain if it matched, or null if the piece has a different value domain.
-
dataWritten
default <A,T> void dataWritten(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length, T value) Data was written into the given state piece (abstract addressing.)- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state piecespace- the address space of the operandoffset- the offset of the operandlength- the size of the operandvalue- the value written
-
delegateDataWritten
default <A,T> void delegateDataWritten(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length, T value) Typically used from withindataWritten(PcodeExecutorStatePiece, AddressSpace, Object, int, Object)to forward the call to the callback for concrete addressingdataWritten(PcodeExecutorStatePiece, Address, int, Object).- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state piecespace- the address space of the operandoffset- the offset of the operandlength- the size of the operandvalue- the value written
-
dataWritten
default <A,T> void dataWritten(PcodeExecutorStatePiece<A, T> piece, Address address, int length, T value) Data was written into the given state piece (concrete addressing).- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state pieceaddress- the address of the operandlength- the size of the operandvalue- the value written
-
delegateDataWritten
default <A,T> void delegateDataWritten(PcodeExecutorStatePiece<A, T> piece, Address address, int length, T value) Typically used from withindataWritten(PcodeExecutorStatePiece, Address, int, Object)to forward the call to the callback for abstract addressingdataWritten(PcodeExecutorStatePiece, AddressSpace, Object, int, Object).- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state pieceaddress- the address of the operandlength- the size of the operandvalue- the value written
-
readUninitialized
default <A,T> int readUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length) The executor is preparing to read from uninitialized portions of the given state piece (abstract addressing).This callback provides an opportunity for something to initialize the required portion lazily. In most cases, this should either return 0 indicating the requested portion remains uninitialized, or the full
lengthindicating the full requested portion is now initialized. If, for some reason, the requested portion could only be partially initialized, this can return a smaller length. Partial initializations are only recognized from the starting offset. Other parts could be initialized; however, there is no mechanism for communicating that result to the executor.- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state piecespace- the address space of the operandoffset- the offset of the operandlength- the size of the operand- Returns:
- the length of the operand just initialized, typically 0 or
length
-
delegateReadUninitialized
default <A,T> int delegateReadUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSpace space, A offset, int length) Typically used from withinreadUninitialized(PcodeExecutorStatePiece, AddressSpace, Object, int)to forward to the callback for concrete addressingreadUninitialized(PcodeExecutorStatePiece, AddressSetView).- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state piecespace- the address space of the operandoffset- the offset of the operandlength- the size of the operand- Returns:
- the length of the operand just initialized, typically 0 or
length
-
readUninitialized
default <A,T> AddressSetView readUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSetView set) The executor is preparing to read from uninitialized portions of the given state piece (concrete addressing).This callback provides an opportunity for something to initialize the required portion lazily. This method must return the address set that remains uninitialized. If no part of the required portion was initialized, this should return
setidentically, so that the caller can quickly recognize that nothing has changed. Otherwise, this should copyset, remove those parts it was able to initialize, and return the copy. DO NOT modify the givenset.- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state pieceset- the uninitialized portion required- Returns:
- the addresses in
setthat remain uninitialized
-
delegateReadUninitialized
default <A,T> AddressSetView delegateReadUninitialized(PcodeExecutorStatePiece<A, T> piece, AddressSetView set) Typically used from withinreadUninitialized(PcodeExecutorStatePiece, AddressSetView)to forward to the callback for abstract addressingreadUninitialized(PcodeExecutorStatePiece, AddressSpace, Object, int).- Type Parameters:
A- the piece's address domainT- the piece's value domain- Parameters:
piece- the state pieceset- the uninitialized portion required- Returns:
- the addresses in
setthat remain uninitialized
-