Package ghidra.pcode.memstate

# Class MemoryBank

java.lang.Object
ghidra.pcode.memstate.MemoryBank

Direct Known Subclasses:
  `MemoryImage`, `MemoryPageBank`, `UniqueMemoryBank`

public abstract class MemoryBank extends Object

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final MemoryFaultHandler`
  `faultHandler`

- ## 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

  Modifier and Type
  Method
  Description
  `static long`
  `constructValue(byte[] ptr, int offset, int size, boolean bigendian)`
  `static void`
  `deconstructValue(byte[] ptr, int offset, long val, int size, boolean bigendian)`
  `int`
  `getChunk(long addrOffset, int size, byte[] res, boolean stopOnUnintialized)`
  `int`
  `getInitializedMaskSize()`
  `MemoryFaultHandler`
  `getMemoryFaultHandler()`
  `protected abstract MemoryPage`
  `getPage(long addr)`
  `int`
  `getPageSize()`
  A MemoryBank is instantiated with a \e natural page size.
  `AddressSpace`
  `getSpace()`
  `boolean`
  `isBigEndian()`
  `void`
  `setChunk(long offset, int size, byte[] val)`
  `void`
  `setInitialized(long offset, int size, boolean initialized)`
  `protected abstract void`
  `setPage(long addr, byte[] val, int skip, int size, int bufOffset)`
  `protected abstract void`
  `setPageInitialized(long addr, boolean initialized, int skip, int size, int bufOffset)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### faultHandler

    protected final MemoryFaultHandler faultHandler

- ## Constructor Details

  - ### 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 space
      `isBigEndian` - memory endianess
      `ps` - ps is the number of bytes in a page (must be a power of 2)
      `faultHandler` - memory fault handler

- ## Method Details

  - ### 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)