summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-17 18:52:29 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-17 18:52:29 +0200
commita182ea8c6021e8dbf580c0951ab9a8f309bf868f (patch)
tree6f5738f0ef33a401b1187f0626e129df7480a724
parent64b0b81b2a368149a7f4cc1bf8fd65f9491cfae5 (diff)
downloadserenity-a182ea8c6021e8dbf580c0951ab9a8f309bf868f.zip
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.
-rw-r--r--Kernel/i386.cpp6
1 files changed, 6 insertions, 0 deletions
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()