From: Tomas Hruby Date: Thu, 16 Sep 2010 09:51:45 +0000 (+0000) Subject: Fixed FPU for single cpu X-Git-Tag: v3.2.0~835 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=13bda81ee0c355d1d3d29ebfcaf6ef904e76564a;p=minix.git Fixed FPU for single cpu --- diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index d9bc31cab..fbc9b14e7 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -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 } diff --git a/kernel/glo.h b/kernel/glo.h index 1c9eb5137..7fb548d4d 100644 --- a/kernel/glo.h +++ b/kernel/glo.h @@ -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 */