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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Mon Dec 10 01:43:07 2012 +0100

arm/mayday: fix mayday with applications compiled in thumb mode

---

 include/asm-arm/thread.h        |    3 +++
 kernel/cobalt/arch/arm/mayday.c |    8 ++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/asm-arm/thread.h b/include/asm-arm/thread.h
index ae8c57c..5c99f0c 100644
--- a/include/asm-arm/thread.h
+++ b/include/asm-arm/thread.h
@@ -100,6 +100,9 @@ struct xnarchtcb {
 #ifdef CONFIG_XENO_ARM_EABI
                unsigned long r7;
 #endif
+#ifdef CONFIG_ARM_THUMB
+               unsigned long psr;
+#endif
        } mayday;
        struct xnthread *self;
        int imask;
diff --git a/kernel/cobalt/arch/arm/mayday.c b/kernel/cobalt/arch/arm/mayday.c
index e8bcc3f..2532fd2 100644
--- a/kernel/cobalt/arch/arm/mayday.c
+++ b/kernel/cobalt/arch/arm/mayday.c
@@ -106,6 +106,11 @@ void xnarch_handle_mayday(struct xnarchtcb *tcb, struct 
pt_regs *regs,
 #ifdef CONFIG_XENO_ARM_EABI
        tcb->mayday.r7 = regs->ARM_r7;
 #endif
+#ifdef CONFIG_ARM_THUMB
+       /* The code on the mayday page must be run in ARM mode */
+       tcb->mayday.psr = regs->ARM_cpsr;
+       regs->ARM_cpsr &= ~PSR_T_BIT;
+#endif
        regs->ARM_pc = tramp;
 }
 
@@ -116,4 +121,7 @@ void xnarch_fixup_mayday(struct xnarchtcb *tcb, struct 
pt_regs *regs)
 #ifdef CONFIG_XENO_ARM_EABI
        regs->ARM_r7 = tcb->mayday.r7;
 #endif
+#ifdef CONFIG_ARM_THUMB
+       regs->ARM_cpsr = tcb->mayday.psr;
+#endif
 }


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

Reply via email to