Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode/usermode Allow the usermode pmaps to also ...



details:   https://anonhg.NetBSD.org/src/rev/4a251c456cac
branches:  trunk
changeset: 365101:4a251c456cac
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Wed Aug 01 09:43:17 2018 +0000

description:
Allow the usermode pmaps to also contain the kernel itself. This is needed for
the kernel pmap.

diffstat:

 sys/arch/usermode/usermode/pmap.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (50 lines):

diff -r f8cb7d09ddc5 -r 4a251c456cac sys/arch/usermode/usermode/pmap.c
--- a/sys/arch/usermode/usermode/pmap.c Wed Aug 01 08:54:48 2018 +0000
+++ b/sys/arch/usermode/usermode/pmap.c Wed Aug 01 09:43:17 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.107 2018/05/17 19:06:02 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.108 2018/08/01 09:43:17 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <reinoud%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 2018/05/17 19:06:02 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2018/08/01 09:43:17 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -285,7 +285,7 @@
                (uint64_t) pv_table_size/1024, (uintptr_t) phys_npages);
 
        /* calculate number of pmap entries needed for a complete map */
-       pm_nentries = (kmem_k_start - VM_MIN_ADDRESS) / PAGE_SIZE;
+       pm_nentries = (kmem_k_end - VM_MIN_ADDRESS) / PAGE_SIZE;
        pm_entries_size = round_page(pm_nentries * sizeof(struct pv_entry *));
        thunk_printf_debug("tlb va->pa lookup table is %"PRIu64" KB for "
                "%d logical pages\n", pm_entries_size/1024, pm_nentries);
@@ -660,6 +660,7 @@
 
        /* not known! then it must be UVM's work */
        if (pv == NULL) {
+thunk_printf("%s: no mapping yet for %p\n", __func__, (void *) va);
                thunk_printf_debug("%s: no mapping yet\n", __func__);
                *atype = VM_PROT_READ;          /* assume it was a read */
                return false;
@@ -1089,8 +1090,12 @@
 
        thunk_printf_debug("pmap_extract: extracting va %p\n", (void *) va);
 #ifdef DIAGNOSTIC
-       if ((va < VM_MIN_ADDRESS) || (va > VM_MAX_KERNEL_ADDRESS))
-               panic("pmap_extract: invalid va isued\n");
+       if ((va < VM_MIN_ADDRESS) || (va > VM_MAX_KERNEL_ADDRESS)) {
+               thunk_printf_debug("pmap_extract: invalid va issued\n");
+               thunk_printf("%p not in [%p, %p]\n", (void *) va,
+                   (void *) VM_MIN_ADDRESS, (void *) VM_MAX_KERNEL_ADDRESS);
+               return false;
+       }
 #endif
        lpn = atop(va - VM_MIN_ADDRESS);        /* V->L */
        pv = pmap_lookup_pv(pmap, lpn);



Home | Main Index | Thread Index | Old Index