diff options
Diffstat (limited to 'sys/arch')
64 files changed, 334 insertions, 352 deletions
diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c index c2d70607801..3234d839dae 100644 --- a/sys/arch/alpha/alpha/pmap.c +++ b/sys/arch/alpha/alpha/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.15 2001/06/23 19:36:44 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.16 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: pmap.c,v 1.154 2000/12/07 22:18:55 thorpej Exp $ */ /*- @@ -1683,9 +1683,8 @@ pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) * or lose information. That is, this routine must actually * insert this page into the given map NOW. */ -void -pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, - vm_prot_t access_type) +int +pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags) { boolean_t managed; pt_entry_t *pte, npte, opte; @@ -1695,19 +1694,18 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, boolean_t needisync = FALSE; boolean_t setisync = FALSE; boolean_t isactive; + boolean_t wired; long cpu_id = cpu_number(); - int error; + int error = KERN_SUCCESS; #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER)) printf("pmap_enter(%p, %lx, %lx, %x, %x)\n", pmap, va, pa, prot, access_type); #endif - if (pmap == NULL) - return; - managed = PAGE_IS_MANAGED(pa); isactive = PMAP_ISACTIVE(pmap, cpu_id); + wired = (flags & PMAP_WIRED) != 0; /* * Determine what we need to do about the I-stream. If @@ -1756,10 +1754,8 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, if (pmap->pm_lev1map == kernel_lev1map) { error = pmap_lev1map_create(pmap, cpu_id); if (error != KERN_SUCCESS) { -#ifdef notyet if (flags & PMAP_CANFAIL) - return (error); -#endif + goto out; panic("pmap_enter: unable to create lev1map"); } } @@ -1776,10 +1772,8 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, error = pmap_ptpage_alloc(pmap, l1pte, PGU_L2PT); if (error != KERN_SUCCESS) { pmap_l1pt_delref(pmap, l1pte, cpu_id); -#ifdef notyet if (flags & PMAP_CANFAIL) - return (error); -#endif + goto out; panic("pmap_enter: unable to create L2 PT " "page"); } @@ -1803,10 +1797,8 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, error = pmap_ptpage_alloc(pmap, l2pte, PGU_L3PT); if (error != KERN_SUCCESS) { pmap_l2pt_delref(pmap, l1pte, l2pte, cpu_id); -#ifdef notyet if (flags & PMAP_CANFAIL) - return (error); -#endif + goto out; panic("pmap_enter: unable to create L3 PT " "page"); } @@ -1911,10 +1903,8 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, error = pmap_pv_enter(pmap, pa, va, pte, TRUE); if (error != KERN_SUCCESS) { pmap_l3pt_delref(pmap, va, pte, cpu_id, NULL); -#ifdef notyet if (flags & PMAP_CANFAIL) - return (error); -#endif + goto out; panic("pmap_enter: unable to enter mapping in PV " "table"); } @@ -1937,13 +1927,13 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, int attrs; #ifdef DIAGNOSTIC - if ((access_type & VM_PROT_ALL) & ~prot) + if ((flags & VM_PROT_ALL) & ~prot) panic("pmap_enter: access type exceeds prot"); #endif simple_lock(&pvh->pvh_slock); - if (access_type & VM_PROT_WRITE) + if (flags & VM_PROT_WRITE) pvh->pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED); - else if (access_type & VM_PROT_ALL) + else if (flags & VM_PROT_ALL) pvh->pvh_attrs |= PGA_REFERENCED; attrs = pvh->pvh_attrs; simple_unlock(&pvh->pvh_slock); @@ -1993,12 +1983,11 @@ pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int wired, if (needisync) PMAP_SYNC_ISTREAM(pmap); +out: PMAP_UNLOCK(pmap); PMAP_MAP_TO_HEAD_UNLOCK(); -#ifdef notyet - return (KERN_SUCCESS); -#endif + return error; } /* diff --git a/sys/arch/alpha/alpha/vm_machdep.c b/sys/arch/alpha/alpha/vm_machdep.c index 0bd241f5e1e..24798a6231b 100644 --- a/sys/arch/alpha/alpha/vm_machdep.c +++ b/sys/arch/alpha/alpha/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.22 2001/06/08 08:08:38 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.23 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.55 2000/03/29 03:49:48 simonb Exp $ */ /* @@ -380,7 +380,7 @@ vmapbuf(bp, len) faddr, &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa), - VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); faddr += PAGE_SIZE; taddr += PAGE_SIZE; } diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c index 28119359342..643950ce1d6 100644 --- a/sys/arch/alpha/dev/bus_dma.c +++ b/sys/arch/alpha/dev/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.2 2001/06/08 08:08:39 art Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.3 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */ /*- @@ -602,8 +602,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) if (size == 0) panic("_bus_dmamem_map: size botch"); pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, 1, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); } } diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index 794e44a9036..4986f0cd536 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.48 2001/07/18 10:47:04 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.49 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: machdep.c,v 1.95 1997/08/27 18:31:17 is Exp $ */ /* @@ -331,8 +331,8 @@ cpu_startup() */ for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp, - msgbufpa + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + msgbufpa + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); /* diff --git a/sys/arch/amiga/amiga/mem.c b/sys/arch/amiga/amiga/mem.c index 73f814ae719..bc83cdfba96 100644 --- a/sys/arch/amiga/amiga/mem.c +++ b/sys/arch/amiga/amiga/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.13 2001/06/27 03:54:13 art Exp $ */ +/* $OpenBSD: mem.c,v 1.14 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: mem.c,v 1.18 1997/02/02 07:17:14 thorpej Exp $ */ /* @@ -146,7 +146,7 @@ mmrw(dev, uio, flags) #endif pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? - VM_PROT_READ : VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c index ae23ce73391..452fee199aa 100644 --- a/sys/arch/amiga/amiga/pmap.c +++ b/sys/arch/amiga/amiga/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.33 2001/07/18 10:47:04 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.34 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: pmap.c,v 1.68 1999/06/19 19:44:09 is Exp $ */ /*- @@ -769,7 +769,7 @@ pmap_map(virt, start, end, prot) prot); #endif while (start < end) { - pmap_enter(pmap_kernel(), virt, start, prot, FALSE, 0); + pmap_enter(pmap_kernel(), virt, start, prot, 0); virt += PAGE_SIZE; start += PAGE_SIZE; } @@ -1110,28 +1110,26 @@ pmap_protect(pmap, sva, eva, prot) */ extern int kernel_copyback; -void -pmap_enter(pmap, va, pa, prot, wired, access_type) +int +pmap_enter(pmap, va, pa, prot, flags) pmap_t pmap; vaddr_t va; paddr_t pa; vm_prot_t prot; - boolean_t wired; - vm_prot_t access_type; + int flags; { u_int *pte; int npte; paddr_t opa; boolean_t cacheable = TRUE; boolean_t checkpv = TRUE; + boolean_t wired = (flags & PMAP_WIRED) != 0; #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER)) printf("pmap_enter(%p, %lx, %lx, %x, %x)\n", pmap, va, pa, prot, wired); #endif - if (pmap == NULL) - return; #ifdef DEBUG if (pmap == pmap_kernel()) @@ -1379,6 +1377,8 @@ validate: pmap_check_wiring("enter", trunc_page((vaddr_t)pmap_pte(pmap, va))); } #endif + + return (KERN_SUCCESS); } /* @@ -2397,8 +2397,8 @@ pmap_enter_ptpage(pmap, va) kpt_used_list = kpt; ptpa = kpt->kpt_pa; bzero((char *)kpt->kpt_va, NBPG); - pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, TRUE, - VM_PROT_DEFAULT); + pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, + VM_PROT_DEFAULT|PMAP_WIRED); #if defined(M68060) if (machineid & AMIGA_68060) { pmap_changebit(ptpa, PG_CCB, 0); @@ -2599,7 +2599,8 @@ pmap_virtual_space(vstartp, vendp) void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) { - pmap_enter(pmap_kernel(), va, pa, prot, 1, VM_PROT_READ|VM_PROT_WRITE); + pmap_enter(pmap_kernel(), va, pa, prot, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } void @@ -2609,8 +2610,8 @@ pmap_kenter_pgs(vaddr_t va, struct vm_page **pgs, int npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } } diff --git a/sys/arch/amiga/amiga/vm_machdep.c b/sys/arch/amiga/amiga/vm_machdep.c index 259075d7924..c3f29b2f3d6 100644 --- a/sys/arch/amiga/amiga/vm_machdep.c +++ b/sys/arch/amiga/amiga/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.20 2001/06/27 03:54:13 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.21 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/05/19 10:14:50 veego Exp $ */ /* @@ -191,8 +191,8 @@ pagemove(from, to, size) pmap_remove(pmap_kernel(), (vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE); pmap_enter(pmap_kernel(), (vm_offset_t)to, pa, - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); from += PAGE_SIZE; to += PAGE_SIZE; size -= PAGE_SIZE; @@ -380,7 +380,7 @@ vmapbuf(bp, len) if (pmap_extract(upmap, uva, &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, - TRUE, 0); + PMAP_WIRED); uva += PAGE_SIZE; kva += PAGE_SIZE; len -= PAGE_SIZE; diff --git a/sys/arch/hp300/hp300/leds.c b/sys/arch/hp300/hp300/leds.c index 561d01788b9..3156cd73618 100644 --- a/sys/arch/hp300/hp300/leds.c +++ b/sys/arch/hp300/hp300/leds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: leds.c,v 1.3 2001/05/11 23:24:57 millert Exp $ */ +/* $OpenBSD: leds.c,v 1.4 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: leds.c,v 1.1 1997/05/05 20:54:35 thorpej Exp $ */ /* @@ -61,7 +61,7 @@ ledinit() { pmap_enter(pmap_kernel(), (vaddr_t)ledbase, (paddr_t)LED_ADDR, - VM_PROT_READ|VM_PROT_WRITE, TRUE, VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); ledaddr = (u_int8_t *) ((long)ledbase | (LED_ADDR & PGOFSET)); } diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 0c840515cb2..9cdd692e170 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.54 2001/07/18 10:47:04 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.55 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */ /* @@ -275,7 +275,7 @@ cpu_startup() */ for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_enter(pmap_kernel(), (vaddr_t)msgbufp, - avail_end + i * NBPG, VM_PROT_ALL, TRUE, VM_PROT_ALL); + avail_end + i * NBPG, VM_PROT_ALL, VM_PROT_ALL|PMAP_WIRED); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); /* @@ -984,7 +984,7 @@ dumpsys() printf("%d ", pg / NPGMB); #undef NPGMB pmap_enter(pmap_kernel(), (vaddr_t)vmmap, maddr, - VM_PROT_READ, TRUE, VM_PROT_READ); + VM_PROT_READ, VM_PROT_READ|PMAP_WIRED); error = (*dump)(dumpdev, blkno, vmmap, NBPG); switch (error) { @@ -1282,7 +1282,7 @@ parityerrorfind() ecacheoff(); for (pg = btoc(lowram); pg < btoc(lowram)+physmem; pg++) { pmap_enter(pmap_kernel(), (vaddr_t)vmmap, ctob(pg), - VM_PROT_READ, TRUE, VM_PROT_READ); + VM_PROT_READ, VM_PROT_READ|PMAP_WIRED); ip = (int *)vmmap; for (o = 0; o < NBPG; o += sizeof(int)) i = *ip++; diff --git a/sys/arch/hp300/hp300/mem.c b/sys/arch/hp300/hp300/mem.c index fb0cbef15e3..fcda2b512d4 100644 --- a/sys/arch/hp300/hp300/mem.c +++ b/sys/arch/hp300/hp300/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.14 2001/06/27 04:05:45 art Exp $ */ +/* $OpenBSD: mem.c,v 1.15 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: mem.c,v 1.25 1999/03/27 00:30:06 mycroft Exp $ */ /* @@ -147,7 +147,7 @@ mmrw(dev, uio, flags) prot = uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE; pmap_enter(pmap_kernel(), (vaddr_t)vmmap, - trunc_page(v), prot, TRUE, prot); + trunc_page(v), prot, prot|PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); diff --git a/sys/arch/hp300/hp300/pmap.c b/sys/arch/hp300/hp300/pmap.c index 7a7de7b2d5a..35e5640df41 100644 --- a/sys/arch/hp300/hp300/pmap.c +++ b/sys/arch/hp300/hp300/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.26 2001/07/18 10:47:04 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.27 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: pmap.c,v 1.80 1999/09/16 14:52:06 chs Exp $ */ /*- @@ -693,7 +693,7 @@ pmap_map(va, spa, epa, prot) ("pmap_map(%lx, %lx, %lx, %x)\n", va, spa, epa, prot)); while (spa < epa) { - pmap_enter(pmap_kernel(), va, spa, prot, FALSE, 0); + pmap_enter(pmap_kernel(), va, spa, prot, 0); va += NBPG; spa += NBPG; } @@ -1130,28 +1130,25 @@ pmap_protect(pmap, sva, eva, prot) * or lose information. That is, this routine must actually * insert this page into the given map NOW. */ -void -pmap_enter(pmap, va, pa, prot, wired, access_type) +int +pmap_enter(pmap, va, pa, prot, flags) pmap_t pmap; vaddr_t va; paddr_t pa; vm_prot_t prot; - boolean_t wired; - vm_prot_t access_type; + int flags; { pt_entry_t *pte; int npte; paddr_t opa; boolean_t cacheable = TRUE; boolean_t checkpv = TRUE; + boolean_t wired = (flags & PMAP_WIRED) != 0; PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER, ("pmap_enter(%p, %lx, %lx, %x, %x)\n", pmap, va, pa, prot, wired)); - if (pmap == NULL) - return; - #ifdef DIAGNOSTIC /* * pmap_enter() should never be used for CADDR1 and CADDR2. @@ -1320,12 +1317,12 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) * on the hint provided in access_type. */ #ifdef DIAGNOSTIC - if (access_type & ~prot) - panic("pmap_enter: access_type exceeds prot"); + if ((flags & VM_PROT_ALL) & ~prot) + panic("pmap_enter: access type exceeds prot"); #endif - if (access_type & VM_PROT_WRITE) + if (flags & VM_PROT_WRITE) *pa_to_attribute(pa) |= (PG_U|PG_M); - else if (access_type & VM_PROT_ALL) + else if (flags & VM_PROT_ALL) *pa_to_attribute(pa) |= PG_U; splx(s); @@ -1417,6 +1414,8 @@ validate: if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) pmap_check_wiring("enter", trunc_page((vaddr_t)pte)); #endif + + return (KERN_SUCCESS); } void @@ -1425,7 +1424,7 @@ pmap_kenter_pa(va, pa, prot) paddr_t pa; vm_prot_t prot; { - pmap_enter(pmap_kernel(), va, pa, prot, TRUE, 0); + pmap_enter(pmap_kernel(), va, pa, prot, PMAP_WIRED); } void @@ -1438,7 +1437,7 @@ pmap_kenter_pgs(va, pgs, npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); } } @@ -2542,8 +2541,8 @@ pmap_enter_ptpage(pmap, va) kpt_used_list = kpt; ptpa = kpt->kpt_pa; bzero((caddr_t)kpt->kpt_va, NBPG); - pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, TRUE, - VM_PROT_DEFAULT); + pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, + VM_PROT_DEFAULT|PMAP_WIRED); #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) { int ix = pmap_ste(pmap, va) - pmap_ste(pmap, 0); diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c index 7808e616b70..309bf31cf7c 100644 --- a/sys/arch/hp300/hp300/trap.c +++ b/sys/arch/hp300/hp300/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.24 2001/06/27 04:05:45 art Exp $ */ +/* $OpenBSD: trap.c,v 1.25 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */ /* @@ -797,7 +797,7 @@ writeback(fp, docachepush) pmap_enter(pmap_kernel(), (vaddr_t)vmmap, trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE, - TRUE, VM_PROT_WRITE); + VM_PROT_WRITE|PMAP_WIRED); fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF]; bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16); pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa); diff --git a/sys/arch/hp300/hp300/vm_machdep.c b/sys/arch/hp300/hp300/vm_machdep.c index 471db3600e3..67f2a97cc77 100644 --- a/sys/arch/hp300/hp300/vm_machdep.c +++ b/sys/arch/hp300/hp300/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.28 2001/07/18 10:47:04 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.29 2001/07/25 13:25:31 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.47 1999/03/26 23:41:29 mycroft Exp $ */ /* @@ -330,7 +330,7 @@ vmapbuf(bp, len) do { if (pmap_extract(upmap, uva, &pa) == FALSE) panic("vmapbuf: null page frame"); - pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); uva += PAGE_SIZE; kva += PAGE_SIZE; len -= PAGE_SIZE; diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index bc754d6b6bb..fe2d161ffcc 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.35 2001/07/05 10:12:08 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.36 2001/07/25 13:25:31 art Exp $ */ /* * Copyright (c) 1999-2000 Michael Shalayeff @@ -644,7 +644,7 @@ cpu_startup() "buffer cache"); pmap_enter(kernel_map->pmap, curbuf, VM_PAGE_TO_PHYS(pg), VM_PROT_READ|VM_PROT_WRITE, - TRUE, VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } diff --git a/sys/arch/hppa/hppa/pmap.c b/sys/arch/hppa/hppa/pmap.c index 5a1062f3eb3..6653a461404 100644 --- a/sys/arch/hppa/hppa/pmap.c +++ b/sys/arch/hppa/hppa/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.45 2001/06/08 08:08:48 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.46 2001/07/25 13:25:31 art Exp $ */ /* * Copyright (c) 1998-2001 Michael Shalayeff @@ -974,24 +974,25 @@ pmap_destroy(pmap) splx(s); } /* - * pmap_enter(pmap, va, pa, prot, wired, access_type) + * pmap_enter(pmap, va, pa, prot, flags) * Create a translation for the virtual address (va) to the physical * address (pa) in the pmap with the protection requested. If the * translation is wired then we can not allow a page fault to occur * for this mapping. */ -void -pmap_enter(pmap, va, pa, prot, wired, access_type) +int +pmap_enter(pmap, va, pa, prot, flags) pmap_t pmap; vaddr_t va; paddr_t pa; - vm_prot_t prot, access_type; - boolean_t wired; + vm_prot_t prot; + int flags; { register struct pv_entry *pv, *ppv; u_int tlbpage, tlbprot; pa_space_t space; boolean_t waswired; + boolean_t wired = (flags & PMAP_WIRED) != 0; int s; pa = hppa_trunc_page(pa); @@ -1010,7 +1011,7 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) tlbpage = tlbbtop(pa); tlbprot = TLB_REF | pmap_prot(pmap, prot) | pmap->pmap_pid; - if (access_type & VM_PROT_WRITE) + if (flags & VM_PROT_WRITE) tlbprot |= TLB_DIRTY; if (!(ppv = pmap_find_va(space, va))) { @@ -1073,6 +1074,8 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) if (pmapdebug & PDB_ENTER) printf("pmap_enter: leaving\n"); #endif + + return (KERN_SUCCESS); } /* diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index fe5685b6f44..b5dd0636f26 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.23 2001/06/10 02:55:43 mickey Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.24 2001/07/25 13:25:31 art Exp $ */ /* * Copyright (c) 1999-2000 Michael Shalayeff @@ -111,8 +111,8 @@ pagemove(from, to, size) pmap_remove(pmap_kernel(), (vaddr_t)from, (vaddr_t)from + PAGE_SIZE); pmap_enter(pmap_kernel(), (vaddr_t)to, pa, - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); from += PAGE_SIZE; to += PAGE_SIZE; size -= PAGE_SIZE; @@ -348,7 +348,7 @@ vmapbuf(bp, len) if (pmap_extract(vm_map_pmap(map), addr, &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), kva, pa, - VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); addr += PAGE_SIZE; kva += PAGE_SIZE; diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c index 507c0f28310..f69db0c9711 100644 --- a/sys/arch/i386/i386/bios.c +++ b/sys/arch/i386/i386/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.44 2001/07/10 11:07:26 espie Exp $ */ +/* $OpenBSD: bios.c,v 1.45 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1997-2001 Michael Shalayeff @@ -409,14 +409,14 @@ bios32_service(service, e, ei) va += i386_trunc_page(BIOS32_START); pa < endpa; pa += NBPG, va += NBPG) { pmap_enter(pmap_kernel(), va, pa, - VM_PROT_READ | VM_PROT_WRITE, TRUE, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); /* for all you, broken hearted */ if (pa >= i386_trunc_page(base)) { pmap_enter(pmap_kernel(), sva, pa, - VM_PROT_READ | VM_PROT_WRITE, TRUE, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); sva += NBPG; } } diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index e2d4e1725e3..f67604aa7da 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.169 2001/07/15 10:54:44 niklas Exp $ */ +/* $OpenBSD: machdep.c,v 1.170 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -360,8 +360,8 @@ cpu_startup() for (i = 0; i < btoc(MSGBUFSIZE); i++, pa += NBPG) pmap_enter(pmap_kernel(), (vm_offset_t)((caddr_t)msgbufp + i * NBPG), pa, - VM_PROT_READ|VM_PROT_WRITE, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); printf("%s", version); @@ -627,8 +627,8 @@ setup_buffers(maxaddr) for (size = PAGE_SIZE * (i < residual ? base + 1 : base); size > 0; size -= NBPG, addr += NBPG) { pmap_enter(pmap_kernel(), addr, pg->phys_addr, - VM_PROT_READ|VM_PROT_WRITE, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); pg = pg->pageq.tqe_next; } } @@ -1815,7 +1815,7 @@ dumpsys() printf("(%x %d) ", maddr, blkno); #endif pmap_enter(pmap_kernel(), dumpspace, maddr, - VM_PROT_READ, TRUE, 0); + VM_PROT_READ, PMAP_WIRED); if ((error = (*dump)(dumpdev, blkno, (caddr_t)dumpspace, NBPG))) break; @@ -2110,8 +2110,8 @@ init386(first_avail) panic("cannot reserve /boot args memory"); pmap_enter(pmap_kernel(), (vaddr_t)bootargp, (paddr_t)bootargv, - VM_PROT_READ|VM_PROT_WRITE, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); bios_getopt(); @@ -3089,8 +3089,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) if (size == 0) panic("_bus_dmamem_map: size botch"); pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, TRUE, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); } } pmap_update(); diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 71f8c9bd9b1..e2dfe79fd2e 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.18 2001/05/16 05:07:48 millert Exp $ */ +/* $OpenBSD: mem.c,v 1.19 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -165,7 +165,7 @@ mmrw(dev, uio, flags) v = uio->uio_offset; pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? - VM_PROT_READ : VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 24178c1351f..3072006f1e5 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.42 2001/07/15 12:23:55 assar Exp $ */ +/* $OpenBSD: pmap.c,v 1.43 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: pmap.c,v 1.84 2000/02/21 02:01:24 chs Exp $ */ /* @@ -2084,7 +2084,7 @@ pmap_map(va, spa, epa, prot) vm_prot_t prot; { while (spa < epa) { - _pmap_enter(pmap_kernel(), va, spa, prot, 0); + pmap_enter(pmap_kernel(), va, spa, prot, 0); va += NBPG; spa += NBPG; } @@ -3434,7 +3434,7 @@ pmap_transfer_ptes(srcpmap, srcl, dstpmap, dstl, toxfer, move) */ int -_pmap_enter(pmap, va, pa, prot, flags) +pmap_enter(pmap, va, pa, prot, flags) struct pmap *pmap; vaddr_t va; paddr_t pa; diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c index fde7a189ed0..39ea7a0e6fb 100644 --- a/sys/arch/i386/i386/vm_machdep.c +++ b/sys/arch/i386/i386/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.27 2001/06/08 08:08:53 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.28 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.61 1996/05/03 19:42:35 christos Exp $ */ /*- @@ -389,8 +389,8 @@ vmapbuf(bp, len) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map), faddr, &fpa); pmap_enter(vm_map_pmap(phys_map), taddr, fpa, - VM_PROT_READ | VM_PROT_WRITE, TRUE, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); faddr += PAGE_SIZE; taddr += PAGE_SIZE; len -= PAGE_SIZE; diff --git a/sys/arch/m68k/m68k/mappedcopy.c b/sys/arch/m68k/m68k/mappedcopy.c index 3dd26fd08b2..63150619992 100644 --- a/sys/arch/m68k/m68k/mappedcopy.c +++ b/sys/arch/m68k/m68k/mappedcopy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mappedcopy.c,v 1.5 2001/06/08 08:08:57 art Exp $ */ +/* $OpenBSD: mappedcopy.c,v 1.6 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: mappedcopy.c,v 1.1 1997/02/02 06:54:10 thorpej Exp $ */ /* @@ -111,8 +111,8 @@ mappedcopyin(fromp, top, count) if (pmap_extract(upmap, trunc_page((vaddr_t)fromp), &upa) == FALSE) panic("mappedcopyin: null page frame"); len = min(count, (PAGE_SIZE - off)); - pmap_enter(pmap_kernel(), kva, upa, VM_PROT_READ, TRUE, - VM_PROT_READ); + pmap_enter(pmap_kernel(), kva, upa, VM_PROT_READ, + VM_PROT_READ|PMAP_WIRED); if (len == PAGE_SIZE && alignable && off == 0) copypage((caddr_t)kva, top); else @@ -163,8 +163,8 @@ mappedcopyout(fromp, top, count) panic("mappedcopyout: null page frame"); len = min(count, (PAGE_SIZE - off)); pmap_enter(pmap_kernel(), kva, upa, - VM_PROT_READ|VM_PROT_WRITE, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); if (len == PAGE_SIZE && alignable && off == 0) copypage(fromp, (caddr_t)kva); else diff --git a/sys/arch/mac68k/dev/nubus.c b/sys/arch/mac68k/dev/nubus.c index 9130a53649a..b770f45dadb 100644 --- a/sys/arch/mac68k/dev/nubus.c +++ b/sys/arch/mac68k/dev/nubus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nubus.c,v 1.17 2001/06/27 04:22:37 art Exp $ */ +/* $OpenBSD: nubus.c,v 1.18 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: nubus.c,v 1.35 1997/04/22 20:20:32 scottr Exp $ */ /* @@ -831,7 +831,7 @@ nubus_mapin(paddr, sz) #else do { pmap_enter(pmap_kernel(), va, pa | pmt, - VM_PROT_READ|VM_PROT_WRITE, FALSE, 0); + VM_PROT_READ|VM_PROT_WRITE, 0); va += NBPG; pa += NBPG; } while ((sz -= NBPG) > 0); diff --git a/sys/arch/mac68k/mac68k/bus_space.c b/sys/arch/mac68k/mac68k/bus_space.c index ab502b412fc..ce4d516f92d 100644 --- a/sys/arch/mac68k/mac68k/bus_space.c +++ b/sys/arch/mac68k/mac68k/bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_space.c,v 1.9 2001/07/05 10:00:35 art Exp $ */ +/* $OpenBSD: bus_space.c,v 1.10 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: bus_space.c,v 1.5 1999/03/26 23:41:30 mycroft Exp $ */ /*- @@ -177,7 +177,7 @@ bus_mem_add_mapping(bpa, size, flags, bshp) for (; pa < endpa; pa += NBPG, va += NBPG) { pmap_enter(pmap_kernel(), va, pa, - VM_PROT_READ | VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); pte = kvtopte(va); if ((flags & BUS_SPACE_MAP_CACHEABLE)) *pte &= ~PG_CI; diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index a3bf9a048b1..f4428a3afe1 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.74 2001/07/05 10:12:10 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.75 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */ /* @@ -354,8 +354,8 @@ cpu_startup(void) for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp, high[numranges - 1] + i * NBPG, - VM_PROT_READ|VM_PROT_WRITE, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); /* @@ -492,8 +492,8 @@ again: panic("cpu_startup: not enough memory for " "buffer cache"); pmap_enter(kernel_map->pmap, curbuf, - VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE, - VM_PROT_ALL); + VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, + VM_PROT_ALL|PMAP_WIRED); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } @@ -718,7 +718,7 @@ boot(howto) /* Map the last physical page VA = PA for doboot() */ pmap_enter(pmap_kernel(), (vm_offset_t)maxaddr, (vm_offset_t)maxaddr, - VM_PROT_ALL, TRUE, VM_PROT_ALL); + VM_PROT_ALL, VM_PROT_ALL|PMAP_WIRED); printf("rebooting...\n"); @@ -910,7 +910,7 @@ dumpsys() maddr = h->ram_segs[seg].start; } pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, maddr, - VM_PROT_READ, TRUE, VM_PROT_READ); + VM_PROT_READ, VM_PROT_READ|PMAP_WIRED); error = (*dump)(dumpdev, blkno, vmmap, NBPG); bad: diff --git a/sys/arch/mac68k/mac68k/mem.c b/sys/arch/mac68k/mac68k/mem.c index d7e8d8d9d27..34d0c7b4f77 100644 --- a/sys/arch/mac68k/mac68k/mem.c +++ b/sys/arch/mac68k/mac68k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.13 2001/06/27 04:22:37 art Exp $ */ +/* $OpenBSD: mem.c,v 1.14 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: mem.c,v 1.22 1999/03/27 00:30:07 mycroft Exp $ */ /* @@ -148,7 +148,7 @@ mmrw(dev, uio, flags) prot = uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE; pmap_enter(pmap_kernel(), (vaddr_t)vmmap, - trunc_page(v), prot, TRUE, prot); + trunc_page(v), prot, prot|PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); diff --git a/sys/arch/mac68k/mac68k/pmap.c b/sys/arch/mac68k/mac68k/pmap.c index 72b9f2655d3..c0ec1f46ee7 100644 --- a/sys/arch/mac68k/mac68k/pmap.c +++ b/sys/arch/mac68k/mac68k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.26 2001/07/18 10:47:04 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.27 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: pmap.c,v 1.55 1999/04/22 04:24:53 chs Exp $ */ /* @@ -649,7 +649,7 @@ pmap_map(va, spa, epa, prot) ("pmap_map(%lx, %lx, %lx, %x)\n", va, spa, epa, prot)); while (spa < epa) { - pmap_enter(pmap_kernel(), va, spa, prot, FALSE, 0); + pmap_enter(pmap_kernel(), va, spa, prot, 0); va += NBPG; spa += NBPG; } @@ -1051,28 +1051,25 @@ extern vm_offset_t tmp_vpages[]; * or lose information. Thatis, this routine must actually * insert this page into the given map NOW. */ -void -pmap_enter(pmap, va, pa, prot, wired, access_type) +int +pmap_enter(pmap, va, pa, prot, flags) pmap_t pmap; vaddr_t va; paddr_t pa; vm_prot_t prot; - boolean_t wired; - vm_prot_t access_type; + int flags; { pt_entry_t *pte; int npte; paddr_t opa; boolean_t cacheable = TRUE; boolean_t checkpv = TRUE; + boolean_t wired = (flags & PMAP_WIRED) != 0; PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER, ("pmap_enter(%p, %lx, %lx, %x, %x)\n", pmap, va, pa, prot, wired)); - if (pmap == NULL) - return; - #ifdef DIAGNOSTIC /* * pmap_enter() should never be used for CADDR1 and CADDR2. @@ -1197,12 +1194,12 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) * on the hint provided in access_type. */ #ifdef DIAGNOSTIC - if (access_type & ~prot) + if ((flags & VM_PROT_ALL) & ~prot) panic("pmap_enter: access_type exceeds prot"); #endif - if (access_type & VM_PROT_WRITE) + if (flags & VM_PROT_WRITE) *pa_to_attribute(pa) |= (PG_U|PG_M); - else if (access_type & VM_PROT_ALL) + else if (flags & VM_PROT_ALL) *pa_to_attribute(pa) |= PG_U; splx(s); } @@ -1265,6 +1262,8 @@ validate: if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) pmap_check_wiring("enter", trunc_page((vaddr_t)pmap_pte(pmap, va))); #endif + + return (KERN_SUCCESS); } /* @@ -2190,8 +2189,8 @@ pmap_enter_ptpage(pmap, va) kpt_used_list = kpt; ptpa = kpt->kpt_pa; bzero((caddr_t)kpt->kpt_va, NBPG); - pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, TRUE, - VM_PROT_DEFAULT); + pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, + VM_PROT_DEFAULT|PMAP_WIRED); #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) { int ix = pmap_ste(pmap, va) - pmap_ste(pmap, 0); @@ -2362,7 +2361,7 @@ pmap_check_wiring(str, va) void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) { - pmap_enter(pmap_kernel(), va, pa, prot, 1, VM_PROT_READ|VM_PROT_WRITE); + pmap_enter(pmap_kernel(), va, pa, prot, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } void @@ -2372,8 +2371,8 @@ pmap_kenter_pgs(vaddr_t va, struct vm_page **pgs, int npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } } diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c index 2cdc6ad3cab..11830547747 100644 --- a/sys/arch/mac68k/mac68k/trap.c +++ b/sys/arch/mac68k/mac68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.24 2001/06/27 04:22:38 art Exp $ */ +/* $OpenBSD: trap.c,v 1.25 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: trap.c,v 1.68 1998/12/22 08:47:07 scottr Exp $ */ /* @@ -748,7 +748,7 @@ writeback(fp, docachepush) pmap_enter(pmap_kernel(), (vaddr_t)vmmap, trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE, - TRUE, VM_PROT_WRITE); + VM_PROT_WRITE|PMAP_WIRED); fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF]; bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16); pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa); diff --git a/sys/arch/mac68k/mac68k/vm_machdep.c b/sys/arch/mac68k/mac68k/vm_machdep.c index bc4ee4ddf53..ee7036db3b1 100644 --- a/sys/arch/mac68k/mac68k/vm_machdep.c +++ b/sys/arch/mac68k/mac68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.21 2001/06/27 04:22:38 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.22 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.29 1998/07/28 18:34:55 thorpej Exp $ */ /* @@ -268,8 +268,8 @@ pagemove(from, to, size) pmap_remove(pmap_kernel(), (vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE); pmap_enter(pmap_kernel(), - (vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + (vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); from += PAGE_SIZE; to += PAGE_SIZE; size -= PAGE_SIZE; @@ -383,7 +383,7 @@ vmapbuf(bp, len) do { if (pmap_extract(upmap, uva, &pa) == FALSE) panic("vmapbuf: null page frame"); - pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); uva += PAGE_SIZE; kva += PAGE_SIZE; len -= PAGE_SIZE; diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index 6ec8c805852..6ec80c9457b 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.43 2001/07/05 10:12:13 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.44 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -262,7 +262,7 @@ cpu_startup() for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp, avail_end + i * NBPG, VM_PROT_READ|VM_PROT_WRITE, - TRUE, VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); /* @@ -384,8 +384,8 @@ again: panic("cpu_startup: not enough memory for " "buffer cache"); pmap_enter(kernel_map->pmap, curbuf, - VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } diff --git a/sys/arch/mvme68k/mvme68k/mem.c b/sys/arch/mvme68k/mvme68k/mem.c index bec83087daf..4d64e7b1d04 100644 --- a/sys/arch/mvme68k/mvme68k/mem.c +++ b/sys/arch/mvme68k/mvme68k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.14 2001/06/27 04:19:17 art Exp $ */ +/* $OpenBSD: mem.c,v 1.15 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -165,8 +165,7 @@ mmrw(dev, uio, flags) pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE, - TRUE, - uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE); + (uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE) | PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); diff --git a/sys/arch/mvme68k/mvme68k/pmap.c b/sys/arch/mvme68k/mvme68k/pmap.c index dd4d94661b1..a9362c39221 100644 --- a/sys/arch/mvme68k/mvme68k/pmap.c +++ b/sys/arch/mvme68k/mvme68k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.26 2001/07/22 19:58:14 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.27 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -657,7 +657,7 @@ pmap_map(va, spa, epa, prot) #endif while (spa < epa) { - pmap_enter(pmap_kernel(), va, spa, prot, FALSE, prot); + pmap_enter(pmap_kernel(), va, spa, prot, prot); va += NBPG; spa += NBPG; } @@ -1030,28 +1030,26 @@ pmap_protect(pmap, sva, eva, prot) * insert this page into the given map NOW. */ -void -pmap_enter(pmap, va, pa, prot, wired, access_type) - register pmap_t pmap; +int +pmap_enter(pmap, va, pa, prot, flags) + pmap_t pmap; vaddr_t va; - register paddr_t pa; + paddr_t pa; vm_prot_t prot; - boolean_t wired; - vm_prot_t access_type; + int flags; { register pt_entry_t *pte; register int npte; vm_offset_t opa; boolean_t cacheable = TRUE; boolean_t checkpv = TRUE; + boolean_t wired = (flags & PMAP_WIRED) != 0; #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER)) - printf("pmap_enter(%x, %x, %x, %x, %x, %x)\n", - pmap, va, pa, prot, wired, access_type); + printf("pmap_enter(%x, %x, %x, %x, %x)\n", + pmap, va, pa, prot, flags); #endif - if (pmap == NULL) - return; /* * For user mapping, allocate kernel VM resources if necessary. @@ -1233,6 +1231,8 @@ validate: if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) pmap_check_wiring("enter", trunc_page(pmap_pte(pmap, va))); #endif + + return (KERN_SUCCESS); } /* @@ -1527,7 +1527,7 @@ pmap_zero_page(phys) printf("pmap_zero_page(%x)\n", phys); #endif kva = (vm_offset_t) CADDR1; - pmap_enter(pmap_kernel(), kva, phys, VM_PROT_READ|VM_PROT_WRITE, TRUE, VM_PROT_READ|VM_PROT_WRITE); + pmap_enter(pmap_kernel(), kva, phys, VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); zeropage((caddr_t)kva); pmap_remove_mapping(pmap_kernel(), kva, PT_ENTRY_NULL, PRM_TFLUSH|PRM_CFLUSH); @@ -1559,8 +1559,8 @@ pmap_copy_page(src, dst) #endif skva = (vm_offset_t) CADDR1; dkva = (vm_offset_t) CADDR2; - pmap_enter(pmap_kernel(), skva, src, VM_PROT_READ, TRUE, VM_PROT_READ); - pmap_enter(pmap_kernel(), dkva, dst, VM_PROT_READ|VM_PROT_WRITE, TRUE, VM_PROT_READ|VM_PROT_WRITE); + pmap_enter(pmap_kernel(), skva, src, VM_PROT_READ, VM_PROT_READ|PMAP_WIRED); + pmap_enter(pmap_kernel(), dkva, dst, VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); copypage((caddr_t)skva, (caddr_t)dkva); /* CADDR1 and CADDR2 are virtually contiguous */ pmap_remove(pmap_kernel(), skva, skva + (2 * NBPG)); @@ -2192,7 +2192,7 @@ pmap_enter_ptpage(pmap, va) kpt_used_list = kpt; ptpa = kpt->kpt_pa; bzero((caddr_t)kpt->kpt_va, NBPG); - pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, TRUE, VM_PROT_DEFAULT); + pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, VM_PROT_DEFAULT|PMAP_WIRED); #if defined(M68060) if (mmutype == MMU_68060) { pmap_changebit(ptpa, PG_CCB, 0); @@ -2415,7 +2415,7 @@ pmap_check_wiring(str, va) void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) { - pmap_enter(pmap_kernel(), va, pa, prot, 1, VM_PROT_READ|VM_PROT_WRITE); + pmap_enter(pmap_kernel(), va, pa, prot, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } void @@ -2425,8 +2425,8 @@ pmap_kenter_pgs(vaddr_t va, struct vm_page **pgs, int npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } } diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 2463a805a8e..15a3a2d2311 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.32 2001/06/27 04:19:17 art Exp $ */ +/* $OpenBSD: trap.c,v 1.33 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -725,7 +725,7 @@ writeback(fp, docachepush) paddr_t pa; pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, - trunc_page(f->f_fa), VM_PROT_WRITE, TRUE, VM_PROT_WRITE); + trunc_page(f->f_fa), VM_PROT_WRITE, VM_PROT_WRITE|PMAP_WIRED); fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF]; bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16); pmap_extract(pmap_kernel(), (vm_offset_t)fa, &pa); diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c index 980bf446a27..d5771767e13 100644 --- a/sys/arch/mvme68k/mvme68k/vm_machdep.c +++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.26 2001/06/27 04:19:17 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.27 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -194,8 +194,8 @@ pagemove(from, to, size) (vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE); pmap_enter(pmap_kernel(), (vm_offset_t)to, pa, - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); from += PAGE_SIZE; to += PAGE_SIZE; size -= PAGE_SIZE; @@ -305,7 +305,7 @@ vmapbuf(bp, siz) (vm_offset_t)addr, &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa), - VM_PROT_READ|VM_PROT_WRITE, TRUE, VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); addr += PAGE_SIZE; kva += PAGE_SIZE; } diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 028f4656e35..225d8e92f3b 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.45 2001/07/05 10:12:15 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.46 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -481,7 +481,7 @@ cpu_startup() for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_enter(kernel_pmap, (vm_offset_t)msgbufp, avail_end + i * NBPG, VM_PROT_READ|VM_PROT_WRITE, - VM_PROT_READ|VM_PROT_WRITE, TRUE); + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); /* @@ -632,8 +632,8 @@ cpu_startup() panic("cpu_startup: not enough memory for " "buffer cache"); pmap_enter(kernel_map->pmap, curbuf, - VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } diff --git a/sys/arch/mvme88k/mvme88k/mem.c b/sys/arch/mvme88k/mvme88k/mem.c index aa612bfc500..9a403ac4db9 100644 --- a/sys/arch/mvme88k/mvme88k/mem.c +++ b/sys/arch/mvme88k/mvme88k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.9 2001/06/27 04:29:20 art Exp $ */ +/* $OpenBSD: mem.c,v 1.10 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -132,7 +132,7 @@ mmrw(dev, uio, flags) } pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? - VM_PROT_READ : VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c index 874fe7dc35f..2dd81f92185 100644 --- a/sys/arch/mvme88k/mvme88k/pmap.c +++ b/sys/arch/mvme88k/mvme88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.36 2001/07/22 19:58:17 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.37 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -2548,10 +2548,10 @@ pmap_expand(pmap_t map, vm_offset_t v) * } * */ -void +int pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, - vm_prot_t prot, boolean_t wired, - vm_prot_t access_type) + vm_prot_t prot, + int flags) { int ap; int spl, spl_sav; @@ -2563,10 +2563,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, register unsigned users; register pte_template_t opte; int kflush; - - if (pmap == PMAP_NULL) { - panic("pmap_enter: pmap is NULL"); - } + boolean_t wired = (flags & PMAP_WIRED) != 0; CHECK_PAGE_ALIGN (va, "pmap_entry - VA"); CHECK_PAGE_ALIGN (pa, "pmap_entry - PA"); @@ -2767,6 +2764,7 @@ Retry: if (pv_e != PV_ENTRY_NULL) free((caddr_t) pv_e, M_VMPVENT); + return (KERN_SUCCESS); } /* pmap_enter */ /* @@ -4429,7 +4427,7 @@ pmap_range_remove(pmap_range_t *ranges, vm_offset_t start, vm_offset_t end) void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) { - pmap_enter(pmap_kernel(), va, pa, prot, 1, VM_PROT_READ|VM_PROT_WRITE); + pmap_enter(pmap_kernel(), va, pa, prot, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } void @@ -4439,8 +4437,8 @@ pmap_kenter_pgs(vaddr_t va, struct vm_page **pgs, int npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } } diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index 20dabb88576..8cefe462111 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.27 2001/07/05 10:03:48 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.28 2001/07/25 13:25:32 art Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -273,7 +273,7 @@ vmapbuf(bp, len) if (pmap_extract(pmap, (vm_offset_t)addr, &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), kva, pa, - VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); addr += PAGE_SIZE; kva += PAGE_SIZE; len -= PAGE_SIZE; @@ -347,7 +347,7 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) while (len>0) { pmap_enter(vm_map_pmap(iomap_map), tva, ppa, - VM_PROT_WRITE|VM_PROT_READ|(CACHE_INH << 16), 1, 0); + VM_PROT_WRITE|VM_PROT_READ|(CACHE_INH << 16), PMAP_WIRED); len -= PAGE_SIZE; tva += PAGE_SIZE; ppa += PAGE_SIZE; @@ -423,7 +423,7 @@ mapiospace(caddr_t pa, int len) pa = (caddr_t)trunc_page((paddr_t)pa); pmap_enter(kernel_pmap, phys_map_vaddr1, (vm_offset_t)pa, - VM_PROT_READ|VM_PROT_WRITE, 1, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); return (phys_map_vaddr1 + off); } @@ -511,8 +511,8 @@ pagemove(from, to, size) pmap_remove(kernel_pmap, (vm_offset_t)from, (vm_offset_t)from + NBPG); pmap_enter(kernel_pmap, - (vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + (vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); from += NBPG; to += NBPG; size -= NBPG; diff --git a/sys/arch/mvmeppc/mvmeppc/bus_dma.c b/sys/arch/mvmeppc/mvmeppc/bus_dma.c index ba6e325a34c..5acfe71d73a 100644 --- a/sys/arch/mvmeppc/mvmeppc/bus_dma.c +++ b/sys/arch/mvmeppc/mvmeppc/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.3 2001/07/04 08:31:33 niklas Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.4 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */ /*- @@ -517,8 +517,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) if (size == 0) panic("_bus_dmamem_map: size botch"); pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, TRUE, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); } } diff --git a/sys/arch/mvmeppc/mvmeppc/machdep.c b/sys/arch/mvmeppc/mvmeppc/machdep.c index dbb9ab1f969..8fa060525c4 100644 --- a/sys/arch/mvmeppc/mvmeppc/machdep.c +++ b/sys/arch/mvmeppc/mvmeppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.3 2001/07/06 05:14:30 smurph Exp $ */ +/* $OpenBSD: machdep.c,v 1.4 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -1215,7 +1215,7 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp) #else pmap_enter(pmap_kernel(), vaddr, spa, #endif - VM_PROT_READ | VM_PROT_WRITE, TRUE, 0/* XXX */); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED /* XXX */); spa += NBPG; vaddr += NBPG; } @@ -1253,7 +1253,7 @@ mapiodev(pa, len) #else pmap_enter(pmap_kernel(), vaddr, spa, #endif - VM_PROT_READ | VM_PROT_WRITE, TRUE, 0/* XXX */); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED/* XXX */); spa += NBPG; vaddr += NBPG; } diff --git a/sys/arch/mvmeppc/mvmeppc/pmap.c b/sys/arch/mvmeppc/mvmeppc/pmap.c index 84edaf00974..560c754f91b 100644 --- a/sys/arch/mvmeppc/mvmeppc/pmap.c +++ b/sys/arch/mvmeppc/mvmeppc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.5 2001/07/18 10:47:05 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.6 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -1161,13 +1161,12 @@ pmap_remove_pv(pm, pteidx, va, pte_lo) /* * Insert physical page at pa into the given pmap at virtual address va. */ -void -pmap_enter(pm, va, pa, prot, wired, access_type) +int +pmap_enter(pm, va, pa, prot, flags) struct pmap *pm; vm_offset_t va, pa; vm_prot_t prot; - int wired; - vm_prot_t access_type; + int flags; { sr_t sr; int idx, i, s; @@ -1224,7 +1223,7 @@ pmap_enter(pm, va, pa, prot, wired, access_type) */ if (pte_insert(idx, &pte)) { splx(s); - return; + return (KERN_SUCCESS); } /* @@ -1236,6 +1235,8 @@ pmap_enter(pm, va, pa, prot, wired, access_type) po->po_pte = pte; LIST_INSERT_HEAD(potable + idx, po, po_list); splx(s); + + return (KERN_SUCCESS); } void @@ -1244,7 +1245,7 @@ pmap_kenter_pa(va, pa, prot) paddr_t pa; vm_prot_t prot; { - pmap_enter(pmap_kernel(), va, pa, prot, 1, 0); + pmap_enter(pmap_kernel(), va, pa, prot, PMAP_WIRED); } void @@ -1257,7 +1258,7 @@ pmap_kenter_pgs(va, pgs, npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, 1, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); } } diff --git a/sys/arch/mvmeppc/mvmeppc/vm_machdep.c b/sys/arch/mvmeppc/mvmeppc/vm_machdep.c index b4139e6e379..50029fd5375 100644 --- a/sys/arch/mvmeppc/mvmeppc/vm_machdep.c +++ b/sys/arch/mvmeppc/mvmeppc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.2 2001/06/27 04:32:46 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.3 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */ /* @@ -155,8 +155,8 @@ pagemove(from, to, size) pmap_extract(pmap_kernel(), va, &pa); pmap_remove(pmap_kernel(), va, va + NBPG); pmap_enter(pmap_kernel(), (vm_offset_t)to, pa, - VM_PROT_READ | VM_PROT_WRITE, 1, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); va += NBPG; to += NBPG; } @@ -246,7 +246,7 @@ vmapbuf(bp, len) for (; len > 0; len -= NBPG) { pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map), faddr, &pa); pmap_enter(vm_map_pmap(phys_map), taddr, pa, - VM_PROT_READ | VM_PROT_WRITE, 1, 0); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); faddr += NBPG; taddr += NBPG; } diff --git a/sys/arch/powerpc/powerpc/dma.c b/sys/arch/powerpc/powerpc/dma.c index 00d491bfe3a..f9b8bfae9c7 100644 --- a/sys/arch/powerpc/powerpc/dma.c +++ b/sys/arch/powerpc/powerpc/dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dma.c,v 1.6 2001/06/27 04:37:20 art Exp $ */ +/* $OpenBSD: dma.c,v 1.7 2001/07/25 13:25:32 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -374,8 +374,8 @@ _dmamem_map(t, segs, nsegs, size, kvap, flags) if (size == 0) panic("_bus_dmamem_map: size botch"); pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, TRUE, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); } } diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c index 27b45f693a5..cc837733129 100644 --- a/sys/arch/powerpc/powerpc/machdep.c +++ b/sys/arch/powerpc/powerpc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.72 2001/07/09 02:14:05 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.73 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -1213,7 +1213,7 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp) #else pmap_enter(pmap_kernel(), vaddr, spa, #endif - VM_PROT_READ | VM_PROT_WRITE, TRUE, 0/* XXX */); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED /* XXX */); spa += NBPG; vaddr += NBPG; } @@ -1272,7 +1272,7 @@ mapiodev(pa, len) #else pmap_enter(pmap_kernel(), vaddr, spa, #endif - VM_PROT_READ | VM_PROT_WRITE, TRUE, 0/* XXX */); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED/* XXX */); spa += NBPG; vaddr += NBPG; } diff --git a/sys/arch/powerpc/powerpc/ofw_machdep.c b/sys/arch/powerpc/powerpc/ofw_machdep.c index 8cd4e945947..76e547fc54b 100644 --- a/sys/arch/powerpc/powerpc/ofw_machdep.c +++ b/sys/arch/powerpc/powerpc/ofw_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_machdep.c,v 1.22 2001/06/24 23:29:35 drahn Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.23 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -187,7 +187,7 @@ restore_ofw_mapping() continue; while (size > 0) { - pmap_enter(&ofw_pmap, va, pa, VM_PROT_ALL, 1, 0); + pmap_enter(&ofw_pmap, va, pa, VM_PROT_ALL, PMAP_WIRED); pa += NBPG; va += NBPG; size -= NBPG; diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index 44c104b4edf..6e85bec52d7 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.36 2001/07/18 10:47:05 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.37 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -1170,13 +1170,12 @@ pmap_remove_pv(pm, pteidx, va, pte_lo) /* * Insert physical page at pa into the given pmap at virtual address va. */ -void -pmap_enter(pm, va, pa, prot, wired, access_type) +int +pmap_enter(pm, va, pa, prot, flags) struct pmap *pm; vm_offset_t va, pa; vm_prot_t prot; - int wired; - vm_prot_t access_type; + int flags; { sr_t sr; int idx, s; @@ -1233,7 +1232,7 @@ pmap_enter(pm, va, pa, prot, wired, access_type) */ if (pte_insert(idx, &pte)) { splx(s); - return; + return (KERN_SUCCESS); } /* @@ -1245,6 +1244,8 @@ pmap_enter(pm, va, pa, prot, wired, access_type) po->po_pte = pte; LIST_INSERT_HEAD(potable + idx, po, po_list); splx(s); + + return (KERN_SUCCESS); } void @@ -1253,7 +1254,7 @@ pmap_kenter_pa(va, pa, prot) paddr_t pa; vm_prot_t prot; { - pmap_enter(pmap_kernel(), va, pa, prot, 1, 0); + pmap_enter(pmap_kernel(), va, pa, prot, PMAP_WIRED); } void @@ -1266,7 +1267,7 @@ pmap_kenter_pgs(va, pgs, npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, 1, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); } } diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c index 93e7a512dc3..f1980b01929 100644 --- a/sys/arch/powerpc/powerpc/vm_machdep.c +++ b/sys/arch/powerpc/powerpc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.20 2001/07/09 02:14:06 mickey Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.21 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */ /* @@ -156,8 +156,8 @@ pagemove(from, to, size) pmap_extract(pmap_kernel(), va, &pa); pmap_remove(pmap_kernel(), va, va + NBPG); pmap_enter(pmap_kernel(), (vm_offset_t)to, pa, - VM_PROT_READ | VM_PROT_WRITE, 1, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); va += NBPG; to += NBPG; } @@ -244,7 +244,7 @@ vmapbuf(bp, len) for (; len > 0; len -= NBPG) { pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map), faddr, &pa); pmap_enter(vm_map_pmap(phys_map), taddr, pa, - VM_PROT_READ | VM_PROT_WRITE, 1, 0); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); faddr += NBPG; taddr += NBPG; } diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index 7e4a9bafaaf..9160e4136f3 100644 --- a/sys/arch/sparc/dev/if_ie.c +++ b/sys/arch/sparc/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.17 2001/06/23 22:03:03 fgsch Exp $ */ +/* $OpenBSD: if_ie.c,v 1.18 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -565,7 +565,7 @@ ieattach(parent, self, aux) panic("ie pmap_extract"); pmap_enter(pmap_kernel(), trunc_page(IEOB_ADBASE+IE_SCP_ADDR), (paddr_t)pa | PMAP_NC /*| PMAP_IOC*/, - VM_PROT_READ | VM_PROT_WRITE, 1, 0); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); sc->scp = (volatile struct ie_sys_conf_ptr *) (IEOB_ADBASE + IE_SCP_ADDR); diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index 69f65fd826c..897b94ec8f4 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.20 2001/06/27 18:30:30 art Exp $ */ +/* $OpenBSD: pmap.h,v 1.21 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */ /* @@ -315,8 +315,7 @@ void pmap_writetext __P((unsigned char *, int)); boolean_t pmap_clear_modify4_4c __P((struct vm_page *)); boolean_t pmap_clear_reference4_4c __P((struct vm_page *)); void pmap_copy_page4_4c __P((paddr_t, paddr_t)); -void pmap_enter4_4c __P((pmap_t, vaddr_t, paddr_t, vm_prot_t, - boolean_t, vm_prot_t)); +int pmap_enter4_4c __P((pmap_t, vaddr_t, paddr_t, vm_prot_t, int)); boolean_t pmap_extract4_4c __P((pmap_t, vaddr_t, paddr_t *)); boolean_t pmap_is_modified4_4c __P((struct vm_page *)); boolean_t pmap_is_referenced4_4c __P((struct vm_page *)); @@ -335,8 +334,7 @@ void pmap_changeprot4_4c __P((pmap_t, vaddr_t, vm_prot_t, int)); boolean_t pmap_clear_modify4m __P((struct vm_page *)); boolean_t pmap_clear_reference4m __P((struct vm_page *)); void pmap_copy_page4m __P((paddr_t, paddr_t)); -void pmap_enter4m __P((pmap_t, vaddr_t, paddr_t, vm_prot_t, - boolean_t, vm_prot_t)); +int pmap_enter4m __P((pmap_t, vaddr_t, paddr_t, vm_prot_t, int)); boolean_t pmap_extract4m __P((pmap_t, vaddr_t, paddr_t *)); boolean_t pmap_is_modified4m __P((struct vm_page *)); boolean_t pmap_is_referenced4m __P((struct vm_page *)); @@ -388,8 +386,8 @@ void pmap_changeprot4m __P((pmap_t, vaddr_t, vm_prot_t, int)); extern boolean_t (*pmap_clear_modify_p) __P((struct vm_page *)); extern boolean_t (*pmap_clear_reference_p) __P((struct vm_page *)); extern void (*pmap_copy_page_p) __P((paddr_t, paddr_t)); -extern void (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, - vm_prot_t, boolean_t, vm_prot_t)); +extern int (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, + vm_prot_t, int)); extern boolean_t (*pmap_extract_p) __P((pmap_t, vaddr_t, paddr_t *)); extern boolean_t (*pmap_is_modified_p) __P((struct vm_page *)); extern boolean_t (*pmap_is_referenced_p) __P((struct vm_page *)); diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c index a487edb43b1..19faa75d219 100644 --- a/sys/arch/sparc/sparc/autoconf.c +++ b/sys/arch/sparc/sparc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.39 2001/05/05 22:34:18 art Exp $ */ +/* $OpenBSD: autoconf.c,v 1.40 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */ /* @@ -351,8 +351,8 @@ bootstrap() /* Map Interrupt Enable Register */ pmap_enter(pmap_kernel(), INTRREG_VA, INT_ENABLE_REG_PHYSADR | PMAP_NC | PMAP_OBIO, - VM_PROT_READ | VM_PROT_WRITE, 1, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); /* Disable all interrupts */ *((unsigned char *)INTRREG_VA) = 0; } diff --git a/sys/arch/sparc/sparc/iommu.c b/sys/arch/sparc/sparc/iommu.c index 87a3fc8908e..91978ace2ea 100644 --- a/sys/arch/sparc/sparc/iommu.c +++ b/sys/arch/sparc/sparc/iommu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iommu.c,v 1.8 2001/06/08 08:09:27 art Exp $ */ +/* $OpenBSD: iommu.c,v 1.9 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: iommu.c,v 1.13 1997/07/29 09:42:04 fair Exp $ */ /* @@ -198,8 +198,8 @@ iommu_attach(parent, self, aux) /* XXX - art, pagewire breaks the tailq */ uvm_pagewire(m); pmap_enter(pmap_kernel(), iopte_va, VM_PAGE_TO_PHYS(m), - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); iopte_va += NBPG; m = TAILQ_NEXT(m, pageq); } diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 12c3f1b07f1..e0be4ea1265 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.59 2001/06/25 00:43:16 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.60 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -180,7 +180,7 @@ cpu_startup() * fix message buffer mapping, note phys addr of msgbuf is 0 */ pmap_enter(pmap_kernel(), MSGBUF_VA, 0x0, VM_PROT_READ|VM_PROT_WRITE, - TRUE, VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); initmsgbuf((caddr_t)(MSGBUF_VA + (CPU_ISSUN4 ? 4096 : 0)), MSGBUFSIZE); proc0.p_addr = proc0paddr; @@ -245,7 +245,7 @@ cpu_startup() "not enough RAM for buffer cache"); pmap_enter(kernel_map->pmap, curbuf, VM_PAGE_TO_PHYS(pg), VM_PROT_READ | VM_PROT_WRITE, - TRUE, VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } @@ -982,7 +982,7 @@ mapdev(phys, virt, offset, size) do { pmap_enter(pmap_kernel(), v, pa | pmtype | PMAP_NC, - VM_PROT_READ | VM_PROT_WRITE, 1, 0); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); v += PAGE_SIZE; pa += PAGE_SIZE; } while ((size -= PAGE_SIZE) > 0); diff --git a/sys/arch/sparc/sparc/mem.c b/sys/arch/sparc/sparc/mem.c index 4890ef6d6a9..79b37e0ec4a 100644 --- a/sys/arch/sparc/sparc/mem.c +++ b/sys/arch/sparc/sparc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.15 2001/05/10 10:34:48 art Exp $ */ +/* $OpenBSD: mem.c,v 1.16 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: mem.c,v 1.13 1996/03/30 21:12:16 christos Exp $ */ /* @@ -146,7 +146,7 @@ mmrw(dev, uio, flags) } pmap_enter(pmap_kernel(), mem_page, trunc_page(pa), uio->uio_rw == UIO_READ ? - VM_PROT_READ : VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)mem_page + o, c, uio); diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index bed6dbba554..fc107e591d4 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.87 2001/06/27 18:30:30 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.88 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -538,8 +538,7 @@ void pv_unlink4_4c __P((struct pvlist *, struct pmap *, vaddr_t)); boolean_t (*pmap_clear_modify_p) __P((struct vm_page *)); boolean_t (*pmap_clear_reference_p) __P((struct vm_page *)); void (*pmap_copy_page_p) __P((paddr_t, paddr_t)); -void (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, vm_prot_t, - boolean_t, vm_prot_t)); +int (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, vm_prot_t, int)); boolean_t (*pmap_extract_p) __P((pmap_t, vaddr_t, paddr_t *)); boolean_t (*pmap_is_modified_p) __P((struct vm_page *)); boolean_t (*pmap_is_referenced_p) __P((struct vm_page *)); @@ -3434,7 +3433,7 @@ pmap_map(va, pa, endpa, prot) int pgsize = PAGE_SIZE; while (pa < endpa) { - pmap_enter(pmap_kernel(), va, pa, prot, 1, 0); + pmap_enter(pmap_kernel(), va, pa, prot, PMAP_WIRED); va += pgsize; pa += pgsize; } @@ -4869,27 +4868,24 @@ out: #if defined(SUN4) || defined(SUN4C) -void -pmap_enter4_4c(pm, va, pa, prot, wired, access_type) +int +pmap_enter4_4c(pm, va, pa, prot, flags) struct pmap *pm; vaddr_t va; paddr_t pa; vm_prot_t prot; - int wired; - vm_prot_t access_type; + int flags; { struct pvlist *pv; int pteproto, ctx; - - if (pm == NULL) - return; + boolean_t wired = (flags & PMAP_WIRED) != 0; if (VA_INHOLE(va)) { #ifdef DEBUG printf("pmap_enter: pm %p, va 0x%lx, pa 0x%lx: in MMU hole\n", pm, va, pa); #endif - return; + return (KERN_FAILURE); } #ifdef DEBUG @@ -4920,6 +4916,8 @@ pmap_enter4_4c(pm, va, pa, prot, wired, access_type) else pmap_enu4_4c(pm, va, prot, wired, pv, pteproto); setcontext4(ctx); + + return (KERN_SUCCESS); } /* enter new (or change existing) kernel mapping */ @@ -5222,7 +5220,7 @@ pmap_kenter_pa4_4c(va, pa, prot) paddr_t pa; vm_prot_t prot; { - pmap_enter4_4c(pmap_kernel(), va, pa, prot, TRUE, 0); + pmap_enter4_4c(pmap_kernel(), va, pa, prot, PMAP_WIRED); } void @@ -5235,7 +5233,7 @@ pmap_kenter_pgs4_4c(va, pgs, npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter4_4c(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); } } @@ -5265,20 +5263,17 @@ pmap_kremove4_4c(va, len) * XXX should have different entry points for changing! */ -void -pmap_enter4m(pm, va, pa, prot, wired, access_type) +int +pmap_enter4m(pm, va, pa, prot, flags) struct pmap *pm; vaddr_t va; paddr_t pa; vm_prot_t prot; - int wired; - vm_prot_t access_type; + int flags; { struct pvlist *pv; int pteproto, ctx; - - if (pm == NULL) - return; + boolean_t wired = (flags & PMAP_WIRED) != 0; #ifdef DEBUG if (pmapdebug & PDB_ENTER) @@ -5325,13 +5320,15 @@ pmap_enter4m(pm, va, pa, prot, wired, access_type) pmap_enu4m(pm, va, prot, wired, pv, pteproto); if (pv) { - if (access_type & VM_PROT_WRITE) + if (flags & VM_PROT_WRITE) pv->pv_flags |= PV_MOD4M; - if (access_type & VM_PROT_READ) + if (flags & VM_PROT_READ) pv->pv_flags |= PV_REF4M; } setcontext4m(ctx); + + return (KERN_SUCCESS); } /* enter new (or change existing) kernel mapping */ @@ -5856,7 +5853,7 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) (pte & PPROT_WRITE) ? (VM_PROT_WRITE | VM_PROT_READ) : VM_PROT_READ, - 0, 0); + 0); src_addr += NBPG; dst_addr += NBPG; } diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index d6af17aa434..798d99ce039 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.28 2001/07/05 10:00:38 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.29 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */ /* @@ -93,8 +93,8 @@ pagemove(from, to, size) pmap_remove(pmap_kernel(), (vaddr_t)from, (vaddr_t)from + PAGE_SIZE); pmap_enter(pmap_kernel(), - (vaddr_t)to, pa, VM_PROT_READ | VM_PROT_WRITE, 1, - VM_PROT_READ | VM_PROT_WRITE); + (vaddr_t)to, pa, VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); from += PAGE_SIZE; to += PAGE_SIZE; size -= PAGE_SIZE; @@ -236,8 +236,7 @@ dvma_mapin_space(map, va, len, canwait, space) #endif #endif pmap_enter(pmap_kernel(), tva, pa | PMAP_NC, - VM_PROT_READ | VM_PROT_WRITE, 1, - 0); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); } tva += PAGE_SIZE; @@ -343,7 +342,7 @@ vmapbuf(bp, sz) * contexts... maybe we should avoid this extra work */ pmap_enter(pmap_kernel(), kva, pa, - VM_PROT_READ | VM_PROT_WRITE, 1, 0); + VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED); uva += PAGE_SIZE; kva += PAGE_SIZE; diff --git a/sys/arch/sun3/sun3/autoconf.c b/sys/arch/sun3/sun3/autoconf.c index 0a89947c437..40a01761f26 100644 --- a/sys/arch/sun3/sun3/autoconf.c +++ b/sys/arch/sun3/sun3/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.13 2001/06/27 04:44:02 art Exp $ */ +/* $OpenBSD: autoconf.c,v 1.14 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: autoconf.c,v 1.37 1996/11/20 18:57:22 gwr Exp $ */ /*- @@ -290,7 +290,7 @@ bus_mapin(bustype, paddr, sz) pmap_map((int)va, pa | pmt, pa + sz, VM_PROT_ALL); #else do { - pmap_enter(pmap_kernel(), va, pa | pmt, VM_PROT_ALL, FALSE, 0); + pmap_enter(pmap_kernel(), va, pa | pmt, VM_PROT_ALL, 0); va += NBPG; pa += NBPG; } while ((sz -= NBPG) > 0); diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index 0d2fceefccf..68f130b2026 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.34 2001/07/05 10:12:17 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.35 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */ /* @@ -319,8 +319,8 @@ cpu_startup() panic("cpu_startup: not enough memory for " "buffer cache"); pmap_enter(kernel_map->pmap, curbuf, - VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } @@ -800,7 +800,7 @@ dumpsys() if ((todo & 0xf) == 0) printf("\r%4d", todo); pmap_enter(pmap_kernel(), vmmap, paddr | PMAP_NC, - VM_PROT_READ, FALSE, VM_PROT_READ); + VM_PROT_READ, VM_PROT_READ); error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); pmap_remove(pmap_kernel(), vmmap, vmmap + NBPG); if (error) diff --git a/sys/arch/sun3/sun3/mem.c b/sys/arch/sun3/sun3/mem.c index 38dd94e5bd8..d52f1c8e97a 100644 --- a/sys/arch/sun3/sun3/mem.c +++ b/sys/arch/sun3/sun3/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.12 2001/06/27 04:44:03 art Exp $ */ +/* $OpenBSD: mem.c,v 1.13 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: mem.c,v 1.19 1995/08/08 21:09:01 gwr Exp $ */ /* @@ -172,7 +172,7 @@ mmrw(dev, uio, flags) /* Temporarily map the memory at vmmap. */ pmap_enter(pmap_kernel(), vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? - VM_PROT_READ : VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index f838fdcec4d..dadbe19b166 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.27 2001/07/18 10:47:05 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.28 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: pmap.c,v 1.64 1996/11/20 18:57:35 gwr Exp $ */ /*- @@ -1623,7 +1623,7 @@ pmap_map(virt, start, end, prot) int prot; { while (start < end) { - pmap_enter(kernel_pmap, virt, start, prot, FALSE, 0); + pmap_enter(kernel_pmap, virt, start, prot, 0); virt += NBPG; start += NBPG; } @@ -2461,20 +2461,18 @@ pmap_enter_user(pmap, va, pa, prot, wired, new_pte) * insert this page into the given map NOW. */ -void -pmap_enter(pmap, va, pa, prot, wired, access_type) +int +pmap_enter(pmap, va, pa, prot, flags) pmap_t pmap; vm_offset_t va; vm_offset_t pa; vm_prot_t prot; - boolean_t wired; - vm_prot_t access_type; + int flags; { int pte_proto; int s; + boolean_t wired = (flags & PMAP_WIRED) != 0; - if (pmap == NULL) - return; #ifdef PMAP_DEBUG if ((pmap_debug & PMD_ENTER) || (va == pmap_db_watchva)) @@ -2510,6 +2508,8 @@ pmap_enter(pmap, va, pa, prot, wired, access_type) pmap_enter_user(pmap, va, pa, prot, wired, pte_proto); } PMAP_UNLOCK(); + + return (KERN_SUCCESS); } /* @@ -3365,7 +3365,7 @@ pmap_deactivate(p) void pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) { - pmap_enter(pmap_kernel(), va, pa, prot, 1, VM_PROT_READ|VM_PROT_WRITE); + pmap_enter(pmap_kernel(), va, pa, prot, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } void @@ -3375,8 +3375,8 @@ pmap_kenter_pgs(vaddr_t va, struct vm_page **pgs, int npgs) for (i = 0; i < npgs; i++, va += PAGE_SIZE) { pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), - VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); } } diff --git a/sys/arch/sun3/sun3/vm_machdep.c b/sys/arch/sun3/sun3/vm_machdep.c index ba4b7ce1f55..8b06c5a7e92 100644 --- a/sys/arch/sun3/sun3/vm_machdep.c +++ b/sys/arch/sun3/sun3/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.17 2001/06/27 04:44:04 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.18 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.35 1996/04/26 18:38:06 gwr Exp $ */ /* @@ -306,8 +306,8 @@ pagemove(from, to, size) pmap_remove(pmap_kernel(), (vm_offset_t)from, (vm_offset_t)from + NBPG); pmap_enter(pmap_kernel(), - (vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, 1, - VM_PROT_READ|VM_PROT_WRITE); + (vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); from += NBPG; to += NBPG; size -= NBPG; @@ -376,7 +376,7 @@ vmapbuf(bp, sz) #endif pmap_enter(pmap_kernel(), kva, pa | PMAP_NC, - VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); + VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED); addr += NBPG; kva += NBPG; } diff --git a/sys/arch/vax/vax/bus_dma.c b/sys/arch/vax/vax/bus_dma.c index 7434034b8b4..9b42340e7f1 100644 --- a/sys/arch/vax/vax/bus_dma.c +++ b/sys/arch/vax/vax/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.2 2001/06/08 08:09:31 art Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.3 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej Exp $ */ /*- @@ -475,8 +475,8 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) if (vax_boardtype == VAX_BTYP_43) addr |= KA43_DIAGMEM; pmap_enter(pmap_kernel(), va, addr, - VM_PROT_READ | VM_PROT_WRITE, TRUE, - VM_PROT_READ | VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED); } } return (0); diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 7a2da3aba70..8cab319a0a7 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.35 2001/07/05 10:12:20 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.36 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* @@ -246,8 +246,8 @@ cpu_startup() panic("cpu_startup: " "not enough RAM for buffer cache"); pmap_enter(kernel_map->pmap, curbuf, - VM_PAGE_TO_PHYS(pg), VM_PROT_READ|VM_PROT_WRITE, TRUE, - VM_PROT_READ|VM_PROT_WRITE); + VM_PAGE_TO_PHYS(pg), VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index 780a43d7d11..6cc82f4833d 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.18 2001/07/05 10:00:40 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.19 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */ /* * Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden. @@ -654,26 +654,23 @@ if(startpmapdebug) * pmap_enter() is the main routine that puts in mappings for pages, or * upgrades mappings to more "rights". Note that: */ -void -pmap_enter(pmap, v, p, prot, wired, access_type) +int +pmap_enter(pmap, v, p, prot, flags) pmap_t pmap; vaddr_t v; paddr_t p; vm_prot_t prot; - boolean_t wired; - vm_prot_t access_type; + int flags; { struct pv_entry *pv, *tmp; int i, s, newpte, oldpte, *patch, index = 0; /* XXX gcc */ + boolean_t wired = (flags & PMAP_WIRED) != 0; #ifdef PMAPDEBUG if (startpmapdebug) - printf("pmap_enter: pmap %p v %lx p %lx prot %x wired %d access %x\n", - pmap, v, p, prot, wired, access_type & VM_PROT_ALL); + printf("pmap_enter: pmap %p v %lx p %lx prot %x wired %d flags %x\n", + pmap, v, p, prot, wired, flags); #endif - /* Can this happen with UVM??? */ - if (pmap == 0) - return; RECURSESTART; /* Find addess of correct pte */ @@ -728,11 +725,12 @@ if (startpmapdebug) pg = uvm_pagealloc(NULL, 0, NULL, 0); if (pg != NULL) break; + if (flags & PMAP_CANFAIL) { + RECURSEEND; + return (KERN_RESOURCE_SHORTAGE); + } - if (pmap == pmap_kernel()) - panic("pmap_enter: no free pages"); - else - uvm_wait("pmap_enter"); + panic("pmap_enter: no free pages"); } phys = VM_PAGE_TO_PHYS(pg); @@ -754,7 +752,7 @@ if (startpmapdebug) if (newpte == (oldpte | PG_W)) { patch[i] |= PG_W; /* Just wiring change */ RECURSEEND; - return; + return (KERN_SUCCESS); } /* Changing mapping? */ @@ -789,11 +787,11 @@ if (startpmapdebug) } pmap->pm_stats.resident_count++; - if (access_type & VM_PROT_READ) { + if (flags & VM_PROT_READ) { pv->pv_attr |= PG_V; newpte |= PG_V; } - if (access_type & VM_PROT_WRITE) + if (flags & VM_PROT_WRITE) pv->pv_attr |= PG_M; patch[i] = newpte; @@ -814,7 +812,7 @@ if (startpmapdebug) more_pventries(); mtpr(0, PR_TBIA); /* Always; safety belt */ - return; + return (KERN_SUCCESS); } void * diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index 7b2e7000d19..54e91bce731 100644 --- a/sys/arch/vax/vax/vm_machdep.c +++ b/sys/arch/vax/vax/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.21 2001/06/08 08:09:33 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.22 2001/07/25 13:25:33 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */ /* @@ -352,7 +352,7 @@ vmapbuf(bp, len) &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), taddr, trunc_page(pa), - VM_PROT_READ|VM_PROT_WRITE, TRUE, VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED); faddr += PAGE_SIZE; taddr += PAGE_SIZE; } |