Module: xenomai-2.4
Branch: master
Commit: 968baf027c9a975cb7794a7df60c7ed9b8b271c1
URL:    
http://git.xenomai.org/?p=xenomai-2.4.git;a=commit;h=968baf027c9a975cb7794a7df60c7ed9b8b271c1

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Apr 10 02:36:58 2009 +0200

x86 FPU fixes

In the non-fxsr case, do not forcibly restore the fpu context by
default, it is the wrong thing to do if the fpu context was not
saved.

---

 include/asm-x86/bits/pod_32.h |   15 ++-------------
 include/asm-x86/bits/pod_64.h |    3 ++-
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/include/asm-x86/bits/pod_32.h b/include/asm-x86/bits/pod_32.h
index 9ddb35b..4fe2729 100644
--- a/include/asm-x86/bits/pod_32.h
+++ b/include/asm-x86/bits/pod_32.h
@@ -299,24 +299,13 @@ static inline void xnarch_enable_fpu(xnarchtcb_t * tcb)
                if (tcb->cr0_ts)
                        return;
 
-               if (wrap_test_fpu_used(task)) {
-                       /* Fpu context was not even saved, do not restore */
-                       clts();
+               if (tcb->ts_usedfpu && !wrap_test_fpu_used(task)) {
+                       xnarch_restore_fpu(tcb);
                        return;
                }
-               
-               xnarch_restore_fpu(tcb);
-               return;
        }
 
        clts();
-
-       if (!cpu_has_fxsr && task)
-               /* fnsave, called by switch_to, initialized the FPU state, so 
that on
-                  cpus prior to PII (i.e. without fxsr), we need to restore 
the saved
-                  state. */
-               __asm__ __volatile__("frstor %0": /* no output */
-                                    :"m"(*tcb->fpup));
 }
 
 #else /* !CONFIG_XENO_HW_FPU */
diff --git a/include/asm-x86/bits/pod_64.h b/include/asm-x86/bits/pod_64.h
index 7baac7f..aebf4d3 100644
--- a/include/asm-x86/bits/pod_64.h
+++ b/include/asm-x86/bits/pod_64.h
@@ -310,7 +310,8 @@ static inline void xnarch_enable_fpu(xnarchtcb_t * tcb)
                if (tcb->cr0_ts)
                        return;
 
-               if (!(task_thread_info(task)->status & TS_USEDFPU)) {
+               if (tcb->ts_usedfpu &&
+                   !(task_thread_info(task)->status & TS_USEDFPU)) {
                        xnarch_restore_fpu(tcb);
                        return;
                }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to