Implement APIC, RTC, basic ACPI parser and timer support
[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
28     interrupt_wrapper:
29         pushl %esp
30         pushl %esi
31         pushl %ebp
32         pushl %edi
33         pushl %edx
34         pushl %ecx
35         pushl %ebx
36         pushl %eax
37
38         movl %esp, %eax
39         andl $0xfffffff0, %esp
40         subl $16, %esp
41         movl %eax, (%esp)
42
43         call intr_handler
44         popl %esp
45
46         popl %eax
47         popl %ebx
48         popl %ecx
49         popl %edx
50         popl %edi
51         popl %ebp
52         popl %esi
53         popl %esp
54
55         addl $8, %esp
56
57         iret