From dd7b72379108c10cd68853d2a8a0332784ebb8cb Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Fri, 14 Jun 2024 09:58:11 +0200 Subject: Kernel: Scheduler: ProcessHeader::New: do not get the pointer before allocating it! Kernel: HAL: AMD64: Two things. - Switching to an ARM HAL for our Zeta platform. - Fix return register when sending acknowledge on APIC, which was using the 32-bit eax instead of rax. Kernel: Boot: Update uname for Windows. Kernel: GDT: move as global (HalKenelMain.cxx) Signed-off-by: Amlal EL Mahrouss --- Kernel/HALKit/AMD64/HalInterruptAPI.asm | 4 ++-- Kernel/HALKit/AMD64/HalKernelMain.cxx | 37 +++++++++++++++------------------ 2 files changed, 19 insertions(+), 22 deletions(-) (limited to 'Kernel/HALKit') diff --git a/Kernel/HALKit/AMD64/HalInterruptAPI.asm b/Kernel/HALKit/AMD64/HalInterruptAPI.asm index 150cfc10..4832ecf3 100644 --- a/Kernel/HALKit/AMD64/HalInterruptAPI.asm +++ b/Kernel/HALKit/AMD64/HalInterruptAPI.asm @@ -157,10 +157,10 @@ __NEW_INT_32: pop rcx pop rax - mov eax, 0 + mov rax, 0 ;; tell there local apic that we're done. - mov dword [0xFEE00000 + 0xB0], eax ; LAPIC_EOI + mov [0xFEE00000 + 0xB0], rax ; LAPIC_EOI iretq diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx index 9b605e1a..cafa6388 100644 --- a/Kernel/HALKit/AMD64/HalKernelMain.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx @@ -28,9 +28,21 @@ namespace NewOS::HAL extern void hal_system_get_cores(NewOS::voidPtr rsdPtr); } // namespace NewOS::HAL +/* GDT constant. */ +STATIC NewOS::HAL::Detail::NewOSGDT cGdt = { + {0, 0, 0, 0x00, 0x00, 0}, // null entry + {0, 0, 0, 0x9a, 0xaf, 0}, // kernel code + {0, 0, 0, 0x92, 0xaf, 0}, // kernel data + {0, 0, 0, 0x00, 0x00, 0}, // null entry + {0, 0, 0, 0x9a, 0xaf, 0}, // user code + {0, 0, 0, 0x92, 0xaf, 0}, // user data +}; + EXTERN_C void hal_init_platform( NewOS::HEL::HandoverInformationHeader* HandoverHeader) { + /* Setup globals. */ + kHandoverHeader = HandoverHeader; if (kHandoverHeader->f_Magic != kHandoverMagic && @@ -39,29 +51,17 @@ EXTERN_C void hal_init_platform( return; } - /// Setup kernel globals. kKernelVirtualSize = HandoverHeader->f_VirtualSize; kKernelVirtualStart = reinterpret_cast( reinterpret_cast(HandoverHeader->f_VirtualStart) + kVirtualAddressStartOffset); kKernelPhysicalStart = HandoverHeader->f_PhysicalStart; - STATIC NewOS::HAL::Detail::NewOSGDT 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 - {0, 0, 0, 0x00, 0x00, 0}, // null entry - {0, 0, 0, 0x9a, 0xaf, 0}, // user code - {0, 0, 0, 0x92, 0xaf, 0}, // user data - }; - NewOS::HAL::RegisterGDT gdtBase; - gdtBase.Base = reinterpret_cast(&GDT); + gdtBase.Base = reinterpret_cast(&cGdt); gdtBase.Limit = sizeof(NewOS::HAL::Detail::NewOSGDT) - 1; - /// Load GDT. - NewOS::HAL::GDTLoader gdt; gdt.Load(gdtBase); @@ -74,7 +74,7 @@ EXTERN_C void hal_init_platform( NewOS::HAL::IDTLoader idt; idt.Load(idtBase); - /// START POST + /* install basic hooks. */ constexpr auto cDummyInterrupt = 0x10; // 16 @@ -87,12 +87,9 @@ EXTERN_C void hal_init_platform( NewOS::HAL::Detail::_ke_power_on_self_test(); - auto cLoaderName = "LaunchDevil"; - NewOS::execute_from_image(KeMain, cLoaderName); + /* Call generic kernel entrypoint. */ - NewOS::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_RsdPtr); + KeMain(); - while (true) - { - } + NewOS::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } -- cgit v1.2.3