Trait aarch64_paging::paging::Translation
source · pub trait Translation {
// Required methods
fn allocate_table(&self) -> (NonNull<PageTable>, PhysicalAddress);
unsafe fn deallocate_table(&self, page_table: NonNull<PageTable>);
fn physical_to_virtual(&self, pa: PhysicalAddress) -> NonNull<PageTable>;
}
Expand description
An implementation of this trait needs to be provided to the mapping routines, so that the physical addresses used in the page tables can be converted into virtual addresses that can be used to access their contents from the code.
Required Methods§
sourcefn allocate_table(&self) -> (NonNull<PageTable>, PhysicalAddress)
fn allocate_table(&self) -> (NonNull<PageTable>, PhysicalAddress)
Allocates a zeroed page, which is already mapped, to be used for a new subtable of some pagetable. Returns both a pointer to the page and its physical address.
sourceunsafe fn deallocate_table(&self, page_table: NonNull<PageTable>)
unsafe fn deallocate_table(&self, page_table: NonNull<PageTable>)
Deallocates the page which was previous allocated by allocate_table
.
Safety
The memory must have been allocated by allocate_table
on the same Translation
, and not
yet deallocated.
sourcefn physical_to_virtual(&self, pa: PhysicalAddress) -> NonNull<PageTable>
fn physical_to_virtual(&self, pa: PhysicalAddress) -> NonNull<PageTable>
Given the physical address of a subtable, returns the virtual address at which it is mapped.