nuclear@11: .data nuclear@11: .align 4 nuclear@11: .short 0 nuclear@11: /* memory reserved for set_idt */ nuclear@11: lim:.short 0 nuclear@11: addr:.long 0 nuclear@11: nuclear@11: .text nuclear@11: /* set_idt(uint32_t addr, uint16_t limit) nuclear@11: * loads the IDTR with the new address and limit for the IDT */ nuclear@11: .globl set_idt nuclear@11: set_idt: nuclear@11: movl 4(%esp), %eax nuclear@11: movl %eax, (addr) nuclear@11: movw 8(%esp), %ax nuclear@11: movw %ax, (lim) nuclear@11: lidt (lim) nuclear@11: ret nuclear@11: nuclear@11: /* interrupt entry with error code macro nuclear@11: * this macro generates an interrupt entry point for the nuclear@11: * exceptions which include error codes in the stack frame nuclear@11: */ nuclear@11: .macro ientry_err n name nuclear@11: .globl intr_entry_\name nuclear@11: intr_entry_\name: nuclear@11: pushl $\n nuclear@11: jmp intr_entry_common nuclear@11: .endm nuclear@11: nuclear@11: /* interrupt entry without error code macro nuclear@11: * this macro generates an interrupt entry point for the interrupts nuclear@11: * and exceptions which do not include error codes in the stack frame nuclear@11: * it pushes a dummy error code (0), to make the stack frame identical nuclear@11: */ nuclear@11: .macro ientry_noerr n name nuclear@11: .globl intr_entry_\name nuclear@11: intr_entry_\name: nuclear@11: pushl $0 nuclear@11: pushl $\n nuclear@11: jmp intr_entry_common nuclear@11: .endm nuclear@11: nuclear@11: /* common code used by all entry points. calls dispatch_intr() nuclear@11: * defined in intr.c nuclear@11: */ nuclear@11: .extern dispatch_intr nuclear@11: intr_entry_common: nuclear@11: pusha nuclear@11: call dispatch_intr nuclear@11: popa nuclear@11: /* remove error code and intr num from stack */ nuclear@11: add $8, %esp nuclear@11: iret nuclear@11: nuclear@11: /* by including interrupts.h with ASM defined, the macros above nuclear@11: * are expanded to generate all required interrupt entry points nuclear@11: */ nuclear@11: #define ASM nuclear@11: #include