Mercurial > lcfOS
diff cos/kernel/asmcode.asm @ 16:ddefe6d97cd7
Merged
author | windel-eee |
---|---|
date | Fri, 18 Nov 2011 14:41:53 +0100 |
parents | a58904747019 |
children | f3e3e0e9c4bc |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cos/kernel/asmcode.asm Fri Nov 18 14:41:53 2011 +0100 @@ -0,0 +1,76 @@ +; The default interrupt handlers. +; from 20 - 31 are reserved vectors. +; below are the custom ones! + +section .text +align 4 + +; Port helpers: +global outb +outb: + mov eax, [esp + 8] + mov edx, [esp + 4] + out dx, al + ret + +global inb +inb: + xor eax, eax + mov edx, [esp + 4] + in al, dx + ret + +; Helper functions: +global enableinterrupts +enableinterrupts: + sti + ret + +global halt +halt: + cli + hlt + +global loadIDT +loadIDT: + ret + +; Define macro with two arguments: +%macro INTX 2 +global %1 +%1: + ; Do some saving: +extern %2 + call %2 + ; Do restoration + iret + +%endmacro + +; Exception handlers: +INTX INTDEF, INTDEF_handler +INTX INT0, INT0handler +INTX INT1, INT1handler +INTX INT2, INT2handler +INTX INT3, INT3handler +INTX INT4, INT4handler +INTX INT5, INT5handler +INTX INT6, INT6handler +INTX INT7, INT7handler +INTX INT8, INT8handler +INTX INT9, INT9handler +INTX INT10, INT10handler +INTX INT11, INT11handler +INTX INT12, INT12handler +INTX INT13, INT13handler +INTX INT14, INT14handler +INTX INT15, INT15handler +INTX INT16, INT16handler +INTX INT17, INT17handler +INTX INT18, INT18handler +INTX INT19, INT19handler + +INTX INT32, INT32handler +INTX INT33, INT33handler +INTX INT34, INT34handler +