summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoramlal <amlal@el-mahrouss-logic.com>2024-03-09 19:12:48 +0000
committeramlal <amlal@el-mahrouss-logic.com>2024-03-09 19:12:48 +0000
commit028d7057402051f809bbafa27aa278769732c56b (patch)
treec48ecab423f26deb28f3c2ad6818494b9c10ce75
parent6f3b9a6359c387766beb5c3be147a9f4f744cbd7 (diff)
Microkernel: See below.
- Moved most of GDT code to AMD64's Processor.hpp - add hal_ category of functions. Signed-off-by: amlal <amlal@el-mahrouss-logic.com>
-rw-r--r--Private/Drivers/AHCI/API.hxx2
-rw-r--r--Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp2
-rw-r--r--Private/HALKit/AMD64/HalKernelMain.cxx35
-rw-r--r--Private/HALKit/AMD64/HalSMPCore.cxx1
-rw-r--r--Private/HALKit/AMD64/Processor.hpp29
-rw-r--r--Private/NewBoot/BootKit/Arch/AHCI.hxx4
6 files changed, 37 insertions, 36 deletions
diff --git a/Private/Drivers/AHCI/API.hxx b/Private/Drivers/AHCI/API.hxx
index 2a02b434..5ef58d84 100644
--- a/Private/Drivers/AHCI/API.hxx
+++ b/Private/Drivers/AHCI/API.hxx
@@ -6,3 +6,5 @@
#pragma once
+#include <Drivers/AHCI/Defines.hxx>
+
diff --git a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
index fa68ef4a..0727aff0 100644
--- a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
+++ b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
@@ -104,7 +104,7 @@ Madt* system_find_core(Madt* madt) {
///////////////////////////////////////////////////////////////////////////////////////
-void system_get_cores(voidPtr rsdPtr) {
+void hal_system_get_cores(voidPtr rsdPtr) {
auto acpi = ACPIManager(rsdPtr);
kApicMadt = acpi.Find(kApicSignature).Leak().Leak();
diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx
index 6e752e99..535a4fc9 100644
--- a/Private/HALKit/AMD64/HalKernelMain.cxx
+++ b/Private/HALKit/AMD64/HalKernelMain.cxx
@@ -22,33 +22,6 @@
EXTERN_C HCore::VoidPtr kInterruptVectorTable[];
-namespace Detail {
-using namespace HCore;
-
-EXTERN_C void _ke_power_on_self_test(void);
-
-/**
- @brief Global descriptor table entry, either null, code or data.
-*/
-struct PACKED HC_GDT_ENTRY final {
- UInt16 Limit0;
- UInt16 Base0;
- UInt8 Base1;
- UInt8 AccessByte;
- UInt8 Limit1_Flags;
- UInt8 Base2;
-};
-
-struct PACKED ALIGN(0x1000) HC_GDT final {
- HC_GDT_ENTRY Null;
- HC_GDT_ENTRY KernCode;
- HC_GDT_ENTRY KernData;
- HC_GDT_ENTRY UserNull;
- HC_GDT_ENTRY UserCode;
- HC_GDT_ENTRY UserData;
-};
-} // namespace Detail
-
EXTERN_C void RuntimeMain(
HCore::HEL::HandoverInformationHeader* HandoverHeader) {
kHandoverHeader = HandoverHeader;
@@ -60,7 +33,7 @@ EXTERN_C void RuntimeMain(
kKernelPhysicalSize = HandoverHeader->f_PhysicalSize;
kKernelPhysicalStart = HandoverHeader->f_PhysicalStart;
- static Detail::HC_GDT GDT = {
+ STATIC HCore::HAL::Detail::HCoreGDT GDT = {
{0, 0, 0, 0x00, 0x00, 0}, // null entry
{0, 0, 0, 0x9a, 0xaf, 0}, // kernel code
{0, 0, 0, 0x92, 0xaf, 0}, // kernel data
@@ -71,8 +44,8 @@ EXTERN_C void RuntimeMain(
HCore::HAL::RegisterGDT gdtBase;
- gdtBase.Base = (HCore::UIntPtr)&GDT;
- gdtBase.Limit = sizeof(Detail::HC_GDT) - 1;
+ gdtBase.Base = reinterpret_cast<HCore::UIntPtr>(&GDT);
+ gdtBase.Limit = sizeof(HCore::HAL::Detail::HCoreGDT) - 1;
/// Load GDT.
@@ -98,7 +71,7 @@ EXTERN_C void RuntimeMain(
/// START POST
- Detail::_ke_power_on_self_test();
+ HCore::HAL::Detail::_ke_power_on_self_test();
/// END POST
diff --git a/Private/HALKit/AMD64/HalSMPCore.cxx b/Private/HALKit/AMD64/HalSMPCore.cxx
index 9e98fb3c..a72d6bfe 100644
--- a/Private/HALKit/AMD64/HalSMPCore.cxx
+++ b/Private/HALKit/AMD64/HalSMPCore.cxx
@@ -7,7 +7,6 @@
#include <KernelKit/ProcessManager.hpp>
using namespace HCore;
-
Void Process::AssignStart(UIntPtr &imageStart) noexcept {
if (imageStart == 0) this->Crash();
diff --git a/Private/HALKit/AMD64/Processor.hpp b/Private/HALKit/AMD64/Processor.hpp
index c69e35d0..e94d055f 100644
--- a/Private/HALKit/AMD64/Processor.hpp
+++ b/Private/HALKit/AMD64/Processor.hpp
@@ -140,7 +140,34 @@ class IDTLoader final {
static void Load(Ref<Register64> &idt);
};
-void system_get_cores(voidPtr rsdPtr);
+Void hal_system_get_cores(VoidPtr rsdPtr);
+
+/// @brief Processor specific structures.
+namespace Detail {
+EXTERN_C void _ke_power_on_self_test(void);
+
+/**
+ @brief Global descriptor table entry, either null, code or data.
+*/
+
+struct PACKED HCoreGDTRecord final {
+ UInt16 Limit0;
+ UInt16 Base0;
+ UInt8 Base1;
+ UInt8 AccessByte;
+ UInt8 Limit1_Flags;
+ UInt8 Base2;
+};
+
+struct PACKED ALIGN(0x1000) HCoreGDT final {
+ HCoreGDTRecord Null;
+ HCoreGDTRecord KernCode;
+ HCoreGDTRecord KernData;
+ HCoreGDTRecord UserNull;
+ HCoreGDTRecord UserCode;
+ HCoreGDTRecord UserData;
+};
+} // namespace Detail
} // namespace HCore::HAL
EXTERN_C void idt_handle_system_call(HCore::UIntPtr rsp);
diff --git a/Private/NewBoot/BootKit/Arch/AHCI.hxx b/Private/NewBoot/BootKit/Arch/AHCI.hxx
index 32fe033c..f4e635c7 100644
--- a/Private/NewBoot/BootKit/Arch/AHCI.hxx
+++ b/Private/NewBoot/BootKit/Arch/AHCI.hxx
@@ -24,10 +24,10 @@ class BDeviceAHCI final {
HCore::Boolean mErr{false};
HCore::Boolean mDetected{false};
- operator bool() { return !mErr; }
+ operator bool() { return !this->mErr; }
};
- operator bool() { return Leak().mDetected; }
+ operator bool() { return this->Leak().mDetected; }
BDeviceAHCI& Read(HCore::WideChar* Buf, const HCore::SizeT& SecCount);
BDeviceAHCI& Write(HCore::WideChar* Buf, const HCore::SizeT& SecCount);