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 Mmh, correctly handle the physmem % lvl == ...



details:   https://anonhg.NetBSD.org/src/rev/304e99219fcd
branches:  trunk
changeset: 354400:304e99219fcd
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Jun 15 09:31:48 2017 +0000

description:
Mmh, correctly handle the physmem % lvl == 0 case. Don't know how I didn't
see this in the first place.

diffstat:

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

diffs (38 lines):

diff -r 8d5aa98e243c -r 304e99219fcd sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Thu Jun 15 07:05:32 2017 +0000
+++ b/sys/arch/x86/x86/pmap.c   Thu Jun 15 09:31:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.248 2017/06/15 07:05:32 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.249 2017/06/15 09:31:48 maxv Exp $  */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.248 2017/06/15 07:05:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.249 2017/06/15 09:31:48 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1518,7 +1518,8 @@
                        memset((void *)tmpva, 0, PAGE_SIZE);
 
                        pde = (pd_entry_t *)tmpva;
-                       npd = (i == nL3e - 1) ? (nL2e % NPDPG) : NPDPG;
+                       npd = ((i == nL3e - 1) && (nL2e % NPDPG != 0)) ?
+                           (nL2e % NPDPG) : NPDPG;
                        for (n = 0; n < npd; n++) {
                                pn = (i * NPDPG) + n;
                                pde[n] = ((paddr_t)pn << L2_SHIFT) | pteflags |
@@ -1533,7 +1534,8 @@
                        pmap_update_pg(tmpva);
 
                        pde = (pd_entry_t *)tmpva;
-                       npd = (i == nL4e - 1) ? (nL3e % NPDPG) : NPDPG;
+                       npd = ((i == nL4e - 1) && (nL3e % NPDPG != 0)) ?
+                           (nL3e % NPDPG) : NPDPG;
                        for (n = 0; n < npd; n++) {
                                pn = (i * NPDPG) + n;
                                pde[n] = (L2page_pa + (pn << PAGE_SHIFT)) |



Home | Main Index | Thread Index | Old Index