From 1808b9060f2dcd431e826139018fffb7ac10a2d1 Mon Sep 17 00:00:00 2001 From: ivila <390810839@qq.com> Date: Fri, 25 Oct 2024 14:12:02 +0800 Subject: [PATCH] no-std: optee-utee: make panic_handler optional Make panic_handler optional for no-std TAs by adding "no_panic_handler" feature flag. It allows no-std TAs to have a custom panic handler. --- optee-utee/Cargo.toml | 3 +++ optee-utee/src/lib.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/optee-utee/Cargo.toml b/optee-utee/Cargo.toml index e33810e4..2324ecf9 100644 --- a/optee-utee/Cargo.toml +++ b/optee-utee/Cargo.toml @@ -32,5 +32,8 @@ uuid = { version = "0.8", default-features = false } hex = { version = "0.4", default-features = false, features = ["alloc"] } libc_alloc = "=1.0.5" +[features] +no_panic_handler = [] + [workspace] members = ['systest'] diff --git a/optee-utee/src/lib.rs b/optee-utee/src/lib.rs index b0c205e3..4827f4a1 100644 --- a/optee-utee/src/lib.rs +++ b/optee-utee/src/lib.rs @@ -35,6 +35,7 @@ use core::panic::PanicInfo; use optee_utee_sys as raw; #[cfg(not(target_os = "optee"))] +#[cfg(not(feature = "no_panic_handler"))] #[panic_handler] fn panic(_info: &PanicInfo) -> ! { unsafe { raw::TEE_Panic(0); }