Package ghidra.app.util.opinion
Class MemorySectionResolver
java.lang.Object
ghidra.app.util.opinion.MemorySectionResolver
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInitializedMemorySection
(MemoryLoadable key, long fileOffset, long numberOfBytes, Address startAddress, String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, String comment, boolean isFragmentationOK, boolean isLoadedSection) Add initialized memory "section" based upon a specified data source fileOffset.void
addUninitializedMemorySection
(MemoryLoadable key, long numberOfBytes, Address startAddress, String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, String comment, boolean isFragmentationOK) Add uninitialized memory "section".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) Create a memory block (possible fragment if conflicts resolved) for the specified loadable "section".protected abstract MemoryBlock
createUninitializedBlock
(MemoryLoadable key, boolean isOverlay, String name, Address start, long length, String comment, boolean r, boolean w, boolean x) Create a memory block (possible fragment if conflicts resolved) for the specified loadable "section".Get program memory objectGet program objectvoid
resolve
(TaskMonitor monitor) Perform final resolve of all defined memory "sections" to establish final memory mappings.
-
Field Details
-
program
-
-
Constructor Details
-
MemorySectionResolver
-
-
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 privilegeisWritable
- true if "section" has write privilegeisExecutable
- true if "section" has execute privilegecomment
- section comment (used as basis for block comment)isFragmentationOK
- if true this memory section may be fragmented due toisLoadedSection
- 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 privilegeisWritable
- true if "section" has write privilegeisExecutable
- true if "section" has execute privilegecomment
- 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
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
Get program memory object- Returns:
- program memory
-
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 blockisOverlay
- true if an overlay should be createdname
- unique name assignment based upon original "section" namestart
- starting physical address of blockfileOffset
- starting file offset for initialized data sourcelength
- number of bytes in blockcomment
- block commentr
- true if "section" has read privilegew
- true if "section" has write privilegex
- 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 blockisOverlay
- true if an overlay should be createdname
- unique name assignment based upon original "section" namestart
- starting physical address of blocklength
- number of bytes in blockcomment
- block commentr
- true if "section" has read privilegew
- true if "section" has write privilegex
- true if "section" has execute privilege- Returns:
- memory block
- Throws:
IOException
AddressOverflowException
CancelledException
-