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.