Implement per-processor local clock initialization

This commit is contained in:
2026-05-19 09:45:17 +02:00
parent 19092eda2e
commit 6e4f0ba6e4
2 changed files with 32 additions and 0 deletions

View File

@@ -447,6 +447,37 @@ HL::Timer::InitializeHpetTimer(VOID)
return STATUS_SUCCESS;
}
/**
* Initializes the local hardware clock for the executing processor and registers
* the necessary clock interrupt handlers.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
HL::Timer::InitializeLocalClock(VOID)
{
XTSTATUS Status;
/* Check if LAPIC timer was selected as the system clock */
if(ClockType == TimerLapic && TimerRoutines.InitializeClock != NULLPTR)
{
/* Proceed with system clock initialization */
Status = TimerRoutines.InitializeClock();
if(Status != STATUS_SUCCESS)
{
/* CPU cannot operate without a functional system clock interrupt */
KE::Crash::Panic(0);
}
}
/* Register the system clock interrupt handler */
HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_CLOCK, HL::Timer::HandleClockInterrupt);
HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_CLOCK_IPI, HL::Timer::HandleClockIpiInterrupt);
}
/**
* Initializes the legacy Programmable Interval Timer (PIT).
*