From b5143c627de2ee128732fcf798c41516ffbc13f7 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. Signed-off-by: ivila <390810839@qq.com> Reviewed-by: Sumit Garg Reviewed-by: Yuan Zhuang --- optee-utee/Cargo.toml | 3 +++ optee-utee/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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..679339ce 100644 --- a/optee-utee/src/lib.rs +++ b/optee-utee/src/lib.rs @@ -34,7 +34,7 @@ use core::panic::PanicInfo; #[cfg(not(target_os = "optee"))] use optee_utee_sys as raw; -#[cfg(not(target_os = "optee"))] +#[cfg(all(not(target_os = "optee"), not(feature = "no_panic_handler")))] #[panic_handler] fn panic(_info: &PanicInfo) -> ! { unsafe { raw::TEE_Panic(0); }