瀏覽代碼

Kernel: After creating our GDT, make sure CS refers to the right descriptor.

This will allow us to boot from e.g GRUB which will have a different looking
GDT in effect before we start moving things around.
Andreas Kling 6 年之前
父節點
當前提交
a182ea8c60
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      Kernel/i386.cpp

+ 6 - 0
Kernel/i386.cpp

@@ -374,6 +374,12 @@ void gdt_init()
         :: "a"(0x10)
         :: "a"(0x10)
         : "memory"
         : "memory"
     );
     );
+
+    // Make sure CS points to the kernel code descriptor.
+    asm volatile(
+        "ljmpl $0x8, $sanity\n"
+        "sanity:\n"
+    );
 }
 }
 
 
 static void unimp_trap()
 static void unimp_trap()