1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 13 #ifndef __DYN_LOAD_H_ 14 #define __DYN_LOAD_H_ 15 #include "gtask_core.h" 16 17 typedef struct { 18 char *file_buffer; 19 int file_size; 20 char *lib_name; 21 char *fname; 22 uint32_t fname_size; 23 } load_elf_func_params; 24 25 #define LIB_EXIST 1 26 #define LOAD_SUCC 0 27 #define LOAD_FAIL (-1) 28 29 bool get_dyn_client_name(bool is_64bit, char *client, uint32_t size); 30 int dynamic_load_lib_elf(const load_elf_func_params *param, const struct service_struct *service, 31 const TEE_UUID *uuid, uint64_t memid, tee_img_type_t type); 32 uint32_t sre_release_dynamic_region(const TEE_UUID *uuid, uint32_t release); 33 TEE_Result load_elf_to_tee(const TEE_UUID *uuid, const char *task_name, bool buildin, 34 bool dyn_conf_registed, struct service_attr *service_attr); 35 int elf_param_check(uint32_t stack_size, uint32_t heap_size, uint32_t mani_ext_size); 36 TEE_Result varify_elf_arch(const char *elf, int file_size, bool *ta_64bit); 37 #endif 38