blob: 5e9cbcce318abd18301c2a521b36ae29b8302f09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_FSGSBASE_H
#define _ASM_FSGSBASE_H 1
#ifndef __ASSEMBLY__
#ifdef CONFIG_X86_64
#include <asm/msr-index.h>
/*
* Read/write a task's fsbase or gsbase. This returns the value that
* the FS/GS base would have (if the task were to be resumed). These
* work on current or on a different non-running task.
*/
unsigned long x86_fsbase_read_task(struct task_struct *task);
unsigned long x86_gsbase_read_task(struct task_struct *task);
int x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase);
int x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase);
/* Helper functions for reading/writing FS/GS base */
static inline unsigned long x86_fsbase_read_cpu(void)
{
unsigned long fsbase;
rdmsrl(MSR_FS_BASE, fsbase);
return fsbase;
}
void x86_fsbase_write_cpu(unsigned long fsbase);
static inline unsigned long x86_gsbase_read_cpu_inactive(void)
{
unsigned long gsbase;
rdmsrl(MSR_KERNEL_GS_BASE, gsbase);
return gsbase;
}
void x86_gsbase_write_cpu_inactive(unsigned long gsbase);
#endif /* CONFIG_X86_64 */
#endif /* __ASSEMBLY__ */
#endif /* _ASM_FSGSBASE_H */
|