debuggers.hg

view xen/arch/x86/i387.c @ 3674:fb875591fd72

bitkeeper revision 1.1159.223.63 (42028527-fv-d9BM0_LRp8UKGP19gQ)

Fix NMI deferral.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Thu Feb 03 20:10:15 2005 +0000 (2005-02-03)
parents ead91151a0e6
children fe5933507ca5 0a4b76b6b5a0
line source
1 /*
2 * linux/arch/i386/kernel/i387.c
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 */
11 #include <xen/config.h>
12 #include <xen/sched.h>
13 #include <asm/processor.h>
14 #include <asm/i387.h>
16 void init_fpu(void)
17 {
18 __asm__("fninit");
19 if ( cpu_has_xmm ) load_mxcsr(0x1f80);
20 set_bit(DF_DONEFPUINIT, &current->flags);
21 }
23 static inline void __save_init_fpu( struct domain *tsk )
24 {
25 if ( cpu_has_fxsr ) {
26 asm volatile( "fxsave %0 ; fnclex"
27 : "=m" (tsk->thread.i387) );
28 } else {
29 asm volatile( "fnsave %0 ; fwait"
30 : "=m" (tsk->thread.i387) );
31 }
32 clear_bit(DF_USEDFPU, &tsk->flags);
33 }
35 void save_init_fpu( struct domain *tsk )
36 {
37 /*
38 * The guest OS may have set the 'virtual STTS' flag.
39 * This causes us to set the real flag, so we'll need
40 * to temporarily clear it while saving f-p state.
41 */
42 if ( test_bit(DF_GUEST_STTS, &tsk->flags) ) clts();
43 __save_init_fpu(tsk);
44 stts();
45 }
47 void restore_fpu( struct domain *tsk )
48 {
49 if ( cpu_has_fxsr ) {
50 asm volatile( "fxrstor %0"
51 : : "m" (tsk->thread.i387) );
52 } else {
53 asm volatile( "frstor %0"
54 : : "m" (tsk->thread.i387) );
55 }
56 }