diff options
| author | amlal <amlal@el-mahrouss-logic.com> | 2024-03-09 19:12:48 +0000 |
|---|---|---|
| committer | amlal <amlal@el-mahrouss-logic.com> | 2024-03-09 19:12:48 +0000 |
| commit | 028d7057402051f809bbafa27aa278769732c56b (patch) | |
| tree | c48ecab423f26deb28f3c2ad6818494b9c10ce75 /Private/HALKit | |
| parent | 6f3b9a6359c387766beb5c3be147a9f4f744cbd7 (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>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp | 2 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalKernelMain.cxx | 35 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalSMPCore.cxx | 1 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/Processor.hpp | 29 |
4 files changed, 33 insertions, 34 deletions
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); |
