Register dispatch interrupt handler
All checks were successful
Builds / ExectOS (i686, debug) (push) Successful in 31s
Builds / ExectOS (amd64, debug) (push) Successful in 32s
Builds / ExectOS (i686, release) (push) Successful in 52s
Builds / ExectOS (amd64, release) (push) Successful in 54s

This commit is contained in:
2026-05-28 23:50:02 +02:00
parent addf9addab
commit 5a5604c35d
4 changed files with 32 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ namespace KE
{ {
public: public:
STATIC XTFASTCALL VOID ExitDispatcher(IN KRUNLEVEL OldRunLevel); STATIC XTFASTCALL VOID ExitDispatcher(IN KRUNLEVEL OldRunLevel);
STATIC XTCDECL VOID HandleDispatchInterrupt(IN PKTRAP_FRAME TrapFrame);
STATIC XTFASTCALL BOOLEAN SwitchContext(IN PKTHREAD CurrentThread, STATIC XTFASTCALL BOOLEAN SwitchContext(IN PKTHREAD CurrentThread,
IN KRUNLEVEL RunLevel); IN KRUNLEVEL RunLevel);
STATIC XTAPI VOID UpdateRunTime(IN PKTRAP_FRAME TrapFrame, STATIC XTAPI VOID UpdateRunTime(IN PKTRAP_FRAME TrapFrame,

View File

@@ -57,6 +57,9 @@ KE::KernelInit::BootstrapApplicationProcessor(IN PPROCESSOR_START_BLOCK StartBlo
/* Initialize local clock for this CPU */ /* Initialize local clock for this CPU */
HL::Timer::InitializeLocalClock(); HL::Timer::InitializeLocalClock();
/* Register DISPATCH interrupt handler */
HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_DPC, KE::Dispatcher::HandleDispatchInterrupt);
/* Enter infinite loop */ /* Enter infinite loop */
DebugPrint(L"KernelInit::BootstrapApplicationProcessor() finished for CPU #%lu. Entering infinite loop.\n", DebugPrint(L"KernelInit::BootstrapApplicationProcessor() finished for CPU #%lu. Entering infinite loop.\n",
ControlBlock->CpuNumber); ControlBlock->CpuNumber);
@@ -129,6 +132,9 @@ KE::KernelInit::BootstrapKernel(VOID)
KE::Processor::InitializeProcessorBlocks(); KE::Processor::InitializeProcessorBlocks();
HL::Cpu::StartAllProcessors(); HL::Cpu::StartAllProcessors();
/* Register DISPATCH interrupt handler */
HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_DPC, KE::Dispatcher::HandleDispatchInterrupt);
/* Enter infinite loop */ /* Enter infinite loop */
DebugPrint(L"KernelInit::BootstrapKernel() finished. Entering infinite loop.\n"); DebugPrint(L"KernelInit::BootstrapKernel() finished. Entering infinite loop.\n");
KE::Crash::HaltSystem(); KE::Crash::HaltSystem();

View File

@@ -29,6 +29,25 @@ KE::Dispatcher::ExitDispatcher(IN KRUNLEVEL OldRunLevel)
RunLevel::LowerRunLevel(OldRunLevel); RunLevel::LowerRunLevel(OldRunLevel);
} }
/**
* Handles the dispatch interrupt by retiring pending DPCs, asking the scheduler for the next runnable thread
* and performing the context switch.
*
* @param TrapFrame
* Supplies a pointer to the hardware trap frame representing the interrupted context.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
KE::Dispatcher::HandleDispatchInterrupt(IN PKTRAP_FRAME TrapFrame)
{
/* End the interrupt */
HL::Pic::SendEoi();
}
/** /**
* Updates the runtime quantum of the currently executing thread and handles preemption. * Updates the runtime quantum of the currently executing thread and handles preemption.
* *

View File

@@ -57,6 +57,9 @@ KE::KernelInit::BootstrapApplicationProcessor(IN PPROCESSOR_START_BLOCK StartBlo
/* Initialize local clock for this CPU */ /* Initialize local clock for this CPU */
HL::Timer::InitializeLocalClock(); HL::Timer::InitializeLocalClock();
/* Register DISPATCH interrupt handler */
HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_DPC, KE::Dispatcher::HandleDispatchInterrupt);
/* Enter infinite loop */ /* Enter infinite loop */
DebugPrint(L"KernelInit::BootstrapApplicationProcessor() finished for CPU #%lu. Entering infinite loop.\n", DebugPrint(L"KernelInit::BootstrapApplicationProcessor() finished for CPU #%lu. Entering infinite loop.\n",
ControlBlock->CpuNumber); ControlBlock->CpuNumber);
@@ -129,6 +132,9 @@ KE::KernelInit::BootstrapKernel(VOID)
KE::Processor::InitializeProcessorBlocks(); KE::Processor::InitializeProcessorBlocks();
HL::Cpu::StartAllProcessors(); HL::Cpu::StartAllProcessors();
/* Register DISPATCH interrupt handler */
HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_DPC, KE::Dispatcher::HandleDispatchInterrupt);
/* Enter infinite loop */ /* Enter infinite loop */
DebugPrint(L"KernelInit::BootstrapKernel() finished. Entering infinite loop.\n"); DebugPrint(L"KernelInit::BootstrapKernel() finished. Entering infinite loop.\n");
KE::Crash::HaltSystem(); KE::Crash::HaltSystem();