pub struct PageTableGuard<'rcu, C: PageTableConfig> {
pub inner: PageTableNodeRef<'rcu, C>,
}Expand description
A guard that holds the lock of a page table node.
Fields§
§inner: PageTableNodeRef<'rcu, C>Implementations§
Source§impl<'rcu, C: PageTableConfig> PageTableGuard<'rcu, C>
impl<'rcu, C: PageTableConfig> PageTableGuard<'rcu, C>
Sourcepub exec fn entry(guard: PPtr<Self>, idx: usize) -> res : Entry<'rcu, C>
pub exec fn entry(guard: PPtr<Self>, idx: usize) -> res : Entry<'rcu, C>
Tracked(owner): Tracked <& NodeOwner <C>>,
Tracked(child_owner): Tracked <& EntryOwner <C>>,
Tracked(guard_perm): Tracked <& GuardPerm <'rcu,C>>,requiresowner.inv(),child_owner.inv(),owner.relate_guard_perm(*guard_perm),guard_perm.addr() == guard.addr(),idx < NR_ENTRIES(),child_owner.match_pte(owner.children_perm.value()[idx as int], child_owner.parent_level),ensuresres.wf(*child_owner),res.node.addr() == guard_perm.addr(),Borrows an entry in the node at a given index.
§Panics
Panics if the index is not within the bound of
nr_subpage_per_huge<C>.
Sourcepub exec fn nr_children(&self) -> nr : u16
pub exec fn nr_children(&self) -> nr : u16
Tracked(owner): Tracked <& mut NodeOwner <C>>,requiresself.inner.inner@.ptr.addr() == old(owner).meta_perm.addr(),self.inner.inner@.ptr.addr() == old(owner).meta_perm.points_to.addr(),old(owner).inv(),ensures*owner == *old(owner),Gets the number of valid PTEs in the node.
Sourcepub exec fn stray_mut(&mut self) -> PCell<bool>
pub exec fn stray_mut(&mut self) -> PCell<bool>
Tracked(owner): Tracked <EntryOwner <C>>,requiresowner.is_node(),old(self).inner.inner@.ptr.addr() == owner.node.unwrap().meta_perm.addr(),old(self).inner.inner@.ptr.addr() == owner.node.unwrap().meta_perm.points_to.addr(),owner.inv(),Returns if the page table node is detached from its parent.
Sourcepub exec fn read_pte(&self, idx: usize) -> pte : C::E
pub exec fn read_pte(&self, idx: usize) -> pte : C::E
Tracked(owner): Tracked <& NodeOwner <C>>,requiresself.inner.inner@.ptr.addr() == owner.meta_perm.addr(),self.inner.inner@.ptr.addr() == owner.meta_perm.points_to.addr(),owner.inv(),meta_to_frame(owner.meta_perm.addr) < VMALLOC_BASE_VADDR() - LINEAR_MAPPING_BASE_VADDR(),FRAME_METADATA_RANGE().start <= owner.meta_perm.addr < FRAME_METADATA_RANGE().end,owner.meta_perm.addr % META_SLOT_SIZE() == 0,idx < NR_ENTRIES(),owner.children_perm.addr() == paddr_to_vaddr(meta_to_frame(owner.meta_perm.addr)),ensurespte == owner.children_perm.value()[idx as int],Reads a non-owning PTE at the given index.
A non-owning PTE means that it does not account for a reference count of the a page if the PTE points to a page. The original PTE still owns the child page.
§Safety
The caller must ensure that the index is within the bound.
Sourcepub exec fn write_pte(&mut self, idx: usize, pte: C::E)
pub exec fn write_pte(&mut self, idx: usize, pte: C::E)
Tracked(owner): Tracked <& mut NodeOwner <C>>,requiresold(owner).inv(),meta_to_frame(old(owner).meta_perm.addr)
< VMALLOC_BASE_VADDR() - LINEAR_MAPPING_BASE_VADDR(),idx < NR_ENTRIES(),ensuresowner.inv(),owner.meta_perm.addr() == old(owner).meta_perm.addr(),owner.meta_own == old(owner).meta_own,owner.meta_perm.points_to == old(owner).meta_perm.points_to,*self == *old(self),Writes a page table entry at a given index.
This operation will leak the old child if the old PTE is present.
§Safety
The caller must ensure that:
Methods from Deref<Target = Frame<M>>§
Sourcepub exec fn meta_pt<'a, C: PageTableConfig>(
&'a self,
verus_tmp_p_slot: Tracked<&'a PointsTo<MetaSlot>>,
owner: MetaSlotOwner,
) -> res : &'a PageTablePageMeta<C>
pub exec fn meta_pt<'a, C: PageTableConfig>( &'a self, verus_tmp_p_slot: Tracked<&'a PointsTo<MetaSlot>>, owner: MetaSlotOwner, ) -> res : &'a PageTablePageMeta<C>
self.inv(),p_slot.pptr() == self.ptr,p_slot.is_init(),p_slot.value().wf(owner),is_variant(owner.view().storage.value(), "PTNode"),Sourcepub exec fn meta(&self) -> &'a M
pub exec fn meta(&self) -> &'a M
Tracked(perm): Tracked <& 'a PointsTo <MetaSlot,M>>,requiresself.ptr.addr() == perm.addr(),self.ptr == perm.points_to.pptr(),perm.is_init(),perm.wf(),Gets the metadata of this page.
Sourcepub exec fn start_paddr(&self) -> Paddr
pub exec fn start_paddr(&self) -> Paddr
Tracked(perm): Tracked <& vstd ::simple_pptr ::PointsTo <MetaSlot>>,requiresperm.addr() == self.ptr.addr(),perm.is_init(),FRAME_METADATA_RANGE().start <= perm.addr() < FRAME_METADATA_RANGE().end,perm.addr() % META_SLOT_SIZE() == 0,Gets the physical address of the start of the frame.
Sourcepub exec fn map_level(&self) -> PagingLevel
pub exec fn map_level(&self) -> PagingLevel
Gets the map level of this page.
This is the level of the page table entry that maps the frame, which determines the size of the frame.
Currently, the level is always 1, which means the frame is a regular page frame.
Sourcepub exec fn reference_count(&self) -> u64
pub exec fn reference_count(&self) -> u64
Tracked(slot_own): Tracked <& mut MetaSlotOwner>,
Tracked(slot_perm): Tracked <& vstd ::simple_pptr ::PointsTo <MetaSlot>>,requiresslot_perm.pptr() == self.ptr,slot_perm.is_init(),old(slot_own).ref_count.is_for(slot_perm.value().ref_count),Gets the reference count of the frame.
It returns the number of all references to the frame, including all the
existing frame handles (Frame, Frame<dyn AnyFrameMeta>), and all
the mappings in the page table that points to the frame.
§Safety
The function is safe to call, but using it requires extra care. The reference count can be changed by other threads at any time including potentially between calling this method and acting on the result.
Sourcepub exec fn borrow(&self) -> res : FrameRef<'a, M>
pub exec fn borrow(&self) -> res : FrameRef<'a, M>
Tracked(regions): Tracked <& mut MetaRegionOwners>,
Tracked(perm): Tracked <& MetaPerm <M>>,requiresold(regions).inv(),self.paddr() % PAGE_SIZE() == 0,self.paddr() < MAX_PADDR(),!old(regions).slots.contains_key(self.index()),perm.points_to.pptr() == self.ptr,perm.is_init(),FRAME_METADATA_RANGE().start <= perm.points_to.addr() < FRAME_METADATA_RANGE().end,perm.points_to.addr() % META_SLOT_SIZE() == 0,ensuresregions.inv(),res.inner@.ptr.addr() == self.ptr.addr(),Borrows a reference from the given frame.
Trait Implementations§
Source§impl<'rcu, C: PageTableConfig> Deref for PageTableGuard<'rcu, C>
impl<'rcu, C: PageTableConfig> Deref for PageTableGuard<'rcu, C>
Source§impl<'rcu, C: PageTableConfig> Undroppable for PageTableGuard<'rcu, C>
impl<'rcu, C: PageTableConfig> Undroppable for PageTableGuard<'rcu, C>
Source§open spec fn constructor_requires(self, s: Self::State) -> bool
open spec fn constructor_requires(self, s: Self::State) -> bool
{ s.lock_held(self.inner.inner@.ptr.addr()) }Source§open spec fn constructor_ensures(self, s0: Self::State, s1: Self::State) -> bool
open spec fn constructor_ensures(self, s0: Self::State, s1: Self::State) -> bool
{ s1.guards == s0.guards.remove(self.inner.inner@.ptr.addr()) }