patch-2.3.99-pre2 linux/arch/sparc64/lib/rwlock.S
Next file: linux/arch/sparc64/mm/fault.c
Previous file: linux/arch/sparc64/lib/blockops.S
Back to the patch index
Back to the overall index
- Lines: 94
- Date:
Thu Mar 16 11:40:17 2000
- Orig file:
v2.3.99-pre1/linux/arch/sparc64/lib/rwlock.S
- Orig date:
Tue Aug 31 17:29:13 1999
diff -u --recursive --new-file v2.3.99-pre1/linux/arch/sparc64/lib/rwlock.S linux/arch/sparc64/lib/rwlock.S
@@ -1,4 +1,4 @@
-/* $Id: rwlock.S,v 1.2 1999/08/23 05:15:58 davem Exp $
+/* $Id: rwlock.S,v 1.3 2000/03/16 16:44:38 davem Exp $
* rwlocks.S: These things are too big to do inline.
*
* Copyright (C) 1999 David S. Miller (davem@redhat.com)
@@ -12,34 +12,33 @@
/* The non-contention read lock usage is 2 cache lines. */
.globl __read_lock, __read_unlock
- /* g1=lock, g3=retpc, g5/g7=scratch */
rwlock_impl_begin:
-__read_lock:
- ldsw [%g1], %g5
+__read_lock: /* %o0 = lock_ptr */
+ ldsw [%o0], %g5
brlz,pn %g5, __read_wait_for_writer
4: add %g5, 1, %g7
- cas [%g1], %g5, %g7
+ cas [%o0], %g5, %g7
cmp %g5, %g7
bne,pn %icc, __read_lock
membar #StoreLoad | #StoreStore
-99: jmpl %g3 + 8, %g0
+99: retl
nop
-__read_unlock:
- lduw [%g1], %g5
+__read_unlock: /* %o0 = lock_ptr */
+ lduw [%o0], %g5
sub %g5, 1, %g7
- cas [%g1], %g5, %g7
+ cas [%o0], %g5, %g7
cmp %g5, %g7
be,pt %xcc, 99b
membar #StoreLoad | #StoreStore
b,a,pt %xcc, __read_unlock
__read_wait_for_writer:
- ldsw [%g1], %g5
+ ldsw [%o0], %g5
brlz,pt %g5, __read_wait_for_writer
membar #LoadLoad
b,a,pt %xcc, 4b
__write_wait_for_writer:
- ldsw [%g1], %g5
+ ldsw [%o0], %g5
brlz,pt %g5, __write_wait_for_writer
membar #LoadLoad
b,a,pt %xcc, 4f
@@ -48,24 +47,23 @@
.align 64
.globl __write_unlock
- /* g1=lock, g3=retpc, g2/g5/g7=scratch */
-__write_unlock:
+__write_unlock: /* %o0 = lock_ptr */
sethi %hi(0x80000000), %g2
-1: lduw [%g1], %g5
+1: lduw [%o0], %g5
andn %g5, %g2, %g7
- cas [%g1], %g5, %g7
+ cas [%o0], %g5, %g7
cmp %g5, %g7
be,pt %icc, 99b
membar #StoreLoad | #StoreStore
b,a,pt %xcc, 1b
.globl __write_lock
-__write_lock:
+__write_lock: /* %o0 = lock_ptr */
sethi %hi(0x80000000), %g2
-1: ldsw [%g1], %g5
+1: ldsw [%o0], %g5
4: brnz,pn %g5, 5f
or %g5, %g2, %g7
- cas [%g1], %g5, %g7
+ cas [%o0], %g5, %g7
cmp %g5, %g7
be,pt %icc, 99b
membar #StoreLoad | #StoreStore
@@ -73,10 +71,10 @@
b,a,pt %xcc, 1b
5: brlz %g5, __write_wait_for_writer
or %g5, %g2, %g7
- cas [%g1], %g5, %g7
+ cas [%o0], %g5, %g7
cmp %g5, %g7
bne,pn %icc, 5b
-8: ldsw [%g1], %g5
+8: ldsw [%o0], %g5
cmp %g5, %g2
be,pn %icc, 99b
membar #LoadLoad
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)