Module Name:    src
Committed By:   mrg
Date:           Sun Dec 20 03:41:49 UTC 2009

Modified Files:
        src/sys/arch/sparc/sparc: pmap.c

Log Message:
- add a diagnostic to ensure that cpus[0] == cpu0's cpu_info->ci_self
- if a cpu doesn't have any mappings allocated, don't copy them.  this
  occurs if a cpu isn't attached (such as a MP kernel with only "cpu0"
  listed in the config file..)


To generate a diff of this commit:
cvs rdiff -u -r1.337 -r1.338 src/sys/arch/sparc/sparc/pmap.c

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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.337 src/sys/arch/sparc/sparc/pmap.c:1.338
--- src/sys/arch/sparc/sparc/pmap.c:1.337	Sat Nov  7 07:27:46 2009
+++ src/sys/arch/sparc/sparc/pmap.c	Sun Dec 20 03:41:49 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.337 2009/11/07 07:27:46 cegger Exp $ */
+/*	$NetBSD: pmap.c,v 1.338 2009/12/20 03:41:49 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.337 2009/11/07 07:27:46 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.338 2009/12/20 03:41:49 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -3907,6 +3907,14 @@
 #endif
 
 	pmap_update(pmap_kernel());
+
+#ifdef DIAGNOSTIC
+	if (curcpu()->ci_self != cpus[0]) {
+		prom_printf("curcpu()->ci_self %p != cpus[0] %p\n", curcpu()->ci_self, cpus[0]);
+		panic("cpuinfo inconsistent");
+	}
+#endif
+
 	prom_printf("pmap_bootstrap4m done\n");
 }
 
@@ -4181,6 +4189,10 @@
 			n = 0;
 #endif
 			{
+				/* Did this cpu attach? */
+				if (pmap_kernel()->pm_reg_ptps[n] == 0)
+					continue;
+
 				if (pm->pm_reg_ptps[n][vr] != SRMMU_TEINVALID)
 					printf("pmap_chk: spurious PTP in user "
 						"region %d on CPU %d\n", vr, n);
@@ -4294,6 +4306,10 @@
 		{
 			int *upt, *kpt;
 
+			/* Did this cpu attach? */
+			if (pmap_kernel()->pm_reg_ptps[n] == 0)
+				continue;
+
 			upt = pool_get(&L1_pool, flags);
 			pm->pm_reg_ptps[n] = upt;
 			pm->pm_reg_ptps_pa[n] = VA2PA((char *)upt);
@@ -4344,7 +4360,13 @@
 		n = 0;
 #endif
 		{
-			int *pt = pm->pm_reg_ptps[n];
+			int *pt;
+
+			/* Did this cpu attach? */
+			if (pmap_kernel()->pm_reg_ptps[n] == 0)
+				continue;
+
+			pt = pm->pm_reg_ptps[n];
 			pm->pm_reg_ptps[n] = NULL;
 			pm->pm_reg_ptps_pa[n] = 0;
 			pool_put(&L1_pool, pt);

Reply via email to