mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
Kernel: Split initialization of Processor structure
We need to very early on initialize the Processor structure so that we can use RecursiveSpinLock early on.
This commit is contained in:
parent
137e1dc7bd
commit
57b61b2dde
3 changed files with 25 additions and 7 deletions
|
@ -822,7 +822,7 @@ Processor& Processor::by_id(u32 cpu)
|
|||
return *procs[cpu];
|
||||
}
|
||||
|
||||
void Processor::initialize(u32 cpu)
|
||||
void Processor::early_initialize(u32 cpu)
|
||||
{
|
||||
m_self = this;
|
||||
|
||||
|
@ -832,15 +832,29 @@ void Processor::initialize(u32 cpu)
|
|||
m_idle_thread = nullptr;
|
||||
m_current_thread = nullptr;
|
||||
m_mm_data = nullptr;
|
||||
m_info = nullptr;
|
||||
|
||||
gdt_init();
|
||||
ASSERT(¤t() == this); // sanity check
|
||||
}
|
||||
|
||||
void Processor::initialize(u32 cpu)
|
||||
{
|
||||
ASSERT(m_self == this);
|
||||
ASSERT(¤t() == this); // sanity check
|
||||
|
||||
m_cpu = cpu;
|
||||
m_in_irq = 0;
|
||||
|
||||
m_idle_thread = nullptr;
|
||||
m_current_thread = nullptr;
|
||||
m_mm_data = nullptr;
|
||||
|
||||
if (cpu == 0)
|
||||
idt_init();
|
||||
else
|
||||
flush_idt();
|
||||
|
||||
ASSERT(¤t() == this); // sanity check
|
||||
|
||||
if (cpu == 0) {
|
||||
ASSERT((FlatPtr(&s_clean_fpu_state) & 0xF) == 0);
|
||||
asm volatile("fninit");
|
||||
|
|
|
@ -639,6 +639,7 @@ class Processor {
|
|||
static Vector<Processor*>& processors();
|
||||
|
||||
public:
|
||||
void early_initialize(u32 cpu);
|
||||
void initialize(u32 cpu);
|
||||
|
||||
Descriptor& get_gdt_entry(u16 selector);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue