summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-01 23:59:03 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-01 23:59:03 +0200
commit5bc5e4de0d4dcfc52c192315ca5c59a066d678d8 (patch)
tree0de48d9d3645b0cd6857b84629d0adbcd353a521 /Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
parentfc0d38259fd6670966b916b1f28a11f3cb2a4c45 (diff)
MHR-23: Fix ACPI and APIC probe.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp')
-rw-r--r--Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
index 287b1882..5ab40532 100644
--- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
+++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
@@ -137,37 +137,17 @@ namespace NewOS::HAL
if (kApicMadt != nullptr)
{
- auto madt = (SDT*)kApicMadt;
-
- const UInt8* madt_end = (const UInt8*)madt + madt->Length;
- const UInt8* entry_ptr = (const UInt8*)(madt + 1);
-
- while (entry_ptr < madt_end)
- {
- const MadtType::MadtAddress* entry_header = (const MadtType::MadtAddress*)entry_ptr;
-
- switch (entry_header->Flags)
- {
- case 0: {
- const MadtProcessorLocalApic* local_apic = (const MadtProcessorLocalApic*)entry_ptr;
- if (local_apic->Flags & 1)
- {
- // Processor is enabled
- kcout << "Processor ID: %d, APIC ID: %d\n"
- << number(local_apic->AcpiProcessorId) << number(local_apic->ApicId);
- }
- break;
- }
- default:
- break;
- }
-
- entry_ptr += entry_header->RecordLen;
- }
-
- while (true)
- {
- }
+ MadtType* madt = (MadtType*)kApicMadt;
+
+ constexpr auto cMaxProbableCores = 4;
+
+ for (SizeT i = 0; i < cMaxProbableCores; ++i)
+ {
+ if (madt->MadtRecords[i].Flags == 0x01) // if local apic.
+ {
+ // then register as a core for scheduler.
+ }
+ }
}
else
{