lock vm while playing with pmap

This commit is contained in:
Alfred Perlstein 2001-05-23 22:13:58 +00:00
parent bb10bb4978
commit b99c886a7f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77081
2 changed files with 18 additions and 0 deletions

View File

@ -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");

View File

@ -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");