Skip to content

Provide functions for accessing the underlying L4 table for mapper types #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/structures/paging/mapper/mapped_page_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ impl<'a, P: PhysToVirt> MappedPageTable<'a, P> {
}
}

/// Returns a mutable reference to the wrapped level 4 `PageTable` instance.
pub fn level_4_table(&mut self) -> &mut PageTable {
&mut self.level_4_table
}

/// Helper function for implementing Mapper. Safe to limit the scope of unsafe, see
/// https://github.com/rust-lang/rfcs/pull/2585.
fn map_to_1gib<A>(
Expand Down
5 changes: 5 additions & 0 deletions src/structures/paging/mapper/offset_page_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ impl<'a> OffsetPageTable<'a> {
inner: MappedPageTable::new(level_4_table, phys_offset),
}
}

/// Returns a mutable reference to the wrapped level 4 `PageTable` instance.
pub fn level_4_table(&mut self) -> &mut PageTable {
self.inner.level_4_table()
}
}

#[derive(Debug)]
Expand Down
5 changes: 5 additions & 0 deletions src/structures/paging/mapper/recursive_page_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ impl<'a> RecursivePageTable<'a> {
}
}

/// Returns a mutable reference to the wrapped level 4 `PageTable` instance.
pub fn level_4_table(&mut self) -> &mut PageTable {
&mut self.p4
}

/// Internal helper function to create the page table of the next level if needed.
///
/// If the passed entry is unused, a new frame is allocated from the given allocator, zeroed,
Expand Down