From: Tomas Hruby Date: Thu, 1 Jul 2010 12:23:25 +0000 (+0000) Subject: FPU cleanup X-Git-Tag: v3.1.8~300 X-Git-Url: http://zhaoyanbai.com/repos/doc/roff.7.html?a=commitdiff_plain;h=7920d48156cf99a6f98982b8ccbee926d4f1b530;p=minix.git FPU cleanup - last reference to MF_USED_FPU removed - proc_used_fpu() used to test for MF_FPU_INITIALIZED --- diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index e98888786..ee039e3a9 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -219,7 +219,7 @@ PUBLIC void save_fpu(struct proc *pr) PUBLIC void restore_fpu(struct proc *pr) { - if(!(pr->p_misc_flags & MF_FPU_INITIALIZED)) { + if(!proc_used_fpu(pr)) { fninit(); pr->p_misc_flags |= MF_FPU_INITIALIZED; } else { diff --git a/kernel/proc.h b/kernel/proc.h index 115bf01ac..45da12c9e 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -146,7 +146,7 @@ struct proc { #define proc_is_preempted(p) ((p)->p_rts_flags & RTS_PREEMPTED) #define proc_no_quantum(p) ((p)->p_rts_flags & RTS_NO_QUANTUM) #define proc_ptr_ok(p) ((p)->p_magic == PMAGIC) -#define proc_used_fpu(p) ((p)->p_misc_flags & (MF_FPU_INITIALIZED|MF_USED_FPU)) +#define proc_used_fpu(p) ((p)->p_misc_flags & (MF_FPU_INITIALIZED)) /* test whether the process is scheduled by the kernel's default policy */ #define proc_kernel_scheduler(p) ((p)->p_scheduler == NULL || \ diff --git a/kernel/system/do_fork.c b/kernel/system/do_fork.c index 9f25c893d..c6956a5e6 100644 --- a/kernel/system/do_fork.c +++ b/kernel/system/do_fork.c @@ -67,7 +67,7 @@ PUBLIC int do_fork(struct proc * caller, message * m_ptr) #if (_MINIX_CHIP == _CHIP_INTEL) rpc->p_seg.p_ldt_sel = old_ldt_sel; /* restore descriptors */ rpc->p_fpu_state.fpu_save_area_p = old_fpu_save_area_p; - if(rpp->p_misc_flags & MF_FPU_INITIALIZED) + if(proc_used_fpu(rpp)) { memcpy(rpc->p_fpu_state.fpu_save_area_p, rpp->p_fpu_state.fpu_save_area_p, FPU_XFP_SIZE); diff --git a/kernel/system/do_mcontext.c b/kernel/system/do_mcontext.c index fa0ed772d..7b27137e0 100644 --- a/kernel/system/do_mcontext.c +++ b/kernel/system/do_mcontext.c @@ -29,7 +29,7 @@ PUBLIC int do_getmcontext(struct proc * caller, message * m_ptr) rp = proc_addr(proc_nr); #if (_MINIX_CHIP == _CHIP_INTEL) - if (!(rp->p_misc_flags & MF_FPU_INITIALIZED)) + if (!proc_used_fpu(rp)) { return(OK); /* No state to copy */ #endif @@ -41,7 +41,7 @@ PUBLIC int do_getmcontext(struct proc * caller, message * m_ptr) #if (_MINIX_CHIP == _CHIP_INTEL) /* Copy FPU state */ mc.mc_fpu_flags = 0; - if (rp->p_misc_flags & MF_FPU_INITIALIZED) { + if (proc_used_fpu(rp)) { /* make sure that the FPU context is saved into proc structure first */ if (fpu_owner == rp) { disable_fpu_exception(); diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index 6da9463a0..3346ae10e 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -44,7 +44,7 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr) /* Copy the registers to the sigcontext structure. */ memcpy(&sc.sc_regs, (char *) &rp->p_reg, sizeof(sigregs)); #if (_MINIX_CHIP == _CHIP_INTEL) - if(rp->p_misc_flags & MF_FPU_INITIALIZED) { + if(proc_used_fpu(rp)) { /* save the FPU context before saving it to the sig context */ if (fpu_owner == rp) { disable_fpu_exception();