pub struct GuestMemory { /* private fields */ }Expand description
Fully mapped guest image address space (slide applied).
Implementations§
Source§impl GuestMemory
impl GuestMemory
Sourcepub fn map_image(
host: HostPageSize,
preferred_base: u64,
requests: &[MapRequest],
file: &mut File,
) -> Result<Self, MapError>
pub fn map_image( host: HostPageSize, preferred_base: u64, requests: &[MapRequest], file: &mut File, ) -> Result<Self, MapError>
Maps all non-skipped requests into the host address space.
Tries preferred addresses first; on failure reserves a contiguous host span for the whole image and places each segment with a uniform slide (guest VA == host VA after placement).
Sourcepub fn map_image_bytes(
host: HostPageSize,
preferred_base: u64,
requests: &[MapRequest],
bytes: &[u8],
) -> Result<Self, MapError>
pub fn map_image_bytes( host: HostPageSize, preferred_base: u64, requests: &[MapRequest], bytes: &[u8], ) -> Result<Self, MapError>
Like Self::map_image, but fills segments from an in-memory container
(same bytes already read for Mach-O parse). Avoids a second disk pass
for large tools (any guest, not tool-specific).
Sourcepub const fn preferred_base(&self) -> u64
pub const fn preferred_base(&self) -> u64
Preferred base used when planning.
Sourcepub const fn host(&self) -> HostPageSize
pub const fn host(&self) -> HostPageSize
Host page size policy.
Sourcepub fn regions(&self) -> &[MappedRegion]
pub fn regions(&self) -> &[MappedRegion]
Mapped regions in plan order (skips omitted).
Sourcepub fn regions_mut(&mut self) -> &mut [MappedRegion]
pub fn regions_mut(&mut self) -> &mut [MappedRegion]
Mutable access to regions (e.g. SVC rewrite before protect).
Sourcepub fn guest_to_host(&self, guest_va: u64) -> Option<*const u8>
pub fn guest_to_host(&self, guest_va: u64) -> Option<*const u8>
Translates a guest VA to a host pointer if it falls in a mapped region.
Sourcepub fn guest_to_host_mut(&mut self, guest_va: u64) -> Option<*mut u8>
pub fn guest_to_host_mut(&mut self, guest_va: u64) -> Option<*mut u8>
Translates guest VA to a mutable host pointer.
Sourcepub fn read_u32_le(&self, guest_va: u64) -> Option<u32>
pub fn read_u32_le(&self, guest_va: u64) -> Option<u32>
Reads a little-endian u32 from a mapped guest VA.
Sourcepub fn read_u64_le(&self, guest_va: u64) -> Option<u64>
pub fn read_u64_le(&self, guest_va: u64) -> Option<u64>
Reads a little-endian u64 from a mapped guest VA.
Sourcepub fn write_u64_le(&mut self, guest_va: u64, value: u64) -> Option<()>
pub fn write_u64_le(&mut self, guest_va: u64, value: u64) -> Option<()>
Writes a little-endian u64 to a mapped guest VA.
Caller must ensure the region is writable (mprotect_rw if needed).