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 Use roundup instead. Otherwise some (userla...



details:   https://anonhg.NetBSD.org/src/rev/ace0e7eb0818
branches:  trunk
changeset: 827000:ace0e7eb0818
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Oct 08 13:49:38 2017 +0000

description:
Use roundup instead. Otherwise some (userland) pages could get mapped in
the text large pages. We were using roundup to improve performance on i386
(mapping the text with large pages even if it was not aligned). But we're
in a state where correctness matters more than performance - the correct way
to get performance here is to align .text to 4MB.

diffstat:

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

diffs (31 lines):

diff -r 236ef246cd54 -r ace0e7eb0818 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sun Oct 08 13:48:40 2017 +0000
+++ b/sys/arch/x86/x86/pmap.c   Sun Oct 08 13:49:38 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.261 2017/10/08 09:06:50 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.262 2017/10/08 13:49:38 maxv Exp $  */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.261 2017/10/08 09:06:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.262 2017/10/08 13:49:38 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1611,10 +1611,10 @@
 #endif
 
        /* Remap the kernel text using large pages. */
-       kva = rounddown(bootspace.text.va, NBPD_L2);
+       kva = roundup(bootspace.text.va, NBPD_L2);
        kva_end = rounddown(bootspace.text.va +
            bootspace.text.sz, NBPD_L1);
-       pa = rounddown(bootspace.text.pa, NBPD_L2);
+       pa = roundup(bootspace.text.pa, NBPD_L2);
        for (/* */; kva + NBPD_L2 <= kva_end; kva += NBPD_L2, pa += NBPD_L2) {
                pde = &L2_BASE[pl2_i(kva)];
                *pde = pa | pmap_pg_g | PG_PS | PG_KR | PG_V;



Home | Main Index | Thread Index | Old Index