From 2fe8c419e2724a7009d39e4adeb05de7569d5d11 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 27 Aug 2025 16:56:41 +0200 Subject: feat: docs/tex: Update OpenHeFS specs. feat: HAL/amd64: Harden AP files. Signed-off-by: Amlal El Mahrouss --- dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc | 2 ++ dev/kernel/HALKit/POWER/HalApplicationProcessor.cc | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'dev/kernel/HALKit') diff --git a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc index 64f146f3..df5386e4 100644 --- a/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc +++ b/dev/kernel/HALKit/AMD64/HalApplicationProcessor.cc @@ -4,6 +4,7 @@ ------------------------------------------- */ +/// Different than the MADT, might be confusing to some. #define APIC_MAG "APIC" #define APIC_ICR_LOW 0x300 @@ -145,6 +146,7 @@ Bool mp_is_smp(Void) noexcept { Void mp_init_cores(VoidPtr vendor_ptr) noexcept { if (!vendor_ptr) return; + if (!kHandoverHeader) return; if (!kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled) { kSMPAware = NO; diff --git a/dev/kernel/HALKit/POWER/HalApplicationProcessor.cc b/dev/kernel/HALKit/POWER/HalApplicationProcessor.cc index daa26e53..c2703af6 100644 --- a/dev/kernel/HALKit/POWER/HalApplicationProcessor.cc +++ b/dev/kernel/HALKit/POWER/HalApplicationProcessor.cc @@ -8,6 +8,8 @@ #include #include +/// @note This part of the HAL needs an owner. + namespace Kernel::Detail { STATIC void mp_hang_fn(void) { while (YES) @@ -21,6 +23,9 @@ namespace Kernel { void mp_wakeup_thread(HAL::StackFramePtr stack) { if (!stack) return; + MUST_PASS(stack->R15 > 0); + MUST_PASS(stack->IP > 0); + hal_set_pc_to_hart(reinterpret_cast(stack->R15), reinterpret_cast(stack->IP)); } @@ -30,7 +35,9 @@ void mp_wakeup_thread(HAL::StackFramePtr stack) { void mp_hang_thread(HAL::StackFramePtr stack) { if (!stack) return; + MUST_PASS(stack->R15 > 0); + hal_set_pc_to_hart(reinterpret_cast(stack->R15), reinterpret_cast(Kernel::Detail::mp_hang_fn)); } -} // namespace Kernel \ No newline at end of file +} // namespace Kernel -- cgit v1.2.3