Basic PS/2 keyboard driver, and ...
[lunaix-os.git] / lunaix-os / kernel / asm / x86 / interrupt.S
1 #define __ASM__
2 #include <arch/x86/interrupts.h>
3
4 .macro isr_template vector, no_error_code=1
5     .global _asm_isr\vector
6     .type _asm_isr\vector, @function
7     _asm_isr\vector:
8         .if \no_error_code
9             pushl $0x0
10         .endif
11         pushl $\vector
12         jmp interrupt_wrapper
13 .endm
14
15 .section .text
16     isr_template FAULT_DIVISION_ERROR
17     isr_template FAULT_GENERAL_PROTECTION, no_error_code=0
18     isr_template FAULT_PAGE_FAULT, no_error_code=0
19
20     isr_template LUNAIX_SYS_PANIC
21
22     isr_template APIC_ERROR_IV
23     isr_template APIC_LINT0_IV
24     isr_template APIC_TIMER_IV
25     isr_template APIC_SPIV_IV
26     isr_template RTC_TIMER_IV
27     isr_template PC_KBD_IV
28
29     interrupt_wrapper:
30         pushl %esp
31         pushl %esi
32         pushl %ebp
33         pushl %edi
34         pushl %edx
35         pushl %ecx
36         pushl %ebx
37         pushl %eax
38
39         movl %esp, %eax
40         andl $0xfffffff0, %esp
41         subl $16, %esp
42         movl %eax, (%esp)
43
44         call intr_handler
45         popl %esp
46
47         popl %eax
48         popl %ebx
49         popl %ecx
50         popl %edx
51         popl %edi
52         popl %ebp
53         popl %esi
54         popl %esp
55
56         addl $8, %esp
57
58         iret