diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1999-11-16 12:21:42 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1999-11-16 12:21:42 +0000 |
commit | 81e5af58866df529cad202ccf14d712d08d97b03 (patch) | |
tree | c77bc7a51e3e75e7e6e8bb34f04aa28eac238c8c /sys/arch | |
parent | 57fe75e3cd2dcce4a979978a624352142d0734da (diff) |
Don't allocate vmmap in pmap_bootstrap, allocate it in mmrw when needed.
At the same time, give it a 'better' name.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc/sparc/mem.c | 25 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/pmap.c | 13 |
2 files changed, 22 insertions, 16 deletions
diff --git a/sys/arch/sparc/sparc/mem.c b/sys/arch/sparc/sparc/mem.c index 0da42036100..80497e5c259 100644 --- a/sys/arch/sparc/sparc/mem.c +++ b/sys/arch/sparc/sparc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.9 1999/11/16 10:04:48 art Exp $ */ +/* $OpenBSD: mem.c,v 1.10 1999/11/16 12:21:41 art Exp $ */ /* $NetBSD: mem.c,v 1.13 1996/03/30 21:12:16 christos Exp $ */ /* @@ -58,10 +58,12 @@ #include <machine/conf.h> #include <vm/vm.h> +#include <vm/vm_kern.h> extern vaddr_t prom_vstart; extern vaddr_t prom_vend; caddr_t zeropage; +vaddr_t mem_page; /*ARGSUSED*/ int @@ -108,10 +110,9 @@ mmrw(dev, uio, flags) struct iovec *iov; int error = 0; static int physlock; - extern caddr_t vmmap; if (minor(dev) == 0) { - /* lock against other uses of shared vmmap */ + /* lock against other uses of shared mem_page */ while (physlock > 0) { physlock++; error = tsleep((caddr_t)&physlock, PZERO | PCATCH, @@ -120,6 +121,15 @@ mmrw(dev, uio, flags) return (error); } physlock = 1; +#if defined(UVM) + if (mem_page == 0) + mem_page = uvm_km_valloc_wait(kernel_map, NBPG); +#else + if (mem_page == 0) + mem_page = kmem_alloc_pageable(kernel_map, NBPG); +#endif + if (mem_page == 0) + panic("mmrw: out of space in kernel_map"); } while (uio->uio_resid > 0 && error == 0) { iov = uio->uio_iov; @@ -134,19 +144,18 @@ mmrw(dev, uio, flags) /* minor device 0 is physical memory */ case 0: - pa = uio->uio_offset; + pa = (paddr_t)uio->uio_offset; if (!pmap_pa_exists(pa)) { error = EFAULT; goto unlock; } - pmap_enter(pmap_kernel(), (vaddr_t)vmmap, + pmap_enter(pmap_kernel(), mem_page, trunc_page(pa), uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE, TRUE, 0); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); - error = uiomove((caddr_t)vmmap + o, c, uio); - pmap_remove(pmap_kernel(), (vaddr_t)vmmap, - (vaddr_t)vmmap + NBPG); + error = uiomove((caddr_t)mem_page + o, c, uio); + pmap_remove(pmap_kernel(), mem_page, mem_page + NBPG); continue; /* minor device 1 is kernel memory */ diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 1a9716df51c..f24652e811b 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.43 1999/11/16 10:49:56 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.44 1999/11/16 12:21:41 art Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -354,7 +354,6 @@ char *ctxbusyvector; /* [4m] tells what contexts are busy (XXX)*/ #endif caddr_t vpage[2]; /* two reserved MD virtual pages */ -caddr_t vmmap; /* one reserved MI vpage for /dev/mem */ caddr_t vdumppages; /* 32KB worth of reserved dump pages */ smeg_t tregion; /* [4/3mmu] Region for temporary mappings */ @@ -2784,8 +2783,8 @@ pmap_bootstrap4_4c(nctx, nregion, nsegment) * the next whole page) and continuing through the number * of available pages are free, but they start at a higher * virtual address. This gives us two mappable MD pages - * for pmap_zero_page and pmap_copy_page, and one MI page - * for /dev/mem, all with no associated physical memory. + * for pmap_zero_page and pmap_copy_page, and some pages + * for dumpsys(), all with no associated physical memory. */ p = (caddr_t)(((u_int)p + NBPG - 1) & ~PGOFSET); avail_start = (paddr_t)p - KERNBASE; @@ -2793,7 +2792,6 @@ pmap_bootstrap4_4c(nctx, nregion, nsegment) i = (int)p; vpage[0] = p, p += NBPG; vpage[1] = p, p += NBPG; - vmmap = p, p += NBPG; p = reserve_dumppages(p); virtual_avail = (vaddr_t)p; @@ -3182,13 +3180,12 @@ pmap_bootstrap4m(void) /* * Reserve virtual address space for two mappable MD pages - * for pmap_zero_page and pmap_copy_page, one MI page - * for /dev/mem, and some more for dumpsys(). + * for pmap_zero_page and pmap_copy_page, and some more for + * dumpsys(). */ q = p; vpage[0] = p, p += NBPG; vpage[1] = p, p += NBPG; - vmmap = p, p += NBPG; p = reserve_dumppages(p); virtual_avail = (vaddr_t)p; |