1 /*
2  * Copyright (c) 2019-2020 Cobham Gaisler AB
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/kernel.h>
8 #include <zephyr/kernel_structs.h>
9 #include <kernel_internal.h>
10 #include <kernel_tls.h>
11 #include <zephyr/app_memory/app_memdomain.h>
12 #include <zephyr/sys/util.h>
13 
arch_tls_stack_setup(struct k_thread * new_thread,char * stack_ptr)14 size_t arch_tls_stack_setup(struct k_thread *new_thread, char *stack_ptr)
15 {
16 	new_thread->tls = POINTER_TO_UINT(stack_ptr);
17 
18 	stack_ptr -= z_tls_data_size();
19 	z_tls_copy(stack_ptr);
20 
21 	return z_tls_data_size();
22 }
23