:: commit 5457af42024e7170e8e98e49b0f285cb502b6286

mintsuki <mintsuki@protonmail.com> — 2020-09-25 22:28

parents: 2483902b88

Minor fixes to Linux and Chainloading protocols

diff --git a/limine.bin b/limine.bin
index 130db29f..852d6db7 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2/protos/chainload.c b/stage2/protos/chainload.c
index f4ee639d..d36e98c9 100644
--- a/stage2/protos/chainload.c
+++ b/stage2/protos/chainload.c
@@ -10,7 +10,8 @@
 __attribute__((section(".realmode"), used))
 static void spinup(uint8_t drive) {
     asm volatile (
-        // Jump to real mode
+        "cld\n\t"
+
         "jmp 0x08:1f\n\t"
         "1: .code16\n\t"
         "mov ax, 0x10\n\t"
@@ -30,9 +31,13 @@ static void spinup(uint8_t drive) {
         "mov fs, ax\n\t"
         "mov gs, ax\n\t"
         "mov ss, ax\n\t"
+
+        "sti\n\t"
+
         "push 0\n\t"
         "push 0x7c00\n\t"
         "retf\n\t"
+
         ".code32\n\t"
         :
         : "d" (drive)
diff --git a/stage2/protos/linux.c b/stage2/protos/linux.c
index 4babd397..48470b2e 100644
--- a/stage2/protos/linux.c
+++ b/stage2/protos/linux.c
@@ -15,7 +15,6 @@
 __attribute__((section(".realmode"), used))
 static void spinup(uint16_t real_mode_code_seg, uint16_t kernel_entry_seg) {
     asm volatile (
-        "cli\n\t"
         "cld\n\t"
 
         "jmp 0x08:1f\n\t"
@@ -36,8 +35,9 @@ static void spinup(uint16_t real_mode_code_seg, uint16_t kernel_entry_seg) {
         "mov fs, bx\n\t"
         "mov gs, bx\n\t"
         "mov ss, bx\n\t"
+        "mov esp, 0xfdf0\n\t"
 
-        "mov sp, 0xfdf0\n\t"
+        "sti\n\t"
 
         "push cx\n\t"
         "push 0\n\t"
tab: 248 wrap: offon