Module: xenomai-3
Branch: next
Commit: b314932e1c15be0f52c6abb9a07fc6492966a024
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b314932e1c15be0f52c6abb9a07fc6492966a024

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri May  1 10:17:06 2015 +0200

cobalt/x86: Fix 32-bit thread switch with stack protector on

Argument numbers slipped when CONFIG_CC_STACKPROTECTOR was enabled. Fix
the unavoidable crash and also improve readability.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/cobalt/arch/x86/thread.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index 1b73b0d..2c2574a 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -57,12 +57,12 @@ static inline void do_switch_threads(struct xnarchtcb 
*out_tcb,
 
        __asm__ __volatile__("pushfl\n\t"
                             "pushl %%ebp\n\t"
-                            "movl %6,%%ecx\n\t"
+                            "movl %[spp_out_ptr],%%ecx\n\t"
                             "movl %%esp,(%%ecx)\n\t"
-                            "movl %7,%%ecx\n\t"
+                            "movl %[ipp_out_ptr],%%ecx\n\t"
                             "movl $1f,(%%ecx)\n\t"
-                            "movl %8,%%ecx\n\t"
-                            "movl %9,%%edi\n\t"
+                            "movl %[spp_in_ptr],%%ecx\n\t"
+                            "movl %[ipp_in_ptr],%%edi\n\t"
                             "movl (%%ecx),%%esp\n\t"
                             "pushl (%%edi)\n\t"
                             __CANARY_SWITCH
@@ -76,10 +76,10 @@ static inline void do_switch_threads(struct xnarchtcb 
*out_tcb,
                               "+a"(outproc),
                               "+d"(inproc)
                               __CANARY_OUTPUT
-                            : "m"(out_tcb->spp),
-                              "m"(out_tcb->ipp),
-                              "m"(in_tcb->spp),
-                              "m"(in_tcb->ipp)
+                            : [spp_out_ptr] "m"(out_tcb->spp),
+                              [ipp_out_ptr] "m"(out_tcb->ipp),
+                              [spp_in_ptr] "m"(in_tcb->spp),
+                              [ipp_in_ptr] "m"(in_tcb->ipp)
                               __CANARY_INPUT
                             : "memory");
 }


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

Reply via email to