From a605b9f8220cd7fbddcba33bc8002bda81248bea Mon Sep 17 00:00:00 2001 From: travis-update-bot Date: Thu, 10 Dec 2015 16:01:40 +0000 Subject: [PATCH] Update blog to e272cc9257de5a22eb8769e81c1c82a3d59ba2ad --- _posts/2015-12-09-modifying-page-tables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2015-12-09-modifying-page-tables.md b/_posts/2015-12-09-modifying-page-tables.md index eab6e2e8..169802fc 100644 --- a/_posts/2015-12-09-modifying-page-tables.md +++ b/_posts/2015-12-09-modifying-page-tables.md @@ -296,12 +296,12 @@ To convert the address into references, we add two functions: ```rust pub fn next_table(&self, index: usize) -> Option<&Table> { self.next_table_address(index) - .map(|t| unsafe { &*(t as *const _) }) + .map(|address| unsafe { &*(address as *const _) }) } pub fn next_table_mut(&mut self, index: usize) -> Option<&mut Table> { self.next_table_address(index) - .map(|t| unsafe { &mut *(t as *mut _) }) + .map(|address| unsafe { &mut *(address as *mut _) }) } ``` We convert the address into raw pointers and then convert them into references in `unsafe` blocks. Now we can start at the `P4` constant and use these functions to access the lower tables. And we don't even need `unsafe` blocks to do it!