mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[HAL/APIC] Fix clock initialization
Previously we enabled the timer interrupt, before the kernel was notified of our time increment, so when a clock interrupt happened, it would increment the tick count, but add 0 to the system time, resulting in an invalid state, in which timers would be inserted into the wrong timer table slot. Fixes CORE-16253
This commit is contained in:
parent
aedb97df47
commit
aa3ef4c632
2 changed files with 4 additions and 2 deletions
|
@ -463,12 +463,12 @@ ApicInitializeIOApic(VOID)
|
||||||
HalpVectorToIndex[Vector] = APIC_FREE_VECTOR;
|
HalpVectorToIndex[Vector] = APIC_FREE_VECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable the timer interrupt */
|
/* Enable the timer interrupt (but keep it masked) */
|
||||||
ReDirReg.Vector = APIC_CLOCK_VECTOR;
|
ReDirReg.Vector = APIC_CLOCK_VECTOR;
|
||||||
ReDirReg.DeliveryMode = APIC_MT_Fixed;
|
ReDirReg.DeliveryMode = APIC_MT_Fixed;
|
||||||
ReDirReg.DestinationMode = APIC_DM_Physical;
|
ReDirReg.DestinationMode = APIC_DM_Physical;
|
||||||
ReDirReg.TriggerMode = APIC_TGM_Edge;
|
ReDirReg.TriggerMode = APIC_TGM_Edge;
|
||||||
ReDirReg.Mask = 0;
|
ReDirReg.Mask = 1;
|
||||||
ReDirReg.Destination = ApicRead(APIC_ID);
|
ReDirReg.Destination = ApicRead(APIC_ID);
|
||||||
ApicWriteIORedirectionEntry(APIC_CLOCK_INDEX, ReDirReg);
|
ApicWriteIORedirectionEntry(APIC_CLOCK_INDEX, ReDirReg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,8 @@ HalpInitializeClock(VOID)
|
||||||
KeSetTimeIncrement(RtcClockRateToIncrement(RtcMaximumClockRate),
|
KeSetTimeIncrement(RtcClockRateToIncrement(RtcMaximumClockRate),
|
||||||
RtcClockRateToIncrement(RtcMinimumClockRate));
|
RtcClockRateToIncrement(RtcMinimumClockRate));
|
||||||
|
|
||||||
|
/* Enable the timer interrupt */
|
||||||
|
HalEnableSystemInterrupt(APIC_CLOCK_VECTOR, CLOCK_LEVEL, Latched);
|
||||||
|
|
||||||
DPRINT1("Clock initialized\n");
|
DPRINT1("Clock initialized\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue