Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Expose the PG_k #define pt/pd bit to both xen and "...



details:   https://anonhg.NetBSD.org/src/rev/59196b2db86a
branches:  trunk
changeset: 771088:59196b2db86a
user:      cherry <cherry%NetBSD.org@localhost>
date:      Tue Nov 08 17:16:52 2011 +0000

description:
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

diffstat:

 sys/arch/x86/include/pmap.h    |  12 +++++++++++-
 sys/arch/x86/x86/pmap.c        |   9 ++-------
 sys/arch/xen/include/xenpmap.h |   9 +--------
 sys/arch/xen/x86/xen_pmap.c    |  11 ++---------
 4 files changed, 16 insertions(+), 25 deletions(-)

diffs (111 lines):

diff -r eda748a92897 -r 59196b2db86a sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h       Tue Nov 08 16:52:11 2011 +0000
+++ b/sys/arch/x86/include/pmap.h       Tue Nov 08 17:16:52 2011 +0000
@@ -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 @@
        ((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:
  */
diff -r eda748a92897 -r 59196b2db86a sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Tue Nov 08 16:52:11 2011 +0000
+++ b/sys/arch/x86/x86/pmap.c   Tue Nov 08 17:16:52 2011 +0000
@@ -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 @@
 #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:
  *
diff -r eda748a92897 -r 59196b2db86a sys/arch/xen/include/xenpmap.h
--- a/sys/arch/xen/include/xenpmap.h    Tue Nov 08 16:52:11 2011 +0000
+++ b/sys/arch/xen/include/xenpmap.h    Tue Nov 08 17:16:52 2011 +0000
@@ -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);
diff -r eda748a92897 -r 59196b2db86a sys/arch/xen/x86/xen_pmap.c
--- a/sys/arch/xen/x86/xen_pmap.c       Tue Nov 08 16:52:11 2011 +0000
+++ b/sys/arch/xen/x86/xen_pmap.c       Tue Nov 08 17:16:52 2011 +0000
@@ -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 @@
 #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;



Home | Main Index | Thread Index | Old Index