162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * x86 FPU signal frame handling methods:
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef _ASM_X86_FPU_SIGNAL_H
662306a36Sopenharmony_ci#define _ASM_X86_FPU_SIGNAL_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/compat.h>
962306a36Sopenharmony_ci#include <linux/user.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <asm/fpu/types.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifdef CONFIG_X86_64
1462306a36Sopenharmony_ci# include <uapi/asm/sigcontext.h>
1562306a36Sopenharmony_ci# include <asm/user32.h>
1662306a36Sopenharmony_ci#else
1762306a36Sopenharmony_ci# define user_i387_ia32_struct	user_i387_struct
1862306a36Sopenharmony_ci# define user32_fxsr_struct	user_fxsr_struct
1962306a36Sopenharmony_ci#endif
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciextern void convert_from_fxsr(struct user_i387_ia32_struct *env,
2262306a36Sopenharmony_ci			      struct task_struct *tsk);
2362306a36Sopenharmony_ciextern void convert_to_fxsr(struct fxregs_state *fxsave,
2462306a36Sopenharmony_ci			    const struct user_i387_ia32_struct *env);
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciunsigned long
2762306a36Sopenharmony_cifpu__alloc_mathframe(unsigned long sp, int ia32_frame,
2862306a36Sopenharmony_ci		     unsigned long *buf_fx, unsigned long *size);
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciunsigned long fpu__get_fpstate_size(void);
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciextern bool copy_fpstate_to_sigframe(void __user *buf, void __user *fp, int size);
3362306a36Sopenharmony_ciextern void fpu__clear_user_states(struct fpu *fpu);
3462306a36Sopenharmony_ciextern bool fpu__restore_sig(void __user *buf, int ia32_frame);
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciextern void restore_fpregs_from_fpstate(struct fpstate *fpstate, u64 mask);
3762306a36Sopenharmony_ci#endif /* _ASM_X86_FPU_SIGNAL_H */
38