X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/f552823ca5288f68128995ed503d0cb0f974d455..48b4a227035048fdebcd32532deb7a857c6199ac:/lunaix-os/kernel/asm/x86/interrupt.S diff --git a/lunaix-os/kernel/asm/x86/interrupt.S b/lunaix-os/kernel/asm/x86/interrupt.S index f05c3b8..471a8e6 100644 --- a/lunaix-os/kernel/asm/x86/interrupt.S +++ b/lunaix-os/kernel/asm/x86/interrupt.S @@ -1,5 +1,6 @@ #define __ASM__ #include +// #define __ASM_INTR_DIAGNOSIS .macro isr_template vector, no_error_code=1 .global _asm_isr\vector @@ -12,12 +13,20 @@ jmp interrupt_wrapper .endm +#ifdef __ASM_INTR_DIAGNOSIS +.section .bss + .global debug_resv + debug_resv: + .skip 16 +#endif + .section .text isr_template FAULT_DIVISION_ERROR isr_template FAULT_GENERAL_PROTECTION, no_error_code=0 isr_template FAULT_PAGE_FAULT, no_error_code=0 isr_template LUNAIX_SYS_PANIC + isr_template LUNAIX_SYS_CALL isr_template APIC_ERROR_IV isr_template APIC_LINT0_IV @@ -28,6 +37,7 @@ interrupt_wrapper: pushl %esp + pushl %esi pushl %ebp pushl %edi @@ -42,6 +52,9 @@ movl %eax, (%esp) call intr_handler + + .global soft_iret + soft_iret: popl %esp popl %eax @@ -55,4 +68,15 @@ addl $8, %esp - iret \ No newline at end of file +#ifdef __ASM_INTR_DIAGNOSIS + cmpl $0, (%esp) + jz 1f + iret +1: + movl $__current, %eax + movl (%esp), %ebx + movl $debug_resv, %ecx + ud2 +#else + iret +#endif