Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Re-enable large pages on the data segment, ...



details:   https://anonhg.NetBSD.org/src/rev/7daf1481efce
branches:  trunk
changeset: 346681:7daf1481efce
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Jul 27 12:08:46 2016 +0000

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

diffstat:

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

diffs (52 lines):

diff -r f4feac5501af -r 7daf1481efce sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Wed Jul 27 11:13:14 2016 +0000
+++ b/sys/arch/x86/x86/pmap.c   Wed Jul 27 12:08:46 2016 +0000
@@ -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 @@
 {
        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 @@
                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 @@
                *pde = pa | pmap_pg_g | PG_PS | pmap_pg_nx | PG_KW | PG_V;
                tlbflushg();
        }
-#endif
 }
 #endif /* !XEN */
 



Home | Main Index | Thread Index | Old Index