From 995e1580f9291c5b8e95687c59b95e561c0c4569 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 29 Mar 2024 23:10:36 +0100 Subject: Kernel: See below. - Fix ACPI. - Parsing SDT correctly now. - Fix ke_runtime_check line endings. - Update Kernel heap magic and add padding to header. - Document Code Manager add limit for process teams. - Add execute_from_image for Code Manager. - Add loop for scheduler inside RuntimeMain. - Set SMP core to 4 for testing purposes. - Check for ACPI 2.x+ Signed-off-by: Amlal El Mahrouss --- .../HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp | 31 +++++----------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp') diff --git a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp index bbd3c6ea..f31e67c2 100644 --- a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp @@ -43,11 +43,7 @@ STATIC voidPtr kApicMadt = nullptr; STATIC const char* kApicSignature = "APIC"; /// @brief Multiple APIC descriptor table. -struct MadtType final { - char fMag[4]; - Int32 fLength; - char fRev; - +struct MadtType final : public SDT { struct MadtAddress final { UInt32 fPhysicalAddress; UInt32 fFlags; // 1 = Dual Legacy PICs installed @@ -91,36 +87,21 @@ struct MadtLocalApicAddressOverride final { /////////////////////////////////////////////////////////////////////////////////////// -STATIC MadtType kApicMadtList[256]; - -MadtType* _hal_system_find_core(MadtType* madt) { - madt = madt + sizeof(MadtType); - - if (rt_string_cmp(madt->fMag, kApicSignature, - rt_string_len(kApicSignature)) == 0) - return madt; - - return nullptr; -} +STATIC MadtType* kApicInfoBlock = nullptr; /////////////////////////////////////////////////////////////////////////////////////// void hal_system_get_cores(voidPtr rsdPtr) { + kcout << "NewKernel.exe: Constructing ACPIFactoryInterface...\r\n"; + auto acpi = ACPIFactoryInterface(rsdPtr); kApicMadt = acpi.Find(kApicSignature).Leak().Leak(); MUST_PASS(kApicMadt); // MADT must exist. - SizeT counter = 0UL; - MadtType* offset = _hal_system_find_core((MadtType*)kApicMadt); - //! now find core addresses. - while (offset != nullptr) { - // calls rt_copy_memory in NewC++ - kApicMadtList[counter] = *offset; - offset = _hal_system_find_core(offset); + kcout << "NewKernel.exe: Successfuly fetched the MADT!\r\n"; - ++counter; - } + kApicInfoBlock = (MadtType*)kApicMadt; } } // namespace NewOS::HAL -- cgit v1.2.3