2 * include/asm-i386/i387.h
4 * Copyright (C) 1994 Linus Torvalds
6 * Pentium III FXSR, SSE support
7 * General FPU state handling cleanups
8 * Gareth Hughes <gareth@valinux.com>, May 2000
11 #ifndef __ASM_I386_I387_H
12 #define __ASM_I386_I387_H
14 #include <linux/sched.h>
15 #include <asm/processor.h>
16 #include <asm/sigcontext.h>
19 extern void init_fpu(void);
21 * FPU lazy state save handling...
23 extern void save_init_fpu( struct task_struct
*tsk
);
24 extern void restore_fpu( struct task_struct
*tsk
);
26 #define unlazy_fpu( tsk ) do { \
27 if ( tsk->flags & PF_USEDFPU ) \
28 save_init_fpu( tsk ); \
31 #define clear_fpu( tsk ) do { \
32 if ( tsk->flags & PF_USEDFPU ) { \
33 asm volatile("fwait"); \
34 tsk->flags &= ~PF_USEDFPU; \
40 * FPU state interaction...
42 extern unsigned short get_fpu_cwd( struct task_struct
*tsk
);
43 extern unsigned short get_fpu_swd( struct task_struct
*tsk
);
44 extern unsigned short get_fpu_twd( struct task_struct
*tsk
);
45 extern unsigned short get_fpu_mxcsr( struct task_struct
*tsk
);
47 extern void set_fpu_cwd( struct task_struct
*tsk
, unsigned short cwd
);
48 extern void set_fpu_swd( struct task_struct
*tsk
, unsigned short swd
);
49 extern void set_fpu_twd( struct task_struct
*tsk
, unsigned short twd
);
50 extern void set_fpu_mxcsr( struct task_struct
*tsk
, unsigned short mxcsr
);
52 #define load_mxcsr( val ) do { \
53 if ( cpu_has_xmm ) { \
54 unsigned long __mxcsr = ((unsigned long)(val) & 0xffff); \
55 asm volatile( "ldmxcsr %0" : : "m" (__mxcsr) ); \
60 * Signal frame handlers...
62 extern int save_i387( struct _fpstate
*buf
);
63 extern int restore_i387( struct _fpstate
*buf
);
66 * ptrace request handers...
68 extern int get_fpregs( struct user_i387_struct
*buf
,
69 struct task_struct
*tsk
);
70 extern int set_fpregs( struct task_struct
*tsk
,
71 struct user_i387_struct
*buf
);
73 extern int get_fpxregs( struct user_fxsr_struct
*buf
,
74 struct task_struct
*tsk
);
75 extern int set_fpxregs( struct task_struct
*tsk
,
76 struct user_fxsr_struct
*buf
);
79 * FPU state for core dumps...
81 extern int dump_fpu( struct pt_regs
*regs
,
82 struct user_i387_struct
*fpu
);
83 extern int dump_extended_fpu( struct pt_regs
*regs
,
84 struct user_fxsr_struct
*fpu
);
86 #endif /* __ASM_I386_I387_H */