diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-08 14:24:04 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-08 14:24:04 +0100 |
| commit | 46b749045670ce74ce06c51334946e0e90837c18 (patch) | |
| tree | 7318192b3c7b401d642a72bf0ca39ec76f177bb3 | |
| parent | 6f5eddc17785607e1cd5e8245d576874f1939beb (diff) | |
HAL: AMD64: Improve code and bugfixed it.
| -rw-r--r-- | Private/HALKit/AMD64/HalDebugOutput.cxx | 4 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalDescriptorLoader.cpp | 3 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalKernelMain.cxx | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/Private/HALKit/AMD64/HalDebugOutput.cxx b/Private/HALKit/AMD64/HalDebugOutput.cxx index fb80365e..24973eb7 100644 --- a/Private/HALKit/AMD64/HalDebugOutput.cxx +++ b/Private/HALKit/AMD64/HalDebugOutput.cxx @@ -56,6 +56,7 @@ bool serial_init() noexcept { } // namespace Detail EXTERN_C void ke_io_print(const char* bytes) { +#ifdef __DEBUG__ Detail::serial_init(); if (!bytes || Detail::kState != kStateReady) return; @@ -67,13 +68,12 @@ EXTERN_C void ke_io_print(const char* bytes) { SizeT len = rt_string_len(bytes, 256); while (index < len) { -#ifdef __DEBUG__ HAL::Out8(Detail::PORT, bytes[index]); -#endif // __DEBUG__ ++index; } Detail::kState = kStateReady; +#endif // __DEBUG__ } TerminalDevice TerminalDevice::Shared() noexcept { diff --git a/Private/HALKit/AMD64/HalDescriptorLoader.cpp b/Private/HALKit/AMD64/HalDescriptorLoader.cpp index 8552b958..a68fb54a 100644 --- a/Private/HALKit/AMD64/HalDescriptorLoader.cpp +++ b/Private/HALKit/AMD64/HalDescriptorLoader.cpp @@ -10,6 +10,8 @@ namespace HCore::HAL { STATIC RegisterGDT kRegGdt; void GDTLoader::Load(RegisterGDT &gdt) { + MUST_PASS(gdt.Base != 0); + kRegGdt.Base = gdt.Base; kRegGdt.Limit = gdt.Limit; @@ -23,6 +25,7 @@ STATIC ::HCore::Detail::AMD64::InterruptDescriptorAMD64 void IDTLoader::Load(Register64 &idt) { volatile ::HCore::UIntPtr **baseIdt = (volatile ::HCore::UIntPtr **)idt.Base; + MUST_PASS(baseIdt); MUST_PASS(baseIdt[0]); diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx index d6b87bb4..2cfd0d01 100644 --- a/Private/HALKit/AMD64/HalKernelMain.cxx +++ b/Private/HALKit/AMD64/HalKernelMain.cxx @@ -96,8 +96,6 @@ EXTERN_C void RuntimeMain( Detail::_ke_power_on_self_test(); - HCore::kcout << "HCoreKrnl: Everything is OK...\r\n"; - /// END POST /// Mounts a NewFS block. @@ -107,9 +105,12 @@ EXTERN_C void RuntimeMain( if (HandoverHeader->f_Bootloader == kInstalledMedia) { /// TODO: Parse system configuration. } else { + HCore::kcout << "HCoreKrnl: Running setup...\r\n"; // Open file from first hard-drive. HCore::PEFLoader img("/System/HCoreInstallWizard.exe"); + MUST_PASS(img.IsLoaded()); + /// Run the server executive. HCore::Utils::execute_from_image(img); } |
