:: commit 3d75644e2c90fce47690d74818fea7c98e5fb278

mintsuki <mintsuki@protonmail.com> — 2020-06-03 11:54

parents: 7336f2b819

Add a call to BIOS int 15h AX EC00h before entering Long Mode in stivale proto

diff --git a/qloader2.bin b/qloader2.bin
index 39b12f50..eab9260f 100644
Binary files a/qloader2.bin and b/qloader2.bin differ
diff --git a/src/lib/blib.c b/src/lib/blib.c
index 6f0598ff..cd1667d4 100644
--- a/src/lib/blib.c
+++ b/src/lib/blib.c
@@ -99,9 +99,7 @@ __attribute__((used)) static uint32_t int_08_ticks_counter;
 __attribute__((naked)) static void int_08_isr(void) {
     asm (
         ".code16\n\t"
-        "pushf\n\t"
         "inc dword ptr cs:[int_08_ticks_counter]\n\t"
-        "popf\n\t"
         "int 0x40\n\t"   // call callback
         "iret\n\t"
         ".code32\n\t"
diff --git a/src/protos/stivale.c b/src/protos/stivale.c
index 30efd465..163ad2e3 100644
--- a/src/protos/stivale.c
+++ b/src/protos/stivale.c
@@ -227,6 +227,16 @@ void stivale_load(char *cmdline, int boot_drive) {
         deinit_vga_textmode();
     }
 
+    if (bits == 64) {
+        // If we're going 64, we might as well call this BIOS interrupt
+        // to tell the BIOS that we are entering Long Mode, since it is in
+        // the specification.
+        struct rm_regs r = {0};
+        r.eax = 0xec00;
+        r.ebx = 0x02;   // Long mode only
+        rm_int(0x15, &r, &r);
+    }
+
     rm_flush_irqs();
 
     if (bits == 64) {
tab: 248 wrap: offon