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;
|
ACPI_TIMER_INFO HL::Acpi::TimerInfo;
|
||||||
|
|
||||||
/* Represents the number of active processors */
|
/* Represents the number of active processors */
|
||||||
KAFFINITY HL::Cpu::ActiveProcessors;
|
KAFFINITY_MAP HL::Cpu::ActiveProcessors;
|
||||||
|
|
||||||
/* Metadata detailing the linear frame buffer geometry */
|
/* Metadata detailing the linear frame buffer geometry */
|
||||||
HL_FRAMEBUFFER_DATA HL::FrameBuffer::FrameBufferData;
|
HL_FRAMEBUFFER_DATA HL::FrameBuffer::FrameBufferData;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ VOID
|
|||||||
HL::Cpu::InitializeProcessor(VOID)
|
HL::Cpu::InitializeProcessor(VOID)
|
||||||
{
|
{
|
||||||
PKPROCESSOR_BLOCK ProcessorBlock;
|
PKPROCESSOR_BLOCK ProcessorBlock;
|
||||||
KAFFINITY Affinity;
|
ULONG BlockIndex, BitIndex;
|
||||||
|
|
||||||
/* Get current processor block */
|
/* Get current processor block */
|
||||||
ProcessorBlock = KE::Processor::GetCurrentProcessorBlock();
|
ProcessorBlock = KE::Processor::GetCurrentProcessorBlock();
|
||||||
@@ -33,17 +33,18 @@ HL::Cpu::InitializeProcessor(VOID)
|
|||||||
ProcessorBlock->StallScaleFactor = INITIAL_STALL_FACTOR;
|
ProcessorBlock->StallScaleFactor = INITIAL_STALL_FACTOR;
|
||||||
ProcessorBlock->Idr = 0xFFFFFFFF;
|
ProcessorBlock->Idr = 0xFFFFFFFF;
|
||||||
|
|
||||||
/* Set processor affinity */
|
/* Calculate the precise block and bit index for the affinity map */
|
||||||
Affinity = (KAFFINITY) 1 << ProcessorBlock->CpuNumber;
|
BlockIndex = ProcessorBlock->CpuNumber / 64;
|
||||||
|
BitIndex = ProcessorBlock->CpuNumber % 64;
|
||||||
|
|
||||||
/* Apply affinity to a set of processors */
|
/* 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 */
|
/* Initialize APIC for this processor */
|
||||||
HL::Pic::InitializePic();
|
HL::Pic::InitializePic();
|
||||||
|
|
||||||
/* Set the APIC running level */
|
/* 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
|
class Cpu
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
STATIC KAFFINITY ActiveProcessors;
|
STATIC KAFFINITY_MAP ActiveProcessors;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC XTAPI VOID InitializeProcessor(VOID);
|
STATIC XTAPI VOID InitializeProcessor(VOID);
|
||||||
|
|||||||
Reference in New Issue
Block a user