BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / b9a1b73816b93781911016a677d4b1bed5b8dcc9 / kernel / main.c

// Related

Nucleus

Barry Global Descriptor Tables b9a1b73 (3 years, 3 months ago)
diff --git a/kernel/main.c b/kernel/main.c
index e797bbc..6f2011e 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -9,10 +9,37 @@
 #include <nucleus/memory.h>
 #include <nucleus/panic.h>
 #include "multiboot.h"
-#include "idt.h"
+#include "desc.h"
 
 extern char _bss[], _end[];
 
+/* 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();
+}
+
 /* Kernel main function */
 _Noreturn void
 kmain(uint32_t esp, struct MultibootInfo *mbinfo)
@@ -25,6 +52,9 @@ kmain(uint32_t esp, struct MultibootInfo *mbinfo)
 
 	/* Processor startup */
 	init_idt();
+	init_gdt();
+	//init_pic();
+	cpu_load();
 
 	panic("End of kernel!");
 }