summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-17 23:55:24 +0200
committerGitHub <noreply@github.com>2025-04-17 23:55:24 +0200
commit8ccccad87b171890cbf5040e63b613307cdc5a30 (patch)
tree4dfb464d36a409ab4686ff4e2cfbf0ed8310f6a8 /dev/kernel/HALKit/AMD64
parent496f814adf3b9cbcaab2e73188a6730d0a780912 (diff)
parent2363e0ef10e1c34b4a6224199304cc6fda4526bb (diff)
Merge pull request #21 from amlel-el-mahrouss/dev
kernel, boot: recovering lost changes because of some git issue.
Diffstat (limited to 'dev/kernel/HALKit/AMD64')
-rw-r--r--dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc28
-rw-r--r--dev/kernel/HALKit/AMD64/HalPagingMgrAMD64.cc2
-rw-r--r--dev/kernel/HALKit/AMD64/Processor.h2
-rw-r--r--dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc2
4 files changed, 7 insertions, 27 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
index 43888f3b..938907f4 100644
--- a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
+++ b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc
@@ -210,24 +210,15 @@ namespace Kernel::HAL
if (kMADTBlock)
{
- SizeT index = 1;
+ SizeT index = 1UL;
kSMPInterrupt = 0;
kSMPCount = 0;
- kout << "SMP: Starting APs...\r";
+ kout << "SMP: Registering APIC IDs...\r";
kApicBaseAddress = kMADTBlock->Address;
- constexpr auto kMemoryAPStart = 0x7C000;
- Char* ptr_ap_code = reinterpret_cast<Char*>(kMemoryAPStart);
-
- mm_map_page(ptr_ap_code, ptr_ap_code, kMMFlagsWr);
-
- SizeT hal_ap_blob_len = hal_ap_blob_end - hal_ap_blob_start;
-
- rt_copy_memory((Char*)hal_ap_blob_start, ptr_ap_code, hal_ap_blob_len);
-
while (Yes)
{
if (kMADTBlock->List[index].Type > 9 ||
@@ -241,18 +232,7 @@ namespace Kernel::HAL
break;
kAPICLocales[kSMPCount] = kMADTBlock->List[kSMPCount].LAPIC.ProcessorID;
- (void)(kout << "SMP: APIC ID: " << number(kAPICLocales[kSMPCount]) << kendl);
-
- // I'll just make the AP start from scratch here.
-
- hal_send_start_ipi(kApicBaseAddress, kAPICLocales[kSMPCount]);
-
- HardwareTimer timer(Kernel::rtl_ms(10));
- timer.Wait();
-
- /// TODO: HAL helper to create an address.
-
- hal_send_sipi(kApicBaseAddress, kAPICLocales[kSMPCount], (UInt8)(((UIntPtr)ptr_ap_code) >> 12));
+ (Void)(kout << "SMP: APIC ID: " << number(kAPICLocales[kSMPCount]) << kendl);
++kSMPCount;
break;
@@ -264,7 +244,7 @@ namespace Kernel::HAL
++index;
}
- (void)(kout << "SMP: number of APs: " << number(kSMPCount) << kendl);
+ (Void)(kout << "SMP: Number of IDs: " << number(kSMPCount) << kendl);
// Kernel is now SMP aware.
// That means that the scheduler is now available (on MP Kernels)
diff --git a/dev/kernel/HALKit/AMD64/HalPagingMgrAMD64.cc b/dev/kernel/HALKit/AMD64/HalPagingMgrAMD64.cc
index 4b50a3f4..16fe843a 100644
--- a/dev/kernel/HALKit/AMD64/HalPagingMgrAMD64.cc
+++ b/dev/kernel/HALKit/AMD64/HalPagingMgrAMD64.cc
@@ -143,7 +143,7 @@ namespace Kernel::HAL
pte->Wr = !!(flags & kMMFlagsWr);
pte->User = !!(flags & kMMFlagsUser);
pte->Nx = !!(flags & kMMFlagsNX);
- pte->Pcd = !(flags & kMMFlagsUncached);
+ pte->Pcd = !(flags & kMMFlagsPCD);
pte->PhysicalAddress = (UIntPtr)(physical_address);
mmi_page_status(pte);
diff --git a/dev/kernel/HALKit/AMD64/Processor.h b/dev/kernel/HALKit/AMD64/Processor.h
index e375a935..a5bc82c7 100644
--- a/dev/kernel/HALKit/AMD64/Processor.h
+++ b/dev/kernel/HALKit/AMD64/Processor.h
@@ -73,7 +73,7 @@ namespace Kernel::HAL
kMMFlagsWr = 1 << 2,
kMMFlagsUser = 1 << 3,
kMMFlagsNX = 1 << 4,
- kMMFlagsUncached = 1 << 5,
+ kMMFlagsPCD = 1 << 5,
kMMFlagsCount = 4,
};
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index 2dfd89a1..9c8f95bc 100644
--- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -283,7 +283,7 @@ STATIC Bool drv_std_init_ahci(UInt16& pi, BOOL& atapi)
kSATADev.EnableMmio();
kSATADev.BecomeBusMaster();
- HAL::mm_map_page((VoidPtr)mem_ahci, (VoidPtr)mem_ahci, HAL::kMMFlagsPresent | HAL::kMMFlagsWr | HAL::kMMFlagsUncached);
+ HAL::mm_map_page((VoidPtr)mem_ahci, (VoidPtr)mem_ahci, HAL::kMMFlagsPresent | HAL::kMMFlagsWr | HAL::kMMFlagsPCD);
UInt32 ports_implemented = mem_ahci->Pi;
UInt16 ahci_index = 0;