[kernel] Don't double-construct the scheduler

The scheduler singleton was getting constructed twice, once at static
time and then again in main(). Make the singleton a pointer so we only
construct it once.
This commit is contained in:
2020-08-02 18:11:09 -07:00
parent cf582c4ce4
commit e1b1b5d357
3 changed files with 7 additions and 4 deletions

View File

@@ -16,7 +16,7 @@
#include "elf/elf.h"
#include "kutil/assert.h"
scheduler scheduler::s_instance(nullptr);
scheduler *scheduler::s_instance = nullptr;
const uint64_t rflags_noint = 0x002;
const uint64_t rflags_int = 0x202;
@@ -34,6 +34,9 @@ scheduler::scheduler(lapic *apic) :
m_clock(0),
m_last_promotion(0)
{
kassert(!s_instance, "Multiple schedulers created!");
s_instance = this;
page_table *pml4 = page_manager::get_pml4();
process *kp = new process(pml4);
m_kernel_process = kp;