pub struct Mapping {
pub va_range: Range<int>,
pub pa_range: Range<Paddr>,
pub page_size: usize,
pub property: PageProperty,
}Expand description
A Mapping maps a virtual address range to a physical address range.
Its size, page_size, is fixed and must be one of 4096, 2097152, 1073741824.
The va_range and pa_range must be of size page_size and aligned on a
page boundary.
The property is a bitfield of flags that describe the properties of the mapping.
va_range is Range<int> rather than Range<Vaddr> because the
canonical upper-half kernel range can reach usize::MAX + 1 for its
exclusive end (2^64), which cannot be represented in usize. The
Mapping::inv predicate bounds va_range.end by pow2(64) so all
concretely realized mappings stay within the addressable space; this
is a no-op constraint for user mappings and the essential cap for
kernel mappings.
Fields§
§va_range: Range<int>§pa_range: Range<Paddr>§page_size: usize§property: PagePropertyImplementations§
Source§impl Mapping
impl Mapping
Sourcepub open spec fn disjoint_vaddrs(m1: Mapping, m2: Mapping) -> bool
pub open spec fn disjoint_vaddrs(m1: Mapping, m2: Mapping) -> bool
{ m1.va_range.end <= m2.va_range.start || m2.va_range.end <= m1.va_range.start }Sourcepub open spec fn disjoint_paddrs(m1: Mapping, m2: Mapping) -> bool
pub open spec fn disjoint_paddrs(m1: Mapping, m2: Mapping) -> bool
{ m1.pa_range.end <= m2.pa_range.start || m2.pa_range.end <= m1.pa_range.start }Sourcepub open spec fn inv(self) -> bool
pub open spec fn inv(self) -> bool
{
&&& set![4096, 2097152, 1073741824].contains(self.page_size)
&&& self.pa_range.start % self.page_size == 0
&&& self.pa_range.end % self.page_size == 0
&&& self.pa_range.start + self.page_size == self.pa_range.end
&&& self.pa_range.start <= self.pa_range.end <= MAX_PADDR
&&& self.va_range.start % self.page_size as int == 0
&&& self.va_range.end % self.page_size as int == 0
&&& self.va_range.start + self.page_size as int == self.va_range.end
&&& 0 <= self.va_range.start <= self.va_range.end
&&& self.va_range.end <= pow2(64)
}Auto Trait Implementations§
impl Freeze for Mapping
impl RefUnwindSafe for Mapping
impl Send for Mapping
impl Sync for Mapping
impl Unpin for Mapping
impl UnsafeUnpin for Mapping
impl UnwindSafe for Mapping
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