Skip to main content

PagingHandler

Trait PagingHandler 

Source
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§

Source

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).

Source

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.

Source

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§

Source

fn alloc_frame() -> Option<PhysAddr>

Request to allocate a 4K-sized physical frame.

Source

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.

Implementors§