Module: xenomai-2.6
Branch: master
Commit: 1467faace860ca7139cc4e1b4ba726836ef14d27
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=1467faace860ca7139cc4e1b4ba726836ef14d27

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Aug 10 21:56:22 2012 +0200

hal/arm: avoid recursive fpu faults

---

 include/asm-arm/system.h |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 2ccfb82..432d5f7 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -147,6 +147,15 @@ static inline int xnarch_fault_fpu_p(struct xnarch_fltinfo 
*fi)
        if (unlikely(thumb_mode(fi->regs))) {
                unsigned short thumbh, thumbl;
 
+#if defined(CONFIG_ARM_THUMB) && __LINUX_ARM_ARCH__ >= 6 && 
defined(CONFIG_CPU_V7)
+#if __LINUX_ARM_ARCH__ < 7
+               if (cpu_architecture() < CPU_ARCH_ARMv7)
+#else
+               if (0)
+#endif /* arch < 7 */
+#endif /* thumb && arch >= 6 && cpu_v7 */
+                       return 0;
+
                thumbh = *(unsigned short *) pc;
                thumbl = *((unsigned short *) pc + 1);
 
@@ -189,8 +198,9 @@ static inline int xnarch_fault_fpu_p(struct xnarch_fltinfo 
*fi)
                /* If an exception is pending, the VFP fault is not really an
                   "FPU unavailable" fault, so we return undefinstr in that
                   case, the nucleus will let linux handle the fault. */
-               if (rthal_vfp_fmrx(FPEXC) & (FPEXC_EX|FPEXC_DEX)
-                   || rthal_vfp_fmrx(FPSCR) & FPSCR_IXE)
+               exc = rthal_vfp_fmrx(FPEXC);
+               if (exc & (FPEXC_EX|FPEXC_DEX)
+                   || ((exc & FPEXC_EN) && rthal_vfp_fmrx(FPSCR) & FPSCR_IXE))
                        exc = IPIPE_TRAP_UNDEFINSTR;
                else
                        exc = IPIPE_TRAP_VFP;


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

Reply via email to