Dynamically allocate active processors affinity map
This commit is contained in:
@@ -32,8 +32,12 @@ HL::Cpu::InitializeProcessor(VOID)
|
||||
ProcessorBlock->StallScaleFactor = INITIAL_STALL_FACTOR;
|
||||
ProcessorBlock->Idr = 0xFFFFFFFF;
|
||||
|
||||
/* Register this CPU in the global active processors map */
|
||||
KE::Affinity::AtomicSetProcessorAffinity(&ActiveProcessors, ProcessorBlock->CpuNumber);
|
||||
/* Check if active processors map is initialized */
|
||||
if(ActiveProcessors != NULLPTR)
|
||||
{
|
||||
/* Register this CPU in the global active processors map */
|
||||
KE::Affinity::AtomicSetProcessorAffinity(ActiveProcessors, ProcessorBlock->CpuNumber);
|
||||
}
|
||||
|
||||
/* Initialize APIC for this processor */
|
||||
HL::Pic::InitializePic();
|
||||
@@ -42,6 +46,27 @@ HL::Cpu::InitializeProcessor(VOID)
|
||||
HL::RunLevel::SetRunLevel(ProcessorBlock->RunLevel);
|
||||
}
|
||||
|
||||
XTAPI
|
||||
XTSTATUS
|
||||
HL::Cpu::InitializeProcessorAffinity(VOID)
|
||||
{
|
||||
XTSTATUS Status;
|
||||
|
||||
/* Allocate an array of pointers */
|
||||
Status = KE::Affinity::CreateAffinityMap(KE::Processor::GetInstalledCpus(), &ActiveProcessors);
|
||||
if(Status != STATUS_SUCCESS)
|
||||
{
|
||||
/* Failed to allocate memory, return error */
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Register BSP in the global active processors map */
|
||||
KE::Affinity::SetProcessorAffinity(ActiveProcessors, 0);
|
||||
|
||||
/* Return success */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wakes up and initializes all Application Processors (APs) and transitions them into the active kernel.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user