pub struct UniqueFrame<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> {
pub ptr: PPtr<MetaSlot>,
pub _marker: PhantomData<M>,
}Fields§
§ptr: PPtr<MetaSlot>§_marker: PhantomData<M>Implementations§
Source§impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> UniqueFrame<M>
impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> UniqueFrame<M>
Sourcepub exec fn from_unused(paddr: Paddr, metadata: M) -> Result<Self, GetFrameError>
pub exec fn from_unused(paddr: Paddr, metadata: M) -> Result<Self, GetFrameError>
with
Tracked(regions): Tracked <& mut MetaRegionOwners>,requirespaddr < MAX_PADDR(),paddr % PAGE_SIZE() == 0,old(regions).slots.contains_key(frame_to_meta(paddr)),old(regions).inv(),Gets a UniqueFrame with a specific usage from a raw, unused page.
The caller should provide the initial metadata of the page.
Source§impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> UniqueFrame<M>
impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> UniqueFrame<M>
Sourcepub exec fn start_paddr(&self) -> Paddr
pub exec fn start_paddr(&self) -> Paddr
with
Tracked(regions): Tracked <& MetaRegionOwners>,Gets the physical address of the start of the frame.
Sourcepub const exec fn level(&self) -> PagingLevel
pub const exec fn level(&self) -> PagingLevel
Gets the paging 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 from_raw(paddr: Paddr) -> res : (Self, Tracked<UniqueFrameOwner<M>>)
pub exec fn from_raw(paddr: Paddr) -> res : (Self, Tracked<UniqueFrameOwner<M>>)
with
Tracked(regions): Tracked <& mut MetaRegionOwners>,
Tracked(meta_perm): Tracked <PointsTo <MetaSlot,M>>,
Tracked(meta_own): Tracked <M ::Owner>,requirespaddr < MAX_PADDR(),paddr % PAGE_SIZE() == 0,old(regions).dropped_slots.contains_key(frame_to_index(paddr)),ensuresres.0.ptr.addr() == frame_to_meta(paddr),res.0.wf(res.1@),res.1@.meta_own == meta_own,res.1@.meta_perm == meta_perm,regions.slots[frame_to_index(paddr)] == old(regions).dropped_slots[frame_to_index(paddr)],!regions.dropped_slots.contains_key(frame_to_index(paddr)),regions.slots == old(regions).slots,regions.slot_owners == old(regions).slot_owners,Restores a raw physical address back into a unique frame.
§Safety
The caller must ensure that the physical address is valid and points to
a forgotten frame that was previously casted by Self::into_raw.
Source§impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> UniqueFrame<M>
impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> UniqueFrame<M>
Sourcepub open spec fn from_unused_spec(
paddr: Paddr,
metadata: M,
pre: MetaRegionModel,
) -> (Self, MetaRegionModel)
pub open spec fn from_unused_spec( paddr: Paddr, metadata: M, pre: MetaRegionModel, ) -> (Self, MetaRegionModel)
recommends
paddr % PAGE_SIZE() == 0,paddr < MAX_PADDR(),pre.inv(),pre.slots[frame_to_index(paddr)].ref_count == REF_COUNT_UNUSED,{
let (ptr, post) = MetaSlot::get_from_unused_spec(paddr, metadata, true, pre);
(
UniqueFrame {
ptr,
_marker: PhantomData,
},
post,
)
}Sourcepub proof fn from_unused_properties(paddr: Paddr, metadata: M, pre: MetaRegionModel)
pub proof fn from_unused_properties(paddr: Paddr, metadata: M, pre: MetaRegionModel)
requires
paddr % 4096 == 0,paddr < MAX_PADDR(),pre.inv(),pre.slots[paddr / 4096].ref_count == REF_COUNT_UNUSED,ensuresUniqueFrame::from_unused_spec(paddr, metadata, pre).1.inv(),Trait Implementations§
Source§impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> ModelOf for UniqueFrame<M>
impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> ModelOf for UniqueFrame<M>
Source§impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> OwnerOf for UniqueFrame<M>
impl<M: AnyFrameMeta + Repr<MetaSlot> + OwnerOf> OwnerOf for UniqueFrame<M>
Auto Trait Implementations§
impl<M> Freeze for UniqueFrame<M>
impl<M> !RefUnwindSafe for UniqueFrame<M>
impl<M> Send for UniqueFrame<M>where
M: Send,
impl<M> Sync for UniqueFrame<M>where
M: Sync,
impl<M> Unpin for UniqueFrame<M>where
M: Unpin,
impl<M> UnwindSafe for UniqueFrame<M>where
M: UnwindSafe,
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