Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#ifndef _ASM_X86_VSYSCALL_H
2#define _ASM_X86_VSYSCALL_H
3
4#include <linux/seqlock.h>
5#include <uapi/asm/vsyscall.h>
6
7#define VGETCPU_RDTSCP 1
8#define VGETCPU_LSL 2
9
10/* kernel space (writeable) */
11extern int vgetcpu_mode;
12extern struct timezone sys_tz;
13
14#include <asm/vvar.h>
15
16extern void map_vsyscall(void);
17
18/*
19 * Called on instruction fetch fault in vsyscall page.
20 * Returns true if handled.
21 */
22extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
23
24#ifdef CONFIG_X86_64
25
26#define VGETCPU_CPU_MASK 0xfff
27
28static inline unsigned int __getcpu(void)
29{
30 unsigned int p;
31
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));
38 }
39
40 return p;
41}
42#endif /* CONFIG_X86_64 */
43
44#endif /* _ASM_X86_VSYSCALL_H */