aboutsummaryrefslogtreecommitdiff
path: root/mubios/arch
diff options
context:
space:
mode:
Diffstat (limited to 'mubios/arch')
-rw-r--r--mubios/arch/interrupt.S1
-rw-r--r--mubios/arch/irq.S29
2 files changed, 30 insertions, 0 deletions
diff --git a/mubios/arch/interrupt.S b/mubios/arch/interrupt.S
index 805cc50..021a83f 100644
--- a/mubios/arch/interrupt.S
+++ b/mubios/arch/interrupt.S
@@ -88,3 +88,4 @@ int1a_return:
BIOS_SERVICE_ENTRY int10_entry, 0x10
BIOS_SERVICE_ENTRY int13_entry, 0x13
BIOS_SERVICE_ENTRY int15_entry, 0x15
+ BIOS_SERVICE_ENTRY int16_entry, 0x16
diff --git a/mubios/arch/irq.S b/mubios/arch/irq.S
index dbde8ad..324ae05 100644
--- a/mubios/arch/irq.S
+++ b/mubios/arch/irq.S
@@ -69,12 +69,41 @@ irq0_send_eoi:
irq1_entry:
push ax
+ push bx
+ push dx
+ push ds
# Read the PS/2 scan code before sending EOI.
in al, 0x60
+ mov dl, al
+
+ test dl, 0x80
+ jnz irq1_send_eoi
+
+ xor ax, ax
+ mov ds, ax
+
+ mov bx, word ptr [0x041C]
+ mov ax, bx
+ add ax, 2
+ cmp ax, 0x043E
+ jb irq1_next_tail_ready
+ mov ax, 0x041E
+irq1_next_tail_ready:
+ cmp ax, word ptr [0x041A]
+ je irq1_send_eoi
+
+ mov byte ptr [bx], 0
+ mov byte ptr [bx + 1], dl
+ mov word ptr [0x041C], ax
+
+irq1_send_eoi:
mov al, 0x20
out 0x20, al
+ pop ds
+ pop dx
+ pop bx
pop ax
iret