diff --git a/arch/x86/kernel/entry.asm b/arch/x86/kernel/entry.asm index d2e288c7..852af114 100644 --- a/arch/x86/kernel/entry.asm +++ b/arch/x86/kernel/entry.asm @@ -160,64 +160,72 @@ isr0: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 0 - jmp isr_common_stub + jmp common_stub ; 1: Debug Exception isr1: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 1 - jmp isr_common_stub + jmp common_stub ; 2: Non Maskable Interrupt Exception isr2: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 2 - jmp isr_common_stub + jmp common_stub ; 3: Int 3 Exception isr3: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 3 - jmp isr_common_stub + jmp common_stub ; 4: INTO Exception isr4: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 4 - jmp isr_common_stub + jmp common_stub ; 5: Out of Bounds Exception isr5: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 5 - jmp isr_common_stub + jmp common_stub ; 6: Invalid Opcode Exception isr6: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 6 - jmp isr_common_stub + jmp common_stub ; 7: Coprocessor Not Available Exception isr7: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 7 - jmp isr_common_stub + jmp common_stub ; 8: Double Fault Exception (With Error Code!) isr8: @@ -225,15 +233,16 @@ isr8: ; Therefore, the interrupt flag (IF) is already cleared. ; cli push byte 8 - jmp isr_common_stub + jmp common_stub ; 9: Coprocessor Segment Overrun Exception isr9: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 9 - jmp isr_common_stub + jmp common_stub ; 10: Bad TSS Exception (With Error Code!) isr10: @@ -241,7 +250,7 @@ isr10: ; Therefore, the interrupt flag (IF) is already cleared. ; cli push byte 10 - jmp isr_common_stub + jmp common_stub ; 11: Segment Not Present Exception (With Error Code!) isr11: @@ -249,7 +258,7 @@ isr11: ; Therefore, the interrupt flag (IF) is already cleared. ; cli push byte 11 - jmp isr_common_stub + jmp common_stub ; 12: Stack Fault Exception (With Error Code!) isr12: @@ -257,7 +266,7 @@ isr12: ; Therefore, the interrupt flag (IF) is already cleared. ; cli push byte 12 - jmp isr_common_stub + jmp common_stub ; 13: General Protection Fault Exception (With Error Code!) isr13: @@ -265,7 +274,7 @@ isr13: ; Therefore, the interrupt flag (IF) is already cleared. ; cli push byte 13 - jmp isr_common_stub + jmp common_stub ; 14: Page Fault Exception (With Error Code!) isr14: @@ -273,23 +282,25 @@ isr14: ; Therefore, the interrupt flag (IF) is already cleared. ; cli push byte 14 - jmp isr_common_stub + jmp common_stub ; 15: Reserved Exception isr15: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 15 - jmp isr_common_stub + jmp common_stub ; 16: Floating Point Exception isr16: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 16 - jmp isr_common_stub + jmp common_stub ; 17: Alignment Check Exception isr17: @@ -297,131 +308,133 @@ isr17: ; Therefore, the interrupt flag (IF) is already cleared. ; cli push byte 17 - jmp isr_common_stub + jmp common_stub ; 18: Machine Check Exception isr18: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 18 - jmp isr_common_stub + jmp common_stub ; 19: Reserved isr19: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 19 - jmp isr_common_stub + jmp common_stub ; 20: Reserved isr20: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 20 - jmp isr_common_stub + jmp common_stub ; 21: Reserved isr21: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 21 - jmp isr_common_stub + jmp common_stub ; 22: Reserved isr22: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 22 - jmp isr_common_stub + jmp common_stub ; 23: Reserved isr23: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 23 - jmp isr_common_stub + jmp common_stub ; 24: Reserved isr24: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 24 - jmp isr_common_stub + jmp common_stub ; 25: Reserved isr25: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 25 - jmp isr_common_stub + jmp common_stub ; 26: Reserved isr26: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 26 - jmp isr_common_stub + jmp common_stub ; 27: Reserved isr27: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 27 - jmp isr_common_stub + jmp common_stub ; 28: Reserved isr28: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 28 - jmp isr_common_stub + jmp common_stub ; 29: Reserved isr29: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 29 - jmp isr_common_stub + jmp common_stub ; 30: Reserved isr30: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 30 - jmp isr_common_stub + jmp common_stub ; 31: Reserved isr31: ; isr0 - isr31 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 31 - jmp isr_common_stub - -isr_common_stub: - pusha - - ; use the same handler for interrupts and exceptions - push esp - call irq_handler - add esp, 4 - - popa - add esp, 4 - iret + jmp common_stub extern syscall_handler @@ -499,188 +512,189 @@ irq0: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 32 - jmp irq_common_stub + jmp common_stub ; 33: IRQ1 irq1: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 33 - jmp irq_common_stub + jmp common_stub ; 34: IRQ2 irq2: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 34 - jmp irq_common_stub + jmp common_stub ; 35: IRQ3 irq3: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 35 - jmp irq_common_stub + jmp common_stub ; 36: IRQ4 irq4: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 36 - jmp irq_common_stub + jmp common_stub ; 37: IRQ5 irq5: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 37 - jmp irq_common_stub + jmp common_stub ; 38: IRQ6 irq6: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 38 - jmp irq_common_stub + jmp common_stub ; 39: IRQ7 irq7: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 39 - jmp irq_common_stub + jmp common_stub ; 40: IRQ8 irq8: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 40 - jmp irq_common_stub + jmp common_stub ; 41: IRQ9 irq9: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 41 - jmp irq_common_stub + jmp common_stub ; 42: IRQ10 irq10: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 42 - jmp irq_common_stub + jmp common_stub ; 43: IRQ11 irq11: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 43 - jmp irq_common_stub + jmp common_stub ; 44: IRQ12 irq12: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 44 - jmp irq_common_stub + jmp common_stub ; 45: IRQ13 irq13: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 45 - jmp irq_common_stub + jmp common_stub ; 46: IRQ14 irq14: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 46 - jmp irq_common_stub + jmp common_stub ; 47: IRQ15 irq15: ; irq0 - irq15 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 47 - jmp irq_common_stub + jmp common_stub ; 48: IRQ16 irq16: ; irq16 - irq23 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 48 - jmp irq_common_stub + jmp common_stub ; 49: IRQ17 irq17: ; irq16- irq23 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 49 - jmp irq_common_stub + jmp common_stub ; 50: IRQ18 irq18: ; irq16 - irq23 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 50 - jmp irq_common_stub + jmp common_stub ; 51: IRQ19 irq19: ; irq16 - irq23 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 51 - jmp irq_common_stub + jmp common_stub ; 52: IRQ20 irq20: ; irq16- irq23 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 52 - jmp irq_common_stub + jmp common_stub ; 53: IRQ21 irq21: @@ -689,68 +703,69 @@ irq21: ; cli push byte 0 ; error code push byte 53 - jmp irq_common_stub + jmp common_stub ; 54: IRQ22 irq22: ; irq16- irq23 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli + push byte 0 ; pseudo error code push byte 54 - jmp irq_common_stub + jmp common_stub ; 55: IRQ23 irq23: ; irq16 - irq23 are registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 55 - jmp irq_common_stub + jmp common_stub apic_timer: ; apic timer is registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 123 - jmp irq_common_stub + jmp common_stub apic_lint0: ; lint0 is registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 124 - jmp irq_common_stub + jmp common_stub apic_lint1: ; lint1 is registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 125 - jmp irq_common_stub + jmp common_stub apic_error: ; LVT error interrupt is registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 126 - jmp irq_common_stub + jmp common_stub apic_svr: ; SVR is registered as "Interrupt Gate" ; Therefore, the interrupt flag (IF) is already cleared. ; cli - push byte 0 ; error code + push byte 0 ; pseudo error code push byte 127 - jmp irq_common_stub + jmp common_stub extern irq_handler -irq_common_stub: +common_stub: pusha ; use the same handler for interrupts and exceptions