1 #ifndef _ASM_X86_SMP_PROCESSOR_ID_H
2 #define _ASM_X86_SMP_PROCESSOR_ID_H
4 #if defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
6 #include <asm/percpu.h>
8 DECLARE_PER_CPU(int, cpu_number);
11 * This function is needed by all SMP systems. It must _always_ be valid
12 * from the initial startup. We map APIC_BASE very early in page_setup(),
13 * so this is correct in the x86 case.
15 #define raw_smp_processor_id() percpu_read(cpu_number)
16 #define safe_smp_processor_id() smp_processor_id()
18 #ifdef CONFIG_X86_64_SMP
19 #define stack_smp_processor_id() \
21 struct thread_info *ti; \
22 __asm__("andq %%rsp,%0; ":"=r" (ti) : "0" (CURRENT_MASK)); \
27 #ifdef CONFIG_DEBUG_PREEMPT
28 extern unsigned int debug_smp_processor_id(void);
29 # define smp_processor_id() debug_smp_processor_id()
31 # define smp_processor_id() raw_smp_processor_id()
34 #endif /* SMP && !__ASSEMBLY__ */
36 #endif /* _ASM_X86_SMP_PROCESSOR_ID_H */