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

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

cobalt/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 44be20c..fa3b695 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -145,6 +145,15 @@ static inline int xnarch_fault_fpu_p(struct 
ipipe_trap_data *d)
        if (unlikely(thumb_mode(d->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);
 
@@ -187,8 +196,9 @@ static inline int xnarch_fault_fpu_p(struct ipipe_trap_data 
*d)
                /* 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