From b920ffee42aecd0803c5afc25c343c91fbae99f0 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 10 Jul 2023 13:04:18 +0200 Subject: [PATCH] kernel: Don't use an active directory for the idle thread Just take the currently used directory. --- kernel/src/thread/Scheduler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/src/thread/Scheduler.cpp b/kernel/src/thread/Scheduler.cpp index 12aad716..77d94238 100644 --- a/kernel/src/thread/Scheduler.cpp +++ b/kernel/src/thread/Scheduler.cpp @@ -27,6 +27,7 @@ namespace Scheduler g_idle.is_kernel = true; g_idle.parent = nullptr; g_idle.name = "[idle]"; + g_idle.active_directory = nullptr; g_idle.ticks_left = 1; @@ -234,7 +235,7 @@ namespace Scheduler { switch_context(old_thread, new_thread, regs); if (!old_thread->is_kernel) old_thread->fp_data.save(); - if (MMU::get_page_directory() != MMU::kernel_page_directory()) + if (old_thread->state != ThreadState::Idle && MMU::get_page_directory() != MMU::kernel_page_directory()) old_thread->active_directory = MMU::get_page_directory(); if (new_thread->active_directory) MMU::switch_page_directory(new_thread->active_directory); if (!new_thread->is_kernel)