aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/i387.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-i386/i387.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-i386/i387.h')
-rw-r--r--include/asm-i386/i387.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
new file mode 100644
index 000000000000..f6feb98a9397
--- /dev/null
+++ b/include/asm-i386/i387.h
@@ -0,0 +1,115 @@
1/*
2 * include/asm-i386/i387.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 *
6 * Pentium III FXSR, SSE support
7 * General FPU state handling cleanups
8 * Gareth Hughes <gareth@valinux.com>, May 2000
9 */
10
11#ifndef __ASM_I386_I387_H
12#define __ASM_I386_I387_H
13
14#include <linux/sched.h>
15#include <linux/init.h>
16#include <asm/processor.h>
17#include <asm/sigcontext.h>
18#include <asm/user.h>
19
20extern void mxcsr_feature_mask_init(void);
21extern void init_fpu(struct task_struct *);
22/*
23 * FPU lazy state save handling...
24 */
25extern void restore_fpu( struct task_struct *tsk );
26
27extern void kernel_fpu_begin(void);
28#define kernel_fpu_end() do { stts(); preempt_enable(); } while(0)
29
30/*
31 * These must be called with preempt disabled
32 */
33static inline void __save_init_fpu( struct task_struct *tsk )
34{
35 if ( cpu_has_fxsr ) {
36 asm volatile( "fxsave %0 ; fnclex"
37 : "=m" (tsk->thread.i387.fxsave) );
38 } else {
39 asm volatile( "fnsave %0 ; fwait"
40 : "=m" (tsk->thread.i387.fsave) );
41 }
42 tsk->thread_info->status &= ~TS_USEDFPU;
43}
44
45#define __unlazy_fpu( tsk ) do { \
46 if ((tsk)->thread_info->status & TS_USEDFPU) \
47 save_init_fpu( tsk ); \
48} while (0)
49
50#define __clear_fpu( tsk ) \
51do { \
52 if ((tsk)->thread_info->status & TS_USEDFPU) { \
53 asm volatile("fnclex ; fwait"); \
54 (tsk)->thread_info->status &= ~TS_USEDFPU; \
55 stts(); \
56 } \
57} while (0)
58
59
60/*
61 * These disable preemption on their own and are safe
62 */
63static inline void save_init_fpu( struct task_struct *tsk )
64{
65 preempt_disable();
66 __save_init_fpu(tsk);
67 stts();
68 preempt_enable();
69}
70
71#define unlazy_fpu( tsk ) do { \
72 preempt_disable(); \
73 __unlazy_fpu(tsk); \
74 preempt_enable(); \
75} while (0)
76
77#define clear_fpu( tsk ) do { \
78 preempt_disable(); \
79 __clear_fpu( tsk ); \
80 preempt_enable(); \
81} while (0)
82 \
83/*
84 * FPU state interaction...
85 */
86extern unsigned short get_fpu_cwd( struct task_struct *tsk );
87extern unsigned short get_fpu_swd( struct task_struct *tsk );
88extern unsigned short get_fpu_mxcsr( struct task_struct *tsk );
89
90/*
91 * Signal frame handlers...
92 */
93extern int save_i387( struct _fpstate __user *buf );
94extern int restore_i387( struct _fpstate __user *buf );
95
96/*
97 * ptrace request handers...
98 */
99extern int get_fpregs( struct user_i387_struct __user *buf,
100 struct task_struct *tsk );
101extern int set_fpregs( struct task_struct *tsk,
102 struct user_i387_struct __user *buf );
103
104extern int get_fpxregs( struct user_fxsr_struct __user *buf,
105 struct task_struct *tsk );
106extern int set_fpxregs( struct task_struct *tsk,
107 struct user_fxsr_struct __user *buf );
108
109/*
110 * FPU state for core dumps...
111 */
112extern int dump_fpu( struct pt_regs *regs,
113 struct user_i387_struct *fpu );
114
115#endif /* __ASM_I386_I387_H */