kernel: Don't use an active directory for the idle thread

Just take the currently used directory.
This commit is contained in:
apio 2023-07-10 13:04:18 +02:00
parent 503dc72686
commit b920ffee42
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -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)