Author: tkreuzer
Date: Fri Jan 20 16:32:43 2012
New Revision: 55014
URL:
http://svn.reactos.org/svn/reactos?rev=55014&view=rev
Log:
[HAL]
- Implement IrqlToSoftVector() macro and use it in HalRequestSoftwareInterrupt, so that on
amd64 the correct interrupt is triggered.
- Really start at the lowest vector for the IRQL in HalpAllocateSystemInterrupt
- Small code refactoring
Modified:
trunk/reactos/hal/halx86/apic/apic.c
trunk/reactos/hal/halx86/apic/apic.h
Modified: trunk/reactos/hal/halx86/apic/apic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/apic/apic.c?rev…
==============================================================================
--- trunk/reactos/hal/halx86/apic/apic.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/apic/apic.c [iso-8859-1] Fri Jan 20 16:32:43 2012
@@ -186,7 +186,7 @@
VOID
FORCEINLINE
-ApicRaiseIrql(KIRQL Irql)
+ApicSetIrql(KIRQL Irql)
{
#ifdef _M_AMD64
__writecr8(Irql);
@@ -197,14 +197,13 @@
ApicWrite(APIC_TPR, IrqlToTpr(Irql));
#endif
}
-
+#define ApicRaiseIrql ApicSetIrql
+
+#ifdef APIC_LAZY_IRQL
VOID
FORCEINLINE
ApicLowerIrql(KIRQL Irql)
{
-#ifdef _M_AMD64
- __writecr8(Irql);
-#elif defined(APIC_LAZY_IRQL)
__writefsbyte(FIELD_OFFSET(KPCR, Irql), Irql);
/* Is the new Irql lower than set in the TPR? */
@@ -216,11 +215,10 @@
/* Need to lower it back */
ApicWrite(APIC_TPR, IrqlToTpr(Irql));
}
+}
#else
- /* Convert IRQL and write the TPR */
- ApicWrite(APIC_TPR, IrqlToTpr(Irql));
-#endif
-}
+#define ApicLowerIrql ApicSetIrql
+#endif
UCHAR
FASTCALL
@@ -394,7 +392,7 @@
ApicWrite(APIC_ERRLVTR, LvtEntry.Long);
/* Set the IRQL from the PCR */
- ApicWrite(APIC_TPR, IrqlToTpr(KeGetPcr()->Irql));
+ ApicSetIrql(KeGetPcr()->Irql);
#ifdef APIC_LAZY_IRQL
/* Save the new hard IRQL in the IRR field */
KeGetPcr()->IRR = KeGetPcr()->Irql;
@@ -410,8 +408,8 @@
IOAPIC_REDIRECTION_REGISTER ReDirReg;
IN UCHAR Vector;
- /* Start with low vector */
- Vector = IrqlToTpr(Irql);
+ /* Start with lowest vector */
+ Vector = IrqlToTpr(Irql) & 0xF0;
/* Find an empty vector */
while (HalpVectorToIndex[Vector] != 0xFF)
@@ -653,7 +651,7 @@
HalRequestSoftwareInterrupt(IN KIRQL Irql)
{
/* Convert irql to vector and request an interrupt */
- ApicRequestInterrupt(IrqlToTpr(Irql), APIC_TGM_Edge);
+ ApicRequestInterrupt(IrqlToSoftVector(Irql), APIC_TGM_Edge);
}
VOID
Modified: trunk/reactos/hal/halx86/apic/apic.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/apic/apic.h?rev…
==============================================================================
--- trunk/reactos/hal/halx86/apic/apic.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/apic/apic.h [iso-8859-1] Fri Jan 20 16:32:43 2012
@@ -14,6 +14,7 @@
#define APIC_PROFILE_VECTOR 0xFD // IRQL 31
#define APIC_NMI_VECTOR 0xFF
#define IrqlToTpr(Irql) (Irql << 4)
+#define IrqlToSoftVector(Irql) ((Irql << 4)|0xf)
#define TprToIrql(Tpr) ((KIRQL)(Tpr >> 4))
#define CLOCK2_LEVEL CLOCK_LEVEL
#else
@@ -31,6 +32,7 @@
#define APIC_PROFILE_VECTOR 0xFD // IRQL 31
#define APIC_NMI_VECTOR 0xFF
#define IrqlToTpr(Irql) (HalpIRQLtoTPR[Irql])
+#define IrqlToSoftVector(Irql) IrqlToTpr(Irql)
#define TprToIrql(Tpr) (HalVectorToIRQL[Tpr >> 4])
#endif