summaryrefslogtreecommitdiffstats
path: root/arch/x86/entry/vdso/vgetcpu.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-06-03 18:05:44 +0200
committerIngo Molnar <mingo@kernel.org>2015-06-03 18:51:37 +0200
commitd603c8e184d882cc3f55c599f4185bad956ee0a7 (patch)
tree9af00f42ddd7fbdc1192e5708caaa3ef85103175 /arch/x86/entry/vdso/vgetcpu.c
parent19a433f45135656d065bdf1bbe543796b194ba3a (diff)
downloadlinux-d603c8e184d882cc3f55c599f4185bad956ee0a7.tar.bz2
x86/asm/entry, x86/vdso: Move the vDSO code to arch/x86/entry/vdso/
Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Brian Gerst <brgerst@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/entry/vdso/vgetcpu.c')
-rw-r--r--arch/x86/entry/vdso/vgetcpu.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/x86/entry/vdso/vgetcpu.c b/arch/x86/entry/vdso/vgetcpu.c
new file mode 100644
index 000000000000..8ec3d1f4ce9a
--- /dev/null
+++ b/arch/x86/entry/vdso/vgetcpu.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2006 Andi Kleen, SUSE Labs.
+ * Subject to the GNU Public License, v.2
+ *
+ * Fast user context implementation of getcpu()
+ */
+
+#include <linux/kernel.h>
+#include <linux/getcpu.h>
+#include <linux/time.h>
+#include <asm/vgtod.h>
+
+notrace long
+__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
+{
+ unsigned int p;
+
+ p = __getcpu();
+
+ if (cpu)
+ *cpu = p & VGETCPU_CPU_MASK;
+ if (node)
+ *node = p >> 12;
+ return 0;
+}
+
+long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
+ __attribute__((weak, alias("__vdso_getcpu")));