From eb035d6a4a39f785b556acabce2a4c1d96eaa282 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Mon, 21 Nov 2011 00:27:10 +0100 Subject: [PATCH] Fixed tripple-fault when creating a new frame, after the current was gc'd. We'll need to get rid of that awful VGA sometime soon. --- sortix/vga.cpp | 1 + sortix/x86-family/memorymanagement.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/sortix/vga.cpp b/sortix/vga.cpp index 21dce5e5..9de757e3 100644 --- a/sortix/vga.cpp +++ b/sortix/vga.cpp @@ -207,6 +207,7 @@ namespace Sortix if ( process != NULL ) { ASSERT(CurrentProcess() == process); } if ( userframe != NULL ) { Memory::UnmapUser((addr_t) userframe); Memory::InvalidatePage((addr_t) userframe); } if ( physical != 0 ) { Page::Put(physical); } + if ( VGA::currentframe == this ) { VGA::currentframe = NULL; } } bool DevVGAFrame::IsType(unsigned type) diff --git a/sortix/x86-family/memorymanagement.cpp b/sortix/x86-family/memorymanagement.cpp index c1868793..988ef893 100644 --- a/sortix/x86-family/memorymanagement.cpp +++ b/sortix/x86-family/memorymanagement.cpp @@ -217,6 +217,8 @@ namespace Sortix // Don't switch if we are already there. if ( addrspace == currentdir ) { return currentdir; } + if ( addrspace & 0xFFFUL ) { PanicF("addrspace 0x%zx was not page-aligned!", addrspace); } + addr_t previous = currentdir; // Switch and flush the TLB.