From be3bcbb878cf110be531a9fea17811fcb55f0e95 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 20 Sep 2016 17:36:36 -0600 Subject: [PATCH] Add function for getting mapped page flags --- arch/x86_64/src/paging/mapper.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86_64/src/paging/mapper.rs b/arch/x86_64/src/paging/mapper.rs index 5b7665a..819efa9 100644 --- a/arch/x86_64/src/paging/mapper.rs +++ b/arch/x86_64/src/paging/mapper.rs @@ -93,6 +93,13 @@ impl Mapper { .and_then(|p1| p1[page.p1_index()].pointed_frame()) } + pub fn translate_page_flags(&self, page: Page) -> Option { + self.p4().next_table(page.p4_index()) + .and_then(|p3| p3.next_table(page.p3_index())) + .and_then(|p2| p2.next_table(page.p2_index())) + .and_then(|p1| Some(p1[page.p1_index()].flags())) + } + /// Translate a virtual address to a physical one pub fn translate(&self, virtual_address: VirtualAddress) -> Option { let offset = virtual_address.get() % PAGE_SIZE;