From 64bc05008327b9f596c6401dcc448c6bea8ac8c3 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Mon, 8 Dec 2008 11:25:50 +0900 Subject: [PATCH] --- yaml --- r: 120095 b: refs/heads/master c: 77ba93a7ac5fb0d9338bffbf97c787b8efe00806 h: refs/heads/master i: 120093: c1fe577d78f9574261b9dc31c49542a3835fd5de 120091: cedd6af7fd94f1a048d12169d7ba2d356a847881 120087: 2f31426f8f82dfe3d29868139fa4b5aeb00badde 120079: bc093e27c9d63c8261def1588cfa6afa5d97e9e0 120063: e1b490ce9c1f2a644050ac0d5cf519d9e0b068b2 v: v3 --- [refs] | 2 +- trunk/arch/sh/include/asm/mutex-llsc.h | 37 +++++++++++++++----------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index c56de0419b86..9c623034f3dc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c6f17cb2272121475c87592560534b157b17544e +refs/heads/master: 77ba93a7ac5fb0d9338bffbf97c787b8efe00806 diff --git a/trunk/arch/sh/include/asm/mutex-llsc.h b/trunk/arch/sh/include/asm/mutex-llsc.h index 7c75af5e734b..a91990c6e8e5 100644 --- a/trunk/arch/sh/include/asm/mutex-llsc.h +++ b/trunk/arch/sh/include/asm/mutex-llsc.h @@ -21,16 +21,18 @@ static inline void __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) { - int __res; + int __ex_flag, __res; __asm__ __volatile__ ( - "movli.l @%1, %0 \n" - "dt %0 \n" - "movco.l %0, @%1 \n" - : "=&z" (__res) + "movli.l @%2, %0 \n" + "add #-1, %0 \n" + "movco.l %0, @%2 \n" + "movt %1 \n" + : "=&z" (__res), "=&r" (__ex_flag) : "r" (&(count)->counter) : "t"); + __res |= !__ex_flag; if (unlikely(__res != 0)) fail_fn(count); } @@ -38,16 +40,18 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) static inline int __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) { - int __res; + int __ex_flag, __res; __asm__ __volatile__ ( - "movli.l @%1, %0 \n" - "dt %0 \n" - "movco.l %0, @%1 \n" - : "=&z" (__res) + "movli.l @%2, %0 \n" + "add #-1, %0 \n" + "movco.l %0, @%2 \n" + "movt %1 \n" + : "=&z" (__res), "=&r" (__ex_flag) : "r" (&(count)->counter) : "t"); + __res |= !__ex_flag; if (unlikely(__res != 0)) __res = fail_fn(count); @@ -57,18 +61,19 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) static inline void __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) { - int __res; + int __ex_flag, __res; __asm__ __volatile__ ( - "1: movli.l @%1, %0 \n\t" + "movli.l @%2, %0 \n\t" "add #1, %0 \n\t" - "movco.l %0, @%1 \n\t" - "bf 1b\n\t" - : "=&z" (__res) + "movco.l %0, @%2 \n\t" + "movt %1 \n\t" + : "=&z" (__res), "=&r" (__ex_flag) : "r" (&(count)->counter) : "t"); - if (unlikely(__res <= 0)) + __res |= !__ex_flag; + if (unlikely(__res != 0)) fail_fn(count); }