Module: xenomai-2.5
Branch: master
Commit: 91a55f9ebb69c9744302999bd74ace083efbd99f
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=91a55f9ebb69c9744302999bd74ace083efbd99f

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun May 16 16:58:40 2010 +0200

arm: fix VFP handling in the SMP case

---

 include/asm-arm/hal.h |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/include/asm-arm/hal.h b/include/asm-arm/hal.h
index 2dae6da..112d9be 100644
--- a/include/asm-arm/hal.h
+++ b/include/asm-arm/hal.h
@@ -239,15 +239,6 @@ static inline void rthal_restore_fpu(rthal_fpenv_t *fpuenv)
     rthal_vfp_load(&fpuenv->vfpstate);
 }
 
-extern union vfp_state *last_VFP_context[NR_CPUS];
-#define rthal_get_fpu_owner()                                          \
-    ({                                                                 \
-       union vfp_state *_vfp_owner = last_VFP_context[smp_processor_id()]; \
-       (!_vfp_owner                                                    \
-        ? NULL                                                         \
-        : container_of(_vfp_owner, rthal_fpenv_t, vfpstate));          \
-    })
-
 #define rthal_vfp_fmrx(_vfp_) ({                       \
     u32 __v;                                           \
     asm volatile("mrc p10, 7, %0, " __stringify(_vfp_) \
@@ -261,6 +252,25 @@ extern union vfp_state *last_VFP_context[NR_CPUS];
                 ", cr0, 0 @ fmxr " #_vfp_ ", %0":      \
                 /* */ : "r" (_var_))
 
+extern union vfp_state *last_VFP_context[NR_CPUS];
+static inline rthal_fpenv_t *rthal_get_fpu_owner(void)
+{
+       union vfp_state *vfp_owner;
+#ifdef CONFIG_SMP
+       unsigned fpexc;
+
+       fpexc = rthal_vfp_fmrx(FPEXC);
+       if (!(fpexc & FPEXC_EN))
+               return NULL;
+#endif
+
+       vfp_owner = last_VFP_context[ipipe_processor_id()];
+       if (!vfp_owner)
+               return NULL;
+
+       return container_of(vfp_owner, rthal_fpenv_t, vfpstate);
+}
+
 #define rthal_disable_fpu() \
     rthal_vfp_fmxr(FPEXC, rthal_vfp_fmrx(FPEXC) & ~FPEXC_EN)
 


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

Reply via email to