fixed DPC and APC calling code

svn path=/trunk/; revision=856
This commit is contained in:
Phillip Susi 1999-12-11 17:31:16 +00:00
parent e0e40991af
commit 14ac854378

View file

@ -47,6 +47,8 @@ static unsigned int HiSetCurrentPICMask(unsigned int mask)
return mask; return mask;
} }
extern VOID KeApcProlog2();
static VOID HiSwitchIrql(KIRQL oldIrql) static VOID HiSwitchIrql(KIRQL oldIrql)
/* /*
* FUNCTION: Switches to the current irql * FUNCTION: Switches to the current irql
@ -83,22 +85,27 @@ static VOID HiSwitchIrql(KIRQL oldIrql)
__asm__("sti\n\t"); __asm__("sti\n\t");
return; return;
} }
if (CurrentIrql == APC_LEVEL)
{
HiSetCurrentPICMask(0); HiSetCurrentPICMask(0);
__asm__("sti\n\t"); if(CurrentIrql == APC_LEVEL)
return; {
} if (DpcQueueSize > 0 )
{
KeSetCurrentIrql(DISPATCH_LEVEL);
__asm__("sti\n\t");
KeDrainDpcQueue();
__asm__("cli\n\t");
KeSetCurrentIrql(PASSIVE_LEVEL);
}
__asm__("sti\n\t");
return;
}
if( CurrentIrql == PASSIVE_LEVEL && CurrentThread->ApcState.KernelApcPending )
{
KeSetCurrentIrql( APC_LEVEL );
KeApcProlog2();
KeSetCurrentIrql( PASSIVE_LEVEL );
}
HiSetCurrentPICMask(0);
if (DpcQueueSize > 0 && oldIrql >= DISPATCH_LEVEL)
{
KeSetCurrentIrql(DISPATCH_LEVEL);
__asm__("sti\n\t");
KeDrainDpcQueue();
__asm__("cli\n\t");
KeSetCurrentIrql(PASSIVE_LEVEL);
}
__asm__("sti\n\t"); __asm__("sti\n\t");
} }