Simplified the definition of the interrupt handlers for non smp machines.
authorHartmut Birr <osexpert@googlemail.com>
Mon, 2 Jan 2006 18:34:31 +0000 (18:34 +0000)
committerHartmut Birr <osexpert@googlemail.com>
Mon, 2 Jan 2006 18:34:31 +0000 (18:34 +0000)
svn path=/trunk/; revision=20532

reactos/ntoskrnl/ke/i386/irqhand.s

index 20b7ead..ecc70d8 100644 (file)
@@ -1,6 +1,31 @@
 #include <ndk/asm.h>
 #include <../hal/halx86/include/halirq.h>
 
 #include <ndk/asm.h>
 #include <../hal/halx86/include/halirq.h>
 
+_KiCommonInterrupt:
+       cld
+       pushl   %ds
+       pushl   %es
+       pushl   %fs
+       pushl   %gs
+       pushl   $0xceafbeef
+       movl    $KGDT_R0_DATA,%eax
+       movl    %eax,%ds
+       movl    %eax,%es
+       movl    %eax,%gs
+       movl    $KGDT_R0_PCR,%eax
+       movl    %eax,%fs
+       pushl   %esp
+       pushl   %ebx
+       call    _KiInterruptDispatch
+       addl    $0xC, %esp
+       popl    %gs
+       popl    %fs
+       popl    %es
+       popl    %ds
+       popa
+       iret
+
+
 #ifdef CONFIG_SMP
 
 #define BUILD_INTERRUPT_HANDLER(intnum) \
 #ifdef CONFIG_SMP
 
 #define BUILD_INTERRUPT_HANDLER(intnum) \
   B(x,8) B(x,9) B(x,A) B(x,B) \
   B(x,C) B(x,D) B(x,E) B(x,F)
 
   B(x,8) B(x,9) B(x,A) B(x,B) \
   B(x,C) B(x,D) B(x,E) B(x,F)
 
-_KiCommonInterrupt:
-       cld
-       pushl %ds
-       pushl %es
-       pushl %fs
-       pushl %gs
-       movl    $0xceafbeef,%eax
-       pushl %eax
-       movl    $KGDT_R0_DATA,%eax
-       movl    %eax,%ds
-       movl    %eax,%es
-       movl %eax,%gs
-       movl    $KGDT_R0_PCR,%eax
-       movl    %eax,%fs
-       pushl %esp
-       pushl %ebx
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
 B16(3) B16(4) B16(5) B16(6)
 B16(7) B16(8) B16(9) B16(A)
 B16(B) B16(C) B16(D) B16(E)
 B16(3) B16(4) B16(5) B16(6)
 B16(7) B16(8) B16(9) B16(A)
 B16(B) B16(C) B16(D) B16(E)
@@ -53,440 +53,29 @@ B16(F)
 
 #undef B
 #undef B16
 
 #undef B
 #undef B16
+#undef BUILD_INTERRUPT_HANDLER
 
 #else /* CONFIG_SMP */
 
 
 #else /* CONFIG_SMP */
 
-.global _irq_handler_0
-_irq_handler_0:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 0)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_1
-_irq_handler_1:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 1)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_2
-_irq_handler_2:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 2)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_3
-_irq_handler_3:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 3)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_4
-_irq_handler_4:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 4)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_5
-_irq_handler_5:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 5)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_6
-_irq_handler_6:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 6)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_7
-_irq_handler_7:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 7)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_8
-_irq_handler_8:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 8)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_9
-_irq_handler_9:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 9)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_10
-_irq_handler_10:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 10)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
-
-.global _irq_handler_11
-_irq_handler_11:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 11)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
+#define BUILD_INTERRUPT_HANDLER(intnum) \
+  .global _irq_handler_##intnum; \
+  _irq_handler_##intnum:; \
+  pusha; \
+  movl $(##intnum + IRQ_BASE), %ebx; \
+  jmp _KiCommonInterrupt;
 
 
-.global _irq_handler_12
-_irq_handler_12:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 12)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
+/* Interrupt handlers and declarations */
 
 
-.global _irq_handler_13
-_irq_handler_13:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 13)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
+#define B(x) \
+  BUILD_INTERRUPT_HANDLER(x)
 
 
-.global _irq_handler_14
-_irq_handler_14:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 14)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
+B(0) B(1) B(2) B(3)
+B(4) B(5) B(6) B(7)
+B(8) B(9) B(10) B(11)
+B(12) B(13) B(14) B(15)
 
 
-.global _irq_handler_15
-_irq_handler_15:
-       cld
-       pusha
-       pushl   %ds
-       pushl   %es
-       pushl   %fs
-       pushl   %gs
-       movl    $0xceafbeef,%eax
-       pushl   %eax
-       movw    $KGDT_R0_DATA,%ax
-       movw    %ax,%ds
-       movw    %ax,%es
-       movw    %ax,%gs
-       movl    $KGDT_R0_PCR, %eax
-       movl    %eax, %fs
-       pushl   %esp
-       pushl   $(IRQ_BASE + 15)
-       call    _KiInterruptDispatch
-       addl    $0xC, %esp
-       popl    %gs
-       popl    %fs
-       popl    %es
-       popl    %ds
-       popa
-       iret
+#undef B
+#undef BUILD_INTERRUPT_HANDLER
 
 #endif /* CONFIG_SMP */
 
 
 #endif /* CONFIG_SMP */