|
@@ -1,6 +1,6 @@
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_FSGSBASE_H
|
|
#ifndef _ASM_FSGSBASE_H
|
|
-#define _ASM_FSGSBASE_H 1
|
|
|
|
|
|
+#define _ASM_FSGSBASE_H
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
@@ -9,14 +9,15 @@
|
|
#include <asm/msr-index.h>
|
|
#include <asm/msr-index.h>
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Read/write a task's fsbase or gsbase. This returns the value that
|
|
|
|
|
|
+ * 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
|
|
* the FS/GS base would have (if the task were to be resumed). These
|
|
- * work on current or on a different non-running task.
|
|
|
|
|
|
+ * work on the current task or on a non-running (typically stopped
|
|
|
|
+ * ptrace child) 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);
|
|
|
|
|
|
+extern unsigned long x86_fsbase_read_task(struct task_struct *task);
|
|
|
|
+extern unsigned long x86_gsbase_read_task(struct task_struct *task);
|
|
|
|
+extern int x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase);
|
|
|
|
+extern int x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase);
|
|
|
|
|
|
/* Helper functions for reading/writing FS/GS base */
|
|
/* Helper functions for reading/writing FS/GS base */
|
|
|
|
|
|
@@ -25,20 +26,21 @@ static inline unsigned long x86_fsbase_read_cpu(void)
|
|
unsigned long fsbase;
|
|
unsigned long fsbase;
|
|
|
|
|
|
rdmsrl(MSR_FS_BASE, fsbase);
|
|
rdmsrl(MSR_FS_BASE, fsbase);
|
|
|
|
+
|
|
return fsbase;
|
|
return fsbase;
|
|
}
|
|
}
|
|
|
|
|
|
-void x86_fsbase_write_cpu(unsigned long fsbase);
|
|
|
|
-
|
|
|
|
static inline unsigned long x86_gsbase_read_cpu_inactive(void)
|
|
static inline unsigned long x86_gsbase_read_cpu_inactive(void)
|
|
{
|
|
{
|
|
unsigned long gsbase;
|
|
unsigned long gsbase;
|
|
|
|
|
|
rdmsrl(MSR_KERNEL_GS_BASE, gsbase);
|
|
rdmsrl(MSR_KERNEL_GS_BASE, gsbase);
|
|
|
|
+
|
|
return gsbase;
|
|
return gsbase;
|
|
}
|
|
}
|
|
|
|
|
|
-void x86_gsbase_write_cpu_inactive(unsigned long gsbase);
|
|
|
|
|
|
+extern void x86_fsbase_write_cpu(unsigned long fsbase);
|
|
|
|
+extern void x86_gsbase_write_cpu_inactive(unsigned long gsbase);
|
|
|
|
|
|
#endif /* CONFIG_X86_64 */
|
|
#endif /* CONFIG_X86_64 */
|
|
|
|
|