Module Name:    src
Committed By:   dholland
Date:           Wed Nov 10 01:49:00 UTC 2010

Modified Files:
        src/sys/arch/mips/mips: locore_mips1.S

Log Message:
Amplify comments per thread in source-changes-d about the previous
commit to this file: we must restore the PID value (that is, the
current address space ID) before touching memory, or the memory writes
might go to arbitrary wrong places or fault.

I'm not completely convinced this function (or other functions in this
file) are handling pipeline hazards safely, but I don't have
authoritative mips1 documentation any more so I'm not going to meddle.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/mips/locore_mips1.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/mips/locore_mips1.S
diff -u src/sys/arch/mips/mips/locore_mips1.S:1.68 src/sys/arch/mips/mips/locore_mips1.S:1.69
--- src/sys/arch/mips/mips/locore_mips1.S:1.68	Mon Nov  8 18:09:38 2010
+++ src/sys/arch/mips/mips/locore_mips1.S	Wed Nov 10 01:49:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_mips1.S,v 1.68 2010/11/08 18:09:38 pooka Exp $	*/
+/*	$NetBSD: locore_mips1.S,v 1.69 2010/11/10 01:49:00 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -926,9 +926,10 @@
 	mfc0	t2, MIPS_COP_0_TLB_HI		# fetch the hi entry
 	mfc0	t3, MIPS_COP_0_TLB_LOW		# fetch the low entry
 
-	mtc0	t0, MIPS_COP_0_TLB_HI		# restore PID
+	mtc0	t0, MIPS_COP_0_TLB_HI		# Restore proper PID
+ 						# (before touching memory)
 	mtc0	v1, MIPS_COP_0_STATUS		# Restore the status register
-	sw	t2, 0(a1)
+	sw	t2, 0(a1)			# Write results back
 	j	ra
 	sw	t3, 4(a1)
 END(mips1_TLBRead)

Reply via email to