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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Tue Jun  9 22:50:01 2009 +0200

Improve decrementer user-space tsc emulation

---

 include/asm-arm/syscall.h |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/asm-arm/syscall.h b/include/asm-arm/syscall.h
index a6d1534..743d4ef 100644
--- a/include/asm-arm/syscall.h
+++ b/include/asm-arm/syscall.h
@@ -286,18 +286,21 @@ static inline unsigned long long __xn_rdtsc(void)
        return (before & ~((unsigned long long) mask)) | (counter & mask);
 
 #elif XNARCH_ARM_TSC_TYPE == __XN_TSC_TYPE_DECREMENTER
+       volatile unsigned long long *const tscp = __xn_tscinfo.u.dec.tsc;
+       volatile unsigned *const counterp = __xn_tscinfo.u.dec.counter;
+       volatile unsigned *const last_cntp = __xn_tscinfo.u.dec.last_cnt;
        const unsigned mask = __xn_tscinfo.u.dec.mask;
-       unsigned long long after, before;
+       register unsigned long long after, before;
        unsigned counter, last_cnt;
 
+       __asm__ ("ldmia %1, %M0\n": "=r"(after): "r"(tscp), "m"(*tscp));
        do {
-               before = *__xn_tscinfo.u.dec.tsc;
-               counter = *__xn_tscinfo.u.dec.counter;
-               last_cnt = *__xn_tscinfo.u.dec.last_cnt;
+               before = after;
+               counter = *counterp;
+               last_cnt = *last_cntp;
                /* compiler barrier. */
                __asm__ __volatile__ ("" : /* */ : /* */ : "memory");
-
-               after = *__xn_tscinfo.u.dec.tsc;
+               __asm__ ("ldmia %1, %M0\n": "=r"(after): "r"(tscp), "m"(*tscp));
        } while (after != before);
 
        counter &= mask;


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

Reply via email to