Struct axalloc::GlobalPage
source · pub struct GlobalPage { /* private fields */ }
Expand description
A RAII wrapper of contiguous 4K-sized pages.
It will automatically deallocate the pages when dropped.
Implementations§
source§impl GlobalPage
impl GlobalPage
sourcepub fn alloc_zero() -> AxResult<Self>
pub fn alloc_zero() -> AxResult<Self>
Allocate one 4K-sized page and fill with zero.
sourcepub fn alloc_contiguous(num_pages: usize, align_pow2: usize) -> AxResult<Self>
pub fn alloc_contiguous(num_pages: usize, align_pow2: usize) -> AxResult<Self>
Allocate contiguous 4K-sized pages.
sourcepub fn start_vaddr(&self) -> VirtAddr
pub fn start_vaddr(&self) -> VirtAddr
Get the start virtual address of this page.
sourcepub fn start_paddr<F>(&self, virt_to_phys: F) -> PhysAddr
pub fn start_paddr<F>(&self, virt_to_phys: F) -> PhysAddr
Get the start physical address of this page.
sourcepub fn as_mut_ptr(&mut self) -> *mut u8
pub fn as_mut_ptr(&mut self) -> *mut u8
Convert to a mutable raw pointer.
sourcepub fn as_slice_mut(&mut self) -> &mut [u8]
pub fn as_slice_mut(&mut self) -> &mut [u8]
Forms a mutable slice that can write data.
Trait Implementations§
source§impl Debug for GlobalPage
impl Debug for GlobalPage
Auto Trait Implementations§
impl RefUnwindSafe for GlobalPage
impl Send for GlobalPage
impl Sync for GlobalPage
impl Unpin for GlobalPage
impl UnwindSafe for GlobalPage
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