Commit | Line | Data |
---|---|---|
2aae950b AK |
1 | /* |
2 | * Copyright 2006 Andi Kleen, SUSE Labs. | |
3 | * Subject to the GNU Public License, v.2 | |
4 | * | |
5 | * Fast user context implementation of getcpu() | |
6 | */ | |
7 | ||
8 | #include <linux/kernel.h> | |
9 | #include <linux/getcpu.h> | |
2aae950b | 10 | #include <linux/time.h> |
2aae950b | 11 | #include <asm/vgtod.h> |
2aae950b | 12 | |
23adec55 SR |
13 | notrace long |
14 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) | |
2aae950b | 15 | { |
8f12dea6 | 16 | unsigned int p; |
2aae950b | 17 | |
51c19b4f MT |
18 | p = __getcpu(); |
19 | ||
2aae950b | 20 | if (cpu) |
51c19b4f | 21 | *cpu = p & VGETCPU_CPU_MASK; |
2aae950b AK |
22 | if (node) |
23 | *node = p >> 12; | |
24 | return 0; | |
25 | } | |
26 | ||
27 | long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) | |
28 | __attribute__((weak, alias("__vdso_getcpu"))); |