1 added + 7 modified, total 8 files
reactos/hal/halx86/include
diff -N halirq.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ halirq.h 1 Nov 2004 14:37:18 -0000 1.1
@@ -0,0 +1,35 @@
+/*
+ * $Id: halirq.h,v 1.1 2004/11/01 14:37:18 hbirr Exp $
+ */
+
+#ifndef __INCLUDE_HAL_HALIRQ
+#define __INCLUDE_HAL_HALIRQ
+
+#ifdef MP
+
+#define FIRST_DEVICE_VECTOR (0x30)
+#define FIRST_SYSTEM_VECTOR (0xef)
+
+#define IRQ_BASE FIRST_DEVICE_VECTOR
+#define NR_IRQS (FIRST_SYSTEM_VECTOR - FIRST_DEVICE_VECTOR)
+
+/*
+ * FIXME:
+ * This does not work if we have more than 24 IRQs (ie. more than one I/O APIC)
+ */
+#define VECTOR2IRQ(vector) (23 - (vector - IRQ_BASE) / 8)
+#define VECTOR2IRQL(vector) (PROFILE_LEVEL - VECTOR2IRQ(vector))
+#define IRQ2VECTOR(irq) (((23 - (irq)) * 8) + FIRST_DEVICE_VECTOR)
+
+#else
+
+#define IRQ_BASE (0x40)
+#define NR_IRQS (16)
+
+#define VECTOR2IRQ(vector) ((vector) - IRQ_BASE)
+#define VECTOR2IRQL(vector) (PROFILE_LEVEL - VECTOR2IRQ(vector))
+#define IRQ2VECTOR(irq) ((irq) + IRQ_BASE)
+
+#endif
+
+#endif /* __INCLUDE_HAL_HALIRQ */
reactos/hal/halx86
diff -u -r1.18 -r1.19
--- irql.c 31 Oct 2004 21:22:06 -0000 1.18
+++ irql.c 1 Nov 2004 14:37:19 -0000 1.19
@@ -1,4 +1,4 @@
-/* $Id: irql.c,v 1.18 2004/10/31 21:22:06 navaraf Exp $
+/* $Id: irql.c,v 1.19 2004/11/01 14:37:19 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -9,19 +9,18 @@
/* INCLUDES *****************************************************************/
+#include <roscfg.h>
#include <ddk/ntddk.h>
#include <internal/ps.h>
#include <ntos/minmax.h>
#include <hal.h>
+#include <halirq.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS ******************************************************************/
-#define NR_IRQS (16)
-#define IRQ_BASE (0x40)
-
/*
* PURPOSE: Current irq level
*/
@@ -86,8 +85,8 @@
WRITE_PORT_UCHAR((PUCHAR)0x20, 0x11);
WRITE_PORT_UCHAR((PUCHAR)0xa0, 0x11);
/* Start of hardware irqs (0x24) */
- WRITE_PORT_UCHAR((PUCHAR)0x21, 0x40);
- WRITE_PORT_UCHAR((PUCHAR)0xa1, 0x48);
+ WRITE_PORT_UCHAR((PUCHAR)0x21, IRQ_BASE);
+ WRITE_PORT_UCHAR((PUCHAR)0xa1, IRQ_BASE + 8);
/* 8259-1 is master */
WRITE_PORT_UCHAR((PUCHAR)0x21, 0x4);
/* 8259-2 is slave */
@@ -152,7 +151,7 @@
* For each deferred interrupt execute all the handlers at DIRQL.
*/
HalpPendingInterruptCount[i]--;
- KiInterruptDispatch2(i, NewIrql);
+ KiInterruptDispatch2(i + IRQ_BASE, NewIrql);
}
KeGetCurrentKPCR()->Irql--;
HalpEndSystemInterrupt(KeGetCurrentKPCR()->Irql);
reactos/hal/halx86
diff -u -r1.6 -r1.7
--- isa.c 28 Dec 2003 22:38:09 -0000 1.6
+++ isa.c 1 Nov 2004 14:37:19 -0000 1.7
@@ -1,4 +1,4 @@
-/* $Id: isa.c,v 1.6 2003/12/28 22:38:09 fireball Exp $
+/* $Id: isa.c,v 1.7 2004/11/01 14:37:19 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -14,10 +14,10 @@
#include <roscfg.h>
#include <ddk/ntddk.h>
#include <bus.h>
-#ifdef MP
-#include <mps.h>
-#endif
+#include <halirq.h>
+#define NDEBUG
+#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
@@ -71,14 +71,9 @@
PKIRQL Irql,
PKAFFINITY Affinity)
{
-#ifdef MP
- *Irql = (KIRQL)(PROFILE_LEVEL - BusInterruptVector);
+ ULONG Vector = IRQ2VECTOR(BusInterruptVector);
+ *Irql = VECTOR2IRQL(Vector);
*Affinity = 0xFFFFFFFF;
- return IRQ2VECTOR(BusInterruptVector);
-#else
- *Irql = (KIRQL)(PROFILE_LEVEL - BusInterruptVector);
- *Affinity = 0xFFFFFFFF;
- return BusInterruptVector;
-#endif
+ return Vector;
}
/* EOF */
reactos/hal/halx86
diff -u -r1.1 -r1.2
--- mps.S 21 Aug 2001 20:18:27 -0000 1.1
+++ mps.S 1 Nov 2004 14:37:19 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Id: mps.S,v 1.1 2001/08/21 20:18:27 chorns Exp $
+/* $Id: mps.S,v 1.2 2004/11/01 14:37:19 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -16,6 +16,7 @@
/* FUNCTIONS *****************************************************************/
#define BEFORE \
+ cld; \
pusha; \
pushl %ds; \
pushl %es; \
reactos/hal/halx86
diff -u -r1.12 -r1.13
--- pci.c 22 Oct 2004 20:08:22 -0000 1.12
+++ pci.c 1 Nov 2004 14:37:19 -0000 1.13
@@ -1,4 +1,4 @@
-/* $Id: pci.c,v 1.12 2004/10/22 20:08:22 ekohl Exp $
+/* $Id: pci.c,v 1.13 2004/11/01 14:37:19 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -21,10 +21,7 @@
#include <roscfg.h>
#include <ddk/ntddk.h>
#include <bus.h>
-#ifdef MP
-#include <mps.h>
-#endif
-
+#include <halirq.h>
#define NDEBUG
#include <internal/debug.h>
@@ -551,15 +548,10 @@
PKIRQL Irql,
PKAFFINITY Affinity)
{
-#ifdef MP
- *Irql = (KIRQL)(PROFILE_LEVEL - BusInterruptVector);
- *Affinity = 0xFFFFFFFF;
- return IRQ2VECTOR(BusInterruptVector);
-#else
- *Irql = (KIRQL)(PROFILE_LEVEL - BusInterruptVector);
+ ULONG Vector = IRQ2VECTOR(BusInterruptVector);
+ *Irql = VECTOR2IRQL(Vector);
*Affinity = 0xFFFFFFFF;
- return BusInterruptVector;
-#endif
+ return Vector;
}
static BOOLEAN STDCALL
reactos/hal/halx86
diff -u -r1.6 -r1.7
--- sysbus.c 28 Dec 2003 22:38:09 -0000 1.6
+++ sysbus.c 1 Nov 2004 14:37:19 -0000 1.7
@@ -1,4 +1,4 @@
-/* $Id: sysbus.c,v 1.6 2003/12/28 22:38:09 fireball Exp $
+/* $Id: sysbus.c,v 1.7 2004/11/01 14:37:19 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -14,9 +14,10 @@
#include <roscfg.h>
#include <ddk/ntddk.h>
#include <bus.h>
-#ifdef MP
-#include <mps.h>
-#endif
+#include <halirq.h>
+
+#define NDEBUG
+#include <internal/debug.h>
/* FUNCTIONS ****************************************************************/
@@ -29,15 +30,10 @@
PKIRQL Irql,
PKAFFINITY Affinity)
{
-#ifdef MP
- *Irql = (KIRQL)(PROFILE_LEVEL - BusInterruptVector);
- *Affinity = 0xFFFFFFFF;
- return IRQ2VECTOR(BusInterruptVector);
-#else
- *Irql = (KIRQL)(PROFILE_LEVEL - BusInterruptVector);
+ ULONG Vector = IRQ2VECTOR(BusInterruptVector);
+ *Irql = VECTOR2IRQL(Vector);
*Affinity = 0xFFFFFFFF;
- return BusInterruptVector;
-#endif
+ return Vector;
}
reactos/ntoskrnl/ke/i386
diff -u -r1.51 -r1.52
--- irq.c 31 Oct 2004 23:57:15 -0000 1.51
+++ irq.c 1 Nov 2004 14:37:19 -0000 1.52
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: irq.c,v 1.51 2004/10/31 23:57:15 navaraf Exp $
+/* $Id: irq.c,v 1.52 2004/11/01 14:37:19 hbirr Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/i386/irq.c
@@ -40,9 +40,7 @@
#include <../dbg/kdb.h>
#endif /* KDBG */
-#ifdef MP
-#include <internal/hal/mps.h>
-#endif /* MP */
+#include <../hal/halx86/include/halirq.h>
#define NDEBUG
#include <internal/debug.h>
@@ -51,18 +49,6 @@
#ifdef MP
-/*
- * FIXME: This does not work if we have more than 24 IRQs (ie. more than one
- * I/O APIC)
- */
-#define VECTOR2IRQ(vector) (((vector) - FIRST_DEVICE_VECTOR) / 8)
-#define IRQ2VECTOR(vector) ((vector * 8) + FIRST_DEVICE_VECTOR)
-#define VECTOR2IRQL(vector) (DISPATCH_LEVEL /* 2 */ + 1 + VECTOR2IRQ(vector))
-
-
-#define IRQ_BASE 0x30
-#define NR_IRQS 0x100 - IRQ_BASE
-
#define __STR(x) #x
#define STR(x) __STR(x)
@@ -152,9 +138,6 @@
#else /* MP */
-#define NR_IRQS (16)
-#define IRQ_BASE (0x40)
-
void irq_handler_0(void);
void irq_handler_1(void);
void irq_handler_2(void);
@@ -217,21 +200,6 @@
{
int i;
-#ifdef MP
-
- /*
- * Setup the IDT entries to point to the interrupt handlers
- */
- for (i=0;i<NR_IRQS;i++)
- {
- KiIdt[IRQ_BASE+i].a=(irq_handler[i]&0xffff)+(KERNEL_CS<<16);
- KiIdt[IRQ_BASE+i].b=(irq_handler[i]&0xffff0000)+PRESENT+
- I486_INTERRUPT_GATE;
- InitializeListHead(&isr_table[i]);
- }
-
-#else
-
/*
* Setup the IDT entries to point to the interrupt handlers
*/
@@ -242,14 +210,11 @@
I486_INTERRUPT_GATE;
InitializeListHead(&isr_table[i]);
}
-
-#endif
-
}
-VOID
+STATIC VOID
KeIRQTrapFrameToTrapFrame(PKIRQ_TRAPFRAME IrqTrapFrame,
- PKTRAP_FRAME TrapFrame)
+ PKTRAP_FRAME TrapFrame)
{
TrapFrame->Gs = (USHORT)IrqTrapFrame->Gs;
TrapFrame->Fs = (USHORT)IrqTrapFrame->Fs;
@@ -268,9 +233,9 @@
TrapFrame->Eflags = IrqTrapFrame->Eflags;
}
-VOID
+STATIC VOID
KeTrapFrameToIRQTrapFrame(PKTRAP_FRAME TrapFrame,
- PKIRQ_TRAPFRAME IrqTrapFrame)
+ PKIRQ_TRAPFRAME IrqTrapFrame)
{
IrqTrapFrame->Gs = TrapFrame->Gs;
IrqTrapFrame->Fs = TrapFrame->Fs;
@@ -307,10 +272,10 @@
/*
* Iterate the list until one of the isr tells us its device interrupted
*/
- current = isr_table[vector].Flink;
+ current = isr_table[vector - IRQ_BASE].Flink;
isr = CONTAINING_RECORD(current,KINTERRUPT,Entry);
- while (current != &isr_table[vector] &&
+ while (current != &isr_table[vector - IRQ_BASE] &&
!isr->ServiceRoutine(isr, isr->ServiceContext))
{
current = current->Flink;
@@ -318,79 +283,8 @@
}
}
-#ifdef MP
-
-VOID
-KiInterruptDispatch (ULONG Vector, PKIRQ_TRAPFRAME Trapframe)
-/*
- * FUNCTION: Calls the irq specific handler for an irq
- * ARGUMENTS:
- * Vector = Interrupt vector
- * Trapframe = CPU context
- * NOTES: Interrupts are disabled at this point.
- */
-{
- KIRQL old_level;
- KTRAP_FRAME KernelTrapFrame;
-
- DbgPrint("V(0x%.02x)", Vector);
-
- /*
- * Notify the rest of the kernel of the raised irq level
- */
- if (!HalBeginSystemInterrupt (Vector,
- VECTOR2IRQL(Vector),
- &old_level))
- {
- return;
- }
-
- /*
- * Mask the related irq
- */
- //HalDisableSystemInterrupt (Vector, 0);
-
- /*
- * Enable interrupts
- * NOTE: Only higher priority interrupts will get through
- */
- Ke386EnableInterrupts();
-
- if (Vector == 0)
- {
- KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
- KeUpdateSystemTime(&KernelTrapFrame, PROFILE_LEVEL);
- }
- else
- {
- /*
- * Actually call the ISR.
- */
- KiInterruptDispatch2(Vector, old_level);
- }
-
- /*
- * Disable interrupts
- */
- Ke386DisableInterrupts();
-
- /*
- * Unmask the related irq
- */
- //HalEnableSystemInterrupt (Vector, 0, 0);
-
- //DbgPrint("E(0x%.02x)\n", Vector);
-
- /*
- * End the system interrupt.
- */
- HalEndSystemInterrupt (old_level, 0);
-}
-
-#else /* MP */
-
VOID
-KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
+KiInterruptDispatch (ULONG vector, PKIRQ_TRAPFRAME Trapframe)
/*
* FUNCTION: Calls the irq specific handler for an irq
* ARGUMENTS:
@@ -413,8 +307,8 @@
* Notify the rest of the kernel of the raised irq level. For the
* default HAL this will send an EOI to the PIC and alter the IRQL.
*/
- if (!HalBeginSystemInterrupt (irq + IRQ_BASE,
- (KIRQL)(PROFILE_LEVEL - irq),
+ if (!HalBeginSystemInterrupt (vector,
+ VECTOR2IRQL(vector),
&old_level))
{
return;
@@ -427,21 +321,22 @@
*/
Ke386EnableInterrupts();
-
- if (irq == 0)
+#ifndef MP
+ if (VECTOR2IRQ(vector) == 0)
{
KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
- KeUpdateSystemTime(&KernelTrapFrame, PROFILE_LEVEL);
+ KeUpdateSystemTime(&KernelTrapFrame, old_level);
#ifdef KDBG
KdbProfileInterrupt(Trapframe->Eip);
#endif /* KDBG */
}
else
+#endif
{
/*
* Actually call the ISR.
*/
- KiInterruptDispatch2(irq, old_level);
+ KiInterruptDispatch2(vector, old_level);
}
/*
@@ -480,8 +375,6 @@
}
}
-#endif /* MP */
-
static VOID
KeDumpIrqList(VOID)
{
@@ -519,6 +412,12 @@
Vector = InterruptObject->Vector;
+ if (Vector < IRQ_BASE && Vector >= IRQ_BASE + NR_IRQS)
+ {
+ return STATUS_INVALID_PARAMETER;
+ }
+ Vector -= IRQ_BASE;
+
/*
* Acquire the table spinlock
*/
@@ -549,11 +448,7 @@
DPRINT("%x %x\n",isr_table[Vector].Flink,isr_table[Vector].Blink);
if (IsListEmpty(&isr_table[Vector]))
{
-#ifdef MP
- HalEnableSystemInterrupt(Vector, 0, 0);
-#else
- HalEnableSystemInterrupt(Vector + IRQ_BASE, 0, 0);
-#endif
+ HalEnableSystemInterrupt(Vector + IRQ_BASE, 0, 0);
}
InsertTailList(&isr_table[Vector],&InterruptObject->Entry);
DPRINT("%x %x\n",InterruptObject->Entry.Flink,
@@ -588,13 +483,9 @@
KeRaiseIrql(InterruptObject->SynchLevel,&oldlvl);
KiAcquireSpinLock(InterruptObject->IrqLock);
RemoveEntryList(&InterruptObject->Entry);
- if (IsListEmpty(&isr_table[InterruptObject->Vector]))
+ if (IsListEmpty(&isr_table[InterruptObject->Vector - IRQ_BASE]))
{
-#ifdef MP
- HalDisableSystemInterrupt(InterruptObject->Vector, 0);
-#else
- HalDisableSystemInterrupt(InterruptObject->Vector + IRQ_BASE, 0);
-#endif
+ HalDisableSystemInterrupt(InterruptObject->Vector, 0);
}
KiReleaseSpinLock(InterruptObject->IrqLock);
KeLowerIrql(oldlvl);
@@ -683,7 +574,7 @@
/*
* Check the parameters
*/
- if (Vector >= NR_IRQS)
+ if (Vector < IRQ_BASE || Vector >= NR_IRQS + IRQ_BASE)
{
return(STATUS_INVALID_PARAMETER);
}
reactos/ntoskrnl/ke/i386
diff -u -r1.8 -r1.9
--- irqhand.s 31 Oct 2004 19:46:10 -0000 1.8
+++ irqhand.s 1 Nov 2004 14:37:19 -0000 1.9
@@ -1,5 +1,6 @@
#include <internal/i386/segment.h>
+#include <../hal/halx86/include/halirq.h>
.global _irq_handler_0
_irq_handler_0:
@@ -18,7 +19,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $0
+ pushl $(IRQ_BASE + 0)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -47,7 +48,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $1
+ pushl $(IRQ_BASE + 1)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -76,7 +77,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $2
+ pushl $(IRQ_BASE + 2)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -105,7 +106,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $3
+ pushl $(IRQ_BASE + 3)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -134,7 +135,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $4
+ pushl $(IRQ_BASE + 4)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -163,7 +164,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $5
+ pushl $(IRQ_BASE + 5)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -192,7 +193,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $6
+ pushl $(IRQ_BASE + 6)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -221,7 +222,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $7
+ pushl $(IRQ_BASE + 7)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -250,7 +251,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $8
+ pushl $(IRQ_BASE + 8)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -279,7 +280,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $9
+ pushl $(IRQ_BASE + 9)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -308,7 +309,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $10
+ pushl $(IRQ_BASE + 10)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -337,7 +338,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $11
+ pushl $(IRQ_BASE + 11)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -366,7 +367,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $12
+ pushl $(IRQ_BASE + 12)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -395,7 +396,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $13
+ pushl $(IRQ_BASE + 13)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -424,7 +425,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $14
+ pushl $(IRQ_BASE + 14)
call _KiInterruptDispatch
popl %eax
popl %eax
@@ -453,7 +454,7 @@
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
- pushl $15
+ pushl $(IRQ_BASE + 15)
call _KiInterruptDispatch
popl %eax
popl %eax
CVSspam 0.2.8