diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-08-15 07:57:32 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-15 07:57:32 -0400 |
commit | 975439fe73d1f0f7ce8c235c66783bd34dc459c3 (patch) | |
tree | 84e29852d96283b13c6e603f86bd506a631343c5 /include/asm-x86/i387.h | |
parent | ef31023743e66de7184e9aad432291c842a6384b (diff) | |
parent | 129d6aba444d1e99d4cbfb9866a4652912426b65 (diff) |
Merge branch 'x86/amd-iommu' into x86/urgent
Diffstat (limited to 'include/asm-x86/i387.h')
-rw-r--r-- | include/asm-x86/i387.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h index 0048fb77afc4..56d00e31aec0 100644 --- a/include/asm-x86/i387.h +++ b/include/asm-x86/i387.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/kernel_stat.h> | 14 | #include <linux/kernel_stat.h> |
15 | #include <linux/regset.h> | 15 | #include <linux/regset.h> |
16 | #include <linux/hardirq.h> | ||
16 | #include <asm/asm.h> | 17 | #include <asm/asm.h> |
17 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
18 | #include <asm/sigcontext.h> | 19 | #include <asm/sigcontext.h> |
@@ -234,6 +235,37 @@ static inline void kernel_fpu_end(void) | |||
234 | preempt_enable(); | 235 | preempt_enable(); |
235 | } | 236 | } |
236 | 237 | ||
238 | /* | ||
239 | * Some instructions like VIA's padlock instructions generate a spurious | ||
240 | * DNA fault but don't modify SSE registers. And these instructions | ||
241 | * get used from interrupt context aswell. To prevent these kernel instructions | ||
242 | * in interrupt context interact wrongly with other user/kernel fpu usage, we | ||
243 | * should use them only in the context of irq_ts_save/restore() | ||
244 | */ | ||
245 | static inline int irq_ts_save(void) | ||
246 | { | ||
247 | /* | ||
248 | * If we are in process context, we are ok to take a spurious DNA fault. | ||
249 | * Otherwise, doing clts() in process context require pre-emption to | ||
250 | * be disabled or some heavy lifting like kernel_fpu_begin() | ||
251 | */ | ||
252 | if (!in_interrupt()) | ||
253 | return 0; | ||
254 | |||
255 | if (read_cr0() & X86_CR0_TS) { | ||
256 | clts(); | ||
257 | return 1; | ||
258 | } | ||
259 | |||
260 | return 0; | ||
261 | } | ||
262 | |||
263 | static inline void irq_ts_restore(int TS_state) | ||
264 | { | ||
265 | if (TS_state) | ||
266 | stts(); | ||
267 | } | ||
268 | |||
237 | #ifdef CONFIG_X86_64 | 269 | #ifdef CONFIG_X86_64 |
238 | 270 | ||
239 | static inline void save_init_fpu(struct task_struct *tsk) | 271 | static inline void save_init_fpu(struct task_struct *tsk) |