:: commit 0562c8ef700ea9824f6b615bbf868e86db67dbf0

mintsuki <mintsuki@protonmail.com> — 2021-08-25 23:41

parents: 605623bd05

multiboot1: When on BIOS, set IDTR to BIOS defaults before handoff

diff --git a/stage23/protos/multiboot1.32.c b/stage23/protos/multiboot1.32.c
index 45d81ce8..8c8786ac 100644
--- a/stage23/protos/multiboot1.32.c
+++ b/stage23/protos/multiboot1.32.c
@@ -2,9 +2,26 @@
 #include <stddef.h>
 #include <stdbool.h>
 #include <mm/vmm.h>
+#if bios == 1
+#  include <sys/idt.h>
+#endif
 
 __attribute__((noreturn)) void multiboot1_spinup_32(
                  uint32_t entry_point, uint32_t multiboot1_info) {
+#if bios == 1
+    struct idtr idtr;
+
+    idtr.limit = 0x3ff;
+    idtr.ptr = 0;
+
+    asm volatile (
+        "lidt %0"
+        :
+        : "m" (idtr)
+        : "memory"
+    );
+#endif
+
     asm volatile (
         "cld\n\t"
 
tab: 248 wrap: offon