Class RelocationState
relocAddress
Holds an address within the section where the relocations
are to be performed. The initial value is the base address
of the section to be relocated.
importIndex
Holds a symbol index, which is used to access an
imported symbol's address. This address can then
be used for relocations. The initial value is 0.
sectionC
Holds the memory address of an instantiated section
within the PEF container, this variable is used by relocation
instructions that relocate section addresses. The initial
value is the memory address of section 0 (if that section
is present and instantiated), otherwise it is 0.
sectionD
Holds the memory address of an instantiated section
within the PEF container, this variable is used by relocation
instructions that relocate section addresses. The initial
value is the memory address of section 1 (if that section
is present and instantiated), otherwise it is 0.
-
Constructor Summary
ConstructorDescriptionRelocationState
(ContainerHeader header, LoaderRelocationHeader relocationHeader, Program program, ImportStateCache importState) Constructs a new relocation state -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
void
fixupMemory
(Address address, Address fixupAddress, MessageLog log) Adds the fixup address to the contents stored at address, then creates a pointer at address.int
Returns the current import index.Returns the current relocation address.Returns the current sectionC address.Returns the current sectionD address.Returns the base address of the section to be relocated.void
Increments the import index by one.void
incrementRelocationAddress
(int addend) Increments the relocation address by the given addendvoid
relocateMemoryAt
(Address address, int addend, MessageLog log) Increments the integer in memory at the specified addressvoid
setImportIndex
(int importIndex) Sets the import index.void
setRelocationAddress
(Address relocationAddress) Sets the relocation address.void
setSectionC
(Address sectionC) Set the sectionC variable to given address.void
setSectionD
(Address sectionD) Set the sectionD variable to given address.
-
Constructor Details
-
RelocationState
public RelocationState(ContainerHeader header, LoaderRelocationHeader relocationHeader, Program program, ImportStateCache importState) Constructs a new relocation state- Parameters:
header
- the PEF container headerrelocationHeader
- the specific relocation header for this stateprogram
- the program being relocatedimportState
- the current import state
-
-
Method Details
-
dispose
public void dispose() -
incrementImportIndex
public void incrementImportIndex()Increments the import index by one. -
incrementRelocationAddress
public void incrementRelocationAddress(int addend) Increments the relocation address by the given addend- Parameters:
addend
- the amount to increment the relocation address
-
setRelocationAddress
Sets the relocation address.- Parameters:
relocationAddress
- the new relocation address
-
setSectionC
Set the sectionC variable to given address.- Parameters:
sectionC
- the new sectionC address
-
setSectionD
Set the sectionD variable to given address.- Parameters:
sectionD
- the new sectionD address
-
getImportIndex
public int getImportIndex()Returns the current import index.- Returns:
- the current import index
-
setImportIndex
public void setImportIndex(int importIndex) Sets the import index.- Parameters:
importIndex
- the new import index value
-
getRelocationAddress
Returns the current relocation address.- Returns:
- the current relocation address
-
getSectionC
Returns the current sectionC address.- Returns:
- the current sectionC address
-
getSectionD
Returns the current sectionD address.- Returns:
- the current sectionD address
-
fixupMemory
Adds the fixup address to the contents stored at address, then creates a pointer at address.- Parameters:
address
- the address to fixupfixupAddress
- the value to use in fixuplog
- message log for recording errors
-
relocateMemoryAt
Increments the integer in memory at the specified address- Parameters:
address
- the address to incrementaddend
- the value to addlog
- a message log
-
getSectionToBeRelocated
Returns the base address of the section to be relocated.- Returns:
- the base address of the section to be relocated
-