2 * Copyright 2006 Andi Kleen, SUSE Labs.
3 * Subject to the GNU Public License, v.2
5 * Fast user context implementation of getcpu()
8 #include <linux/kernel.h>
9 #include <linux/getcpu.h>
10 #include <linux/jiffies.h>
11 #include <linux/time.h>
12 #include <asm/vsyscall.h>
13 #include <asm/vgtod.h>
16 __vdso_getcpu(unsigned *cpu
, unsigned *node
, struct getcpu_cache
*unused
)
20 if (VVAR(vgetcpu_mode
) == VGETCPU_RDTSCP
) {
21 /* Load per CPU data from RDTSCP */
24 /* Load per CPU data from GDT */
25 asm("lsl %1,%0" : "=r" (p
) : "r" (__PER_CPU_SEG
));
34 long getcpu(unsigned *cpu
, unsigned *node
, struct getcpu_cache
*tcache
)
35 __attribute__((weak
, alias("__vdso_getcpu")));