aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/vvar.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/vvar.h')
-rw-r--r--arch/x86/include/asm/vvar.h29
1 files changed, 25 insertions, 4 deletions
diff --git a/arch/x86/include/asm/vvar.h b/arch/x86/include/asm/vvar.h
index d76ac40da206..081d909bc495 100644
--- a/arch/x86/include/asm/vvar.h
+++ b/arch/x86/include/asm/vvar.h
@@ -16,8 +16,8 @@
16 * you mess up, the linker will catch it.) 16 * you mess up, the linker will catch it.)
17 */ 17 */
18 18
19/* Base address of vvars. This is not ABI. */ 19#ifndef _ASM_X86_VVAR_H
20#define VVAR_ADDRESS (-10*1024*1024 - 4096) 20#define _ASM_X86_VVAR_H
21 21
22#if defined(__VVAR_KERNEL_LDS) 22#if defined(__VVAR_KERNEL_LDS)
23 23
@@ -29,16 +29,35 @@
29 29
30#else 30#else
31 31
32#ifdef BUILD_VDSO32
33
34#define DECLARE_VVAR(offset, type, name) \
35 extern type vvar_ ## name __attribute__((visibility("hidden")));
36
37#define VVAR(name) (vvar_ ## name)
38
39#else
40
41extern char __vvar_page;
42
43/* Base address of vvars. This is not ABI. */
44#ifdef CONFIG_X86_64
45#define VVAR_ADDRESS (-10*1024*1024 - 4096)
46#else
47#define VVAR_ADDRESS (&__vvar_page)
48#endif
49
32#define DECLARE_VVAR(offset, type, name) \ 50#define DECLARE_VVAR(offset, type, name) \
33 static type const * const vvaraddr_ ## name = \ 51 static type const * const vvaraddr_ ## name = \
34 (void *)(VVAR_ADDRESS + (offset)); 52 (void *)(VVAR_ADDRESS + (offset));
35 53
54#define VVAR(name) (*vvaraddr_ ## name)
55#endif
56
36#define DEFINE_VVAR(type, name) \ 57#define DEFINE_VVAR(type, name) \
37 type name \ 58 type name \
38 __attribute__((section(".vvar_" #name), aligned(16))) __visible 59 __attribute__((section(".vvar_" #name), aligned(16))) __visible
39 60
40#define VVAR(name) (*vvaraddr_ ## name)
41
42#endif 61#endif
43 62
44/* DECLARE_VVAR(offset, type, name) */ 63/* DECLARE_VVAR(offset, type, name) */
@@ -48,3 +67,5 @@ DECLARE_VVAR(16, int, vgetcpu_mode)
48DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data) 67DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data)
49 68
50#undef DECLARE_VVAR 69#undef DECLARE_VVAR
70
71#endif