pub struct GuestMap {
regions: BTreeMap<u64, Region>,
pages: u64,
quota_pages: u64,
}Expand description
Guest memory map of a world.
Fields§
§regions: BTreeMap<u64, Region>§pages: u64§quota_pages: u64Implementations§
Source§impl GuestMap
impl GuestMap
Sourcepub const fn quota_pages(&self) -> u64
pub const fn quota_pages(&self) -> u64
Page quota.
Sourcepub fn region_count(&self) -> usize
pub fn region_count(&self) -> usize
Number of ranges.
Sourcepub fn reserve(
&mut self,
gpa: u64,
len: u64,
perms: u32,
memtype: u8,
) -> Result<Region, MapError>
pub fn reserve( &mut self, gpa: u64, len: u64, perms: u32, memtype: u8, ) -> Result<Region, MapError>
Reserves a range. Idempotence is forbidden: an exact overlap is an error, which makes double mappings visible.
Sourcepub fn remove(&mut self, gpa: u64) -> Option<Region>
pub fn remove(&mut self, gpa: u64) -> Option<Region>
Removes the range starting exactly at gpa.
Sourcepub fn region_containing(&self, gpa: u64) -> Option<Region>
pub fn region_containing(&self, gpa: u64) -> Option<Region>
Returns the range containing gpa.
Sourcepub fn regions(&self) -> impl Iterator<Item = &Region>
pub fn regions(&self) -> impl Iterator<Item = &Region>
Iterates over the ranges (ascending order).
Sourcepub fn set_quota(&mut self, quota_pages: u64)
pub fn set_quota(&mut self, quota_pages: u64)
Resets the quota (used when a world is reconfigured).
Sourcepub fn reserve_with_plan(
&mut self,
gpa: u64,
len: u64,
perms: u32,
memtype: u8,
) -> Result<(Region, Vec<MapSegment>), MapError>
pub fn reserve_with_plan( &mut self, gpa: u64, len: u64, perms: u32, memtype: u8, ) -> Result<(Region, Vec<MapSegment>), MapError>
Reserves a range and returns its 2 MiB/4 KiB mapping plan.
The reservation rules (alignment, overlap, quota) are exactly those of
Self::reserve: the quota counts the same number of 4 KiB pages
whatever the granularity, so a 2 MiB leaf accounts for 512 pages.
Trait Implementations§
Auto Trait Implementations§
impl Forget for GuestMap
impl Freeze for GuestMap
impl Move for GuestMap
impl RefUnwindSafe for GuestMap
impl Send for GuestMap
impl Sync for GuestMap
impl Unpin for GuestMap
impl UnsafeUnpin for GuestMap
impl UnwindSafe for GuestMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more