pub struct VmPagePtr(/* private fields */);Expand description
Type-safe wrapper around a raw pointer to a kernel page.
Implementations§
Source§impl VmPagePtr
impl VmPagePtr
Sourcepub const unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub const unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Creates a VmPagePtr from a raw pointer.
§Safety
The caller must ensure that ptr is a valid pointer to a kernel page.
Sourcepub unsafe fn is_free(self) -> bool
pub unsafe fn is_free(self) -> bool
Returns whether this page is in the FREE state. When in the FREE state the page is assumed to be owned by the relevant PmmNode, and hence unless its lock is held this query must be assumed to be racy.
§Safety
The caller must ensure that it either still has ownership of the page or knows it is safe to inspect the state.
Sourcepub unsafe fn is_free_loaned(self) -> bool
pub unsafe fn is_free_loaned(self) -> bool
Returns whether this page is in the FREE_LOANED state. Similar to the FREE state the page is assumed to be owned by the relevant PmmNode, however this distinguishes whether the page is part of the general purpose free list, versus the more narrowly usable set of loaned pages.
§Safety
The caller must ensure that it either still has ownership of the page or knows it is safe to inspect the state.
Sourcepub unsafe fn is_loaned(self) -> bool
pub unsafe fn is_loaned(self) -> bool
If true, this page is “loaned” in the sense of being loaned from a contiguous VMO (via decommit) to Zircon. If the original contiguous VMO is deleted, this page will no longer be loaned. A loaned page cannot be pinned. Instead a different physical page (non-loaned) is used for the pin. A loaned page can be (re-)committed back into its original contiguous VMO, which causes the data in the loaned page to be moved into a different physical page (which itself can be non-loaned or loaned). A loaned page cannot be used to allocate a new contiguous VMO. Maybe queried by anyone who either owns the page, or has sufficient knowledge that the loaned state cannot be being altered in parallel.
§Safety
The caller must ensure that it either still has ownership of the page or knows it is safe to inspect the state.
Sourcepub unsafe fn is_loan_cancelled(self) -> bool
pub unsafe fn is_loan_cancelled(self) -> bool
If true, the original contiguous VMO wants the page back. Such pages won’t be reused until the page is no longer loaned, either via commit of the page back into the contiguous VMO that loaned the page, or via deletion of the contiguous VMO that loaned the page. Such pages are not in the free_loaned_list_ in pmm, which is how reuse is prevented. Should only be called by the PmmNode under its lock.
§Safety
The caller must ensure that it either still has ownership of the page or knows it is safe to inspect the state.
Sourcepub unsafe fn set_is_loaned(self)
pub unsafe fn set_is_loaned(self)
Sets the loaned flag on the page.
§Safety
The caller must ensure that it owns the page and holds the loaned pages lock of the PmmNode
Sourcepub unsafe fn clear_is_loaned(self)
pub unsafe fn clear_is_loaned(self)
Clears the loaned flag on the page.
§Safety
The caller must ensure that it owns the page and holds the loaned pages lock of the PmmNode
Sourcepub unsafe fn set_is_loan_cancelled(self)
pub unsafe fn set_is_loan_cancelled(self)
Sets the loan_cancelled flag on the page. May be done even if not the owner of the page.
§Safety
The caller must ensure that it holds the loaned pages lock of the PmmNode
Sourcepub unsafe fn clear_is_loan_cancelled(self)
pub unsafe fn clear_is_loan_cancelled(self)
Clears the loan_cancelled flag on the page. May be done even if not the owner of the page.
§Safety
The caller must ensure that it holds the loaned pages lock of the PmmNode
Sourcepub unsafe fn dump(self)
pub unsafe fn dump(self)
Dumps information about the page to the debuglog.
§Safety
The caller must ensure that it either still has ownership of the page or knows it is safe to access the pages state.
Sourcepub unsafe fn paddr(self) -> PAddr
pub unsafe fn paddr(self) -> PAddr
Return the physical address of the page.
§Safety
The caller must ensure that it either still has ownership of the page or knows it is safe to inspect the state.
Sourcepub unsafe fn state(self) -> VmPageState
pub unsafe fn state(self) -> VmPageState
Return the current VmPageState of this page.
§Safety
The caller must ensure that it either still has ownership of the page or knows it is safe to inspect the state.
Sourcepub unsafe fn set_state(self, new_state: VmPageState)
pub unsafe fn set_state(self, new_state: VmPageState)
Sets the VmPageState of this page.
§Safety
The caller must ensure that it owns the page or holds the necessary locks to modify its state.
Trait Implementations§
impl Copy for VmPagePtr
impl Eq for VmPagePtr
impl StructuralPartialEq for VmPagePtr
Auto Trait Implementations§
impl Freeze for VmPagePtr
impl RefUnwindSafe for VmPagePtr
impl !Send for VmPagePtr
impl !Sync for VmPagePtr
impl Unpin for VmPagePtr
impl UnsafeUnpin for VmPagePtr
impl UnwindSafe for VmPagePtr
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§impl<T> Init<T> for T
impl<T> Init<T> for T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot. Read more