PR port-amd64/32816 amd64 can not load lkms

Change some assertions to partially allow for VM_MAP_IS_KERNEL(map) where
map is outside the range of kernel_map.
This commit is contained in:
ad 2008-12-01 10:54:57 +00:00
parent c967a6ed32
commit a371a02d26
3 changed files with 23 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_km.c,v 1.101 2008/08/04 13:37:33 pooka Exp $ */
/* $NetBSD: uvm_km.c,v 1.102 2008/12/01 10:54:57 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -128,7 +128,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.101 2008/08/04 13:37:33 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.102 2008/12/01 10:54:57 ad Exp $");
#include "opt_uvmhist.h"
@ -462,15 +462,16 @@ uvm_km_pgremove(vaddr_t startva, vaddr_t endva)
*/
void
uvm_km_pgremove_intrsafe(vaddr_t start, vaddr_t end)
uvm_km_pgremove_intrsafe(struct vm_map *map, vaddr_t start, vaddr_t end)
{
struct vm_page *pg;
paddr_t pa;
UVMHIST_FUNC("uvm_km_pgremove_intrsafe"); UVMHIST_CALLED(maphist);
KASSERT(VM_MIN_KERNEL_ADDRESS <= start);
KASSERT(VM_MAP_IS_KERNEL(map));
KASSERT(vm_map_min(map) <= start);
KASSERT(start < end);
KASSERT(end <= VM_MAX_KERNEL_ADDRESS);
KASSERT(end <= vm_map_max(map));
for (; start < end; start += PAGE_SIZE) {
if (!pmap_extract(pmap_kernel(), start, &pa)) {
@ -485,23 +486,23 @@ uvm_km_pgremove_intrsafe(vaddr_t start, vaddr_t end)
#if defined(DEBUG)
void
uvm_km_check_empty(vaddr_t start, vaddr_t end, bool intrsafe)
uvm_km_check_empty(struct vm_map *map, vaddr_t start, vaddr_t end)
{
struct vm_page *pg;
vaddr_t va;
paddr_t pa;
KDASSERT(VM_MIN_KERNEL_ADDRESS <= start);
KDASSERT(VM_MAP_IS_KERNEL(map));
KDASSERT(vm_map_min(map) <= start);
KDASSERT(start < end);
KDASSERT(end <= VM_MAX_KERNEL_ADDRESS);
KDASSERT(end <= vm_map_max(map));
for (va = start; va < end; va += PAGE_SIZE) {
if (pmap_extract(pmap_kernel(), va, &pa)) {
panic("uvm_km_check_empty: va %p has pa 0x%llx",
(void *)va, (long long)pa);
}
if (!intrsafe) {
const struct vm_page *pg;
if ((map->flags & VM_MAP_INTRSAFE) == 0) {
mutex_enter(&uvm_kernel_object->vmobjlock);
pg = uvm_pagelookup(uvm_kernel_object,
va - vm_map_min(kernel_map));
@ -655,7 +656,7 @@ uvm_km_free(struct vm_map *map, vaddr_t addr, vsize_t size, uvm_flag_t flags)
uvm_km_pgremove(addr, addr + size);
pmap_remove(pmap_kernel(), addr, addr + size);
} else if (flags & UVM_KMF_WIRED) {
uvm_km_pgremove_intrsafe(addr, addr + size);
uvm_km_pgremove_intrsafe(map, addr, addr + size);
pmap_kremove(addr, size);
}
@ -765,7 +766,7 @@ uvm_km_free_poolpage_cache(struct vm_map *map, vaddr_t addr)
}
KASSERT(pmap_extract(pmap_kernel(), addr, NULL));
uvm_km_pgremove_intrsafe(addr, addr + PAGE_SIZE);
uvm_km_pgremove_intrsafe(map, addr, addr + PAGE_SIZE);
pmap_kremove(addr, PAGE_SIZE);
#if defined(DEBUG)
pmap_update(pmap_kernel());

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_km.h,v 1.17 2007/02/21 23:00:13 thorpej Exp $ */
/* $NetBSD: uvm_km.h,v 1.18 2008/12/01 10:54:57 ad Exp $ */
/*
*
@ -49,9 +49,9 @@
void uvm_km_init(vaddr_t, vaddr_t);
void uvm_km_pgremove(vaddr_t, vaddr_t);
void uvm_km_pgremove_intrsafe(vaddr_t, vaddr_t);
void uvm_km_pgremove_intrsafe(struct vm_map *, vaddr_t, vaddr_t);
#if defined(DEBUG)
void uvm_km_check_empty(vaddr_t, vaddr_t, bool);
void uvm_km_check_empty(struct vm_map *, vaddr_t, vaddr_t);
#else
#define uvm_km_check_empty(a, b, c) /* nothing */
#endif /* defined(DEBUG) */

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_map.c,v 1.263 2008/07/29 00:03:06 matt Exp $ */
/* $NetBSD: uvm_map.c,v 1.264 2008/12/01 10:54:57 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.263 2008/07/29 00:03:06 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.264 2008/12/01 10:54:57 ad Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@ -1198,8 +1198,7 @@ uvm_map(struct vm_map *map, vaddr_t *startp /* IN/OUT */, vsize_t size,
#if defined(DEBUG)
if (!error && VM_MAP_IS_KERNEL(map)) {
uvm_km_check_empty(*startp, *startp + size,
(map->flags & VM_MAP_INTRSAFE) != 0);
uvm_km_check_empty(map, *startp, *startp + size);
}
#endif /* defined(DEBUG) */
@ -2328,7 +2327,7 @@ uvm_unmap_remove(struct vm_map *map, vaddr_t start, vaddr_t end,
*/
if ((entry->flags & UVM_MAP_KMAPENT) == 0) {
uvm_km_pgremove_intrsafe(entry->start,
uvm_km_pgremove_intrsafe(map, entry->start,
entry->end);
pmap_kremove(entry->start, len);
}
@ -2406,8 +2405,8 @@ uvm_unmap_remove(struct vm_map *map, vaddr_t start, vaddr_t end,
}
if (VM_MAP_IS_KERNEL(map)) {
uvm_km_check_empty(entry->start, entry->end,
(map->flags & VM_MAP_INTRSAFE) != 0);
uvm_km_check_empty(map, entry->start,
entry->end);
}
}
#endif /* defined(DEBUG) */