Skip to main content

PageTableNodeRef

Type Alias PageTableNodeRef 

Source
pub type PageTableNodeRef<'a, C> = FrameRef<'a, PageTablePageMeta<C>>;
Expand description

A reference to a page table node.

Aliased Type§

pub struct PageTableNodeRef<'a, C> { /* private fields */ }

Implementations§

Source§

impl<'a, C: PageTableConfig> PageTableNodeRef<'a, C>

Source

pub open spec fn locks_preserved_except<'rcu>( addr: usize, guards0: Guards, guards1: Guards, ) -> bool

{
    &&& OwnerSubtree::implies(
        CursorOwner::<'rcu, C>::node_unlocked(guards0),
        CursorOwner::<'rcu, C>::node_unlocked_except(guards1, addr),
    )
    &&& forall |i: usize| guards0.lock_held(i) ==> guards1.lock_held(i)
    &&& forall |i: usize| guards0.unlocked(i) && i != addr ==> guards1.unlocked(i)

}
Source

pub exec fn lock<'rcu>( self, _guard: &'rcu dyn InAtomicMode, ) -> res : PageTableGuard<'rcu, C>
where 'a: 'rcu,

with
Tracked(guards): Tracked<&mut Guards>,
Tracked(metadata_perm): Tracked<&MetadataPerm>,
requires
self.external_meta_wf(*metadata_perm),
self@.tracked_metadata_perm@ is Some ==> self.inv(),
old(guards).unlocked(self.slot_vaddr()),
ensures
final(guards).lock_held(self.slot_vaddr()),
Self::locks_preserved_except(self.slot_vaddr(), *old(guards), *final(guards)),
res.inner == self,

Locks the page table node.

An atomic mode guard is required to

  1. prevent deadlocks;
  2. provide a lifetime ('rcu) that the nodes are guaranteed to outlive.
§Verification Design

As of when we verified this library, we didn’t have a spin lock implementation, so we axiomatize what happens when it’s successful.

Source

pub unsafe exec fn make_guard_unchecked<'rcu>( self, _guard: &'rcu dyn InAtomicMode, ) -> res : PageTableGuard<'rcu, C>
where 'a: 'rcu,

with
Tracked(guards): Tracked<&mut Guards>,
requires
self@.ptr_inv(),
self@.tracked_metadata_perm@ is Some ==> self.inv(),
old(guards).unlocked(self.slot_vaddr()),
ensures
final(guards).lock_held(self.slot_vaddr()),
Self::locks_preserved_except(self.slot_vaddr(), *old(guards), *final(guards)),
res.inner == self,

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.