]> Zhao Yanbai Git Server - minix.git/commitdiff
Fixed FPU for single cpu
authorTomas Hruby <tom@minix3.org>
Thu, 16 Sep 2010 09:51:45 +0000 (09:51 +0000)
committerTomas Hruby <tom@minix3.org>
Thu, 16 Sep 2010 09:51:45 +0000 (09:51 +0000)
kernel/arch/i386/arch_system.c
kernel/glo.h

index d9bc31cab46c9e96d6fd70f00e488e703ead8ba5..fbc9b14e787d09e371bd510ee61197f7dd95c445 100644 (file)
@@ -244,7 +244,7 @@ PUBLIC void fpu_init(void)
 
 PUBLIC void save_local_fpu(struct proc *pr)
 {
-       if(!fpu_presence)
+       if(!is_fpu())
                return;
 
        /* Save changed FPU context. */
@@ -258,9 +258,12 @@ PUBLIC void save_local_fpu(struct proc *pr)
 
 PUBLIC void save_fpu(struct proc *pr)
 {
-#if CONFIG_SMP
+#ifdef CONFIG_SMP
        if (cpuid == pr->p_cpu) {
-               save_local_fpu(pr);
+               if (get_cpulocal_var(fpu_owner) == pr) {
+                       disable_fpu_exception();
+                       save_local_fpu(pr);
+               }
        }
        else {
                int stopped;
@@ -280,7 +283,10 @@ PUBLIC void save_fpu(struct proc *pr)
                        RTS_UNSET(pr, RTS_PROC_STOP);
        }
 #else
-       save_local_fpu(pr);
+       if (get_cpulocal_var(fpu_owner) == pr) {
+               disable_fpu_exception();
+               save_local_fpu(pr);
+       }
 #endif
 }
 
index 1c9eb5137e87222d7ea82f7eb7d81e38139048c9..7fb548d4d9d76e83ca2c473cd89611b73e91d104 100644 (file)
@@ -43,7 +43,6 @@ EXTERN int do_serial_debug;
 EXTERN time_t boottime;
 EXTERN char params_buffer[512];                /* boot monitor parameters */
 EXTERN int minix_panicing;
-EXTERN char fpu_presence;
 EXTERN int verboseboot;                        /* verbose boot, init'ed in cstart */
 #define MAGICTEST 0xC0FFEE23
 EXTERN u32_t magictest;                        /* global magic number */