pub struct AddressSpace { /* private fields */ }Expand description
Tracked guest VA ranges for one process (borrowed images + owned mmaps).
Independent of the active trap slot: build and test locally, then
install_active before jumping to guest code.
[check_snap] is an immutable Arc rebuilt on mutations so concurrent
check_range can walk regions without holding the active RwLock.
Implementations§
Source§impl AddressSpace
impl AddressSpace
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears all regions. Owned mappings are munmap’d; borrowed ones are not.
Sourcepub fn register_borrowed(&mut self, region: &MappedRegion)
pub fn register_borrowed(&mut self, region: &MappedRegion)
Registers a borrowed region (image / stack). Does not take ownership.
Sourcepub fn register_owned(
&mut self,
guest_addr: u64,
ptr: *mut u8,
len: usize,
prot: u32,
)
pub fn register_owned( &mut self, guest_addr: u64, ptr: *mut u8, len: usize, prot: u32, )
Registers an owned mapping created by a guest mmap.
Sourcepub fn check_range(&self, addr: u64, len: usize, need_write: bool) -> bool
pub fn check_range(&self, addr: u64, len: usize, need_write: bool) -> bool
Validates that [addr, addr+len) lies in a registered region with the
requested access. When empty (unit tests without maps), returns true
so pure dispatch tests do not need a full map setup.
Sourcepub fn find_covering(&self, addr: u64, len: usize) -> Option<RegRegionSnapshot>
pub fn find_covering(&self, addr: u64, len: usize) -> Option<RegRegionSnapshot>
Finds the region that fully contains [addr, addr+len), if any.
Sourcepub fn update_prot(&mut self, addr: u64, len: usize, prot: u32) -> bool
pub fn update_prot(&mut self, addr: u64, len: usize, prot: u32) -> bool
Updates protection bits on the region covering addr.
Sourcepub fn remove_range(&mut self, addr: u64, len: usize) -> RemoveOutcome
pub fn remove_range(&mut self, addr: u64, len: usize) -> RemoveOutcome
Removes and optionally unmaps an owned region that fully covers the range.
Borrowed regions are removed from tracking without munmap.