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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Tue May 15 14:16:26 2012 +0200

mayday: fix xnshadow_sys_mayday return value

This avoids clobbering the calling process registers

---

 kernel/cobalt/nucleus/shadow.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/kernel/cobalt/nucleus/shadow.c b/kernel/cobalt/nucleus/shadow.c
index 8ad8e17..9661e92 100644
--- a/kernel/cobalt/nucleus/shadow.c
+++ b/kernel/cobalt/nucleus/shadow.c
@@ -1215,7 +1215,12 @@ static int xnshadow_sys_mayday(void)
                 * handle_head_syscall().
                 */
                xnarch_fixup_mayday(xnthread_archtcb(cur), cur->regs);
-               return 0;
+
+               /* returning 0 here would clobber the register holding
+                  the return value. Instead, return whatever value
+                  xnarch_fixup_mayday set for this register, in order
+                  not to undo what xnarch_fixup_mayday did. */
+               return __xn_reg_rval(regs);
        }
 
        printk(KERN_WARNING


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

Reply via email to