pub trait RelocationEngine {
// Required methods
fn apply_relocation(
&self,
image_data: &mut [u8],
entry: RelocationEntry,
page_rva: u32,
delta: i64,
) -> PeResult<()>;
fn unapply_relocation(
&self,
image_data: &mut [u8],
entry: RelocationEntry,
page_rva: u32,
delta: i64,
) -> PeResult<()>;
fn arch(&self) -> PeArch;
}Expand description
Trait for platform-specific relocation application
Different architectures implement this differently:
- x86_64: Simple pointer fixups
- ARM64: May involve ADRP/ADD instruction pairs
- ARM32: Thumb mode considerations
Required Methods§
Sourcefn apply_relocation(
&self,
image_data: &mut [u8],
entry: RelocationEntry,
page_rva: u32,
delta: i64,
) -> PeResult<()>
fn apply_relocation( &self, image_data: &mut [u8], entry: RelocationEntry, page_rva: u32, delta: i64, ) -> PeResult<()>
Apply relocation (add delta to relocated values) Used when UEFI loads the image
Sourcefn unapply_relocation(
&self,
image_data: &mut [u8],
entry: RelocationEntry,
page_rva: u32,
delta: i64,
) -> PeResult<()>
fn unapply_relocation( &self, image_data: &mut [u8], entry: RelocationEntry, page_rva: u32, delta: i64, ) -> PeResult<()>
Unapply relocation (subtract delta from relocated values) Used when creating bootable image from memory