Module Name: src Committed By: maxv Date: Wed Jul 27 12:08:46 UTC 2016
Modified Files: src/sys/arch/x86/x86: pmap.c Log Message: Re-enable large pages on the data segment, but don't map the first page, and add a comment to explain why. We will have to move the LAPIC VA. The large page support is technically the same as before my last commit, since in practice, the first page of .data is never mapped with large pages. To generate a diff of this commit: cvs rdiff -u -r1.217 -r1.218 src/sys/arch/x86/x86/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/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.217 src/sys/arch/x86/x86/pmap.c:1.218 --- src/sys/arch/x86/x86/pmap.c:1.217 Mon Jul 25 12:11:40 2016 +++ src/sys/arch/x86/x86/pmap.c Wed Jul 27 12:08:46 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.217 2016/07/25 12:11:40 maxv Exp $ */ +/* $NetBSD: pmap.c,v 1.218 2016/07/27 12:08:46 maxv Exp $ */ /*- * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.217 2016/07/25 12:11:40 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.218 2016/07/27 12:08:46 maxv Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -1573,9 +1573,7 @@ pmap_remap_largepages(void) { extern char __rodata_start; extern char __data_start; -#if 0 extern char __kernel_end; -#endif pd_entry_t *pde; vaddr_t kva, kva_end; paddr_t pa; @@ -1606,9 +1604,13 @@ pmap_remap_largepages(void) tlbflushg(); } -#if 0 /* Remap the kernel data+bss using large pages. */ - kva = roundup((vaddr_t)&__data_start, NBPD_L2); + /* + * XXX: we need to make sure the first page (PAGE_SIZE) of .data is not + * mapped with a large page. As bizarre as it might seem, this first + * page is used as the VA for the LAPIC page. + */ + kva = roundup((vaddr_t)&__data_start+PAGE_SIZE, NBPD_L2); kva_end = rounddown((vaddr_t)&__kernel_end, NBPD_L1); pa = kva - KERNBASE; for (/* */; kva + NBPD_L2 <= kva_end; kva += NBPD_L2, pa += NBPD_L2) { @@ -1616,7 +1618,6 @@ pmap_remap_largepages(void) *pde = pa | pmap_pg_g | PG_PS | pmap_pg_nx | PG_KW | PG_V; tlbflushg(); } -#endif } #endif /* !XEN */