Skip to content

Commit a182ea8

Browse files
committed
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.
1 parent 64b0b81 commit a182ea8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Kernel/i386.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@ void gdt_init()
374374
:: "a"(0x10)
375375
: "memory"
376376
);
377+
378+
// Make sure CS points to the kernel code descriptor.
379+
asm volatile(
380+
"ljmpl $0x8, $sanity\n"
381+
"sanity:\n"
382+
);
377383
}
378384

379385
static void unimp_trap()

0 commit comments

Comments
 (0)