diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hp300/dev/grf.c | 7 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/grf.c | 7 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 6 | ||||
-rw-r--r-- | sys/kern/sysv_shm.c | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_extern.h | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_io.c | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_km.c | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_map.c | 7 | ||||
-rw-r--r-- | sys/uvm/uvm_map.h | 6 | ||||
-rw-r--r-- | sys/uvm/uvm_map_i.h | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_mmap.c | 10 | ||||
-rw-r--r-- | sys/uvm/uvm_pager.c | 4 | ||||
-rw-r--r-- | sys/uvm/uvm_unix.c | 35 | ||||
-rw-r--r-- | sys/uvm/uvm_user.c | 11 |
14 files changed, 54 insertions, 67 deletions
diff --git a/sys/arch/hp300/dev/grf.c b/sys/arch/hp300/dev/grf.c index 4f3b20b93ec..fcd648f8ea2 100644 --- a/sys/arch/hp300/dev/grf.c +++ b/sys/arch/hp300/dev/grf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf.c,v 1.19 2002/03/14 01:26:30 millert Exp $ */ +/* $OpenBSD: grf.c,v 1.20 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: grf.c,v 1.30 1998/08/20 08:33:41 kleink Exp $ */ /* @@ -654,7 +654,6 @@ grfunmap(dev, addr, p) struct grf_softc *sc = grf_cd.cd_devs[GRFUNIT(dev)]; struct grf_data *gp = sc->sc_data; vsize_t size; - int rv; #ifdef DEBUG if (grfdebug & GDB_MMAP) @@ -664,9 +663,9 @@ grfunmap(dev, addr, p) return(EINVAL); /* XXX: how do we deal with this? */ (void) (*gp->g_sw->gd_mode)(gp, GM_UNMAP, 0); size = round_page(gp->g_display.gd_regsize + gp->g_display.gd_fbsize); - rv = uvm_unmap(&p->p_vmspace->vm_map, (vaddr_t)addr, + uvm_unmap(&p->p_vmspace->vm_map, (vaddr_t)addr, (vaddr_t)addr + size); - return(rv == KERN_SUCCESS ? 0 : EINVAL); + return (0); } #ifdef COMPAT_HPUX diff --git a/sys/arch/mac68k/dev/grf.c b/sys/arch/mac68k/dev/grf.c index 7adae8ca1b3..bd4082449ec 100644 --- a/sys/arch/mac68k/dev/grf.c +++ b/sys/arch/mac68k/dev/grf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf.c,v 1.21 2002/03/14 01:26:35 millert Exp $ */ +/* $OpenBSD: grf.c,v 1.22 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: grf.c,v 1.41 1997/02/24 06:20:04 scottr Exp $ */ /* @@ -391,7 +391,6 @@ grfunmap(dev, addr, p) { struct grf_softc *gp; vm_size_t size; - int rv; gp = grf_cd.cd_devs[GRFUNIT(dev)]; @@ -405,8 +404,8 @@ grfunmap(dev, addr, p) size = round_page(gp->sc_grfmode->fbsize); - rv = uvm_unmap(&p->p_vmspace->vm_map, (vm_offset_t)addr, + uvm_unmap(&p->p_vmspace->vm_map, (vm_offset_t)addr, (vm_offset_t)addr + size); - return (rv == 0 ? 0 : EINVAL); + return (0); } diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index b272919b5da..17cd424fea0 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.51 2002/10/12 01:09:43 krw Exp $ */ +/* $OpenBSD: machdep.c,v 1.52 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -1634,9 +1634,9 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) /* Return excess virtual addresses */ if (va != sva) - (void)uvm_unmap(kernel_map, sva, va); + uvm_unmap(kernel_map, sva, va); if (va + size != sva + oversize) - (void)uvm_unmap(kernel_map, va + size, sva + oversize); + uvm_unmap(kernel_map, va + size, sva + oversize); *kvap = (caddr_t)va; diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 2f59bc99f31..7a0aa69fcf6 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.27 2002/07/16 23:06:05 art Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.28 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -144,15 +144,13 @@ shm_delete_mapping(vm, shmmap_s) struct shmmap_state *shmmap_s; { struct shmid_ds *shmseg; - int segnum, result; + int segnum; size_t size; segnum = IPCID_TO_IX(shmmap_s->shmid); shmseg = &shmsegs[segnum]; size = round_page(shmseg->shm_segsz); - result = uvm_deallocate(&vm->vm_map, shmmap_s->va, size); - if (result != KERN_SUCCESS) - return EINVAL; + uvm_deallocate(&vm->vm_map, shmmap_s->va, size); shmmap_s->shmid = -1; shmseg->shm_dtime = time.tv_sec; if ((--shmseg->shm_nattch <= 0) && diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index b26d57e2f51..0df95bbe76f 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.45 2002/03/14 03:16:13 millert Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.46 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -589,7 +589,7 @@ int uvm_coredump(struct proc *, struct vnode *, int uvm_grow(struct proc *, vaddr_t); /* uvm_user.c */ -int uvm_deallocate(vm_map_t, vaddr_t, vsize_t); +void uvm_deallocate(vm_map_t, vaddr_t, vsize_t); /* uvm_vnode.c */ void uvm_vnp_setsize(struct vnode *, voff_t); diff --git a/sys/uvm/uvm_io.c b/sys/uvm/uvm_io.c index ecb007827dc..4bbabf480a7 100644 --- a/sys/uvm/uvm_io.c +++ b/sys/uvm/uvm_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_io.c,v 1.13 2001/12/19 08:58:07 art Exp $ */ +/* $OpenBSD: uvm_io.c,v 1.14 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_io.c,v 1.12 2000/06/27 17:29:23 mrg Exp $ */ /* @@ -138,7 +138,7 @@ uvm_io(map, uio) */ vm_map_lock(kernel_map); - (void)uvm_unmap_remove(kernel_map, kva, kva+chunksz, + uvm_unmap_remove(kernel_map, kva, kva+chunksz, &dead_entries); vm_map_unlock(kernel_map); diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index aa7bf26bc15..9442515f0b2 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.33 2002/09/12 12:50:47 art Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.34 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -612,7 +612,7 @@ uvm_km_free_wakeup(map, addr, size) vm_map_entry_t dead_entries; vm_map_lock(map); - (void)uvm_unmap_remove(map, trunc_page(addr), round_page(addr+size), + uvm_unmap_remove(map, trunc_page(addr), round_page(addr+size), &dead_entries); wakeup(map); vm_map_unlock(map); diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index eff1798f895..9a5dd610ed0 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.54 2002/10/29 01:26:58 art Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.55 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -1314,7 +1314,7 @@ uvm_map_findspace(map, hint, length, result, uobj, uoffset, align, flags) * in "entry_list" */ -int +void uvm_unmap_remove(map, start, end, entry_list) vm_map_t map; vaddr_t start,end; @@ -1486,7 +1486,6 @@ uvm_unmap_remove(map, start, end, entry_list) *entry_list = first_entry; UVMHIST_LOG(maphist,"<- done!", 0, 0, 0, 0); - return(KERN_SUCCESS); } /* @@ -3271,7 +3270,7 @@ uvmspace_free(vm) #endif vm_map_lock(&vm->vm_map); if (vm->vm_map.nentries) { - (void)uvm_unmap_remove(&vm->vm_map, + uvm_unmap_remove(&vm->vm_map, vm->vm_map.min_offset, vm->vm_map.max_offset, &dead_entries); if (dead_entries != NULL) diff --git a/sys/uvm/uvm_map.h b/sys/uvm/uvm_map.h index f99f25e307c..8dbc4fda58b 100644 --- a/sys/uvm/uvm_map.h +++ b/sys/uvm/uvm_map.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.h,v 1.27 2002/06/11 06:38:01 art Exp $ */ +/* $OpenBSD: uvm_map.h,v 1.28 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_map.h,v 1.24 2001/02/18 21:19:08 chs Exp $ */ /* @@ -348,9 +348,9 @@ int uvm_map_reserve(vm_map_t, vsize_t, vaddr_t, vsize_t, void uvm_map_setup(vm_map_t, vaddr_t, vaddr_t, int); int uvm_map_submap(vm_map_t, vaddr_t, vaddr_t, vm_map_t); MAP_INLINE -int uvm_unmap(vm_map_t, vaddr_t, vaddr_t); +void uvm_unmap(vm_map_t, vaddr_t, vaddr_t); void uvm_unmap_detach(vm_map_entry_t,int); -int uvm_unmap_remove(vm_map_t, vaddr_t, vaddr_t, +void uvm_unmap_remove(vm_map_t, vaddr_t, vaddr_t, vm_map_entry_t *); #endif /* _KERNEL */ diff --git a/sys/uvm/uvm_map_i.h b/sys/uvm/uvm_map_i.h index 7ed2826dcd6..c5d3a238c5b 100644 --- a/sys/uvm/uvm_map_i.h +++ b/sys/uvm/uvm_map_i.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map_i.h,v 1.15 2002/02/28 18:50:26 provos Exp $ */ +/* $OpenBSD: uvm_map_i.h,v 1.16 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_map_i.h,v 1.18 2000/11/27 08:40:04 chs Exp $ */ /* @@ -160,12 +160,11 @@ uvm_map_setup(map, min, max, flags) * => map must be unlocked (we will lock it) */ -MAP_INLINE int +MAP_INLINE void uvm_unmap(map, start, end) vm_map_t map; vaddr_t start,end; { - int result; vm_map_entry_t dead_entries; UVMHIST_FUNC("uvm_unmap"); UVMHIST_CALLED(maphist); @@ -176,14 +175,13 @@ uvm_unmap(map, start, end) * detach from the dead entries... */ vm_map_lock(map); - result = uvm_unmap_remove(map, start, end, &dead_entries); + uvm_unmap_remove(map, start, end, &dead_entries); vm_map_unlock(map); if (dead_entries != NULL) uvm_unmap_detach(dead_entries, 0); UVMHIST_LOG(maphist, "<- done", 0,0,0,0); - return(result); } diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index b97c486ee0d..b8f865d81ae 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.35 2002/08/23 00:53:51 pvalchev Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.36 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -685,7 +685,7 @@ sys_munmap(p, v, retval) /* * doit! */ - (void) uvm_unmap_remove(map, addr, addr + size, &dead_entries); + uvm_unmap_remove(map, addr, addr + size, &dead_entries); vm_map_unlock(map); /* and unlock */ @@ -1098,7 +1098,7 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit) if (*addr & PAGE_MASK) return(EINVAL); uvmflag |= UVM_FLAG_FIXED; - (void) uvm_unmap(map, *addr, *addr + size); /* zap! */ + uvm_unmap(map, *addr, *addr + size); /* zap! */ } /* @@ -1221,7 +1221,7 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit) retval = KERN_RESOURCE_SHORTAGE; vm_map_unlock(map); /* unmap the region! */ - (void) uvm_unmap(map, *addr, *addr + size); + uvm_unmap(map, *addr, *addr + size); goto bad; } /* @@ -1232,7 +1232,7 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit) FALSE, UVM_LK_ENTER); if (retval != KERN_SUCCESS) { /* unmap the region! */ - (void) uvm_unmap(map, *addr, *addr + size); + uvm_unmap(map, *addr, *addr + size); goto bad; } return (0); diff --git a/sys/uvm/uvm_pager.c b/sys/uvm/uvm_pager.c index 3511cd2ecae..cacc3de236a 100644 --- a/sys/uvm/uvm_pager.c +++ b/sys/uvm/uvm_pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pager.c,v 1.32 2002/05/24 13:10:53 art Exp $ */ +/* $OpenBSD: uvm_pager.c,v 1.33 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_pager.c,v 1.36 2000/11/27 18:26:41 chs Exp $ */ /* @@ -226,7 +226,7 @@ uvm_pagermapout(kva, npages) } vm_map_lock(pager_map); - (void) uvm_unmap_remove(pager_map, kva, kva + size, &entries); + uvm_unmap_remove(pager_map, kva, kva + size, &entries); simple_lock(&pager_map_wanted_lock); if (pager_map_wanted) { pager_map_wanted = FALSE; diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index 6bed872378d..fa1a212f406 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_unix.c,v 1.21 2002/08/23 11:26:57 art Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.22 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */ /* @@ -77,8 +77,7 @@ sys_obreak(p, v, retval) } */ *uap = v; struct vmspace *vm = p->p_vmspace; vaddr_t new, old; - ssize_t diff; - int rv; + int error; old = (vaddr_t)vm->vm_daddr; new = round_page((vaddr_t)SCARG(uap, nsize)); @@ -86,35 +85,31 @@ sys_obreak(p, v, retval) return (ENOMEM); old = round_page(old + ptoa(vm->vm_dsize)); - diff = new - old; - if (diff == 0) + if (new == old) return (0); /* * grow or shrink? */ - if (diff > 0) { - rv = uvm_map(&vm->vm_map, &old, diff, NULL, UVM_UNKNOWN_OFFSET, - 0, UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RWX, UVM_INH_COPY, + if (new > old) { + error = uvm_map(&vm->vm_map, &old, new - old, NULL, + UVM_UNKNOWN_OFFSET, 0, + UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RWX, UVM_INH_COPY, UVM_ADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); - if (rv == KERN_SUCCESS) { - vm->vm_dsize += atop(diff); - return (0); + if (error) { + uprintf("sbrk: grow %ld failed, error = %d\n", + new - old, error); + return (ENOMEM); } + vm->vm_dsize += atop(new - old); } else { - rv = uvm_deallocate(&vm->vm_map, new, -diff); - if (rv == KERN_SUCCESS) { - vm->vm_dsize -= atop(-diff); - return (0); - } + uvm_deallocate(&vm->vm_map, new, old - new); + vm->vm_dsize -= atop(old - new); } - uprintf("sbrk: %s %ld failed, return = %d\n", - diff > 0 ? "grow" : "shrink", - (long)(diff > 0 ? diff : -diff), rv); - return (ENOMEM); + return (0); } /* diff --git a/sys/uvm/uvm_user.c b/sys/uvm/uvm_user.c index 01677547711..f08d8674603 100644 --- a/sys/uvm/uvm_user.c +++ b/sys/uvm/uvm_user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_user.c,v 1.9 2001/12/19 08:58:07 art Exp $ */ +/* $OpenBSD: uvm_user.c,v 1.10 2002/10/29 18:30:21 art Exp $ */ /* $NetBSD: uvm_user.c,v 1.8 2000/06/27 17:29:37 mrg Exp $ */ /* @@ -50,7 +50,7 @@ * uvm_deallocate: deallocate memory (unmap) */ -int +void uvm_deallocate(map, start, size) vm_map_t map; vaddr_t start; @@ -60,9 +60,8 @@ uvm_deallocate(map, start, size) if (map == NULL) panic("uvm_deallocate with null map"); - if (size == (vaddr_t) 0) - return (KERN_SUCCESS); - - return(uvm_unmap(map, trunc_page(start), round_page(start+size))); + if (size == 0) + return; + uvm_unmap(map, trunc_page(start), round_page(start+size)); } |