x86_64::structures::paging::mapper

Trait CleanUp

Source
pub trait CleanUp {
    // Required methods
    unsafe fn clean_up<D>(&mut self, frame_deallocator: &mut D)
       where D: FrameDeallocator<Size4KiB>;
    unsafe fn clean_up_addr_range<D>(
        &mut self,
        range: PageRangeInclusive,
        frame_deallocator: &mut D,
    )
       where D: FrameDeallocator<Size4KiB>;
}
Expand description

Provides methods for cleaning up unused entries.

Required Methods§

Source

unsafe fn clean_up<D>(&mut self, frame_deallocator: &mut D)

Remove all empty P1-P3 tables

§Safety

The caller has to guarantee that it’s safe to free page table frames: All page table frames must only be used once and only in this page table (e.g. no reference counted page tables or reusing the same page tables for different virtual addresses ranges in the same page table).

Source

unsafe fn clean_up_addr_range<D>( &mut self, range: PageRangeInclusive, frame_deallocator: &mut D, )

Remove all empty P1-P3 tables in a certain range

// clean up all page tables in the lower half of the address space
let lower_half = Page::range_inclusive(
    Page::containing_address(VirtAddr::new(0)),
    Page::containing_address(VirtAddr::new(0x0000_7fff_ffff_ffff)),
);
page_table.clean_up_addr_range(lower_half, frame_deallocator);
§Safety

The caller has to guarantee that it’s safe to free page table frames: All page table frames must only be used once and only in this page table (e.g. no reference counted page tables or reusing the same page tables for different virtual addresses ranges in the same page table).

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§