1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements.  See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership.  The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License.  You may obtain a copy of the License at
8 //
9 //   http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied.  See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 #[no_mangle]
19 pub static mut trace_level: libc::c_int = TRACE_LEVEL;
20 
21 #[no_mangle]
22 pub static trace_ext_prefix: &[u8] = TRACE_EXT_PREFIX;
23 
24 #[no_mangle]
25 #[link_section = ".ta_head"]
26 pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
27     uuid: TA_UUID,
28     stack_size: TA_STACK_SIZE + TA_FRAMEWORK_STACK_SIZE,
29     flags: TA_FLAGS,
30     depr_entry: std::u64::MAX,
31 };
32 
33 #[no_mangle]
34 #[link_section = ".bss"]
35 pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];
36 
37 #[no_mangle]
38 pub static ta_heap_size: libc::size_t = std::mem::size_of::<u8>() * TA_DATA_SIZE as usize;
39 static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
40 static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
41 static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;
42 
43 #[no_mangle]
44 pub static ta_num_props: libc::size_t = 9;
45 
46 #[no_mangle]
47 pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
48     optee_utee_sys::user_ta_property {
49         name: optee_utee_sys::TA_PROP_STR_SINGLE_INSTANCE,
50         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_BOOL,
51         value: &FLAG_BOOL as *const bool as *mut _,
52     },
53     optee_utee_sys::user_ta_property {
54         name: optee_utee_sys::TA_PROP_STR_MULTI_SESSION,
55         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_BOOL,
56         value: &FLAG_MULTI as *const bool as *mut _,
57     },
58     optee_utee_sys::user_ta_property {
59         name: optee_utee_sys::TA_PROP_STR_KEEP_ALIVE,
60         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_BOOL,
61         value: &FLAG_INSTANCE as *const bool as *mut _,
62     },
63     optee_utee_sys::user_ta_property {
64         name: optee_utee_sys::TA_PROP_STR_DATA_SIZE,
65         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_U32,
66         value: &TA_DATA_SIZE as *const u32 as *mut _,
67     },
68     optee_utee_sys::user_ta_property {
69         name: optee_utee_sys::TA_PROP_STR_STACK_SIZE,
70         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_U32,
71         value: &TA_STACK_SIZE as *const u32 as *mut _,
72     },
73     optee_utee_sys::user_ta_property {
74         name: optee_utee_sys::TA_PROP_STR_VERSION,
75         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_STRING,
76         value: TA_VERSION as *const [u8] as *mut _,
77     },
78     optee_utee_sys::user_ta_property {
79         name: optee_utee_sys::TA_PROP_STR_DESCRIPTION,
80         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_STRING,
81         value: TA_DESCRIPTION as *const [u8] as *mut _,
82     },
83     optee_utee_sys::user_ta_property {
84         name: "gp.ta.description\0".as_ptr(),
85         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_STRING,
86         value: EXT_PROP_VALUE_1 as *const [u8] as *mut _,
87     },
88     optee_utee_sys::user_ta_property {
89         name: "gp.ta.version\0".as_ptr(),
90         prop_type: optee_utee_sys::user_ta_prop_type::USER_TA_PROP_TYPE_U32,
91         value: &EXT_PROP_VALUE_2 as *const u32 as *mut _,
92     },
93 ];
94 
95 #[no_mangle]
tahead_get_trace_level() -> libc::c_int96 pub unsafe extern "C" fn tahead_get_trace_level() -> libc::c_int {
97     return trace_level;
98 }
99