[HALX86/APIC] Use physical addressing in HalEnableSystemInterrupt

This commit is contained in:
Timo Kreuzer 2023-11-25 08:15:18 +01:00
parent f1f01771b6
commit faaac75546

View file

@ -675,7 +675,6 @@ HalEnableSystemInterrupt(
IN KINTERRUPT_MODE InterruptMode) IN KINTERRUPT_MODE InterruptMode)
{ {
IOAPIC_REDIRECTION_REGISTER ReDirReg; IOAPIC_REDIRECTION_REGISTER ReDirReg;
PKPRCB Prcb = KeGetCurrentPrcb();
UCHAR Index; UCHAR Index;
ASSERT(Irql <= HIGH_LEVEL); ASSERT(Irql <= HIGH_LEVEL);
ASSERT((IrqlToTpr(Irql) & 0xF0) == (Vector & 0xF0)); ASSERT((IrqlToTpr(Irql) & 0xF0) == (Vector & 0xF0));
@ -693,26 +692,21 @@ HalEnableSystemInterrupt(
/* Read the redirection entry */ /* Read the redirection entry */
ReDirReg = ApicReadIORedirectionEntry(Index); ReDirReg = ApicReadIORedirectionEntry(Index);
/* Check if the interrupt was unused */ /* Check if the interrupt is already enabled */
if (ReDirReg.Vector != Vector) if (ReDirReg.Mask == FALSE)
{ {
ReDirReg.Vector = Vector; /* If the vector matches, there is nothing more to do,
ReDirReg.MessageType = APIC_MT_LowestPriority; otherwise something is wrong. */
ReDirReg.DestinationMode = APIC_DM_Logical; return (ReDirReg.Vector == Vector);
ReDirReg.Destination = 0;
} }
/* Check if the destination is logical */ /* Set up the redirection entry */
if (ReDirReg.DestinationMode == APIC_DM_Logical) ReDirReg.Vector = Vector;
{ ReDirReg.MessageType = APIC_MT_Fixed;
/* Set the bit for this cpu */ ReDirReg.DestinationMode = APIC_DM_Physical;
ReDirReg.Destination |= ApicLogicalId(Prcb->Number); ReDirReg.Destination = KeGetCurrentPrcb()->InitialApicId;
} ReDirReg.TriggerMode = (InterruptMode == LevelSensitive) ?
APIC_TGM_Level : APIC_TGM_Edge;
/* Set the trigger mode */
ReDirReg.TriggerMode = 1 - InterruptMode;
/* Now unmask it */
ReDirReg.Mask = FALSE; ReDirReg.Mask = FALSE;
/* Write back the entry */ /* Write back the entry */