:: commit b913ecbf44a33686d51fd7906c454b56761adb8b

mintsuki <mintsuki@protonmail.com> — 2021-01-17 15:42

parents: cae6298dce

sleep: Do not clobber int 0x80 for PIT IRQ handler callback

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 75b805fa..c241ce3b 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 847aebb3..7ca62e94 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index 073ed65e..7a9d6bb2 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/lib/sleep.asm b/stage2/lib/sleep.asm
index cbb455ef..11a35900 100644
--- a/stage2/lib/sleep.asm
+++ b/stage2/lib/sleep.asm
@@ -1,12 +1,14 @@
 section .realmode
 
 int_08_ticks_counter: dd 0
+int_08_callback:      dd 0
 
 int_08_isr:
     bits 16
+    pushf
     inc dword [cs:int_08_ticks_counter]
-    int 0x80   ; call callback
-    iret
+    popf
+    jmp far [cs:int_08_callback]
     bits 32
 
 extern getchar_internal
@@ -15,7 +17,7 @@ global pit_sleep_and_quit_on_keypress
 pit_sleep_and_quit_on_keypress:
     ; Hook int 0x08
     mov edx, dword [0x08*4]
-    mov dword [0x80*4], edx
+    mov dword [int_08_callback], edx
     mov edx, int_08_isr
     mov dword [0x08*4], int_08_isr
 
@@ -100,7 +102,7 @@ pit_sleep_and_quit_on_keypress:
     pop ebx
 
     ; Dehook int 0x08
-    mov edx, dword [0x80*4]
+    mov edx, dword [int_08_callback]
     mov dword [0x08*4], edx
 
     push eax
tab: 248 wrap: offon