From 6a75fdfc1070befb5de70045696a411d84ed1c42 Mon Sep 17 00:00:00 2001 From: josh Date: Thu, 23 Jul 2009 22:02:11 +0000 Subject: [PATCH] Added isr.asm with 50 isr_%d labels defined, ready to call isr() git-svn-id: svn://anubis/hos/trunk@62 5b3e749e-e535-0410-8002-a9bb6afbdfca --- kernel/boot/isr.asm | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 kernel/boot/isr.asm diff --git a/kernel/boot/isr.asm b/kernel/boot/isr.asm new file mode 100644 index 0000000..d1d7374 --- /dev/null +++ b/kernel/boot/isr.asm @@ -0,0 +1,61 @@ + +; C ISR routine +[extern isr] + +; Macro for creating a single ISR label +; We need to push a junk value on the stack first +; if the interrupt number is not 8 or 10-14. +; This is to properly align the stack for both exceptions +; having and not having error codes. +%macro isr_label 1 +[global isr_%1] +isr_%1: + %if ( (%1 != 8) && (%1 < 10 || %1 > 14) ) + push eax ; junk value to take error code stack space + %endif + push eax + mov al, %1 ; save interrupt number in al + jmp isr_common +%endmacro + +; Loop to create all of our ISR labels +%assign i 0 +%rep 50 + isr_label i + %assign i i+1 +%endrep + +; The common ISR routine +isr_common: + push ebx + push ecx + push edx + push edi + push esi + push ebp + push ds + push es + push fs + push gs + + push esp + push eax +; TODO: currently commented since there is no isr() +; so the build will not break +; call isr + add esp, 8 + + pop gs + pop fs + pop es + pop ds + pop ebp + pop esi + pop edi + pop edx + pop ecx + pop ebx + pop eax ; error code can be ignored now + pop eax + + iret