[][src]Trait sunrise_kernel::paging::hierarchical_table::HierarchicalTable

pub trait HierarchicalTable {
    type EntryType: HierarchicalEntry;
    type CacheFlusherType: PagingCacheFlusher;
    type ChildTableType: HierarchicalTable;
    fn entries(&mut self) -> &mut [Self::EntryType];
fn table_level() -> usize;
fn get_child_table(
        &mut self,
        index: usize
    ) -> PageState<SmartHierarchicalTable<Self::ChildTableType>>;
fn create_child_table(
        &mut self,
        index: usize
    ) -> SmartHierarchicalTable<Self::ChildTableType>; fn zero(&mut self) { ... }
fn guard_all_entries(&mut self) { ... }
fn map_nth_entry(
        &mut self,
        entry: usize,
        paddr: PhysicalAddress,
        flags: <Self::EntryType as HierarchicalEntry>::EntryFlagsType
    ) { ... }
fn guard_nth_entry(&mut self, entry: usize) { ... }
fn unmap_nth_entry(&mut self, entry: usize) { ... }
fn entry_vm_size() -> usize { ... }
fn get_child_table_or_create(
        &mut self,
        index: usize
    ) -> PageState<SmartHierarchicalTable<Self::ChildTableType>> { ... } }

A hierarchical paging is composed of tables. All tables must implement the following trait A table of entries, either the top-level directory or one of the page tables. A table is a parent table if its child are also tables, instead of regular pages.

Associated Types

type EntryType: HierarchicalEntry

The Entry our table has

type CacheFlusherType: PagingCacheFlusher

A Flusher that should be called on table modifications

type ChildTableType: HierarchicalTable

If we're a parent table, the type of our child tables. If we're not a parent, this type will never be used and you can set it to Self.

Loading content...

Required methods

fn entries(&mut self) -> &mut [Self::EntryType]

gets the raw array of entries

fn table_level() -> usize

Called to check if this table's entries should be treated as pointers to child tables. Level 0 = simple table, level 1 = parent of simple tables, level 2 = parent of parent of simple tables, ...

fn get_child_table(
    &mut self,
    index: usize
) -> PageState<SmartHierarchicalTable<Self::ChildTableType>>

Gets a reference to a child page table.

Panics

Should panic if called on a table which isn't a parent table.

fn create_child_table(
    &mut self,
    index: usize
) -> SmartHierarchicalTable<Self::ChildTableType>

Allocates a child page table, zero it and add an entry pointing to it.

Panics

Should panic if called on a table which isn't a parent table. Should panic if entry was not available.

Loading content...

Provided methods

fn zero(&mut self)

zero out the whole table

fn guard_all_entries(&mut self)

Makes all entries guarded

fn map_nth_entry(
    &mut self,
    entry: usize,
    paddr: PhysicalAddress,
    flags: <Self::EntryType as HierarchicalEntry>::EntryFlagsType
)

Creates a mapping on the nth entry of a table

fn guard_nth_entry(&mut self, entry: usize)

Marks the nth entry as guard page

fn unmap_nth_entry(&mut self, entry: usize)

Marks the nth entry as guard page

fn entry_vm_size() -> usize

the size an entry in this table spans in virtual memory. should be something like PAGE_SIZE * (ENTRY_COUNT ^ table level)

fn get_child_table_or_create(
    &mut self,
    index: usize
) -> PageState<SmartHierarchicalTable<Self::ChildTableType>>

Gets the child page table at given index, or creates it if it does not exist

Panics

Should panic if called on a table which isn't a parent table.

Loading content...

Implementations on Foreign Types

impl HierarchicalTable for ()[src]

type EntryType = Entry

type CacheFlusherType = NoFlush

type ChildTableType = ()

Loading content...

Implementors

impl HierarchicalTable for ActivePageDirectory[src]

type EntryType = I386Entry

type CacheFlusherType = TlbFlush

type ChildTableType = ActivePageTable

fn get_child_table(
    &mut self,
    index: usize
) -> PageState<SmartHierarchicalTable<ActivePageTable>>
[src]

Gets a child ActivePageTable through recursive mapping.

fn create_child_table(
    &mut self,
    index: usize
) -> SmartHierarchicalTable<ActivePageTable>
[src]

Creates a child ActivePageTable, maps it at the given index, and returns it.

Panics

Panics if the entry was not available.

impl HierarchicalTable for ActivePageTable[src]

type EntryType = I386Entry

type CacheFlusherType = TlbFlush

type ChildTableType = Self

fn get_child_table(
    &mut self,
    _index: usize
) -> PageState<SmartHierarchicalTable<Self::ChildTableType>>
[src]

Panics, a page table has no children.

fn create_child_table(
    &mut self,
    _index: usize
) -> SmartHierarchicalTable<Self::ChildTableType>
[src]

Panics, a page table has no children.

impl HierarchicalTable for InactivePageDirectory[src]

type EntryType = I386Entry

type CacheFlusherType = NoFlush

type ChildTableType = InactivePageTable

fn get_child_table(
    &mut self,
    index: usize
) -> PageState<SmartHierarchicalTable<InactivePageTable>>
[src]

Gets the child InactivePageTable at the given index. Temporarily maps it if it is present.

fn create_child_table(
    &mut self,
    index: usize
) -> SmartHierarchicalTable<InactivePageTable>
[src]

Creates a child InactivePageTable at the given index, temporarily maps it, and returns it.

Panics

Panics if the entry was not available.

impl HierarchicalTable for InactivePageTable[src]

type EntryType = I386Entry

type CacheFlusherType = NoFlush

type ChildTableType = Self

fn get_child_table(
    &mut self,
    _index: usize
) -> PageState<SmartHierarchicalTable<Self::ChildTableType>>
[src]

Panics, a page table has no children.

fn create_child_table(
    &mut self,
    _index: usize
) -> SmartHierarchicalTable<Self::ChildTableType>
[src]

Panics, a page table has no children.

Loading content...