1/*	$NetBSD: fpu.h,v 1.23 2020/10/24 07:14:29 mgorny Exp $	*/
2
3#ifndef	_X86_FPU_H_
4#define	_X86_FPU_H_
5
6#include <x86/cpu_extended_state.h>
7
8#ifdef _KERNEL
9
10struct cpu_info;
11struct lwp;
12struct trapframe;
13
14void fpuinit(struct cpu_info *);
15void fpuinit_mxcsr_mask(void);
16
17void fpu_area_save(void *, uint64_t, bool);
18void fpu_area_restore(const void *, uint64_t, bool);
19
20void fpu_save(void);
21
22void fpu_set_default_cw(struct lwp *, unsigned int);
23
24void fputrap(struct trapframe *);
25void fpudna(struct trapframe *);
26
27void process_xmm_to_s87(const struct fxsave *, struct save87 *);
28void process_s87_to_xmm(const struct save87 *, struct fxsave *);
29
30void fpu_clear(struct lwp *, unsigned int);
31void fpu_sigreset(struct lwp *);
32
33void fpu_lwp_fork(struct lwp *, struct lwp *);
34void fpu_lwp_abandon(struct lwp *l);
35
36void fpu_kern_enter(void);
37void fpu_kern_leave(void);
38
39void process_write_fpregs_xmm(struct lwp *, const struct fxsave *);
40void process_write_fpregs_s87(struct lwp *, const struct save87 *);
41
42void process_read_fpregs_xmm(struct lwp *, struct fxsave *);
43void process_read_fpregs_s87(struct lwp *, struct save87 *);
44
45int process_read_xstate(struct lwp *, struct xstate *);
46int process_verify_xstate(const struct xstate *);
47int process_write_xstate(struct lwp *, const struct xstate *);
48
49#endif
50
51#endif /* _X86_FPU_H_ */
52