Make p{1,2,3}_table functions unsafe

This commit is contained in:
Philipp Oppermann
2015-11-30 12:24:32 +01:00
parent cf5e2715ae
commit 882af6f14e
2 changed files with 14 additions and 6 deletions

View File

@@ -135,15 +135,21 @@ impl Page {
Table(Page { number: 0o_777_777_777_777 })
}
fn p3_table(&self) -> Table {
/// # Safety
/// Only valid if the corresponding entry in the parent table is PRESENT and not HUGE_PAGE.
unsafe fn p3_table(&self) -> Table {
Table(Page { number: 0o_777_777_777_000 | self.p4_index() })
}
fn p2_table(&self) -> Table {
/// # Safety
/// Only valid if the corresponding entry in the parent table is PRESENT and not HUGE_PAGE.
unsafe fn p2_table(&self) -> Table {
Table(Page { number: 0o_777_777_000_000 | (self.p4_index() << 9) | self.p3_index() })
}
fn p1_table(&self) -> Table {
/// # Safety
/// Only valid if the corresponding entry in the parent table is PRESENT and not HUGE_PAGE.
unsafe fn p1_table(&self) -> Table {
Table(Page {
number: 0o_777_000_000_000 | (self.p4_index() << 18) | (self.p3_index() << 9) |
self.p2_index(),