Kernel: Move current and idle thread to Processor

This commit is contained in:
2024-03-08 23:24:18 +02:00
parent e636dce919
commit 2420886c2c
5 changed files with 49 additions and 37 deletions

View File

@@ -1,7 +1,6 @@
#include <kernel/Memory/kmalloc.h>
#include <kernel/Processor.h>
#include <kernel/Debug.h>
#include <kernel/Thread.h>
namespace Kernel
{
@@ -67,4 +66,11 @@ namespace Kernel
return processor;
}
void Processor::allocate_idle_thread()
{
ASSERT(idle_thread() == nullptr);
auto* idle_thread = MUST(Thread::create_kernel([](void*) { for (;;) asm volatile("hlt"); }, nullptr, nullptr));
write_gs_ptr(offsetof(Processor, m_idle_thread), idle_thread);
}
}