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 <assert.h>
10 #include <kernel/misc_arch.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 #endif /*KERNEL_MISC_H*/
27