error in Sparc64 rwlock.S

From: leif
Date: Tue Nov 18 2003 - 16:03:25 EST


I'm going through the 2.6.0-test9 and some -mm3 patches, and have run
into
an issue with arch/sparc64/lib/rwlock.S

When compiling, the assembler complains of multiple definitions of
__write_trylock.

from the 2.6.0-test9-mm3.bz2 patchfile:

--- linux-2.6.0-test9/arch/sparc64/lib/rwlock.S 2003-11-09
16:45:05.000000000 -
+++ 25/arch/sparc64/lib/rwlock.S 2003-11-12 21:37:55.000000000
-0800
@@ -63,5 +63,55 @@ __write_lock: /* %o0 = lock_ptr */
be,pt %icc, 99b
membar #StoreLoad | #StoreStore
ba,a,pt %xcc, 1b
+
+ .globl __write_trylock
+__write_trylock: /* %o0 = lock_ptr */
+ sethi %hi(0x80000000), %g2
+1: lduw [%o0], %g5
+ brnz,pn %g5, __write_trylock_fail
+4: or %g5, %g2, %g7
+
+ cas [%o0], %g5, %g7
+ cmp %g5, %g7
+ be,pt %icc, __write_trylock_succeed
+ membar #StoreLoad | #StoreStore
+
+ ba,pt %xcc, 1b
+ nop
+__write_trylock_succeed:
+ retl
+ mov 1, %o0
+
+__write_trylock_fail:
+ retl
+ mov 0, %o0
+
+ .globl __read_trylock
+__read_trylock: /* %o0 = lock_ptr */
+ ldsw [%o0], %g5
+ brlz,pn %g5, 100f
+ add %g5, 1, %g7
+ cas [%o0], %g5, %g7
+ cmp %g5, %g7
+ bne,pn %icc, __read_trylock
+ membar #StoreLoad | #StoreStore
+ retl
+ mov 1, %o0
+
+ .globl __write_trylock
+__write_trylock: /* %o0 = lock_ptr */
+ sethi %hi(0x80000000), %g2
+1: lduw [%o0], %g5
+4: brnz,pn %g5, 100f
+ or %g5, %g2, %g7
+ cas [%o0], %g5, %g7
+ cmp %g5, %g7
+ bne,pn %icc, 1b
+ membar #StoreLoad | #StoreStore
+ retl
+ mov 1, %o0
+100: retl
+ mov 0, %o0


You can see where __write_trylock is defined as a global entry point
twice.

Unfortunately, I'm not knowledgeable enough about sparc assembler to
be able to fix this correctly.

Please cc me directly, as I'm no longer on LKML.

Thanks,

Leif

Attachment: smime.p7s
Description: S/MIME cryptographic signature