Package ghidra.pcode.memstate
Class MemoryBank
java.lang.Object
ghidra.pcode.memstate.MemoryBank
- Direct Known Subclasses:
MemoryImage,MemoryPageBank,UniqueMemoryBank
Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MemoryFaultHandlerDeprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorsConstructorDescriptionMemoryBank(AddressSpace spc, boolean isBigEndian, int ps, MemoryFaultHandler faultHandler) Deprecated, for removal: This API element is subject to removal in a future version.A MemoryBank must be associated with a specific address space, have a preferred or natural pagesize. -
Method Summary
Modifier and TypeMethodDescriptionstatic longconstructValue(byte[] ptr, int offset, int size, boolean bigendian) Deprecated, for removal: This API element is subject to removal in a future version.This is a static convenience routine for decoding a value from a sequence of bytes depending on the desired endiannessstatic voiddeconstructValue(byte[] ptr, int offset, long val, int size, boolean bigendian) Deprecated, for removal: This API element is subject to removal in a future version.This is a static convenience routine for encoding bytes from a given value, depending on the desired endiannessintgetChunk(long addrOffset, int size, byte[] res, boolean stopOnUnintialized) Deprecated, for removal: This API element is subject to removal in a future version.This is the most general method for reading a sequence of bytes from the memory bank.intDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.protected abstract MemoryPagegetPage(long addr) Deprecated, for removal: This API element is subject to removal in a future version.intDeprecated, for removal: This API element is subject to removal in a future version.A MemoryBank is instantiated with a natural page size.getSpace()Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.voidsetChunk(long offset, int size, byte[] val) Deprecated, for removal: This API element is subject to removal in a future version.This the most general method for writing a sequence of bytes into the memory bank.voidsetInitialized(long offset, int size, boolean initialized) Deprecated, for removal: This API element is subject to removal in a future version.This method allows ranges of bytes to marked as initialized or not.protected abstract voidsetPage(long addr, byte[] val, int skip, int size, int bufOffset) Deprecated, for removal: This API element is subject to removal in a future version.This routine writes data only to a single page of the memory bank.protected abstract voidsetPageInitialized(long addr, boolean initialized, int skip, int size, int bufOffset) Deprecated, for removal: This API element is subject to removal in a future version.This routine marks a range within a single page of the memory bank as initialized or uninitialized.
-
Field Details
-
faultHandler
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
MemoryBank
Deprecated, for removal: This API element is subject to removal in a future version.A MemoryBank must be associated with a specific address space, have a preferred or natural pagesize. The pagesize must be a power of 2.- Parameters:
spc- is the associated address spaceisBigEndian- memory endiannessps- ps is the number of bytes in a page (must be a power of 2)faultHandler- memory fault handler
-
-
Method Details
-
getMemoryFaultHandler
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- memory fault handler (may be null)
-
isBigEndian
public boolean isBigEndian()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- true if memory bank is big endian
-
getPageSize
public int getPageSize()Deprecated, for removal: This API element is subject to removal in a future version.A MemoryBank is instantiated with a natural page size. Requests for large chunks of data may be broken down into units of this size.- Returns:
- the number of bytes in a page.
-
getInitializedMaskSize
public int getInitializedMaskSize()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the size of a page initialized mask in bytes. Each bit within the mask corresponds to a data byte within a page.
-
getSpace
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the AddressSpace associated with this bank.
-
getPage
Deprecated, for removal: This API element is subject to removal in a future version. -
setPage
protected abstract void setPage(long addr, byte[] val, int skip, int size, int bufOffset) Deprecated, for removal: This API element is subject to removal in a future version.This routine writes data only to a single page of the memory bank. Bytes need not be written to the exact start of the page, but all bytes must be written to only one page when using this routine. A page is a fixed number of bytes, and the address of a page is always aligned based on this size. This routine may be overridden for a page based implementation of the MemoryBank. The default implementation writes the page as a sequence of aligned words, using the insert method.- Parameters:
addr- is the aligned offset of the desired pageval- is a pointer to the bytes to be written into the pageskip- is the offset into the page where bytes will be writtensize- is the number of bytes to be writtenbufOffset- the offset in val from which to get the bytes
-
setPageInitialized
protected abstract void setPageInitialized(long addr, boolean initialized, int skip, int size, int bufOffset) Deprecated, for removal: This API element is subject to removal in a future version.This routine marks a range within a single page of the memory bank as initialized or uninitialized. A page is a fixed number of bytes, and the address of a page is always aligned based on this size. This routine may be overridden for a page based implementation of the MemoryBank. The default implementation writes the page as a sequence of aligned words, using the insert method.- Parameters:
addr- is the aligned offset of the desired pageinitialized- true if range should be marked as initialized, false if uninitializedskip- is the offset into the page where bytes will be writtensize- is the number of bytes to be writtenbufOffset- the offset in val from which to get the bytes
-
setChunk
public void setChunk(long offset, int size, byte[] val) Deprecated, for removal: This API element is subject to removal in a future version.This the most general method for writing a sequence of bytes into the memory bank. The initial offset and page writes will be wrapped within the address space.- Parameters:
offset- is the start of the byte range to be written. This offset will be wrapped within the spacesize- is the number of bytes to writeval- is a pointer to the sequence of bytes to be written into the bank
-
setInitialized
public void setInitialized(long offset, int size, boolean initialized) Deprecated, for removal: This API element is subject to removal in a future version.This method allows ranges of bytes to marked as initialized or not. There is no restriction on the offset to write to or the number of bytes to be written, except that the range must be contained in the address space.- Parameters:
offset- is the start of the byte range to be writtensize- is the number of bytes to writeinitialized- indicates if the range should be marked as initialized or not
-
getChunk
public int getChunk(long addrOffset, int size, byte[] res, boolean stopOnUnintialized) Deprecated, for removal: This API element is subject to removal in a future version.This is the most general method for reading a sequence of bytes from the memory bank. There is no restriction on the offset or the number of bytes to read, except that the range must be contained in the address space.- Parameters:
addrOffset- is the start of the byte range to readsize- is the number of bytes to readres- is a pointer to where the retrieved bytes should be storedstopOnUnintialized- if true a partial read is permitted and returned size may be smaller than size requested if uninitialized data is encountered.- Returns:
- number of bytes actually read
-
constructValue
public static long constructValue(byte[] ptr, int offset, int size, boolean bigendian) Deprecated, for removal: This API element is subject to removal in a future version.This is a static convenience routine for decoding a value from a sequence of bytes depending on the desired endianness- Parameters:
ptr- is the pointer to the bytes to decodeoffset- a fixed offset fromptrused during decodesize- is the number of bytesbigendian- is true if the bytes are encoded in big endian form- Returns:
- the decoded value
-
deconstructValue
public static void deconstructValue(byte[] ptr, int offset, long val, int size, boolean bigendian) Deprecated, for removal: This API element is subject to removal in a future version.This is a static convenience routine for encoding bytes from a given value, depending on the desired endianness- Parameters:
ptr- is a pointer to the location to write the encoded bytesoffset- a fixed offset fromptrto where to write the bytesval- is the value to be encodedsize- is the number of bytes to encodebigendian- is true if a big endian encoding is desired
-