Package ghidra.pcode.memstate
Class MemoryBank
- java.lang.Object
 - 
- ghidra.pcode.memstate.MemoryBank
 
 
- 
- Direct Known Subclasses:
 MemoryImage,MemoryPageBank,UniqueMemoryBank
public abstract class MemoryBank extends java.lang.Object 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected MemoryFaultHandlerfaultHandler 
- 
Constructor Summary
Constructors Constructor Description MemoryBank(AddressSpace spc, boolean isBigEndian, int ps, MemoryFaultHandler faultHandler)A MemoryBank must be associated with a specific address space, have a preferred or natural pagesize. 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static longconstructValue(byte[] ptr, int offset, int size, boolean bigendian)static voiddeconstructValue(byte[] ptr, int offset, long val, int size, boolean bigendian)intgetChunk(long addrOffset, int size, byte[] res, boolean stopOnUnintialized)intgetInitializedMaskSize()MemoryFaultHandlergetMemoryFaultHandler()protected abstract MemoryPagegetPage(long addr)intgetPageSize()A MemoryBank is instantiated with a \e natural page size.AddressSpacegetSpace()booleanisBigEndian()voidsetChunk(long offset, int size, byte[] val)voidsetInitialized(long offset, int size, boolean initialized)protected abstract voidsetPage(long addr, byte[] val, int skip, int size, int bufOffset)protected abstract voidsetPageInitialized(long addr, boolean initialized, int skip, int size, int bufOffset) 
 - 
 
- 
- 
Field Detail
- 
faultHandler
protected final MemoryFaultHandler faultHandler
 
 - 
 
- 
Constructor Detail
- 
MemoryBank
public MemoryBank(AddressSpace spc, boolean isBigEndian, int ps, MemoryFaultHandler faultHandler)
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 endianessps- ps is the number of bytes in a page (must be a power of 2)faultHandler- memory fault handler
 
 - 
 
- 
Method Detail
- 
getMemoryFaultHandler
public MemoryFaultHandler getMemoryFaultHandler()
- Returns:
 - memory fault handler (may be null)
 
 
- 
isBigEndian
public boolean isBigEndian()
- Returns:
 - true if memory bank is big endian
 
 
- 
getPageSize
public int getPageSize()
A MemoryBank is instantiated with a \e 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()
- Returns:
 - the size of a page initialized mask in bytes. Each bit within the mask corresponds to a data byte within a page.
 
 
- 
getSpace
public AddressSpace getSpace()
- Returns:
 - the AddressSpace associated with this bank.
 
 
- 
getPage
protected abstract MemoryPage getPage(long addr)
 
- 
setPage
protected abstract void setPage(long addr, byte[] val, int skip, int size, int bufOffset) 
- 
setPageInitialized
protected abstract void setPageInitialized(long addr, boolean initialized, int skip, int size, int bufOffset) 
- 
setChunk
public void setChunk(long offset, int size, byte[] val) 
- 
setInitialized
public void setInitialized(long offset, int size, boolean initialized) 
- 
getChunk
public int getChunk(long addrOffset, int size, byte[] res, boolean stopOnUnintialized) 
- 
constructValue
public static long constructValue(byte[] ptr, int offset, int size, boolean bigendian) 
- 
deconstructValue
public static void deconstructValue(byte[] ptr, int offset, long val, int size, boolean bigendian) 
 - 
 
 -