[NTOS:KE] Fix initialization of node block for application processors

- Initialize KeNodeBlock[0] statically
- Update Prcb->ParentNode->ProcessorMask for all processors
This commit is contained in:
Timo Kreuzer 2023-12-20 20:04:41 +02:00
parent 619ff7c429
commit 9c1cfe0587
3 changed files with 10 additions and 12 deletions

View file

@ -147,6 +147,10 @@ KiSystemStartupBootStack(VOID)
PKPROCESS Process = Thread->ApcState.Process;
PVOID KernelStack = (PVOID)KeLoaderBlock->KernelStack;
/* Set Node Data */
Prcb->ParentNode = KeNodeBlock[0];
Prcb->ParentNode->ProcessorMask |= Prcb->SetMember;
/* Initialize the Power Management Support for this PRCB */
PoInitializePrcb(Prcb);
@ -228,11 +232,6 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
PVOID DpcStack;
ULONG i;
/* Set Node Data */
KeNodeBlock[0] = &KiNode0;
Prcb->ParentNode = KeNodeBlock[0];
KeNodeBlock[0]->ProcessorMask = Prcb->SetMember;
/* Set boot-level flags */
KeFeatureBits = Prcb->FeatureBits;

View file

@ -413,7 +413,7 @@ KiVerifyCpuFeatures(PKPRCB Prcb)
Cr0 &= ~(CR0_EM | CR0_MP);
// Enable FPU exceptions.
Cr0 |= CR0_NE;
__writecr0(Cr0);
// Check for Pentium FPU bug.
@ -492,14 +492,13 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
/* Initialize spinlocks and DPC data */
KiInitSpinLocks(Prcb, Number);
/* Set Node Data */
Prcb->ParentNode = KeNodeBlock[0];
Prcb->ParentNode->ProcessorMask |= Prcb->SetMember;
/* Check if this is the Boot CPU */
if (!Number)
{
/* Set Node Data */
KeNodeBlock[0] = &KiNode0;
Prcb->ParentNode = KeNodeBlock[0];
KeNodeBlock[0]->ProcessorMask = Prcb->SetMember;
/* Set boot-level flags */
KeI386CpuType = Prcb->CpuType;
KeI386CpuStep = Prcb->CpuStep;

View file

@ -36,7 +36,7 @@ CCHAR KeNumberProcessors = 0;
/* NUMA Node Support */
KNODE KiNode0;
PKNODE KeNodeBlock[1];
PKNODE KeNodeBlock[1] = { &KiNode0 };
UCHAR KeNumberNodes = 1;
UCHAR KeProcessNodeSeed;