Module Name: src Committed By: reinoud Date: Wed Aug 1 09:43:17 UTC 2018
Modified Files: src/sys/arch/usermode/usermode: pmap.c Log Message: Allow the usermode pmaps to also contain the kernel itself. This is needed for the kernel pmap. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c diff -u src/sys/arch/usermode/usermode/pmap.c:1.107 src/sys/arch/usermode/usermode/pmap.c:1.108 --- src/sys/arch/usermode/usermode/pmap.c:1.107 Thu May 17 19:06:02 2018 +++ src/sys/arch/usermode/usermode/pmap.c Wed Aug 1 09:43:17 2018 @@ -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 <rein...@netbsd.org> @@ -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 @@ pmap_bootstrap(void) (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 @@ pmap_fault(pmap_t pmap, vaddr_t va, vm_p /* 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 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa 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);