From 832126883b66286caa428684a55aec120f9c2752 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Mon, 1 Jun 2026 20:19:05 -0700 Subject: [PATCH] h2: boot: initialize SHIFT and TCM_VAL to zero on non-multicore path When MULTICORE is defined but CORE_COUNT == 0 (single-core hardware, as on the QEMU virt machine), boot.ref.S jumps directly to .Lno_multicore without executing the multicore core-synchronization block that sets SHIFT (r15) and TCM_VAL (r7). These registers are subsequently passed to H2K_thread_boot() as the multicore_shift and tcm_offset arguments. With SHIFT uninitialized, H2K_kg_init() computes a garbage phys_offset (H2K_LINK_ADDR - garbage_shift - H2K_LOAD_ADDR), corrupting the H2 kernel address-space setup and causing silent boot failures. Initialize SHIFT = #0 and TCM_VAL = #0 at .Lno_multicore so the single-core path always passes correct zero values to H2K_thread_boot(). Signed-off-by: Brian Cain --- kernel/init/boot/boot.ref.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/init/boot/boot.ref.S b/kernel/init/boot/boot.ref.S index 2ed83d785..59f7771f9 100644 --- a/kernel/init/boot/boot.ref.S +++ b/kernel/init/boot/boot.ref.S @@ -336,8 +336,11 @@ boot_continuation: isync .Lno_multicore: + /* Single-core or non-multicore path: initialize shift/TCM to zero */ + SHIFT = #0 + TCM_VAL = #0 #endif - + /* Setup EVB */ SETCONST(TMP,H2K_event_vectors) evb = TMP