summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/fpu/xstate.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-10-13 17:55:55 +0300
committerBorislav Petkov <bp@suse.de>2021-10-21 15:24:14 +0300
commit49e4eb4125d506937e52e10c34c8cafd93ab0ed6 (patch)
tree1fa7ef4a7fe827c6da8793fc9ba3ea84d7f592bd /arch/x86/kernel/fpu/xstate.h
parent3ac8d75778fc8c1c22daad9bc674166b862f6f6e (diff)
downloadlinux-49e4eb4125d506937e52e10c34c8cafd93ab0ed6.tar.xz
x86/fpu/xstate: Use fpstate for copy_uabi_to_xstate()
Prepare for dynamically enabled states per task. The function needs to retrieve the features and sizes which are valid in a fpstate context. Retrieve them from fpstate. Move the function declarations to the core header as they are not required anywhere else. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20211013145323.233529986@linutronix.de
Diffstat (limited to 'arch/x86/kernel/fpu/xstate.h')
-rw-r--r--arch/x86/kernel/fpu/xstate.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h
index b74c5953558c..379dbfa4f526 100644
--- a/arch/x86/kernel/fpu/xstate.h
+++ b/arch/x86/kernel/fpu/xstate.h
@@ -15,8 +15,20 @@ static inline void xstate_init_xcomp_bv(struct xregs_state *xsave, u64 mask)
xsave->header.xcomp_bv = mask | XCOMP_BV_COMPACTED_FORMAT;
}
+enum xstate_copy_mode {
+ XSTATE_COPY_FP,
+ XSTATE_COPY_FX,
+ XSTATE_COPY_XSAVE,
+};
+
+struct membuf;
extern void __copy_xstate_to_uabi_buf(struct membuf to, struct fpstate *fpstate,
u32 pkru_val, enum xstate_copy_mode copy_mode);
+extern void copy_xstate_to_uabi_buf(struct membuf to, struct task_struct *tsk,
+ enum xstate_copy_mode mode);
+extern int copy_uabi_from_kernel_to_xstate(struct fpstate *fpstate, const void *kbuf);
+extern int copy_sigframe_from_user_to_xstate(struct fpstate *fpstate, const void __user *ubuf);
+
extern void fpu__init_cpu_xstate(void);
extern void fpu__init_system_xstate(void);