mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[HALX86]
- Do not allow software interrupts to preempt code running with interrupts disabled during KfLowerIrql svn path=/trunk/; revision=54418
This commit is contained in:
parent
01323f857e
commit
aefaa2f4f9
1 changed files with 21 additions and 17 deletions
|
@ -665,26 +665,30 @@ KfLowerIrql(IN KIRQL OldIrql)
|
|||
|
||||
/* Set old IRQL */
|
||||
Pcr->Irql = OldIrql;
|
||||
|
||||
/* Check for pending software interrupts and compare with current IRQL */
|
||||
PendingIrqlMask = Pcr->IRR & FindHigherIrqlMask[OldIrql];
|
||||
if (PendingIrqlMask)
|
||||
|
||||
/* Make sure interrupts were enabled */
|
||||
if (EFlags & EFLAGS_INTERRUPT_MASK)
|
||||
{
|
||||
/* Check if pending IRQL affects hardware state */
|
||||
BitScanReverse(&PendingIrql, PendingIrqlMask);
|
||||
if (PendingIrql > DISPATCH_LEVEL)
|
||||
/* Check for pending software interrupts and compare with current IRQL */
|
||||
PendingIrqlMask = Pcr->IRR & FindHigherIrqlMask[OldIrql];
|
||||
if (PendingIrqlMask)
|
||||
{
|
||||
/* Set new PIC mask */
|
||||
Mask.Both = Pcr->IDR;
|
||||
__outbyte(PIC1_DATA_PORT, Mask.Master);
|
||||
__outbyte(PIC2_DATA_PORT, Mask.Slave);
|
||||
|
||||
/* Clear IRR bit */
|
||||
Pcr->IRR ^= (1 << PendingIrql);
|
||||
/* Check if pending IRQL affects hardware state */
|
||||
BitScanReverse(&PendingIrql, PendingIrqlMask);
|
||||
if (PendingIrql > DISPATCH_LEVEL)
|
||||
{
|
||||
/* Set new PIC mask */
|
||||
Mask.Both = Pcr->IDR;
|
||||
__outbyte(PIC1_DATA_PORT, Mask.Master);
|
||||
__outbyte(PIC2_DATA_PORT, Mask.Slave);
|
||||
|
||||
/* Clear IRR bit */
|
||||
Pcr->IRR ^= (1 << PendingIrql);
|
||||
}
|
||||
|
||||
/* Now handle pending interrupt */
|
||||
SWInterruptHandlerTable[PendingIrql]();
|
||||
}
|
||||
|
||||
/* Now handle pending interrupt */
|
||||
SWInterruptHandlerTable[PendingIrql]();
|
||||
}
|
||||
|
||||
/* Restore interrupt state */
|
||||
|
|
Loading…
Reference in a new issue