diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 7713eaa80561..7619f5f3dfef 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.233 1997/06/12 15:46:32 mrg Exp $ */ +/* $NetBSD: machdep.c,v 1.234 1997/06/12 23:57:26 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -2028,27 +2028,31 @@ _bus_dmamap_load(t, map, buf, buflen, p, flags) bus_addr_t curaddr, lastaddr; caddr_t vaddr = buf; int first, seg; - - if (buflen > map->_dm_size) - return (EINVAL); + pmap_t pmap; /* * Make sure that on error condition we return "no valid mappings". */ map->dm_nsegs = 0; + if (buflen > map->_dm_size) + return (EINVAL); + /* * XXX Need to implement "don't dma across this boundry". */ + if (p != NULL) + pmap = p->p_vmspace->vm_map.pmap; + else + pmap = pmap_kernel(); + lastaddr = ~0; /* XXX gcc */ for (first = 1, seg = 0; buflen > 0 && seg < map->_dm_segcnt; ) { /* * Get the physical address for this segment. */ - curaddr = (bus_addr_t)pmap_extract(p != NULL ? - &p->p_vmspace->vm_pmap : pmap_kernel(), - (vm_offset_t)vaddr); + curaddr = (bus_addr_t)pmap_extract(pmap, (vm_offset_t)vaddr); /* * Compute the segment size, and adjust counts. diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 67bd8982addf..6e70818afbe8 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.42 1997/06/06 23:14:22 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.43 1997/06/12 23:57:28 thorpej Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -681,7 +681,7 @@ pmap_release(pmap) printf("pmap_release(%p)\n", pmap); #endif -#ifdef DIAGNOSTIC +#ifdef notdef /* DIAGNOSTIC */ /* sometimes 1, sometimes 0; could rearrange pmap_destroy */ if (pmap->pm_count != 1) panic("pmap_release count"); @@ -720,7 +720,7 @@ pmap_activate(pmap, pcb) if (pmap /*&& pmap->pm_pdchanged */) { pcb->pcb_cr3 = pmap_extract(pmap_kernel(), (vm_offset_t)pmap->pm_pdir); - if (pmap == &curproc->p_vmspace->vm_pmap) + if (pmap == curproc->p_vmspace->vm_map.pmap) lcr3(pcb->pcb_cr3); pmap->pm_pdchanged = FALSE; } diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c index bf7f4f56f621..c5a9e104d1b6 100644 --- a/sys/arch/i386/i386/vm_machdep.c +++ b/sys/arch/i386/i386/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.63 1996/12/10 05:28:15 tls Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.64 1997/06/12 23:57:29 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -106,7 +106,7 @@ cpu_fork(p1, p2) /* Sync curpcb (which is presumably p1's PCB) and copy it to p2. */ savectx(curpcb); *pcb = p1->p_addr->u_pcb; - pmap_activate(&p2->p_vmspace->vm_pmap, pcb); + pmap_activate(p2->p_vmspace->vm_map.pmap, pcb); /* * Preset these so that gdt_compact() doesn't get confused if called diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h index aa677381c430..5ca538cc0e00 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.25 1997/05/16 21:35:36 gwr Exp $ */ +/* $NetBSD: pmap.h,v 1.26 1997/06/12 23:57:30 thorpej Exp $ */ /* * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -204,6 +204,4 @@ void pmap_activate __P((pmap_t, struct pcb *)); #endif /* _KERNEL */ -#define __VM_PMAP_HACK - #endif /* _I386_PMAP_H_ */ diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c index 008cf7e70764..0c17bdc580c2 100644 --- a/sys/arch/i386/isa/isa_machdep.c +++ b/sys/arch/i386/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa_machdep.c,v 1.21 1997/06/06 23:28:41 thorpej Exp $ */ +/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */ #define ISA_DMA_STATS @@ -900,6 +900,7 @@ _isa_dma_check_buffer(buf, buflen, segcnt, boundary, p) vm_offset_t vaddr = (vm_offset_t)buf; vm_offset_t pa, lastpa, endva; u_long pagemask = ~(boundary - 1); + pmap_t pmap; int nsegs; endva = round_page(vaddr + buflen); @@ -907,12 +908,16 @@ _isa_dma_check_buffer(buf, buflen, segcnt, boundary, p) nsegs = 1; lastpa = 0; + if (p != NULL) + pmap = p->p_vmspace->vm_map.pmap; + else + pmap = pmap_kernel(); + for (; vaddr < endva; vaddr += NBPG) { /* * Get physical address for this segment. */ - pa = pmap_extract(p != NULL ? &p->p_vmspace->vm_pmap : - pmap_kernel(), (vm_offset_t)vaddr); + pa = pmap_extract(pmap, (vm_offset_t)vaddr); pa = trunc_page(pa); /*