This source file includes following definitions.
- x86_fsbase_read_cpu
- x86_gsbase_read_cpu_inactive
- x86_fsbase_write_cpu
- x86_gsbase_write_cpu_inactive
1
2 #ifndef _ASM_FSGSBASE_H
3 #define _ASM_FSGSBASE_H
4
5 #ifndef __ASSEMBLY__
6
7 #ifdef CONFIG_X86_64
8
9 #include <asm/msr-index.h>
10
11
12
13
14
15
16
17 extern unsigned long x86_fsbase_read_task(struct task_struct *task);
18 extern unsigned long x86_gsbase_read_task(struct task_struct *task);
19 extern void x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase);
20 extern void x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase);
21
22
23
24 static inline unsigned long x86_fsbase_read_cpu(void)
25 {
26 unsigned long fsbase;
27
28 rdmsrl(MSR_FS_BASE, fsbase);
29
30 return fsbase;
31 }
32
33 static inline unsigned long x86_gsbase_read_cpu_inactive(void)
34 {
35 unsigned long gsbase;
36
37 rdmsrl(MSR_KERNEL_GS_BASE, gsbase);
38
39 return gsbase;
40 }
41
42 static inline void x86_fsbase_write_cpu(unsigned long fsbase)
43 {
44 wrmsrl(MSR_FS_BASE, fsbase);
45 }
46
47 static inline void x86_gsbase_write_cpu_inactive(unsigned long gsbase)
48 {
49 wrmsrl(MSR_KERNEL_GS_BASE, gsbase);
50 }
51
52 #endif
53
54 #endif
55
56 #endif