diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-07-25 13:25:34 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-07-25 13:25:34 +0000 |
commit | 9b5d0ac364b4502c9f4962efc3b9cf762eeb8a23 (patch) | |
tree | c5b76dbc032ac625cb87376504029b7b8c6c8f71 /sys/arch/hp300 | |
parent | 2aa44ff1a290aa08d7d6659ac7350bb6d3efb06c (diff) |
Change the pmap_enter interface to merge access_type and the wired boolean
and arbitrary flags into one argument.
One new flag is PMAP_CANFAIL that tells pmap_enter that it can fail if there
are not enough resources to satisfy the request. If this flag is not passed,
pmap_enter should panic as it should have done before this change (XXX - many
pmaps are still not doing that).
Only i386 and alpha implement CANFAIL for now.
Includes uvm updates from NetBSD.
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r-- | sys/arch/hp300/hp300/leds.c | 4 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/machdep.c | 8 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/pmap.c | 33 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/trap.c | 4 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/vm_machdep.c | 4 |
6 files changed, 28 insertions, 29 deletions
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; |