Module Name: src Committed By: bouyer Date: Wed May 11 16:22:46 UTC 2022
Modified Files: src/sys/arch/xen/x86: x86_xpmap.c Log Message: In bootstrap, after switching to a new page table make sure that now-unused memory is unmapped. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/xen/x86/x86_xpmap.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/xen/x86/x86_xpmap.c diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.90 src/sys/arch/xen/x86/x86_xpmap.c:1.91 --- src/sys/arch/xen/x86/x86_xpmap.c:1.90 Sun Sep 6 02:18:53 2020 +++ src/sys/arch/xen/x86/x86_xpmap.c Wed May 11 16:22:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_xpmap.c,v 1.90 2020/09/06 02:18:53 riastradh Exp $ */ +/* $NetBSD: x86_xpmap.c,v 1.91 2022/05/11 16:22:46 bouyer Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.90 2020/09/06 02:18:53 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.91 2022/05/11 16:22:46 bouyer Exp $"); #include "opt_xen.h" #include "opt_ddb.h" @@ -911,7 +911,7 @@ xen_bootstrap_tables(vaddr_t old_pgd, va /* Unpin old PGD */ xpq_queue_unpin_table(xpmap_ptom_masked(old_pgd - KERNBASE)); - /* Mark old tables RW */ + /* Mark old tables RW if used, unmap otherwise */ page = old_pgd; addr = xpmap_mtop((paddr_t)L2[pl2_pi(page)] & PTE_4KFRAME); pte = (pd_entry_t *)((u_long)addr + KERNBASE); @@ -925,6 +925,12 @@ xen_bootstrap_tables(vaddr_t old_pgd, va */ pte++; } + while (page < old_pgd + (old_count * PAGE_SIZE)) { + addr = xpmap_ptom(((u_long)pte) - KERNBASE); + xpq_queue_pte_update(addr, 0); + page += PAGE_SIZE; + pte++; + } xpq_flush_queue(); }