Module Name: src Committed By: martin Date: Fri May 13 11:12:49 UTC 2022
Modified Files: src/sys/arch/xen/x86 [netbsd-9]: x86_xpmap.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1444): sys/arch/xen/x86/x86_xpmap.c: revision 1.91 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.84.4.1 -r1.84.4.2 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.84.4.1 src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.2 --- src/sys/arch/xen/x86/x86_xpmap.c:1.84.4.1 Sun May 31 10:39:34 2020 +++ src/sys/arch/xen/x86/x86_xpmap.c Fri May 13 11:12:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_xpmap.c,v 1.84.4.1 2020/05/31 10:39:34 martin Exp $ */ +/* $NetBSD: x86_xpmap.c,v 1.84.4.2 2022/05/13 11:12:49 martin 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.84.4.1 2020/05/31 10:39:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.84.4.2 2022/05/13 11:12:49 martin Exp $"); #include "opt_xen.h" #include "opt_ddb.h" @@ -909,7 +909,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)] & PG_FRAME); pte = (pd_entry_t *)((u_long)addr + KERNBASE); @@ -923,6 +923,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(); }