Import xpmap_pg_nx, and put it in the per-cpu recursive slot on amd64. trunk
authormaxv <maxv@NetBSD.org>
Sun, 22 Jan 2017 19:42:48 +0000
branchtrunk
changeset 248048 a5b163b1aba9
parent 248047 ad45ddb38823
child 248049 dd090cfdbf03
Import xpmap_pg_nx, and put it in the per-cpu recursive slot on amd64.
sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c	Sun Jan 22 19:29:38 2017 +0000
+++ b/sys/arch/xen/x86/cpu.c	Sun Jan 22 19:42:48 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.105 2016/11/25 12:20:03 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.106 2017/01/22 19:42:48 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2016/11/25 12:20:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.106 2017/01/22 19:42:48 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1218,20 +1218,19 @@
 	KASSERT(ci->ci_kpm_pdirpa != 0);
 
 #if defined(__x86_64__)
-	/*
-	 * Copy over the pmap_kernel() shadow L4 entries 
-	 */
+	extern pt_entry_t xpmap_pg_nx;
 
+	/* Copy over the pmap_kernel() shadow L4 entries */
 	memcpy(ci->ci_kpm_pdir, pmap_kernel()->pm_pdir, PAGE_SIZE);
 
 	/* Recursive kernel mapping */
 	ci->ci_kpm_pdir[PDIR_SLOT_PTE] = xpmap_ptom_masked(ci->ci_kpm_pdirpa)
-	    | PG_k | PG_V;
+	    | PG_k | PG_V | xpmap_pg_nx;
 #elif defined(PAE)
-	/* Copy over the pmap_kernel() shadow L2 entries that map the kernel */
+	/* Copy over the pmap_kernel() shadow L2 entries */
 	memcpy(ci->ci_kpm_pdir, pmap_kernel()->pm_pdir + PDIR_SLOT_KERN,
 	    nkptp[PTP_LEVELS - 1] * sizeof(pd_entry_t));
-#endif /* __x86_64__ else PAE */
+#endif
 
 	/* Xen wants a RO pdir. */
 	pmap_protect(pmap_kernel(), (vaddr_t)ci->ci_kpm_pdir,