From 7102d90b2b1ebfb96e1df6470b566f3784f4e0d7 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 23 Apr 2024 20:22:21 +0300 Subject: [PATCH] Kernel: Verify we are running on hart 0 This is already an implicit assumption when we initialize our CPU id. --- Kernel/Arch/init.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Kernel/Arch/init.cpp b/Kernel/Arch/init.cpp index d6e3aabb5ff..797b2b2e822 100644 --- a/Kernel/Arch/init.cpp +++ b/Kernel/Arch/init.cpp @@ -243,6 +243,11 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT NO_SANITIZE_COVERAGE void init([[maybe_ new (&bsp_processor()) Processor(); bsp_processor().early_initialize(0); +#if ARCH(RISCV64) + // We implicitly assume the boot hart is hart 0 above and below + VERIFY(boot_info.mhartid == 0); +#endif + // Invoke the constructors needed for the kernel heap for (ctor_func_t* ctor = start_heap_ctors; ctor < end_heap_ctors; ctor++) (*ctor)();