xref: /minix/minix/kernel/arch/i386/include/arch_smp.h (revision 83133719)
1 #ifndef __SMP_X86_H__
2 #define __SMP_X86_H__
3 
4 #include "arch_proto.h" /* K_STACK_SIZE */
5 
6 #define MAX_NR_INTERRUPT_ENTRIES	128
7 
8 #ifndef __ASSEMBLY__
9 
10 /* returns the current cpu id */
11 #define cpuid	(((u32_t *)(((u32_t)get_stack_frame() + (K_STACK_SIZE - 1)) \
12 						& ~(K_STACK_SIZE - 1)))[-1])
13 /*
14  * in case apic or smp is disabled in boot monitor, we need to finish single cpu
15  * boot using the legacy PIC
16  */
17 #define smp_single_cpu_fallback() do {		\
18 	  tss_init(0, get_k_stack_top(0));	\
19 	  bsp_cpu_id = 0;			\
20 	  ncpus = 1;				\
21 	  bsp_finish_booting();			\
22 } while(0)
23 
24 extern unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
25 
26 #define barrier()	do { mfence(); } while(0)
27 
28 #endif
29 
30 #endif /* __SMP_X86_H__ */
31 
32