From 81fdf1f77acae64b9373be5c664bf2e4ee1102a7 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Thu, 4 Jun 2026 11:51:01 +0200 Subject: [PATCH] Allocate executive thread structure for idle thread and assign PRCB pointers --- xtoskrnl/ke/amd64/krnlinit.cc | 11 ++++++----- xtoskrnl/ke/i686/krnlinit.cc | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/xtoskrnl/ke/amd64/krnlinit.cc b/xtoskrnl/ke/amd64/krnlinit.cc index 45f6637..d7dbc22 100644 --- a/xtoskrnl/ke/amd64/krnlinit.cc +++ b/xtoskrnl/ke/amd64/krnlinit.cc @@ -27,7 +27,7 @@ KE::KernelInit::BootstrapApplicationProcessor(IN PPROCESSOR_START_BLOCK StartBlo { PKPROCESSOR_CONTROL_BLOCK ControlBlock; PKPROCESS IdleProcess; - PKTHREAD IdleThread; + PETHREAD IdleThread; /* Initialize application CPU */ AR::ProcessorSupport::InitializeProcessor(StartBlock->ProcessorStructures); @@ -60,13 +60,14 @@ KE::KernelInit::BootstrapApplicationProcessor(IN PPROCESSOR_START_BLOCK StartBlo HL::Timer::InitializeLocalClock(); /* Allocate and wipe memory for Idle thread */ - MM::Allocator::AllocatePool(NonPagedPool, sizeof(KTHREAD), (PVOID *)&IdleThread); - RTL::Memory::ZeroMemory(IdleThread, sizeof(KTHREAD)); + MM::Allocator::AllocatePool(NonPagedPool, sizeof(ETHREAD), (PVOID *)&IdleThread); + RTL::Memory::ZeroMemory(IdleThread, sizeof(ETHREAD)); /* Initialize Idle thread */ IdleProcess = KE::KProcess::GetIdleProcess(); - ControlBlock->CurrentThread = IdleThread; - KE::KThread::InitializeIdleThread(IdleProcess, IdleThread, ControlBlock, StartBlock->Stack); + ControlBlock->CurrentThread = &IdleThread->ThreadControlBlock; + ControlBlock->IdleThread = &IdleThread->ThreadControlBlock; + KE::KThread::InitializeIdleThread(IdleProcess, &IdleThread->ThreadControlBlock, ControlBlock, StartBlock->Stack); /* Register DISPATCH interrupt handler */ HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_DPC, KE::Dispatcher::HandleDispatchInterrupt); diff --git a/xtoskrnl/ke/i686/krnlinit.cc b/xtoskrnl/ke/i686/krnlinit.cc index cacdbe6..0092aa9 100644 --- a/xtoskrnl/ke/i686/krnlinit.cc +++ b/xtoskrnl/ke/i686/krnlinit.cc @@ -27,7 +27,7 @@ KE::KernelInit::BootstrapApplicationProcessor(IN PPROCESSOR_START_BLOCK StartBlo { PKPROCESSOR_CONTROL_BLOCK ControlBlock; PKPROCESS IdleProcess; - PKTHREAD IdleThread; + PETHREAD IdleThread; /* Initialize application CPU */ AR::ProcessorSupport::InitializeProcessor(StartBlock->ProcessorStructures); @@ -60,13 +60,14 @@ KE::KernelInit::BootstrapApplicationProcessor(IN PPROCESSOR_START_BLOCK StartBlo HL::Timer::InitializeLocalClock(); /* Allocate and wipe memory for Idle thread */ - MM::Allocator::AllocatePool(NonPagedPool, sizeof(KTHREAD), (PVOID *)&IdleThread); - RTL::Memory::ZeroMemory(IdleThread, sizeof(KTHREAD)); + MM::Allocator::AllocatePool(NonPagedPool, sizeof(ETHREAD), (PVOID *)&IdleThread); + RTL::Memory::ZeroMemory(IdleThread, sizeof(ETHREAD)); /* Initialize Idle thread */ IdleProcess = KE::KProcess::GetIdleProcess(); - ControlBlock->CurrentThread = IdleThread; - KE::KThread::InitializeIdleThread(IdleProcess, IdleThread, ControlBlock, StartBlock->Stack); + ControlBlock->CurrentThread = &IdleThread->ThreadControlBlock; + ControlBlock->IdleThread = &IdleThread->ThreadControlBlock; + KE::KThread::InitializeIdleThread(IdleProcess, &IdleThread->ThreadControlBlock, ControlBlock, StartBlock->Stack); /* Register DISPATCH interrupt handler */ HL::Irq::RegisterSystemInterruptHandler(APIC_VECTOR_DPC, KE::Dispatcher::HandleDispatchInterrupt);