Package ghidra.app.util.opinion
Class MemorySectionResolver
- java.lang.Object
-
- ghidra.app.util.opinion.MemorySectionResolver
-
public abstract class MemorySectionResolver extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MemorySectionResolver(Program program)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addInitializedMemorySection(MemoryLoadable key, long fileOffset, long numberOfBytes, Address startAddress, java.lang.String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, java.lang.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, java.lang.String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, java.lang.String comment, boolean isFragmentationOK)
Add uninitialized memory "section".protected abstract MemoryBlock
createInitializedBlock(MemoryLoadable key, boolean isOverlay, java.lang.String name, Address start, long fileOffset, long length, java.lang.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, java.lang.String name, Address start, long length, java.lang.String comment, boolean r, boolean w, boolean x)
Create a memory block (possible fragment if conflicts resolved) for the specified loadable "section".Memory
getMemory()
Get program memory objectProgram
getProgram()
Get program objectvoid
resolve(TaskMonitor monitor)
Perform final resolve of all defined memory "sections" to establish final memory mappings.
-
-
-
Field Detail
-
program
protected final Program program
-
-
Constructor Detail
-
MemorySectionResolver
public MemorySectionResolver(Program program)
-
-
Method Detail
-
addInitializedMemorySection
public void addInitializedMemorySection(MemoryLoadable key, long fileOffset, long numberOfBytes, Address startAddress, java.lang.String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, java.lang.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.length
- number of bytes within "section"startAddress
- desired physical start address of "section"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, java.lang.String sectionName, boolean isReadable, boolean isWritable, boolean isExecutable, java.lang.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"length
- number of bytes within "section"startAddress
- desired physical start address of "section"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
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, java.lang.String name, Address start, long fileOffset, long length, java.lang.String comment, boolean r, boolean w, boolean x, TaskMonitor monitor) throws java.io.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:
java.io.IOException
AddressOverflowException
CancelledException
-
createUninitializedBlock
protected abstract MemoryBlock createUninitializedBlock(MemoryLoadable key, boolean isOverlay, java.lang.String name, Address start, long length, java.lang.String comment, boolean r, boolean w, boolean x) throws java.io.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:
java.io.IOException
AddressOverflowException
CancelledException
-
-