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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Oct 31 12:28:34 2010 +0100

hal/blackfin: remove redundant stack clean up

---

 include/asm-blackfin/bits/pod.h |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/asm-blackfin/bits/pod.h b/include/asm-blackfin/bits/pod.h
index 9feda93..2ad4584 100644
--- a/include/asm-blackfin/bits/pod.h
+++ b/include/asm-blackfin/bits/pod.h
@@ -138,17 +138,18 @@ static inline void xnarch_init_thread(xnarchtcb_t * tcb,
                                      int imask,
                                      struct xnthread *thread, char *name)
 {
-       unsigned long *ksp;
+       unsigned long ksp, *switchregs;
 
-       ksp =
-           (unsigned long
-            *)(((unsigned long)tcb->stackbase + tcb->stacksize - 40) & ~0xf);
-       ksp[0] = (unsigned long)tcb;    /* r0 */
-       memset(&ksp[1], 0, sizeof(long) * 7);   /* ( R7:4, P5:3 ) */
-       ksp[8] = 0;             /* fp */
-       ksp[9] = (unsigned long)&xnarch_thread_trampoline;      /* rets */
+       ksp = (((unsigned long)tcb->stackbase + tcb->stacksize - 40) & ~0xf);
+       switchregs = (unsigned long *)ksp;
+       /*
+        * Stack space is guaranteed to be clear, so R7:4, P5:3, fp
+        * are already zero. We only need to set r0 and rets.
+        */
+       switchregs[0] = (unsigned long)tcb;     /* r0 */
+       switchregs[9] = (unsigned long)&xnarch_thread_trampoline; /* rets */
 
-       tcb->ts.ksp = (unsigned long)ksp;
+       tcb->ts.ksp = ksp;
        tcb->ts.pc = (unsigned long)&rthal_thread_trampoline;
        tcb->ts.usp = 0;
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to