xref: /optee_os/ldelf/include/ldelf.h (revision d1911a85142da16fef5ebdcdac0348d29ce37cd8)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2019, Linaro Limited
4  */
5 
6 #ifndef __LDELF_H
7 #define __LDELF_H
8 
9 #include <stdint.h>
10 #include <tee_api_types.h>
11 
12 /* Size of stack for TEE Core to allocate */
13 #define LDELF_STACK_SIZE	(4096 * 2)
14 
15 /*
16  * struct ldelf_arg - argument for ldelf
17  * @uuid:	[in] UUID of TA to load
18  * @is_32bit:	[out] 1 if a 32bit TA or 0 if a 64bit TA
19  * @flags:	[out] Flags field of TA header
20  * @entry_func:	[out] TA entry function
21  * @stack_ptr:	[out] TA stack pointer
22  */
23 struct ldelf_arg {
24 	TEE_UUID uuid;
25 	uint32_t is_32bit;
26 	uint32_t flags;
27 	uint64_t entry_func;
28 	uint64_t stack_ptr;
29 };
30 
31 /*
32  * ldelf is loaded into memory by TEE Core. BSS is initialized and a
33  * stack is allocated and supplied in SP register. A struct ldelf_arg
34  * is placed in the stack and a pointer to the struct is provided in
35  * r0/x0.
36  *
37  * ldelf relocates itself to the address where it is loaded before the main
38  * C routine is called.
39  *
40  * In the main C routine the TA is loaded using the PTA System interface.
41  */
42 
43 #endif /*__LDELF_H*/
44