about summary refs log tree commit diff stats
path: root/boot.subx
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-28 08:22:05 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-03-28 08:30:57 -0700
commitdfda825e55439b6ab89e4715913ee749d4e27b80 (patch)
tree54f45100a6db627ca28a6f7a8b77e3a3455e51e0 /boot.subx
parentad53022489ad22dea8afd534cd4a05ccf26a6cec (diff)
downloadmu-dfda825e55439b6ab89e4715913ee749d4e27b80.tar.gz
always acknowledge enabled interrupts
Now we can start enabling the timer interrupt. It doesn't do anything yet,
but keyboard continues to work.
Diffstat (limited to 'boot.subx')
-rw-r--r--boot.subx19
1 files changed, 17 insertions, 2 deletions
diff --git a/boot.subx b/boot.subx
index 6b95b9f9..21899dbc 100644
--- a/boot.subx
+++ b/boot.subx
@@ -211,8 +211,8 @@ initialize_32bit_mode:
   # Reference:
   #   https://wiki.osdev.org/Exceptions
 
-  # enable keyboard IRQ (1)
-  b0/copy-to-al 0xfd/imm8  # disable mask for IRQ1
+  # enable timer IRQ0 and keyboard IRQ1
+  b0/copy-to-al 0xfc/imm8  # disable mask for IRQ0 and IRQ1
   e6/write-al-into-port 0x21/imm8
 
   fb/enable-interrupts
@@ -300,6 +300,21 @@ idt_start:
 == code
 
 null-interrupt-handler:
+  # prologue
+  # Don't disable interrupts; the timer has the highest priority anyway,
+  # and this interrupt triggers extremely frequently.
+  fa/disable-interrupts
+  60/push-all-registers
+  9c/push-flags
+  # acknowledge interrupt
+  b0/copy-to-al 0x20/imm8
+  e6/write-al-into-port 0x20/imm8
+  31/xor %eax 0/r32/eax
+$null-interrupt-handler:epilogue:
+  # epilogue
+  9d/pop-flags
+  61/pop-all-registers
+  fb/enable-interrupts
   cf/return-from-interrupt
 
 keyboard-interrupt-handler: