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

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

---

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

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 05b7a1b..16e570b 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1663,7 +1663,12 @@ static int xnshadow_sys_mayday(struct pt_regs *regs)
                 * relax. See do_hisyscall_event().
                 */
                xnarch_fixup_mayday(xnthread_archtcb(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@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to