diff options
Diffstat (limited to 'arch/x86_64/idt.s')
-rw-r--r-- | arch/x86_64/idt.s | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/x86_64/idt.s b/arch/x86_64/idt.s new file mode 100644 index 0000000..ead5b20 --- /dev/null +++ b/arch/x86_64/idt.s @@ -0,0 +1,47 @@ +.set IRQ_BASE, 0x20 + +.section .text +.extern handle_interrput +.global irqign + +.macro gen_irq_handler num +.global irqhdl\num\() +irqhdl\num\(): +movb $\num + IRQ_BASE, (intrptno) +jmp _bot +.endm + +gen_irq_handler 0x00 +gen_irq_handler 0x01 + +_bot: +/* store current data */ +push %ebp +push %edi +push %esi +push %edx +push %ecx +push %ebx +push %eax + +/* call interrupt handler */ +push %esp +push (intrptno) +call kernel_handle_interrupt +movl %eax, %esp + +/* restore previous data */ +pop %eax +pop %ebx +pop %ecx +pop %edx +pop %esi +pop %edi +pop %ebp + +irqign: +/* continue */ +iret + +.data +intrptno: .byte 0 |