handle return codes that include tags

This commit is contained in:
bunnie 2025-10-06 03:49:55 +08:00
parent 69d81042b9
commit 3c341d0f8e
2 changed files with 16 additions and 4 deletions

View file

@ -32,7 +32,11 @@ pub fn boot_or_die() -> ! {
true, true,
None, None,
) { ) {
Ok(k) => crate::println!("**should be unreachable** Booted with key {}", k), Ok((k, tag)) => crate::println!(
"**should be unreachable** Booted with key {}({})",
k,
core::str::from_utf8(&tag.to_le_bytes()).unwrap_or("invalid tag")
),
Err(e) => crate::println!("Image did not validate: {:?}", e), Err(e) => crate::println!("Image did not validate: {:?}", e),
} }
crate::println!("No valid loader or baremetal image found. Halting!"); crate::println!("No valid loader or baremetal image found. Halting!");

View file

@ -266,7 +266,11 @@ pub unsafe extern "C" fn rust_entry(signed_buffer: *const usize, signature: u32)
false, false,
None, None,
) { ) {
Ok(k) => println!("*** Kernel signature check by key @ {} OK ***", k), Ok((k, tag)) => println!(
"*** Kernel signature check by key @ {}({}) OK ***",
k,
core::str::from_utf8(&tag.to_le_bytes()).unwrap_or("invalid tag")
),
Err(e) => { Err(e) => {
println!("Kernel failed signature check. Dying: {:?}", e); println!("Kernel failed signature check. Dying: {:?}", e);
bao1x_hal::sigcheck::die_no_std(); bao1x_hal::sigcheck::die_no_std();
@ -285,8 +289,12 @@ pub unsafe extern "C" fn rust_entry(signed_buffer: *const usize, signature: u32)
false, false,
None, None,
) { ) {
Ok(k) => { Ok((k, tag)) => {
println!("*** Detached app signature check by key @ {} OK ***", k); println!(
"*** Detached app signature check by key @ {}({}) OK ***",
k,
core::str::from_utf8(&tag.to_le_bytes()).unwrap_or("invalid tag")
);
true true
} }
Err(_e) => { Err(_e) => {