mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Use expect instead of unwrap
This commit is contained in:
@@ -672,7 +672,7 @@ fn unmap<A>(&mut self, page: Page, allocator: &mut A)
|
|||||||
.next_table_mut(page.p4_index())
|
.next_table_mut(page.p4_index())
|
||||||
.and_then(|p3| p3.next_table_mut(page.p3_index()))
|
.and_then(|p3| p3.next_table_mut(page.p3_index()))
|
||||||
.and_then(|p2| p2.next_table_mut(page.p2_index()))
|
.and_then(|p2| p2.next_table_mut(page.p2_index()))
|
||||||
.unwrap();
|
.expect("mapping code does not support huge pages");
|
||||||
let frame = p1[page.p1_index()].pointed_frame().unwrap();
|
let frame = p1[page.p1_index()].pointed_frame().unwrap();
|
||||||
p1[page.p1_index()].set_unused();
|
p1[page.p1_index()].set_unused();
|
||||||
unsafe { tlb::flush(page.start_address()) };
|
unsafe { tlb::flush(page.start_address()) };
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ impl RecursivePageTable {
|
|||||||
.next_table_mut(page.p4_index())
|
.next_table_mut(page.p4_index())
|
||||||
.and_then(|p3| p3.next_table_mut(page.p3_index()))
|
.and_then(|p3| p3.next_table_mut(page.p3_index()))
|
||||||
.and_then(|p2| p2.next_table_mut(page.p2_index()))
|
.and_then(|p2| p2.next_table_mut(page.p2_index()))
|
||||||
.unwrap();
|
.expect("mapping code does not support huge pages");
|
||||||
let frame = p1[page.p1_index()].pointed_frame().unwrap();
|
let frame = p1[page.p1_index()].pointed_frame().unwrap();
|
||||||
p1[page.p1_index()].set_unused();
|
p1[page.p1_index()].set_unused();
|
||||||
unsafe { tlb::flush(page.start_address()) };
|
unsafe { tlb::flush(page.start_address()) };
|
||||||
|
|||||||
Reference in New Issue
Block a user