patch-2.3.9 linux/arch/mips/sgi/kernel/indy_sc.c

Next file: linux/arch/mips/sgi/kernel/indy_timer.c
Previous file: linux/arch/mips/sgi/kernel/indy_mc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.8/linux/arch/mips/sgi/kernel/indy_sc.c linux/arch/mips/sgi/kernel/indy_sc.c
@@ -1,4 +1,4 @@
-/* $Id: indy_sc.c,v 1.9 1998/08/17 12:14:55 ralf Exp $
+/* $Id: indy_sc.c,v 1.9 1999/05/12 21:57:49 ulfc Exp $
  *
  * indy_sc.c: Indy cache managment functions.
  *
@@ -38,6 +38,7 @@
 		.set	noreorder
 		.set	mips3
 		.set	noat
+		mfc0	$2, $12
 		li	$1, 0x80	# Go 64 bit
 		mtc0	$1, $12
 
@@ -50,12 +51,12 @@
 		bne	%0, %1, 1b
 		daddu	%0, 32
 
-		mtc0	$0, $12		# Back to 32 bit
+		mtc0	$2, $12		# Back to 32 bit
 		nop; nop; nop; nop;
 		.set mips0
 		.set reorder"
-		: "=r" (first), "=r" (last)
-		: "0" (first), "1" (last)
+		: /* no output */
+		: "r" (first), "r" (last)
 		: "$1");
 }
 
@@ -69,7 +70,10 @@
 #endif
 	/* Which lines to flush?  */
 	first_line = SC_INDEX(addr);
-	last_line = SC_INDEX(SC_ROUND(addr + size));
+	if (size <= SC_LINE)
+		last_line = SC_INDEX(addr);
+	else
+		last_line = SC_INDEX(addr + size - 1);
 
 	__save_and_cli(flags);
 	if (first_line <= last_line) {
@@ -80,8 +84,8 @@
 	/* Cache index wrap around.  Due to the way the buddy system works
 	   this case should not happen.  We're prepared to handle it,
 	   though. */
-	indy_sc_wipe(last_line, SC_SIZE);
-	indy_sc_wipe(0, first_line);
+	indy_sc_wipe(first_line, SC_SIZE - SC_LINE);
+	indy_sc_wipe(0, last_line);
 out:
 	__restore_flags(flags);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)