xref: /netbsd-src/sys/arch/x86/include/fpu.h (revision c38e7cc395b1472a774ff828e46123de44c628e9)
1 /*	$NetBSD: fpu.h,v 1.7 2017/11/03 07:14:24 maxv 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 
10 struct cpu_info;
11 struct lwp;
12 struct trapframe;
13 
14 void fpuinit(struct cpu_info *);
15 void fpuinit_mxcsr_mask(void);
16 void fpusave_lwp(struct lwp *, bool);
17 void fpusave_cpu(bool);
18 
19 void fpu_set_default_cw(struct lwp *, unsigned int);
20 
21 void fputrap(struct trapframe *);
22 void fpudna(struct trapframe *);
23 
24 void process_xmm_to_s87(const struct fxsave *, struct save87 *);
25 void process_s87_to_xmm(const struct save87 *, struct fxsave *);
26 
27 /* Set all to defaults (eg during exec) */
28 void fpu_save_area_clear(struct lwp *, unsigned int);
29 /* Reset control words only - for signal handlers */
30 void fpu_save_area_reset(struct lwp *);
31 
32 /* Copy data outside pcb during fork */
33 void fpu_save_area_fork(struct pcb *, const struct pcb *);
34 
35 /* Load FP registers with user-supplied values */
36 void process_write_fpregs_xmm(struct lwp *lwp, const struct fxsave *fpregs);
37 void process_write_fpregs_s87(struct lwp *lwp, const struct save87 *fpregs);
38 
39 /* Save FP registers for copy to userspace */
40 void process_read_fpregs_xmm(struct lwp *lwp, struct fxsave *fpregs);
41 void process_read_fpregs_s87(struct lwp *lwp, struct save87 *fpregs);
42 
43 #endif
44 
45 #endif /* _X86_FPU_H_ */
46