[−][src]Trait sunrise_bootstrap::paging::table::PageDirectoryTrait
A trait describing all the things that a PageDirectory can do.
Implementer only has to provide functions to map a table and create one, and the trait does the rest.
Thanks to this we can have the same api for every kind of directories, the only difference is the way we access the page tables for writing :
- an ActivePageDirectory will want to use recursive mapping
- an InactivePageDirectory will want to temporarily map the table
- a PagingOffPageDirectory will point to physical memory
Associated Types
type PageTableType: PageTableTrait
type FlusherType: Flusher
Required methods
fn get_table(
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
Gets a reference to a page table
fn create_table(
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
Allocates a page table, zero it and add an entry to the directory pointing to it
Provided methods
fn get_table_or_create(
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
Gets the page table at given index, or creates it if it does not exist
Panics
Panics if the whole page table is guarded.
fn map_to(
&mut self,
page: Frame,
address: VirtualAddress,
flags: I386EntryFlags
)
&mut self,
page: Frame,
address: VirtualAddress,
flags: I386EntryFlags
)
Creates a mapping in the page tables with the given flags
Panics
Panics if entry was already in use Panics if address is not page-aligned.
fn guard(&mut self, address: VirtualAddress)
Creates a guard page
Panics
Panics if entry was already in use Panics if address is not page-aligned.
fn __unmap(&mut self, page: VirtualAddress) -> PageState<Frame>
Deletes a mapping in the page tables, returning the frame if it existed.
Panics
Panics if address is not page-aligned.
fn find_available_virtual_space_aligned<Land: VirtualSpaceLand>(
&mut self,
page_nb: usize,
alignement: usize
) -> Option<VirtualAddress>
&mut self,
page_nb: usize,
alignement: usize
) -> Option<VirtualAddress>
Finds a virtual space hole that can contain page_nb consecutive pages Alignment is the bitshift of a mask that the first page address must satisfy (ex: 24 for 0x**000000)
Implementors
impl PageDirectoryTrait for ActivePageDirectory
[src]
type PageTableType = ActivePageTable
type FlusherType = TlbFlush
fn get_table(
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
[src]
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
Gets a reference to a page table through recursive mapping
fn create_table(
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
[src]
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
Allocates a page table, zero it and add an entry to the directory pointing to it
impl PageDirectoryTrait for InactivePageDirectory
[src]
type PageTableType = InactivePageTable
type FlusherType = NoFlush
fn get_table(
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
[src]
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
Temporary map the table
fn create_table(
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
[src]
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
Allocates a page table, temporarily map it, zero it and add an entry to the directory pointing to it
impl PageDirectoryTrait for PagingOffDirectory
[src]
type PageTableType = PagingOffTable
type FlusherType = NoFlush
fn get_table(
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
[src]
&mut self,
index: usize
) -> PageState<SmartHierarchicalTable<Self::PageTableType>>
Simply cast pointed frame as PageTable
fn create_table(
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
[src]
&mut self,
index: usize
) -> SmartHierarchicalTable<Self::PageTableType>
Allocates a page table, zero it and add an entry to the directory pointing to it