Module: xenomai-forge
Branch: next
Commit: b13eb100580e1acd2b24d0699b0a688294ae72b5
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=b13eb100580e1acd2b24d0699b0a688294ae72b5

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 d7fba09..cd80e8d 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