basic process support and some syscalls
[lunaix-os.git] / lunaix-os / kernel / asm / x86 / interrupt.S
index 11fe3fd505f54af8a0b68e5fbef73483dd41d6c0..471a8e643f44a204b23c3928f5269cc76cd69ddf 100644 (file)
@@ -1,5 +1,6 @@
 #define __ASM__
 #include <arch/x86/interrupts.h>
+// #define __ASM_INTR_DIAGNOSIS
 
 .macro isr_template vector, no_error_code=1
     .global _asm_isr\vector
         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
     isr_template APIC_TIMER_IV
     isr_template APIC_SPIV_IV
     isr_template RTC_TIMER_IV
+    isr_template PC_KBD_IV
 
     interrupt_wrapper:
         pushl %esp
+
         pushl %esi
         pushl %ebp
         pushl %edi
@@ -41,6 +52,9 @@
         movl %eax, (%esp)
 
         call intr_handler
+
+    .global soft_iret
+    soft_iret:
         popl %esp
 
         popl %eax
 
         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