pub trait PagingHandler: Sized {
// Required methods
fn alloc_frames(num: usize, align: usize) -> Option<PhysAddr>;
fn dealloc_frames(paddr: PhysAddr, num: usize);
fn phys_to_virt(paddr: PhysAddr) -> VirtAddr;
// Provided methods
fn alloc_frame() -> Option<PhysAddr> { ... }
fn dealloc_frame(paddr: PhysAddr) { ... }
}Expand description
The low-level OS-dependent helpers that must be provided for
PageTable64.
Required Methods§
Sourcefn alloc_frames(num: usize, align: usize) -> Option<PhysAddr>
fn alloc_frames(num: usize, align: usize) -> Option<PhysAddr>
Allocate num contiguous physical frames, with the starting physical
address aligned to align bytes (must be a power of two, and must be
a multiple of 4K).
Sourcefn dealloc_frames(paddr: PhysAddr, num: usize)
fn dealloc_frames(paddr: PhysAddr, num: usize)
Free num contiguous physical frames starting from the given physical
address. The num must be the same as that used in allocation.
Sourcefn phys_to_virt(paddr: PhysAddr) -> VirtAddr
fn phys_to_virt(paddr: PhysAddr) -> VirtAddr
Returns a virtual address that maps to the given physical address.
Used to access the physical memory directly in page table implementation.
Provided Methods§
Sourcefn alloc_frame() -> Option<PhysAddr>
fn alloc_frame() -> Option<PhysAddr>
Request to allocate a 4K-sized physical frame.
Sourcefn dealloc_frame(paddr: PhysAddr)
fn dealloc_frame(paddr: PhysAddr)
Request to free a allocated physical frame.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.