From bbc4a4aefe12e4a66b4177324c07a40fbc202e48 Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jackpot51@gmail.com> Date: Fri, 28 Jan 2022 09:47:47 -0700 Subject: [PATCH] workaround for crash on graphical debug finish --- src/arch/x86_64/graphical_debug/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/arch/x86_64/graphical_debug/mod.rs b/src/arch/x86_64/graphical_debug/mod.rs index 13d06ce5..1bf3cf78 100644 --- a/src/arch/x86_64/graphical_debug/mod.rs +++ b/src/arch/x86_64/graphical_debug/mod.rs @@ -62,14 +62,16 @@ pub fn init(active_table: &mut ActivePageTable) { } pub fn fini(active_table: &mut ActivePageTable) { - if let Some(debug_display) = DEBUG_DISPLAY.lock().take() { + let debug_display_opt = DEBUG_DISPLAY.lock().take(); + if let Some(debug_display) = debug_display_opt { let display = debug_display.into_display(); let onscreen = display.onscreen.as_mut_ptr() as usize; - let size = display.width * display.height; - { + let size = display.onscreen.len() * 4; + //TODO: fix crash if we unmap this memory + if false { let flush_all = PageFlushAll::new(); let start_page = Page::containing_address(VirtualAddress::new(onscreen)); - let end_page = Page::containing_address(VirtualAddress::new(onscreen + size * 4)); + let end_page = Page::containing_address(VirtualAddress::new(onscreen + size)); for page in Page::range_inclusive(start_page, end_page) { let (result, _frame) = active_table.unmap_return(page, false); flush_all.consume(result); -- GitLab