X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=kern%2Fsrc%2Fintrent.asm;fp=kern%2Fsrc%2Fintrent.asm;h=0fd515d7a027fd9c0f3d45f24abcee3274348de7;hb=88e57cf7f2581900eb31cb835a18ad414e37786c;hp=0000000000000000000000000000000000000000;hpb=5145ed1e2adefc9c66e20681532a3a7cd6c2de01;p=eightysix diff --git a/kern/src/intrent.asm b/kern/src/intrent.asm new file mode 100644 index 0000000..0fd515d --- /dev/null +++ b/kern/src/intrent.asm @@ -0,0 +1,63 @@ +; interrupt entry routines + cpu 8086 + bits 16 + section .text + +extern dispatch_intr + +%macro INTR_ENTRY 2 +global intr_entry_%2 +intr_entry_%2: + push bp + push ax + push bp + mov bp, sp + mov ax, %1 + mov [bp + 4], ax + pop bp + pop ax + jmp intr_entry_common +%endmacro + +intr_entry_common: + push ax + mov ax, sp + add ax, 2 + push cx + push dx + push bx + push ax ; saved sp + push bp + push si + push di + call dispatch_intr + pop di + pop si + pop bp + pop bx ; throw away saved sp + pop bx + pop dx + pop cx + pop ax + add sp, 2 ; remove interrupt number from the stack + iret + +; CPU exceptions +INTR_ENTRY 0, div +INTR_ENTRY 1, trap +INTR_ENTRY 2, nmi +INTR_ENTRY 3, break +INTR_ENTRY 4, ovf +INTR_ENTRY 5, bound +INTR_ENTRY 6, ill +; IRQs +INTR_ENTRY 8, irq0 +INTR_ENTRY 9, irq1 +INTR_ENTRY 10, irq2 +INTR_ENTRY 11, irq3 +INTR_ENTRY 12, irq4 +INTR_ENTRY 13, irq5 +INTR_ENTRY 14, irq6 +INTR_ENTRY 15, irq7 + +; vi:ts=8 sts=8 sw=8 ft=nasm: