From a182ea8c6021e8dbf580c0951ab9a8f309bf868f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 17 May 2019 18:52:29 +0200 Subject: 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. --- Kernel/i386.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp index 95b6cf9419..a20458fc15 100644 --- a/Kernel/i386.cpp +++ b/Kernel/i386.cpp @@ -374,6 +374,12 @@ void gdt_init() :: "a"(0x10) : "memory" ); + + // Make sure CS points to the kernel code descriptor. + asm volatile( + "ljmpl $0x8, $sanity\n" + "sanity:\n" + ); } static void unimp_trap() -- cgit v1.2.3