Refactor processor affinity logic
This commit is contained in:
@@ -28,7 +28,7 @@ ACPI_SYSTEM_INFO HL::Acpi::SystemInfo;
|
||||
ACPI_TIMER_INFO HL::Acpi::TimerInfo;
|
||||
|
||||
/* Represents the number of active processors */
|
||||
KAFFINITY HL::Cpu::ActiveProcessors;
|
||||
KAFFINITY_MAP HL::Cpu::ActiveProcessors;
|
||||
|
||||
/* Metadata detailing the linear frame buffer geometry */
|
||||
HL_FRAMEBUFFER_DATA HL::FrameBuffer::FrameBufferData;
|
||||
|
||||
@@ -24,7 +24,7 @@ VOID
|
||||
HL::Cpu::InitializeProcessor(VOID)
|
||||
{
|
||||
PKPROCESSOR_BLOCK ProcessorBlock;
|
||||
KAFFINITY Affinity;
|
||||
ULONG BlockIndex, BitIndex;
|
||||
|
||||
/* Get current processor block */
|
||||
ProcessorBlock = KE::Processor::GetCurrentProcessorBlock();
|
||||
@@ -33,17 +33,18 @@ HL::Cpu::InitializeProcessor(VOID)
|
||||
ProcessorBlock->StallScaleFactor = INITIAL_STALL_FACTOR;
|
||||
ProcessorBlock->Idr = 0xFFFFFFFF;
|
||||
|
||||
/* Set processor affinity */
|
||||
Affinity = (KAFFINITY) 1 << ProcessorBlock->CpuNumber;
|
||||
/* Calculate the precise block and bit index for the affinity map */
|
||||
BlockIndex = ProcessorBlock->CpuNumber / 64;
|
||||
BitIndex = ProcessorBlock->CpuNumber % 64;
|
||||
|
||||
/* Apply affinity to a set of processors */
|
||||
ActiveProcessors |= Affinity;
|
||||
RTL::Atomic::Or64((PLONG_PTR)&ActiveProcessors.Bitmap[BlockIndex], ((KAFFINITY)1 << BitIndex));
|
||||
|
||||
/* Initialize APIC for this processor */
|
||||
HL::Pic::InitializePic();
|
||||
|
||||
/* Set the APIC running level */
|
||||
HL::RunLevel::SetRunLevel(KE::Processor::GetCurrentProcessorBlock()->RunLevel);
|
||||
HL::RunLevel::SetRunLevel(ProcessorBlock->RunLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace HL
|
||||
class Cpu
|
||||
{
|
||||
private:
|
||||
STATIC KAFFINITY ActiveProcessors;
|
||||
STATIC KAFFINITY_MAP ActiveProcessors;
|
||||
|
||||
public:
|
||||
STATIC XTAPI VOID InitializeProcessor(VOID);
|
||||
|
||||
Reference in New Issue
Block a user