diff --git a/Kernel/MemoryManager.cpp b/Kernel/MemoryManager.cpp index 698427b59e1..3aa26098dbc 100644 --- a/Kernel/MemoryManager.cpp +++ b/Kernel/MemoryManager.cpp @@ -156,6 +156,14 @@ byte* MemoryManager::quickMapOnePage(PhysicalAddress physicalAddress) return (byte*)(4 * MB); } +void MemoryManager::flushTLB() +{ + asm volatile( + "mov %cr3, %eax\n" + "mov %eax, %cr3\n" + ); +} + bool MemoryManager::unmapRegion(Task& task, Task::Region& region) { auto& zone = *region.zone; @@ -169,6 +177,7 @@ bool MemoryManager::unmapRegion(Task& task, Task::Region& region) // kprintf("MM: >> Unmapped L%x => P%x <<\n", laddr, zone.m_pages[i].get()); } + flushTLB(); return true; } @@ -194,6 +203,7 @@ bool MemoryManager::mapRegion(Task& task, Task::Region& region) //kprintf("MM: >> Mapped L%x => P%x <<\n", laddr, zone.m_pages[i].get()); } + flushTLB(); return true; } diff --git a/Kernel/MemoryManager.h b/Kernel/MemoryManager.h index 35f83ab3065..916ae453370 100644 --- a/Kernel/MemoryManager.h +++ b/Kernel/MemoryManager.h @@ -60,6 +60,7 @@ private: ~MemoryManager(); void initializePaging(); + void flushTLB(); void protectMap(LinearAddress, size_t length); void identityMap(LinearAddress, size_t length); diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 19d5aa7361e..743c2b06ca0 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -168,8 +168,6 @@ static void init_stage2() } #endif - //auto* idTask = Task::create("/bin/id", (uid_t)209, (gid_t)1985); - auto* shTask = Task::create("/bin/sh", (uid_t)100, (gid_t)100); //new Task(motd_main, "motd", IPC::Handle::MotdTask, Task::Ring0);