Nucleus
Barry Per-CPU Scheduler bb0cb77 (3 years, 2 months ago)
diff --git a/kernel/main.c b/kernel/main.c
index 76d5ef1..b7d8eb8 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -17,41 +17,10 @@
#include "desc.h"
#include "acpi/acpi.h"
-struct CPUData __seg_gs *cpu = 0;
-
extern char _bss[], _end[];
void page_fault_handler(struct InterruptFrame *frame);
-
-/* Per-CPU Setup */
-void
-cpu_load(void)
-{
- /* Initialise SSE */
- asm volatile(
- "mov %cr0, %eax;"
- "andl $0xfffffffb, %eax;"
- "orl $0x2, %eax;"
- "mov %eax, %cr0;"
- "mov %cr4, %eax;"
- "orl $0x600, %eax;"
- "mov %eax, %cr4;"
- );
-
- /* Initialise CR4.PGE */
- asm volatile(
- "mov %cr4, %eax;"
- "orl $0x10, %eax;"
- "mov %eax, %cr4;"
- );
-
- /* Tables */
- cpu_load_idt();
- cpu_load_gdt();
- set_gs_base((uintptr_t) kmalloc(sizeof(struct CPUData)));
- cpu->id = CPUID;
-
- asm volatile("sti");
-}
+void ipiq_handler(struct InterruptFrame *frame);
+void cpu_load(void);
/* Kernel main function */
_Noreturn void
@@ -67,6 +36,7 @@ kmain(struct MultibootInfo *mbinfo)
init_idt();
init_pic();
cpu_load();
+ register_ipi(0, ipiq_handler);
/* Initialise paging */
init_paging();