patch-2.1.51 linux/arch/sparc64/lib/locks.S

Next file: linux/arch/sparc64/mm/fault.c
Previous file: linux/arch/sparc64/lib/checksum.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.50/linux/arch/sparc64/lib/locks.S linux/arch/sparc64/lib/locks.S
@@ -1,4 +1,4 @@
-/* $Id: locks.S,v 1.3 1997/07/22 05:51:42 davem Exp $
+/* $Id: locks.S,v 1.5 1997/07/31 05:28:16 davem Exp $
  * locks.S: SMP low-level lock primitives on Sparc64.
  *
  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -12,9 +12,9 @@
 	.align		32
 
 ___lk_busy_spin:
-	orcc		%g2, 0, %g0
-	bne,pt		%icc, ___lk_busy_spin
-	 ldub		[%g1 + 0], %g2
+	ldub		[%g1 + 0], %g2
+	brnz,pt		%g2, ___lk_busy_spin
+	 membar		#LoadLoad
 	b,pt		%xcc, 1f
 	 ldstub		[%g1 + 0], %g2
 
@@ -23,16 +23,15 @@
 	addcc		%g2, -1, %g2
 	rdpr		%pil, %g3
 	bcs,a,pn	%icc, 9f
-	 st		%g2, [%g6 + AOFF_task_lock_depth]
+	 stw		%g2, [%g6 + AOFF_task_lock_depth]
 	wrpr		%g0, 15, %pil
 	ldstub		[%g1 + 0], %g2
-1:	brnz,a,pn	%g2, ___lk_busy_spin
-	 ldub		[%g1 + 0], %g2
+1:	brnz,pn		%g2, ___lk_busy_spin
+	 membar		#StoreLoad | #StoreStore
 	lduw		[%g6 + AOFF_task_processor], %g2
-	membar		#LoadLoad | #LoadStore
 	stb		%g2, [%g1 + 1]
 2:	mov		-1, %g2
-	st		%g2, [%g6 + AOFF_task_lock_depth]
+	stw		%g2, [%g6 + AOFF_task_lock_depth]
 	wrpr		%g3, 0, %pil
 9:	jmpl		%o7 + 0x8, %g0
 	 mov		%g5, %o7
@@ -41,16 +40,16 @@
 ___lock_reacquire_kernel:
 	rdpr		%pil, %g3
 	wrpr		%g0, 15, %pil
-	st		%g2, [%g6 + AOFF_task_lock_depth]
+	stw		%g2, [%g6 + AOFF_task_lock_depth]
 	ldstub		[%g1 + 0], %g2
 1:	brz,pt		%g2, 3f
-	 ldub		[%g1 + 0], %g2
-2:	brnz,a,pt	%g2, 2b
-	 ldub		[%g1 + 0], %g2
+	 membar		#StoreLoad | #StoreStore
+2:	ldub		[%g1 + 0], %g2
+	brnz,pt		%g2, 2b
+	 membar		#LoadLoad
 	b,pt		%xcc, 1b
 	 ldstub		[%g1 + 0], %g2
 3:	lduw		[%g6 + AOFF_task_processor], %g2
-	membar		#LoadLoad | #LoadStore
 	stb		%g2, [%g1 + 1]
 	wrpr		%g3, 0, %pil
 	jmpl		%o7 + 0x8, %g0

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov