X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fsparc64%2Flib%2Fdebuglocks.c;h=c421e0c653253270c9b5edda838a22134e803c5d;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hp=9e083e27d2db966bcc8fa4f7227d033e084992e9;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/arch/sparc64/lib/debuglocks.c b/arch/sparc64/lib/debuglocks.c index 9e083e27d..c421e0c65 100644 --- a/arch/sparc64/lib/debuglocks.c +++ b/arch/sparc64/lib/debuglocks.c @@ -84,7 +84,7 @@ again: put_cpu(); } -int _spin_trylock(spinlock_t *lock) +int _do_spin_trylock(spinlock_t *lock) { unsigned long val, caller; int cpu = get_cpu(); @@ -138,15 +138,15 @@ wlock_again: } /* Try once to increment the counter. */ __asm__ __volatile__( -" ldx [%0], %%g5\n" -" brlz,a,pn %%g5, 2f\n" +" ldx [%0], %%g1\n" +" brlz,a,pn %%g1, 2f\n" " mov 1, %0\n" -" add %%g5, 1, %%g7\n" -" casx [%0], %%g5, %%g7\n" -" sub %%g5, %%g7, %0\n" +" add %%g1, 1, %%g7\n" +" casx [%0], %%g1, %%g7\n" +" sub %%g1, %%g7, %0\n" "2:" : "=r" (val) : "0" (&(rw->lock)) - : "g5", "g7", "memory"); + : "g1", "g7", "memory"); membar("#StoreLoad | #StoreStore"); if (val) goto wlock_again; @@ -172,14 +172,15 @@ void _do_read_unlock (rwlock_t *rw, char *str) runlock_again: /* Spin trying to decrement the counter using casx. */ __asm__ __volatile__( -" ldx [%0], %%g5\n" -" sub %%g5, 1, %%g7\n" -" casx [%0], %%g5, %%g7\n" +" membar #StoreLoad | #LoadLoad\n" +" ldx [%0], %%g1\n" +" sub %%g1, 1, %%g7\n" +" casx [%0], %%g1, %%g7\n" " membar #StoreLoad | #StoreStore\n" -" sub %%g5, %%g7, %0\n" +" sub %%g1, %%g7, %0\n" : "=r" (val) : "0" (&(rw->lock)) - : "g5", "g7", "memory"); + : "g1", "g7", "memory"); if (val) { if (!--stuck) { if (shown++ <= 2) @@ -215,17 +216,17 @@ wlock_again: __asm__ __volatile__( " mov 1, %%g3\n" " sllx %%g3, 63, %%g3\n" -" ldx [%0], %%g5\n" -" brlz,pn %%g5, 1f\n" -" or %%g5, %%g3, %%g7\n" -" casx [%0], %%g5, %%g7\n" +" ldx [%0], %%g1\n" +" brlz,pn %%g1, 1f\n" +" or %%g1, %%g3, %%g7\n" +" casx [%0], %%g1, %%g7\n" " membar #StoreLoad | #StoreStore\n" " ba,pt %%xcc, 2f\n" -" sub %%g5, %%g7, %0\n" +" sub %%g1, %%g7, %0\n" "1: mov 1, %0\n" "2:" : "=r" (val) : "0" (&(rw->lock)) - : "g3", "g5", "g7", "memory"); + : "g3", "g1", "g7", "memory"); if (val) { /* We couldn't get the write bit. */ if (!--stuck) { @@ -247,15 +248,15 @@ wlock_again: __asm__ __volatile__( " mov 1, %%g3\n" " sllx %%g3, 63, %%g3\n" -"1: ldx [%0], %%g5\n" -" andn %%g5, %%g3, %%g7\n" -" casx [%0], %%g5, %%g7\n" -" cmp %%g5, %%g7\n" +"1: ldx [%0], %%g1\n" +" andn %%g1, %%g3, %%g7\n" +" casx [%0], %%g1, %%g7\n" +" cmp %%g1, %%g7\n" " bne,pn %%xcc, 1b\n" " membar #StoreLoad | #StoreStore" : /* no outputs */ : "r" (&(rw->lock)) - : "g3", "g5", "g7", "cc", "memory"); + : "g3", "g1", "g7", "cc", "memory"); while(rw->lock != 0) { if (!--stuck) { if (shown++ <= 2) @@ -290,16 +291,17 @@ void _do_write_unlock(rwlock_t *rw) current->thread.smp_lock_count--; wlock_again: __asm__ __volatile__( +" membar #StoreLoad | #LoadLoad\n" " mov 1, %%g3\n" " sllx %%g3, 63, %%g3\n" -" ldx [%0], %%g5\n" -" andn %%g5, %%g3, %%g7\n" -" casx [%0], %%g5, %%g7\n" +" ldx [%0], %%g1\n" +" andn %%g1, %%g3, %%g7\n" +" casx [%0], %%g1, %%g7\n" " membar #StoreLoad | #StoreStore\n" -" sub %%g5, %%g7, %0\n" +" sub %%g1, %%g7, %0\n" : "=r" (val) : "0" (&(rw->lock)) - : "g3", "g5", "g7", "memory"); + : "g3", "g1", "g7", "memory"); if (val) { if (!--stuck) { if (shown++ <= 2) @@ -321,17 +323,17 @@ int _do_write_trylock (rwlock_t *rw, char *str) __asm__ __volatile__( " mov 1, %%g3\n" " sllx %%g3, 63, %%g3\n" -" ldx [%0], %%g5\n" -" brlz,pn %%g5, 1f\n" -" or %%g5, %%g3, %%g7\n" -" casx [%0], %%g5, %%g7\n" +" ldx [%0], %%g1\n" +" brlz,pn %%g1, 1f\n" +" or %%g1, %%g3, %%g7\n" +" casx [%0], %%g1, %%g7\n" " membar #StoreLoad | #StoreStore\n" " ba,pt %%xcc, 2f\n" -" sub %%g5, %%g7, %0\n" +" sub %%g1, %%g7, %0\n" "1: mov 1, %0\n" "2:" : "=r" (val) : "0" (&(rw->lock)) - : "g3", "g5", "g7", "memory"); + : "g3", "g1", "g7", "memory"); if (val) { put_cpu(); @@ -345,15 +347,15 @@ int _do_write_trylock (rwlock_t *rw, char *str) __asm__ __volatile__( " mov 1, %%g3\n" " sllx %%g3, 63, %%g3\n" -"1: ldx [%0], %%g5\n" -" andn %%g5, %%g3, %%g7\n" -" casx [%0], %%g5, %%g7\n" -" cmp %%g5, %%g7\n" +"1: ldx [%0], %%g1\n" +" andn %%g1, %%g3, %%g7\n" +" casx [%0], %%g1, %%g7\n" +" cmp %%g1, %%g7\n" " bne,pn %%xcc, 1b\n" " membar #StoreLoad | #StoreStore" : /* no outputs */ : "r" (&(rw->lock)) - : "g3", "g5", "g7", "cc", "memory"); + : "g3", "g1", "g7", "cc", "memory"); put_cpu();