From 718eb388cb391183033ff47383ada39911d7c673 Mon Sep 17 00:00:00 2001 From: Jonathan Klimt Date: Tue, 10 Dec 2024 19:14:20 +0100 Subject: [PATCH] uhyve: don't panic on initial unmap if page is not mapped --- src/arch/x86_64/mm/paging.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/arch/x86_64/mm/paging.rs b/src/arch/x86_64/mm/paging.rs index 34cdb1cbc5..fda118bd24 100644 --- a/src/arch/x86_64/mm/paging.rs +++ b/src/arch/x86_64/mm/paging.rs @@ -387,8 +387,11 @@ pub fn init_page_tables() { let mut page_table = unsafe { recursive_page_table() }; for page in page_range { - let (_frame, flush) = page_table.unmap(page).unwrap(); - flush.ignore(); + match page_table.unmap(page) { + Ok((_frame, flush)) => flush.ignore(), + Err(UnmapError::PageNotMapped) => {} // If it wasn't mapped, that's not an issue + Err(e) => panic!("Couldn't unmap page {page:?}: {e:?}"), + } } tlb::flush_all();