Package ghidra.pcode.exec
Class BytesPcodeExecutorStateSpace
java.lang.Object
ghidra.pcode.exec.BytesPcodeExecutorStateSpace
- Direct Known Subclasses:
JitBytesPcodeExecutorStatePiece.JitBytesPcodeExecutorStateSpace
A p-code executor state space for storing and retrieving bytes as arrays
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SemisparseByteArrayprotected static final byte[]protected final Languageprotected final AbstractBytesPcodeExecutorStatePiece<?> protected final AddressSpace -
Constructor Summary
ConstructorsModifierConstructorDescriptionBytesPcodeExecutorStateSpace(Language language, AddressSpace space, AbstractBytesPcodeExecutorStatePiece<?> piece) Construct an internal space for the given address spaceprotectedBytesPcodeExecutorStateSpace(Language language, AddressSpace space, AbstractBytesPcodeExecutorStatePiece<?> piece, SemisparseByteArray bytes) -
Method Summary
Modifier and TypeMethodDescriptionprotected AddressSetaddInPlace(AddressSet set, ULongSpan.ULongSpanSet spanSet) protected AddressRangeprotected AddressSetvoidclear()protected AddressSetViewcomputeUninitialized(long offset, int size) Compute the uninitialized span set, considering possible wrap-aroundfork(AbstractBytesPcodeExecutorStatePiece<?> piece) getRegisterValues(List<Register> registers) getRegs(AddressSetView set) byte[]read(long offset, int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb) Read a value from the space at the given offsetprotected byte[]readBytes(long offset, int size, PcodeExecutorStatePiece.Reason reason) Read a value from cache (or raw space if not acting as a cache) at the given offsetprotected ULongSpan.ULongSpanSetreadUninitializedFromBacking(ULongSpan.ULongSpanSet uninitialized) Deprecated, for removal: This API element is subject to removal in a future version.protected ULongSpanspanRng(AddressRange range) protected ULongSpan.ULongSpanSetspanSet(AddressSetView set) This assumes without assertion that the set is contained in this spaceprotected voidwarnAddressSet(String message, AddressSetView set) protected voidwarnUninit(AddressSetView uninitialized) voidwrite(long offset, byte[] val, int srcOffset, int length, PcodeStateCallbacks cb) Write a value at the given offset
-
Field Details
-
EMPTY
protected static final byte[] EMPTY -
language
-
space
-
piece
-
bytes
-
-
Constructor Details
-
BytesPcodeExecutorStateSpace
public BytesPcodeExecutorStateSpace(Language language, AddressSpace space, AbstractBytesPcodeExecutorStatePiece<?> piece) Construct an internal space for the given address space- Parameters:
language- the language, for logging diagnosticsspace- the address spacepiece- the owning piece
-
BytesPcodeExecutorStateSpace
protected BytesPcodeExecutorStateSpace(Language language, AddressSpace space, AbstractBytesPcodeExecutorStatePiece<?> piece, SemisparseByteArray bytes)
-
-
Method Details
-
fork
-
write
Write a value at the given offset- Parameters:
offset- the offsetval- the valuesrcOffset- offset within val to startlength- the number of bytes to writecb- callbacks to receive emulation events
-
readUninitializedFromBacking
@Deprecated(forRemoval=true) protected ULongSpan.ULongSpanSet readUninitializedFromBacking(ULongSpan.ULongSpanSet uninitialized) Deprecated, for removal: This API element is subject to removal in a future version.Please use thePcodeEmulationCallbacksand/orPcodeStateCallbacksinsteadExtension point: Read from backing into this space, when acting as a cache.- Parameters:
uninitialized- the ranges which need to be read.- Returns:
- the ranges which remain uninitialized
- Implementation Notes:
- This only remains because of
AdaptedEmulator. Perhaps that should be refactored to use callbacks, too. That's only supposed to exist as an interim, though, so is it worth the effort? We could remove the entirebackingconcept if we did, though.
-
readBytes
Read a value from cache (or raw space if not acting as a cache) at the given offset- Parameters:
offset- the offsetsize- the number of bytes to read (the size of the value)- Returns:
- the bytes read
-
addrRng
-
spanRng
-
addInPlace
-
addrSet
-
spanSet
This assumes without assertion that the set is contained in this space- Parameters:
set- the address set- Returns:
- the unsigned long span set
-
getRegs
-
warnAddressSet
-
warnUninit
-
computeUninitialized
Compute the uninitialized span set, considering possible wrap-around- Parameters:
offset- the offsetsize- the number of bytes- Returns:
- the uninitialized offset ranges
-
read
public byte[] read(long offset, int size, PcodeExecutorStatePiece.Reason reason, PcodeStateCallbacks cb) Read a value from the space at the given offsetIf this space is not acting as a cache, this simply delegates to
readBytes(long, int, Reason). Otherwise, it will first ensure the cache covers the requested value.- Parameters:
offset- the offsetsize- the number of bytes to read (the size of the value)reason- the reason for reading statecb- callbacks to receive emulation events- Returns:
- the bytes read
-
getRegisterValues
-
clear
public void clear()
-
PcodeEmulationCallbacksand/orPcodeStateCallbacksinstead