summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-05-23 22:17:28 +0000
committeralfred <alfred@FreeBSD.org>2001-05-23 22:17:28 +0000
commitc93a1be72bccb1fe439910ab62060fbd513b94c2 (patch)
treeb2aab829ab9d82547f7dd2bd5ca02404109ea622 /sys/amd64
parent54b23216796ed23667a583bdd2ac4b94e502545b (diff)
downloadFreeBSD-src-c93a1be72bccb1fe439910ab62060fbd513b94c2.zip
FreeBSD-src-c93a1be72bccb1fe439910ab62060fbd513b94c2.tar.gz
pmap_mapdev needs the vm_mtx, aquire it if not already locked
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index fd4fed3..c6db00b 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -3135,10 +3135,15 @@ pmap_mapdev(pa, size)
{
vm_offset_t va, tmpva, offset;
unsigned *pte;
+ int hadvmlock;
offset = pa & PAGE_MASK;
size = roundup(offset + size, PAGE_SIZE);
+ hadvmlock = mtx_owned(&vm_mtx);
+ if (!hadvmlock)
+ mtx_lock(&vm_mtx);
+
va = kmem_alloc_pageable(kernel_map, size);
if (!va)
panic("pmap_mapdev: Couldn't alloc kernel virtual memory");
@@ -3153,6 +3158,9 @@ pmap_mapdev(pa, size)
}
invltlb();
+ if (!hadvmlock)
+ mtx_unlock(&vm_mtx);
+
return ((void *)(va + offset));
}
OpenPOWER on IntegriCloud