Class UniqueMemoryBank

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

public class UniqueMemoryBank extends MemoryBank
An subclass of MemoryBank intended for modeling the "unique" memory space. The space is byte-addressable and paging is not supported.
  • Field Details

  • Constructor Details

    • UniqueMemoryBank

      public UniqueMemoryBank(AddressSpace spc, boolean isBigEndian)
  • Method Details

    • getPage

      protected MemoryPage getPage(long addr)
      Specified by:
      getPage in class MemoryBank
    • setPage

      protected void setPage(long addr, byte[] val, int skip, int size, int bufOffset)
      Description copied from class: MemoryBank
      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.
      Specified by:
      setPage in class MemoryBank
      Parameters:
      addr - is the aligned offset of the desired page
      val - is a pointer to the bytes to be written into the page
      skip - is the offset into the page where bytes will be written
      size - is the number of bytes to be written
      bufOffset - the offset in val from which to get the bytes
    • setPageInitialized

      protected void setPageInitialized(long addr, boolean initialized, int skip, int size, int bufOffset)
      Description copied from class: MemoryBank
      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.
      Specified by:
      setPageInitialized in class MemoryBank
      Parameters:
      addr - is the aligned offset of the desired page
      initialized - true if range should be marked as initialized, false if uninitialized
      skip - is the offset into the page where bytes will be written
      size - is the number of bytes to be written
      bufOffset - the offset in val from which to get the bytes
    • getChunk

      public int getChunk(long offset, int size, byte[] dest, boolean stopOnUninitialized)
      Description copied from class: MemoryBank
      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.
      Overrides:
      getChunk in class MemoryBank
      Parameters:
      offset - is the start of the byte range to read
      size - is the number of bytes to read
      dest - is a pointer to where the retrieved bytes should be stored
      stopOnUninitialized - 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
    • setChunk

      public void setChunk(long offset, int size, byte[] src)
      Description copied from class: MemoryBank
      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.
      Overrides:
      setChunk in class MemoryBank
      Parameters:
      offset - is the start of the byte range to be written. This offset will be wrapped within the space
      size - is the number of bytes to write
      src - is a pointer to the sequence of bytes to be written into the bank
    • clear

      public void clear()
      Clear unique storage at the start of an instruction