Skip to content

Commit 1335841

Browse files
committed
add getter for the offset in OffsetPageTable
1 parent 3d4264f commit 1335841

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/structures/paging/mapper/mapped_page_table.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ impl<'a, P: PageTableFrameMapping> MappedPageTable<'a, P> {
4242
&mut self.level_4_table
4343
}
4444

45+
/// Returns the `PageTableFrameMapping` used for converting virtual to physical addresses.
46+
pub fn page_table_frame_mapping(&self) -> &P {
47+
&self.page_table_walker.page_table_frame_mapping
48+
}
49+
4550
/// Helper function for implementing Mapper. Safe to limit the scope of unsafe, see
4651
/// https://github.com/rust-lang/rfcs/pull/2585.
4752
fn map_to_1gib<A>(

src/structures/paging/mapper/offset_page_table.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ impl<'a> OffsetPageTable<'a> {
4242
pub fn level_4_table(&mut self) -> &mut PageTable {
4343
self.inner.level_4_table()
4444
}
45+
46+
/// Returns the offset used for converting virtual to physical addresses.
47+
pub fn phys_offset(&self) -> VirtAddr {
48+
self.inner.page_table_frame_mapping().offset
49+
}
4550
}
4651

4752
#[derive(Debug)]

0 commit comments

Comments
 (0)