Module Name:    src
Committed By:   maxv
Date:           Sun Oct  8 13:49:38 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: pmap.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 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.261 src/sys/arch/x86/x86/pmap.c:1.262
--- src/sys/arch/x86/x86/pmap.c:1.261	Sun Oct  8 09:06:50 2017
+++ src/sys/arch/x86/x86/pmap.c	Sun Oct  8 13:49:38 2017
@@ -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 @@ pmap_remap_largepages(void)
 #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;

Reply via email to