1 /*
2  * Copyright (c) 2016 Wind River Systems, Inc.
3  * Copyright (c) 2018 Intel Corporation
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 /* this file is only meant to be included by kernel_structs.h */
9 
10 #ifndef ZEPHYR_ARCH_X86_INCLUDE_IA32_KERNEL_ARCH_FUNC_H_
11 #define ZEPHYR_ARCH_X86_INCLUDE_IA32_KERNEL_ARCH_FUNC_H_
12 
13 #ifndef _ASMLANGUAGE
14 
15 #include <stddef.h> /* For size_t */
16 
17 #include <zephyr/platform/hooks.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
arch_kernel_init(void)23 static inline void arch_kernel_init(void)
24 {
25 #ifdef CONFIG_SOC_PER_CORE_INIT_HOOK
26 	soc_per_core_init_hook();
27 #endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */
28 }
29 
30 static ALWAYS_INLINE void
arch_thread_return_value_set(struct k_thread * thread,unsigned int value)31 arch_thread_return_value_set(struct k_thread *thread, unsigned int value)
32 {
33 	/* write into 'eax' slot created in z_swap() entry */
34 
35 	*(unsigned int *)(thread->callee_saved.esp) = value;
36 }
37 
38 extern void arch_cpu_atomic_idle(unsigned int key);
39 
40 int arch_swap(unsigned int key);
41 
42 /* ASM code to fiddle with registers to enable the MMU with PAE paging */
43 void z_x86_enable_paging(void);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif /* _ASMLANGUAGE */
50 
51 #endif /* ZEPHYR_ARCH_X86_INCLUDE_IA32_KERNEL_ARCH_FUNC_H_ */
52