about summary refs log tree commit diff
path: root/src/bootloader/utils/irq.s
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-06-23 19:31:26 +0200
committerYour Name <you@example.com>2020-06-23 19:31:26 +0200
commit86add5103e8b80a5ba614c1d4986b67ffb073953 (patch)
tree338e0af49c5093cef88485509fc4fce8010da79e /src/bootloader/utils/irq.s
parentFormat: added kernel includes to pOS.h instead of kernel.cpp (diff)
downloadpOS-86add5103e8b80a5ba614c1d4986b67ffb073953.tar.gz
pOS-86add5103e8b80a5ba614c1d4986b67ffb073953.tar.bz2
pOS-86add5103e8b80a5ba614c1d4986b67ffb073953.zip
Base: Added support for interrupts and exception handlers
Diffstat (limited to 'src/bootloader/utils/irq.s')
-rw-r--r--src/bootloader/utils/irq.s157
1 files changed, 157 insertions, 0 deletions
diff --git a/src/bootloader/utils/irq.s b/src/bootloader/utils/irq.s
new file mode 100644
index 0000000..c485613
--- /dev/null
+++ b/src/bootloader/utils/irq.s
@@ -0,0 +1,157 @@
+global irq0
+global irq1
+global irq2
+global irq3
+global irq4
+global irq5
+global irq6
+global irq7
+global irq8
+global irq9
+global irq10
+global irq11
+global irq12
+global irq13
+global irq14
+global irq15
+
+; 32: IRQ0
+irq0:
+    cli
+    push byte 0
+    push byte 32
+    jmp irq_common_stub
+
+; 33: IRQ1
+irq1:
+    cli
+    push byte 0
+    push byte 33
+    jmp irq_common_stub
+
+; 34: IRQ2
+irq2:
+    cli
+    push byte 0
+    push byte 34
+    jmp irq_common_stub
+
+; 35: IRQ3
+irq3:
+    cli
+    push byte 0
+    push byte 35
+    jmp irq_common_stub
+
+; 36: IRQ4
+irq4:
+    cli
+    push byte 0
+    push byte 36
+    jmp irq_common_stub
+
+; 37: IRQ5
+irq5:
+    cli
+    push byte 0
+    push byte 37
+    jmp irq_common_stub
+
+; 38: IRQ6
+irq6:
+    cli
+    push byte 0
+    push byte 38
+    jmp irq_common_stub
+
+; 39: IRQ7
+irq7:
+    cli
+    push byte 0
+    push byte 39
+    jmp irq_common_stub
+
+; 40: IRQ8
+irq8:
+    cli
+    push byte 0
+    push byte 40
+    jmp irq_common_stub
+
+; 41: IRQ9
+irq9:
+    cli
+    push byte 0
+    push byte 41
+    jmp irq_common_stub
+
+; 42: IRQ10
+irq10:
+    cli
+    push byte 0
+    push byte 42
+    jmp irq_common_stub
+
+; 43: IRQ11
+irq11:
+    cli
+    push byte 0
+    push byte 43
+    jmp irq_common_stub
+
+; 44: IRQ12
+irq12:
+    cli
+    push byte 0
+    push byte 44
+    jmp irq_common_stub
+
+; 45: IRQ13
+irq13:
+    cli
+    push byte 0
+    push byte 45
+    jmp irq_common_stub
+
+; 46: IRQ14
+irq14:
+    cli
+    push byte 0
+    push byte 46
+    jmp irq_common_stub
+
+; 47: IRQ15
+irq15:
+    cli
+    push byte 0
+    push byte 47
+    jmp irq_common_stub
+
+extern irq_handler
+
+irq_common_stub:
+    pusha
+    push ds
+    push es
+    push fs
+    push gs
+
+    mov ax, 0x10
+    mov ds, ax
+    mov es, ax
+    mov fs, ax
+    mov gs, ax
+    mov eax, esp
+
+    push eax
+    mov eax, irq_handler
+    call eax
+    pop eax
+
+    pop gs
+    pop fs
+    pop es
+    pop ds
+    popa
+    add esp, 8
+    iret