[HAL] Fix compiler preprocessor checks for the IRQL masks so other compilers than GCC get proper entries too.

[HAL] Define the HalpHardwareInterrupt macro for MSVC too.
[HAL] Replace IRQL_DEBUG with DBG so we always check for incorrect IRQL on debug. I believe incorrect IRQL raise/lower is a common and serious enough error to always be checked for on debug builds without defining some special debug option.

svn path=/trunk/; revision=47519
This commit is contained in:
Stefan Ginsberg 2010-06-02 13:59:47 +00:00
parent ebed05d2d4
commit f1f3d045d4

View file

@ -94,8 +94,8 @@ PHAL_DISMISS_INTERRUPT HalpSpecialDismissLevelTable[16] =
/* This table contains the static x86 PIC mapping between IRQLs and IRQs */ /* This table contains the static x86 PIC mapping between IRQLs and IRQs */
ULONG KiI8259MaskTable[32] = ULONG KiI8259MaskTable[32] =
{ {
#ifdef __GNUC__ #if defined(__GNUC__) && \
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 404 (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)
/* /*
* It Device IRQLs only start at 4 or higher, so these are just software * It Device IRQLs only start at 4 or higher, so these are just software
* IRQLs that don't really change anything on the hardware * IRQLs that don't really change anything on the hardware
@ -206,14 +206,13 @@ ULONG KiI8259MaskTable[32] =
0xFFFFFFFB, /* IRQL 30 */ 0xFFFFFFFB, /* IRQL 30 */
0xFFFFFFFB /* IRQL 31 */ 0xFFFFFFFB /* IRQL 31 */
#endif #endif
#endif
}; };
/* This table indicates which IRQs, if pending, can preempt a given IRQL level */ /* This table indicates which IRQs, if pending, can preempt a given IRQL level */
ULONG FindHigherIrqlMask[32] = ULONG FindHigherIrqlMask[32] =
{ {
#ifdef __GNUC__ #if defined(__GNUC__) && \
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 404 (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)
/* /*
* Software IRQLs, at these levels all hardware interrupts can preempt. * Software IRQLs, at these levels all hardware interrupts can preempt.
* Each higher IRQL simply enables which software IRQL can preempt the * Each higher IRQL simply enables which software IRQL can preempt the
@ -313,7 +312,6 @@ ULONG FindHigherIrqlMask[32] =
0, /* IRQL 30 */ 0, /* IRQL 30 */
0 /* IRQL 31 */ 0 /* IRQL 31 */
#endif #endif
#endif
}; };
/* Denotes minimum required IRQL before we can process pending SW interrupts */ /* Denotes minimum required IRQL before we can process pending SW interrupts */
@ -329,6 +327,8 @@ KIRQL SWInterruptLookUpTable[8] =
DISPATCH_LEVEL /* IRR 7 */ DISPATCH_LEVEL /* IRR 7 */
}; };
#if defined(__GNUC__)
#define HalpDelayedHardwareInterrupt(x) \ #define HalpDelayedHardwareInterrupt(x) \
VOID HalpHardwareInterrupt##x(VOID); \ VOID HalpHardwareInterrupt##x(VOID); \
VOID \ VOID \
@ -337,6 +337,23 @@ KIRQL SWInterruptLookUpTable[8] =
asm volatile ("int $%c0\n"::"i"(PRIMARY_VECTOR_BASE + x)); \ asm volatile ("int $%c0\n"::"i"(PRIMARY_VECTOR_BASE + x)); \
} }
#elif defined(_MSC_VER)
#define HalpDelayedHardwareInterrupt(x) \
VOID HalpHardwareInterrupt##x(VOID); \
VOID \
HalpHardwareInterrupt##x(VOID) \
{ \
__asm \
{ \
int PRIMARY_VECTOR_BASE + x \
} \
}
#else
#error Unsupported compiler
#endif
/* Pending/delayed hardware interrupt handlers */ /* Pending/delayed hardware interrupt handlers */
HalpDelayedHardwareInterrupt(0); HalpDelayedHardwareInterrupt(0);
HalpDelayedHardwareInterrupt(1); HalpDelayedHardwareInterrupt(1);
@ -522,7 +539,7 @@ KeRaiseIrqlToDpcLevel(VOID)
CurrentIrql = Pcr->Irql; CurrentIrql = Pcr->Irql;
Pcr->Irql = DISPATCH_LEVEL; Pcr->Irql = DISPATCH_LEVEL;
#ifdef IRQL_DEBUG #if DBG
/* Validate correct raise */ /* Validate correct raise */
if (CurrentIrql > DISPATCH_LEVEL) KeBugCheck(IRQL_NOT_GREATER_OR_EQUAL); if (CurrentIrql > DISPATCH_LEVEL) KeBugCheck(IRQL_NOT_GREATER_OR_EQUAL);
#endif #endif
@ -545,7 +562,7 @@ KeRaiseIrqlToSynchLevel(VOID)
CurrentIrql = Pcr->Irql; CurrentIrql = Pcr->Irql;
Pcr->Irql = SYNCH_LEVEL; Pcr->Irql = SYNCH_LEVEL;
#ifdef IRQL_DEBUG #if DBG
/* Validate correct raise */ /* Validate correct raise */
if (CurrentIrql > SYNCH_LEVEL) if (CurrentIrql > SYNCH_LEVEL)
{ {
@ -575,7 +592,7 @@ KfRaiseIrql(IN KIRQL NewIrql)
/* Read current IRQL */ /* Read current IRQL */
CurrentIrql = Pcr->Irql; CurrentIrql = Pcr->Irql;
#ifdef IRQL_DEBUG #if DBG
/* Validate correct raise */ /* Validate correct raise */
if (CurrentIrql > NewIrql) if (CurrentIrql > NewIrql)
{ {
@ -605,7 +622,7 @@ KfLowerIrql(IN KIRQL OldIrql)
PKPCR Pcr = KeGetPcr(); PKPCR Pcr = KeGetPcr();
PIC_MASK Mask; PIC_MASK Mask;
#ifdef IRQL_DEBUG #if DBG
/* Validate correct lower */ /* Validate correct lower */
if (OldIrql > Pcr->Irql) if (OldIrql > Pcr->Irql)
{ {