Linux 3.11-rc3
[cris-mirror.git] / arch / x86 / include / asm / vsyscall.h
blob2a46ca720afca5fd6f5e5010698e8eea56748837
1 #ifndef _ASM_X86_VSYSCALL_H
2 #define _ASM_X86_VSYSCALL_H
4 #include <linux/seqlock.h>
5 #include <uapi/asm/vsyscall.h>
7 #define VGETCPU_RDTSCP 1
8 #define VGETCPU_LSL 2
10 /* kernel space (writeable) */
11 extern int vgetcpu_mode;
12 extern struct timezone sys_tz;
14 #include <asm/vvar.h>
16 extern void map_vsyscall(void);
19 * Called on instruction fetch fault in vsyscall page.
20 * Returns true if handled.
22 extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
24 #ifdef CONFIG_X86_64
26 #define VGETCPU_CPU_MASK 0xfff
28 static inline unsigned int __getcpu(void)
30 unsigned int p;
32 if (VVAR(vgetcpu_mode) == VGETCPU_RDTSCP) {
33 /* Load per CPU data from RDTSCP */
34 native_read_tscp(&p);
35 } else {
36 /* Load per CPU data from GDT */
37 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
40 return p;
42 #endif /* CONFIG_X86_64 */
44 #endif /* _ASM_X86_VSYSCALL_H */