pub struct LibMappings<T> { /* private fields */ }Expand description
Keeps track of mapped libraries in an address space. Stores a value for each mapping, and allows efficient lookup of that value based on an address.
Implementations§
Source§impl<T> LibMappings<T>
impl<T> LibMappings<T>
Sourcepub fn add_mapping(
&mut self,
start_avma: u64,
end_avma: u64,
relative_address_at_start: u32,
value: T,
)
pub fn add_mapping( &mut self, start_avma: u64, end_avma: u64, relative_address_at_start: u32, value: T, )
Add a mapping to this address space. Any existing mappings which overlap with the new mapping are removed.
start_avma and end_avma describe the address range that this mapping
occupies.
AVMA = “actual virtual memory address”
relative_address_at_start is the “relative address” which corresponds
to start_avma, in the library that is mapped in this mapping. This is zero if
start_avm is the base address of the library.
A relative address is a u32 value which is relative to the library base address.
So you will usually set relative_address_at_start to start_avma - base_avma.
For ELF binaries, the base address is the AVMA of the first segment, i.e. the
start_avma of the mapping created by the first ELF LOAD command.
For mach-O binaries, the base address is the vmaddr of the __TEXT segment.
For Windows binaries, the base address is the image load address.
Sourcepub fn remove_mapping(&mut self, start_avma: u64) -> Option<(u32, T)>
pub fn remove_mapping(&mut self, start_avma: u64) -> Option<(u32, T)>
Remove a mapping which starts at the given address. If found, this returns
the relative_address_at_start and the associated value of the mapping.
Trait Implementations§
Source§impl<T: Clone> Clone for LibMappings<T>
impl<T: Clone> Clone for LibMappings<T>
Source§fn clone(&self) -> LibMappings<T>
fn clone(&self) -> LibMappings<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more