Linux 3.8-rc7
[cris-mirror.git] / arch / x86 / vdso / vgetcpu.c
blob2f94b039e55b6c2da8f40616af7445e0f8454a27
1 /*
2 * Copyright 2006 Andi Kleen, SUSE Labs.
3 * Subject to the GNU Public License, v.2
5 * Fast user context implementation of getcpu()
6 */
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>
15 notrace long
16 __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
18 unsigned int p;
20 p = __getcpu();
22 if (cpu)
23 *cpu = p & VGETCPU_CPU_MASK;
24 if (node)
25 *node = p >> 12;
26 return 0;
29 long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
30 __attribute__((weak, alias("__vdso_getcpu")));