Package ghidra.app.emulator
Class AdaptedMemoryState<T>
java.lang.Object
ghidra.pcode.memstate.AbstractMemoryState
ghidra.app.emulator.AdaptedMemoryState<T>
- Type Parameters:
T
- the type of values in the wrapped state. This matters not toEmulatorHelper
, so long asAdaptedMemoryState
can be made concrete.
- All Implemented Interfaces:
MemoryState
An implementation of
MemoryState
which wraps a newer PcodeExecutorState
.
This is a transitional component used internally by the AdaptedEmulator
. It is also used
in the ModifiedPcodeThread
, which is part of the newer PcodeEmulator
system, as a
means of incorporating EmulateInstructionStateModifier
, which is part of the older
EmulatorHelper
system. This class will be removed once both conditions are met:
- An equivalent state modification system is developed for the
PcodeEmulator
system, and eachEmulateInstructionStateModifier
is ported to it. - The
AdaptedEmulator
class is removed.
Guidance for the use of this class is the same as AdaptedEmulator
.
-
Constructor Summary
ConstructorDescriptionAdaptedMemoryState
(PcodeExecutorState<T> state, PcodeExecutorStatePiece.Reason reason) -
Method Summary
Modifier and TypeMethodDescriptionint
getChunk
(byte[] res, AddressSpace spc, long off, int size, boolean stopOnUnintialized) This is the main interface for reading a range of bytes from the MemorySate.Any MemoryBank that has been registered with this MemoryState can be retrieved via this method if the MemoryBank's associated address space is known.void
setChunk
(byte[] val, AddressSpace spc, long off, int size) This is the main interface for setting values for a range of bytes in the MemoryState.void
setInitialized
(boolean initialized, AddressSpace spc, long off, int size) This is the main interface for setting the initialization status for a range of bytes in the MemoryState.void
setMemoryBank
(MemoryBank bank) MemoryBanks associated with specific address spaces must be registers with this MemoryState via this method.Methods inherited from class ghidra.pcode.memstate.AbstractMemoryState
getBigInteger, getBigInteger, getBigInteger, getBigInteger, getValue, getValue, getValue, getValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
-
Constructor Details
-
AdaptedMemoryState
-
-
Method Details
-
setMemoryBank
Description copied from interface:MemoryState
MemoryBanks associated with specific address spaces must be registers with this MemoryState via this method. Each address space that will be used during emulation must be registered separately. The MemoryState object does not assume responsibility for freeing the MemoryBank.- Parameters:
bank
- is a pointer to the MemoryBank to be registered
-
getMemoryBank
Description copied from interface:MemoryState
Any MemoryBank that has been registered with this MemoryState can be retrieved via this method if the MemoryBank's associated address space is known.- Parameters:
spc
- is the address space of the desired MemoryBank- Returns:
- the MemoryBank or null if no bank is associated with spc.
-
getChunk
Description copied from interface:MemoryState
This is the main interface for reading a range of bytes from the MemorySate. The MemoryBank associated with the address space of the query is looked up and the request is forwarded to the getChunk method on the MemoryBank. If there is no registered MemoryBank or some other error, an exception is thrown. All getLongValue methods utilize this method to read the bytes from the appropriate memory bank.- Parameters:
res
- the result buffer for storing retrieved bytesspc
- the desired address spaceoff
- the starting offset of the byte range being readsize
- the number of bytes being readstopOnUnintialized
- if true a partial read is permitted and returned size may be smaller than size requested- Returns:
- number of bytes actually read
-
setChunk
Description copied from interface:MemoryState
This is the main interface for setting values for a range of bytes in the MemoryState. The MemoryBank associated with the desired address space is looked up and the write is forwarded to the setChunk method on the MemoryBank. If there is no registered MemoryBank or some other error, an exception is throw. All setValue methods utilize this method to read the bytes from the appropriate memory bank.- Parameters:
val
- the byte values to be written into the MemoryStatespc
- the address space being writtenoff
- the starting offset of the range being writtensize
- the number of bytes to write
-
setInitialized
Description copied from interface:MemoryState
This is the main interface for setting the initialization status for a range of bytes in the MemoryState. The MemoryBank associated with the desired address space is looked up and the write is forwarded to the setInitialized method on the MemoryBank. If there is no registered MemoryBank or some other error, an exception is throw. All setValue methods utilize this method to read the bytes from the appropriate memory bank.- Parameters:
initialized
- indicates if range should be marked as initialized or notspc
- the address space being writtenoff
- the starting offset of the range being writtensize
- the number of bytes to write
-