patch-2.1.34 linux/arch/sparc/lib/locks.S

Next file: linux/arch/sparc/mm/hypersparc.S
Previous file: linux/arch/sparc/lib/atomic.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.33/linux/arch/sparc/lib/locks.S linux/arch/sparc/lib/locks.S
@@ -1,4 +1,4 @@
-/* $Id: locks.S,v 1.4 1997/03/04 16:26:41 jj Exp $
+/* $Id: locks.S,v 1.9 1997/04/14 05:38:41 davem Exp $
  * locks.S: SMP low-level lock primitives on Sparc.
  *
  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -7,6 +7,7 @@
 #include <asm/cprefix.h>
 #include <asm/ptrace.h>
 #include <asm/psr.h>
+#include <asm/spinlock.h>
 
 	.text
 	.align	4
@@ -24,38 +25,15 @@
 	.globl	___spinlock_waitfor
 ___spinlock_waitfor:
 1:	orcc	%g2, 0x0, %g0
-	bne	1b
+	bne,a	1b
 	 ldub	[%g1], %g2
 	ldstub	[%g1], %g2
 	jmpl	%o7 - 12, %g0
 	 mov	%g4, %o7
 
-	/* This is called when the kernel master lock holder changes,
-	 * caller's PC is in %o7, %o7 must be restored to the value
-	 * in %g4 when returning.  The interrupt receiver cpu is to
-	 * change to the new kernel lock holder before returning.
-	 * The current implementation assumes that irq_rcvreg is a
-	 * pointer to a word sized register which can be written with
-	 * the MID value of the cpu to receive undirected interrupts.
-	 * CPUID is in %g5, and mid_xlate is a byte table which translates
-	 * CPUID values into the corresponding MID.
-	 */
-	.globl	___become_idt
-___become_idt:
-#ifdef __SMP__
-	sethi	%hi(C_LABEL(mid_xlate)), %g2
-	or	%g2, %lo(C_LABEL(mid_xlate)), %g2
-	ldub	[%g5 + %g2], %g7
-	sethi	%hi(C_LABEL(irq_rcvreg)), %g2
-	ld	[%g2 + %lo(C_LABEL(irq_rcvreg))], %g2
-	st	%g7, [%g2]
-#endif
-	jmpl	%o7 + 8, %g0
-	 mov	%g4, %o7
-
 ___lk_busy_spin:
 	orcc	%g2, 0, %g0
-	bne	___lk_busy_spin
+	bne,a	___lk_busy_spin
 	 ldub	[%g1 + 0], %g2
 	b	1f
 	 ldstub	[%g1 + 0], %g2	
@@ -73,23 +51,34 @@
 1:	orcc	%g2, 0, %g0
 	bne,a	___lk_busy_spin
 	 ldub	[%g1 + 0], %g2
-	ldub	[%g1 + 2], %g2
-	cmp	%g2, %g5
-	be	2f
-	 stb	%g5, [%g1 + 1]
-	stb	%g5, [%g1 + 2]
-#ifdef __SMP__
-	set	C_LABEL(mid_xlate), %g2
-	ldub	[%g2 + %g5], %g7
-	sethi	%hi(C_LABEL(irq_rcvreg)), %g2
-	ld	[%g2 + %lo(C_LABEL(irq_rcvreg))], %g2
-	st	%g7, [%g2]
-#endif
-2:	mov	-1, %g2
+	stb	%g5, [%g1 + 1]
+	mov	-1, %g2
 	st	%g2, [%g6 + AOFF_task_lock_depth]
 	wr	%g3, 0x0, %psr
 	nop; nop; nop
 9:	jmpl	%o7 + 0x8, %g0
+	 mov	%g4, %o7
+
+	.globl	___lock_reaquire_kernel
+___lock_reaquire_kernel:
+	rd	%psr, %g3
+	or	%g3, PSR_PIL, %g7
+	wr	%g7, 0x0, %psr
+	nop; nop; nop
+	st	%g2, [%g6 + AOFF_task_lock_depth]
+	ldstub	[%g1 + 0], %g2
+1:	orcc	%g2, 0, %g0
+	be	3f
+	 ldub	[%g1 + 0], %g2
+2:	orcc	%g2, 0, %g0
+	bne,a	2b
+	 ldub	[%g1 + 0], %g2
+	b	1b
+	 ldstub	[%g1 + 0], %g2
+3:	stb	%g5, [%g1 + 1]
+	wr	%g3, 0x0, %psr
+	nop; nop; nop
+	jmpl	%o7 + 0x8, %g0
 	 mov	%g4, %o7
 
 #undef NO_PROC_ID

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