cpu_load_pmap() should not be used to load pmap_kernel(), since in the trunk
authorcherry <cherry@NetBSD.org>
Thu, 23 Feb 2012 04:10:51 +0000
branchtrunk
changeset 209418 47d6b7288587
parent 209417 33178a3cdab5
child 209419 4bef30104fe5
cpu_load_pmap() should not be used to load pmap_kernel(), since in the x86 model, its mappings are shared across pmaps. KASSERT() for this and remove unused codepaths.
sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c	Thu Feb 23 00:22:07 2012 +0000
+++ b/sys/arch/xen/x86/cpu.c	Thu Feb 23 04:10:51 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer Exp $	*/
+/*	$NetBSD: cpu.c,v 1.84 2012/02/23 04:10:51 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.84 2012/02/23 04:10:51 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1176,6 +1176,8 @@
 void
 cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap)
 {
+	KASSERT(pmap != pmap_kernel());
+	
 #if defined(__x86_64__) || defined(PAE)
 	struct cpu_info *ci = curcpu();
 	uint32_t cpumask = ci->ci_cpumask;
@@ -1226,14 +1228,8 @@
 			}
 		}
 
-		if (__predict_true(pmap != pmap_kernel())) {
-			xen_set_user_pgd(pmap_pdirpa(pmap, 0));
-			ci->ci_xen_current_user_pgd = pmap_pdirpa(pmap, 0);
-		}
-		else {
-			xpq_queue_pt_switch(l4_pd_ma);
-			ci->ci_xen_current_user_pgd = 0;
-		}
+		xen_set_user_pgd(pmap_pdirpa(pmap, 0));
+		ci->ci_xen_current_user_pgd = pmap_pdirpa(pmap, 0);
 
 		tlbflush();
 	}