pub struct NodeOwner<C: PageTableConfig> {
pub meta_own: PageMetaOwner,
pub children_perm: PointsTo<C::E, NR_ENTRIES>,
pub level: PagingLevel,
pub tree_level: int,
pub slot_index: usize,
}Fields§
§meta_own: PageMetaOwner§children_perm: PointsTo<C::E, NR_ENTRIES>§level: PagingLevel§tree_level: int§slot_index: usizeBorrow-model handle for the node’s metadata slot: identifies the slot
in MetaRegionOwners where the perm is parked. Consumers source the
perm via regions.borrow_typed_perm(slot_index).
Implementations§
Source§impl<C: PageTableConfig> NodeOwner<C>
impl<C: PageTableConfig> NodeOwner<C>
Sourcepub open spec fn meta_addr_self(self) -> Vaddr
pub open spec fn meta_addr_self(self) -> Vaddr
{ meta_addr(self.slot_index) }The meta address of this node’s slot, computed from slot_index.
Always equals self.meta_perm.addr() under inv().
Sourcepub open spec fn meta_perm_of(
self,
regions: MetaRegionOwners,
) -> PointsTo<MetaSlot, Metadata<PageTablePageMeta<C>>>
pub open spec fn meta_perm_of( self, regions: MetaRegionOwners, ) -> PointsTo<MetaSlot, Metadata<PageTablePageMeta<C>>>
{
vstd_extra::cast_ptr::PointsTo::new_spec(
regions.slots[self.slot_index],
regions.slot_owners[self.slot_index].inner_perms,
)
}Reconstructs a metadata cast_ptr from regions at self.slot_index.
The borrow-model home of the node’s metadata perm.
Sourcepub open spec fn metaregion_sound_node(self, regions: MetaRegionOwners) -> bool
pub open spec fn metaregion_sound_node(self, regions: MetaRegionOwners) -> bool
{
let idx = self.slot_index;
&&& regions.slots.contains_key(idx)
&&& self.meta_perm_of(regions).is_init()
&&& self.meta_perm_of(regions).wf(&self.meta_perm_of(regions).inner_perms)
&&& self.meta_perm_of(regions).value().metadata.wf(self.meta_own)
&&& self.level == self.meta_perm_of(regions).value().metadata.level
&&& self.meta_own.nr_children.id()
== self.meta_perm_of(regions).value().metadata.nr_children.id()
}Regions-tied invariants that used to live in NodeOwner::inv() via
the now-removed meta_perm field. Establishes the bridge between
the NodeOwner and the slot perm parked in regions.
Source§impl<C: PageTableConfig> NodeOwner<C>
impl<C: PageTableConfig> NodeOwner<C>
Sourcepub uninterp spec fn set_children_perm(self, idx: usize, pte: C::E) -> Self
pub uninterp spec fn set_children_perm(self, idx: usize, pte: C::E) -> Self
Sourcepub proof fn set_children_perm_axiom(self, idx: usize, pte: C::E)
pub proof fn set_children_perm_axiom(self, idx: usize, pte: C::E)
self.inv(),idx < NR_ENTRIES,ensuresself.set_children_perm(idx, pte).inv(),self.set_children_perm(idx, pte).meta_own == self.meta_own,self.set_children_perm(idx, pte).slot_index == self.slot_index,self.set_children_perm(idx, pte).level == self.level,self.set_children_perm(idx, pte).tree_level == self.tree_level,self.set_children_perm(idx, pte).children_perm.addr() == self.children_perm.addr(),self.set_children_perm(idx, pte).children_perm.value()
== self.children_perm.value().update(idx as int, pte),Sourcepub proof fn nr_children_absent_slot_bound(self, idx: usize)
pub proof fn nr_children_absent_slot_bound(self, idx: usize)
self.inv(),idx < NR_ENTRIES,!self.children_perm.value()[idx as int].is_present(),ensuresself.meta_own.nr_children.value() < NR_ENTRIES,If any slot in children_perm holds a non-present PTE, then
nr_children < NR_ENTRIES.
Axiomatizes the intended meaning of nr_children: it counts the
number of present PTEs in the node. When at least one slot is
absent, the count must be strictly less than the maximum. This
sidesteps a full nr_children == count(present PTEs) invariant
(which would thread through every PTE mutation); the axiom instead
exposes the single boundary fact that Entry::replace needs when
incrementing the counter.
Sourcepub proof fn nr_children_present_slot_bound(self, idx: usize)
pub proof fn nr_children_present_slot_bound(self, idx: usize)
self.inv(),idx < NR_ENTRIES,self.children_perm.value()[idx as int].is_present(),ensuresself.meta_own.nr_children.value() > 0,If any slot in children_perm holds a present PTE, then
nr_children > 0. Dual of Self::nr_children_absent_slot_bound;
used by Entry::replace when decrementing the counter.
Source§impl<'rcu, C: PageTableConfig> NodeOwner<C>
impl<'rcu, C: PageTableConfig> NodeOwner<C>
Sourcepub open spec fn relate_guard(self, guard: PageTableGuard<'rcu, C>) -> bool
pub open spec fn relate_guard(self, guard: PageTableGuard<'rcu, C>) -> bool
{
&&& guard.inner.inner@.ptr.addr() == self.meta_addr_self()
&&& guard.inner.inner@.wf(self)
}Trait Implementations§
Source§impl<C: PageTableConfig> Inv for NodeOwner<C>
impl<C: PageTableConfig> Inv for NodeOwner<C>
Source§open spec fn inv(self) -> bool
open spec fn inv(self) -> bool
{
&&& self.meta_own.inv()
&&& 0 <= self.meta_own.nr_children.value() <= NR_ENTRIES
&&& 1 <= self.level <= NR_LEVELS
&&& self.children_perm.is_init_all()
&&& self.children_perm.addr()
== paddr_to_vaddr(meta_to_frame(meta_addr(self.slot_index)))
&&& self.tree_level == INC_LEVELS - self.level - 1
&&& self.slot_index < max_meta_slots() as usize
&&& FRAME_METADATA_RANGE.start <= meta_addr(self.slot_index)
< FRAME_METADATA_RANGE.end
&&& meta_addr(self.slot_index) % META_SLOT_SIZE == 0
&&& meta_to_frame(meta_addr(self.slot_index))
< VMALLOC_BASE_VADDR - LINEAR_MAPPING_BASE_VADDR
&&& meta_to_frame(meta_addr(self.slot_index)) < MAX_PADDR
&&& meta_to_frame(meta_addr(self.slot_index)) == self.children_perm.addr()
&&& self.slot_index == frame_to_index(meta_to_frame(meta_addr(self.slot_index)))
}