Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/x86 use pmap_protect() instead of pmap_kenter_p...



details:   https://anonhg.NetBSD.org/src/rev/442a9050dbcd
branches:  trunk
changeset: 777549:442a9050dbcd
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Feb 22 18:29:31 2012 +0000

description:
use pmap_protect() instead of pmap_kenter_pa() to remap R/O an exiting
page. This gets rid of the last "mapping already present" warnings.

diffstat:

 sys/arch/xen/x86/cpu.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r 0d442f104b80 -r 442a9050dbcd sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Wed Feb 22 18:25:12 2012 +0000
+++ b/sys/arch/xen/x86/cpu.c    Wed Feb 22 18:29:31 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.82 2012/02/21 19:10:13 bouyer Exp $  */
+/*     $NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer 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.82 2012/02/21 19:10:13 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1324,9 +1324,9 @@
 #endif /* __x86_64__ else PAE */
 
        /* Xen wants R/O */
-       pmap_kenter_pa((vaddr_t)ci->ci_kpm_pdir, ci->ci_kpm_pdirpa,
-           VM_PROT_READ, 0);
-
+       pmap_protect(pmap_kernel(), (vaddr_t)ci->ci_kpm_pdir,
+           (vaddr_t)ci->ci_kpm_pdir + PAGE_SIZE, VM_PROT_READ);
+       pmap_update(pmap_kernel());
 #if defined(PAE)
        /* Initialise L3 entry 3. This mapping is shared across all
         * pmaps and is static, ie; loading a new pmap will not update
@@ -1336,8 +1336,9 @@
        ci->ci_pae_l3_pdir[3] = xpmap_ptom_masked(ci->ci_kpm_pdirpa) | PG_k | PG_V;
 
        /* Mark L3 R/O (Xen wants this) */
-       pmap_kenter_pa((vaddr_t)ci->ci_pae_l3_pdir, ci->ci_pae_l3_pdirpa,
-               VM_PROT_READ, 0);
+       pmap_protect(pmap_kernel(), (vaddr_t)ci->ci_pae_l3_pdir,
+           (vaddr_t)ci->ci_pae_l3_pdir + PAGE_SIZE, VM_PROT_READ);
+       pmap_update(pmap_kernel());
 
        xpq_queue_pin_l3_table(xpmap_ptom_masked(ci->ci_pae_l3_pdirpa));
 



Home | Main Index | Thread Index | Old Index