summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 18:06:17 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 18:06:17 +0200
commit01fb3ca21dd5846ecd7e4e94571ede5a5264d9a6 (patch)
tree60201d088bb2c1cc12777611b15c2708bf71787b /Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
parent579d076015eece5961b1034979ade2be09c6bfcd (diff)
[SMP] WiP impelementation of SMP inside the HAL.
- Doing R&D on SMP on AMD64, - Working on a first application. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx')
-rw-r--r--Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx37
1 files changed, 18 insertions, 19 deletions
diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
index 48d737fe..0557afac 100644
--- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
+++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
@@ -67,13 +67,13 @@ namespace Kernel::HAL
/// @brief Multiple APIC Descriptor Table.
struct MadtType final : public SDT
{
+ UInt32 Address;
+ UInt32 Flags; // 1 = Dual Legacy PICs installed
+
struct MadtAddress final
{
Char RecordType;
Char RecordLen; // record length
-
- UInt32 Address;
- UInt32 Flags; // 1 = Dual Legacy PICs installed
} MadtRecords[];
};
@@ -120,13 +120,8 @@ namespace Kernel::HAL
STATIC MadtType* kApicInfoBlock = nullptr;
- STATIC struct
- {
- UIntPtr fAddress{0};
- UInt32 fKind{0};
- } kApicMadtAddresses[255] = {};
-
- STATIC SizeT kApicMadtAddressesCount = 0UL;
+ EXTERN_C SizeT kApicMadtAddressesCount = 0UL;
+ EXTERN_C SizeT cBspDone = 0UL;
enum
{
@@ -170,9 +165,12 @@ namespace Kernel::HAL
}
/// @internal
- EXTERN_C Void hal_apic_acknowledge(Void)
+ EXTERN_C Void hal_ap_startup(Void)
{
- kcout << "newoskrnl: acknowledge APIC.\r";
+ while (Yes)
+ {
+
+ }
}
/// @internal
@@ -216,6 +214,8 @@ namespace Kernel::HAL
return (eax & 0xfffff000) | ((UIntPtr)(edx & 0x0f) << 32);
}
+ EXTERN_C Void hal_ap_trampoline(Void);
+
/// @brief Fetch and enable cores inside main CPU.
/// @param rsdPtr RSD PTR structure.
Void hal_system_get_cores(voidPtr rsdPtr)
@@ -225,16 +225,15 @@ namespace Kernel::HAL
if (kApicMadt != nullptr)
{
- MadtType* madt = reinterpret_cast<MadtType*>(kApicMadt);
-
- cpu_set_apic_base(cpu_get_apic_base());
+ UInt8 bsp_id, bsp_done = No;
- // set SVR register to bit 8 to start recieve interrupts.
+ UInt32 num_cores = 4;
+ UInt32* local_apic_ptr = nullptr;
+ UInt32* local_apic_ids[255] = {0};
- auto flagsSet = Kernel::ke_dma_read(cAPICAddress, 0xF0); // SVR register.
- flagsSet |= 0x100;
+ MadtType* type = (MadtType*)kApicMadt;
- Kernel::ke_dma_write(cAPICAddress, 0xF0, flagsSet | 0x100);
+ local_apic_ptr = (UInt32*)type->Address;
}
else
{