pub struct FrameRef<'a, M: AnyFrameMeta> {
pub inner: NeverDrop<Frame<M>>,
pub _marker: PhantomData<&'a Frame<M>>,
}Expand description
A struct that can work as &'a Frame<M>.
Fields§
§inner: NeverDrop<Frame<M>>§_marker: PhantomData<&'a Frame<M>>Implementations§
Source§impl<M: AnyFrameMeta> FrameRef<'_, M>
impl<M: AnyFrameMeta> FrameRef<'_, M>
Sourcepub exec fn borrow_paddr(raw: Paddr) -> r : Self
pub exec fn borrow_paddr(raw: Paddr) -> r : Self
Tracked(regions): Tracked <& mut MetaRegionOwners>,
Tracked(perm): Tracked <& MetaPerm <M>>,requiresraw % PAGE_SIZE() == 0,raw < MAX_PADDR(),!old(regions).slots.contains_key(frame_to_index(raw)),old(regions).inv(),ensuresregions.inv(),manually_drop_deref_spec(&r.inner.0).ptr.addr() == frame_to_meta(raw),Borrows the Frame at the physical address as a FrameRef.
§Safety
The caller must ensure that:
- the frame outlives the created reference, so that the reference can be seen as borrowed from that frame.
- the type of the
FrameRef(M) matches the borrowed frame.
Source§impl<'a, C: PageTableConfig> FrameRef<'a, PageTablePageMeta<C>>
impl<'a, C: PageTableConfig> FrameRef<'a, PageTablePageMeta<C>>
Sourcepub exec fn lock<'rcu, A: InAtomicMode>(
self,
_guard: &'rcu A,
) -> PPtr<PageTableGuard<'rcu, C>>where
'a: 'rcu,
pub exec fn lock<'rcu, A: InAtomicMode>(
self,
_guard: &'rcu A,
) -> PPtr<PageTableGuard<'rcu, C>>where
'a: 'rcu,
Tracked(guards): Tracked <& mut Guards <'rcu,C>>,
->
guard_perm: Tracked <GuardPerm <'rcu,C>>,Locks the page table node.
An atomic mode guard is required to
- prevent deadlocks;
- provide a lifetime (
'rcu) that the nodes are guaranteed to outlive.
Sourcepub exec fn make_guard_unchecked<'rcu, A: InAtomicMode>(
self,
_guard: &'rcu A,
) -> res : PPtr<PageTableGuard<'rcu, C>>where
'a: 'rcu,
pub exec fn make_guard_unchecked<'rcu, A: InAtomicMode>(
self,
_guard: &'rcu A,
) -> res : PPtr<PageTableGuard<'rcu, C>>where
'a: 'rcu,
Tracked(owner): Tracked <& NodeOwner <C>>,
Tracked(guards): Tracked <& mut Guards <'rcu,C>>,
->
guard_perm: Tracked <GuardPerm <'rcu,C>>,requiresowner.inv(),self.inner@.wf(*owner),!old(guards).guards.contains_key(owner.meta_perm.addr()),old(guards).unlocked(owner.meta_perm.addr()),ensuresguards.lock_held(owner.meta_perm.addr()),OwnerSubtree::implies(
CursorOwner::node_unlocked(*old(guards)),
CursorOwner::node_unlocked_except(*guards, owner.meta_perm.addr()),
),forall |i: usize| old(guards).lock_held(i) ==> guards.lock_held(i),res.addr() == guard_perm@.addr(),owner.relate_guard_perm(guard_perm@),Creates a new PageTableGuard without checking if the page table lock is held.
§Safety
This function must be called if this task logically holds the lock.
Calling this function when a guard is already created is undefined behavior unless that guard was already forgotten.
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.