Module: xenomai-gch
Branch: for-forge
Commit: 22ed3b6ac405282518415daec019068447ce20b1
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=22ed3b6ac405282518415daec019068447ce20b1

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Oct 25 12:55:11 2013 +0200

cobalt/x86: add missing fpu save for the migration case

---

 kernel/cobalt/arch/x86/thread.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index 24363df..548c63c 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -265,7 +265,17 @@ void xnarch_leave_root(struct xnarchtcb *rootcb)
 
 void xnarch_save_fpu(struct xnarchtcb *tcb)
 {
-       /* Already saved by __switch_to */
+       struct task_struct *p = tcb->core.host_task;
+
+       if (wrap_test_fpu_used(p) == 0)
+               /* Common case: already saved by __switch_to */
+               return;
+       
+       /* Exceptional case: a migrating thread */
+       clts();
+
+       __do_save_i387(x86_fpustate_ptr(&p->thread));
+       wrap_clear_fpu_used(p);
 }
 
 void xnarch_restore_fpu(struct xnarchtcb *tcb)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to