summaryrefslogtreecommitdiffstats
path: root/sys/amd64/isa
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-05-23 22:13:58 +0000
committeralfred <alfred@FreeBSD.org>2001-05-23 22:13:58 +0000
commit54b23216796ed23667a583bdd2ac4b94e502545b (patch)
tree5189be3f72473b6b45518b100a79a856be135d01 /sys/amd64/isa
parent04aacfa65885d1d56b9137ffbcd462f2e51ff5b6 (diff)
downloadFreeBSD-src-54b23216796ed23667a583bdd2ac4b94e502545b.zip
FreeBSD-src-54b23216796ed23667a583bdd2ac4b94e502545b.tar.gz
lock vm while playing with pmap
Diffstat (limited to 'sys/amd64/isa')
-rw-r--r--sys/amd64/isa/isa_dma.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/amd64/isa/isa_dma.c b/sys/amd64/isa/isa_dma.c
index dab5e6a..42b9c7c 100644
--- a/sys/amd64/isa/isa_dma.c
+++ b/sys/amd64/isa/isa_dma.c
@@ -52,6 +52,8 @@
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/module.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -252,7 +254,12 @@ isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
}
/* translate to physical */
+ mtx_lock(&vm_mtx); /*
+ * XXX: need to hold for longer period to
+ * ensure that mappings don't change
+ */
phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
+ mtx_unlock(&vm_mtx);
if (flags & ISADMA_RAW) {
dma_auto_mode |= (1 << chan);
@@ -373,7 +380,9 @@ isa_dmarangecheck(caddr_t va, u_int length, int chan)
endva = (vm_offset_t)round_page((vm_offset_t)va + length);
for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
+ mtx_lock(&vm_mtx);
phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
+ mtx_unlock(&vm_mtx);
#define ISARAM_END RAM_END
if (phys == 0)
panic("isa_dmacheck: no physical page present");
OpenPOWER on IntegriCloud