From 07e7197517ed018c12ca4fd4d7639823569828e3 Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 1 Oct 2025 23:36:14 +0800 Subject: [PATCH] upgrade the sigcheck boot routine to pass kernel arguments all other boot modes would get an a0 with the address that the kernel is "supposed" to be located. this is neither security sensitive or problematic. --- libs/bao1x-hal/src/sigcheck.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/bao1x-hal/src/sigcheck.rs b/libs/bao1x-hal/src/sigcheck.rs index 28e42c702..d8dc56cb1 100644 --- a/libs/bao1x-hal/src/sigcheck.rs +++ b/libs/bao1x-hal/src/sigcheck.rs @@ -127,10 +127,16 @@ fn erase_secrets() { } pub fn jump_to(target: usize) -> ! { + // loader expects a0 to have the address of the kernel image pre-loaded + let kernel_loc = bao1x_api::offsets::KERNEL_START; unsafe { core::arch::asm!( - "jr {0}", - in(reg) target, + "mv t0, {target}", + "mv a0, {kernel_loc}", + "mv a1, x0", + "jr t0", + target = in(reg) target, + kernel_loc = in(reg) kernel_loc, options(noreturn) ); }