1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 
6 #ifndef KERNEL_MISC_H
7 #define KERNEL_MISC_H
8 
9 #include <arm.h>
10 #include <assert.h>
11 #include <kernel/thread.h>
12 #include <types_ext.h>
13 
14 size_t __get_core_pos(void);
15 
get_core_pos(void)16 static inline size_t __noprof get_core_pos(void)
17 {
18 	/*
19 	 * Foreign interrupts must be disabled before playing with current
20 	 * core since we otherwise may be rescheduled to a different core.
21 	 */
22 	assert(thread_get_exceptions() & THREAD_EXCP_FOREIGN_INTR);
23 	return __get_core_pos();
24 }
25 
26 size_t get_core_pos_mpidr(uint32_t mpidr);
27 
28 uint32_t read_mode_sp(int cpu_mode);
29 uint32_t read_mode_lr(int cpu_mode);
30 
31 #endif /*KERNEL_MISC_H*/
32 
33