Class MemorySectionResolver

java.lang.Object
ghidra.app.util.opinion.MemorySectionResolver

public abstract class MemorySectionResolver extends Object
  • Field Details

    • program

      protected final Program program
  • Constructor Details

    • MemorySectionResolver

      public MemorySectionResolver(Program program)
  • Method Details

    • addInitializedMemorySection

      public void addInitializedMemorySection(MemoryLoadable key, long fileOffset, long numberOfBytes, Address startAddress, String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, String comment, boolean isFragmentationOK, boolean isLoadedSection) throws AddressOverflowException
      Add initialized memory "section" based upon a specified data source fileOffset. The last "section" defined will take precedence when resolving conflicts. Sections identified as loaded will take precedence over those that are non-loaded. placed into memory
      Parameters:
      key - the loadable section key which corresponds to this memory "section"
      fileOffset - data source file offset. It is assumed that all initialized "sections" draw from a single data source.
      numberOfBytes - number of bytes within "section"
      startAddress - desired physical start address of "section" (not overlay address)
      sectionName - name of "section"
      isReadable - true if "section" has read privilege
      isWritable - true if "section" has write privilege
      isExecutable - true if "section" has execute privilege
      comment - section comment (used as basis for block comment)
      isFragmentationOK - if true this memory section may be fragmented due to
      isLoadedSection - if true this memory section will take precedence over non-loaded sections conflict/overlap with other memory sections of higher precedence.
      Throws:
      AddressOverflowException
    • addUninitializedMemorySection

      public void addUninitializedMemorySection(MemoryLoadable key, long numberOfBytes, Address startAddress, String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, String comment, boolean isFragmentationOK) throws AddressOverflowException
      Add uninitialized memory "section". The last "section" defined will take precedence when resolving conflicts.
      Parameters:
      key - the loadable section key which corresponds to this memory "section"
      numberOfBytes - number of bytes within "section"
      startAddress - desired physical start address of "section" (not overlay address)
      sectionName - name of "section"
      isReadable - true if "section" has read privilege
      isWritable - true if "section" has write privilege
      isExecutable - true if "section" has execute privilege
      comment - section comment (used as basis for block comment)
      isFragmentationOK - if true this memory section may be fragmented due to conflict/overlap with other memory sections of higher precedence.
      Throws:
      AddressOverflowException
    • resolve

      public void resolve(TaskMonitor monitor) throws CancelledException
      Perform final resolve of all defined memory "sections" to establish final memory mappings. This method will resolve all conflicts and create memory blocks within the associated program.
      Parameters:
      monitor -
      Throws:
      CancelledException
    • getMemory

      public Memory getMemory()
      Get program memory object
      Returns:
      program memory
    • getProgram

      public Program getProgram()
      Get program object
      Returns:
      program
    • createInitializedBlock

      protected abstract MemoryBlock createInitializedBlock(MemoryLoadable key, boolean isOverlay, String name, Address start, long fileOffset, long length, String comment, boolean r, boolean w, boolean x, TaskMonitor monitor) throws IOException, AddressOverflowException, CancelledException
      Create a memory block (possible fragment if conflicts resolved) for the specified loadable "section". If multiple blocks are created due to size restrictions only the first block will be returned. The returned block's length can be checked to determine if this has occurred.
      Parameters:
      key - the loadable section key which corresponds to this memory block or null for an adhoc block
      isOverlay - true if an overlay should be created
      name - unique name assignment based upon original "section" name
      start - starting physical address of block
      fileOffset - starting file offset for initialized data source
      length - number of bytes in block
      comment - block comment
      r - true if "section" has read privilege
      w - true if "section" has write privilege
      x - true if "section" has execute privilege
      Returns:
      memory block
      Throws:
      IOException
      AddressOverflowException
      CancelledException
    • createUninitializedBlock

      protected abstract MemoryBlock createUninitializedBlock(MemoryLoadable key, boolean isOverlay, String name, Address start, long length, String comment, boolean r, boolean w, boolean x) throws IOException, AddressOverflowException, CancelledException
      Create a memory block (possible fragment if conflicts resolved) for the specified loadable "section". If multiple blocks are created due to size restrictions only the first block will be returned. The returned block's length can be checked to determine if this has occurred.
      Parameters:
      key - the loadable section key which corresponds to this memory block or null for an adhoc block
      isOverlay - true if an overlay should be created
      name - unique name assignment based upon original "section" name
      start - starting physical address of block
      length - number of bytes in block
      comment - block comment
      r - true if "section" has read privilege
      w - true if "section" has write privilege
      x - true if "section" has execute privilege
      Returns:
      memory block
      Throws:
      IOException
      AddressOverflowException
      CancelledException