Module Name:    src
Committed By:   cherry
Date:           Tue Nov  8 17:16:52 UTC 2011

Modified Files:
        src/sys/arch/x86/include: pmap.h
        src/sys/arch/x86/x86: pmap.c
        src/sys/arch/xen/include: xenpmap.h
        src/sys/arch/xen/x86: xen_pmap.c

Log Message:
Expose the PG_k #define pt/pd bit to both xen and "baremetal" x86. This is 
required, since kernel pages are mapped with user permissions in XEN/amd64 
since the VM kernel runs in ring3. Since XEN/i386(including PAE) runs in ring1, 
supervisor mode is appropriate for these ports. We need to share this since the 
pmap implementation is still shared. Once the xen implementation is 
sufficiently independant of the x86 one, this can be made private to 
xen/include/xenpmap.h


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/xen/x86/xen_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/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.44 src/sys/arch/x86/include/pmap.h:1.45
--- src/sys/arch/x86/include/pmap.h:1.44	Sun Nov  6 11:40:47 2011
+++ src/sys/arch/x86/include/pmap.h	Tue Nov  8 17:16:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.44 2011/11/06 11:40:47 cherry Exp $	*/
+/*	$NetBSD: pmap.h,v 1.45 2011/11/08 17:16:52 cherry Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -173,6 +173,16 @@ struct pmap {
 	((pmap)->pm_pdirpa[0] + (index) * sizeof(pd_entry_t))
 #endif
 
+/* 
+ * flag to be used for kernel mappings: PG_u on Xen/amd64, 
+ * 0 otherwise.
+ */
+#if defined(XEN) && defined(__x86_64__)
+#define PG_k PG_u
+#else
+#define PG_k 0
+#endif
+
 /*
  * MD flags that we use for pmap_enter and pmap_kenter_pa:
  */

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.140 src/sys/arch/x86/x86/pmap.c:1.141
--- src/sys/arch/x86/x86/pmap.c:1.140	Tue Nov  8 12:44:29 2011
+++ src/sys/arch/x86/x86/pmap.c	Tue Nov  8 17:16:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.140 2011/11/08 12:44:29 njoly Exp $	*/
+/*	$NetBSD: pmap.c,v 1.141 2011/11/08 17:16:52 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.140 2011/11/08 12:44:29 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.141 2011/11/08 17:16:52 cherry Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -211,11 +211,6 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1
 #include <xen/hypervisor.h>
 #endif
 
-/* If this is not needed anymore it should be GC'ed */
-#ifndef PG_k
-#define	PG_k	0
-#endif
-
 /*
  * general info:
  *

Index: src/sys/arch/xen/include/xenpmap.h
diff -u src/sys/arch/xen/include/xenpmap.h:1.30 src/sys/arch/xen/include/xenpmap.h:1.31
--- src/sys/arch/xen/include/xenpmap.h:1.30	Sun Nov  6 11:40:47 2011
+++ src/sys/arch/xen/include/xenpmap.h	Tue Nov  8 17:16:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenpmap.h,v 1.30 2011/11/06 11:40:47 cherry Exp $	*/
+/*	$NetBSD: xenpmap.h,v 1.31 2011/11/08 17:16:52 cherry Exp $	*/
 
 /*
  *
@@ -34,13 +34,6 @@
 #include "opt_xen.h"
 #endif
 
-/* flag to be used for kernel mappings: PG_u on Xen/amd64, 0 otherwise */
-#if defined(XEN) && defined(__x86_64__)
-#define PG_k PG_u
-#else
-#define PG_k 0
-#endif
-
 #define	INVALID_P2M_ENTRY	(~0UL)
 
 void xpq_queue_machphys_update(paddr_t, paddr_t);

Index: src/sys/arch/xen/x86/xen_pmap.c
diff -u src/sys/arch/xen/x86/xen_pmap.c:1.7 src/sys/arch/xen/x86/xen_pmap.c:1.8
--- src/sys/arch/xen/x86/xen_pmap.c:1.7	Sun Nov  6 11:40:47 2011
+++ src/sys/arch/xen/x86/xen_pmap.c	Tue Nov  8 17:16:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_pmap.c,v 1.7 2011/11/06 11:40:47 cherry Exp $	*/
+/*	$NetBSD: xen_pmap.c,v 1.8 2011/11/08 17:16:52 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.7 2011/11/06 11:40:47 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v 1.8 2011/11/08 17:16:52 cherry Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -142,13 +142,6 @@ __KERNEL_RCSID(0, "$NetBSD: xen_pmap.c,v
 #include <xen/hypervisor.h>
 #endif
 
-/* flag to be used for kernel mappings: PG_u on Xen/amd64, 0 otherwise */
-#if defined(XEN) && defined(__x86_64__)
-#define PG_k PG_u
-#else
-#define PG_k 0
-#endif
-
 #define COUNT(x)	/* nothing */
 
 static pd_entry_t * const alternate_pdes[] = APDES_INITIALIZER;

Reply via email to