summaryrefslogtreecommitdiff
path: root/sys/arch/vax
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-07-25 13:25:34 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-07-25 13:25:34 +0000
commit9b5d0ac364b4502c9f4962efc3b9cf762eeb8a23 (patch)
treec5b76dbc032ac625cb87376504029b7b8c6c8f71 /sys/arch/vax
parent2aa44ff1a290aa08d7d6659ac7350bb6d3efb06c (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/vax')
-rw-r--r--sys/arch/vax/vax/bus_dma.c6
-rw-r--r--sys/arch/vax/vax/machdep.c6
-rw-r--r--sys/arch/vax/vax/pmap.c34
-rw-r--r--sys/arch/vax/vax/vm_machdep.c4
4 files changed, 24 insertions, 26 deletions
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;
}