summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2019-11-05 08:18:48 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2019-11-05 08:18:48 +0000
commit09ab9fb0c20037ad595a778350ad4c99d69ed997 (patch)
treee34bf5b05981acda83cbf586698822a413842ef1
parentd6ff0c8f91abff11817847004c4f0983578c3ea4 (diff)
Kill uvm_deallocate(9) and use uvm_unmap() directly.
ok kettenis@, semarie@, deraadt@
-rw-r--r--share/man/man9/uvm.916
-rw-r--r--sys/conf/files3
-rw-r--r--sys/kern/kern_exec.c5
-rw-r--r--sys/kern/sysv_shm.c8
-rw-r--r--sys/uvm/uvm_extern.h3
-rw-r--r--sys/uvm/uvm_unix.c4
-rw-r--r--sys/uvm/uvm_user.c55
7 files changed, 12 insertions, 82 deletions
diff --git a/share/man/man9/uvm.9 b/share/man/man9/uvm.9
index 7a2dd78c20d..0b809f9d3bc 100644
--- a/share/man/man9/uvm.9
+++ b/share/man/man9/uvm.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: uvm.9,v 1.70 2019/06/21 09:39:48 visa Exp $
+.\" $OpenBSD: uvm.9,v 1.71 2019/11/05 08:18:47 mpi Exp $
.\" $NetBSD: uvm.9,v 1.14 2000/06/29 06:08:44 mrg Exp $
.\"
.\" Copyright (c) 1998 Matthew R. Green
@@ -30,7 +30,7 @@
.\" XXX this manual sets nS to 1 or 0 in the description, to obtain
.\" synopsis-like function prototypes. any better way?
.\"
-.Dd $Mdocdate: June 21 2019 $
+.Dd $Mdocdate: November 5 2019 $
.Dt UVM_INIT 9
.Os
.Sh NAME
@@ -43,7 +43,6 @@
.Nm uvm_map_pageable_all ,
.Nm uvm_map_checkprot ,
.Nm uvm_map_protect ,
-.Nm uvm_deallocate ,
.Nm uvmspace_alloc ,
.Nm uvmspace_exec ,
.Nm uvmspace_fork ,
@@ -182,8 +181,6 @@ function initialises the swap subsystem.
.Fn uvm_map_checkprot "vm_map_t map" "vaddr_t start" "vaddr_t end" "vm_prot_t protection"
.Ft int
.Fn uvm_map_protect "vm_map_t map" "vaddr_t start" "vaddr_t end" "vm_prot_t new_prot" "boolean_t set_max"
-.Ft void
-.Fn uvm_deallocate "vm_map_t map" "vaddr_t start" "vsize_t size"
.Ft struct vmspace *
.Fn uvmspace_alloc "vaddr_t min" "vaddr_t max" "boolean_t pageable" "boolean_t remove_holes"
.Ft void
@@ -393,15 +390,6 @@ is non-zero.
This function returns a standard errno.
.Pp
The
-.Fn uvm_deallocate
-function deallocates kernel memory in map
-.Fa map
-from address
-.Fa start
-to
-.Fa start + size .
-.Pp
-The
.Fn uvmspace_alloc
function allocates and returns a new address space, with ranges from
.Fa min
diff --git a/sys/conf/files b/sys/conf/files
index b370fd08177..d6ada6f53a9 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.676 2019/11/04 23:52:27 dlg Exp $
+# $OpenBSD: files,v 1.677 2019/11/05 08:18:47 mpi Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -968,7 +968,6 @@ file uvm/uvm_stat.c
file uvm/uvm_swap.c
file uvm/uvm_swap_encrypt.c uvm_swap_encrypt
file uvm/uvm_unix.c
-file uvm/uvm_user.c
file uvm/uvm_vnode.c
# IPv6
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 9233cbcf5cf..b71c8a9843c 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.208 2019/08/02 02:17:35 cheloha Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.209 2019/11/05 08:18:47 mpi Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -749,8 +749,7 @@ exec_abort:
* get rid of the (new) address space we have created, if any, get rid
* of our namei data and vnode, and exit noting failure
*/
- uvm_deallocate(&vm->vm_map, VM_MIN_ADDRESS,
- VM_MAXUSER_ADDRESS - VM_MIN_ADDRESS);
+ uvm_unmap(&vm->vm_map, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS);
if (pack.ep_interp != NULL)
pool_put(&namei_pool, pack.ep_interp);
if (pack.ep_emul_arg != NULL)
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 6e9f7e2184d..d3ebc0b08f8 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.74 2019/11/04 00:48:22 guenther Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.75 2019/11/05 08:18:47 mpi Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -160,14 +160,14 @@ shm_delete_mapping(struct vmspace *vm, struct shmmap_state *shmmap_s)
{
struct shmid_ds *shmseg;
int segnum;
- size_t size;
+ vaddr_t end;
segnum = IPCID_TO_IX(shmmap_s->shmid);
if (segnum < 0 || segnum >= shminfo.shmmni ||
(shmseg = shmsegs[segnum]) == NULL)
return (EINVAL);
- size = round_page(shmseg->shm_segsz);
- uvm_deallocate(&vm->vm_map, shmmap_s->va, size);
+ end = round_page(shmmap_s->va+shmseg->shm_segsz);
+ uvm_unmap(&vm->vm_map, trunc_page(shmmap_s->va), end);
shmmap_s->shmid = -1;
shmseg->shm_dtime = time_second;
if ((--shmseg->shm_nattch <= 0) &&
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index 038416756fc..bf51058b8e0 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_extern.h,v 1.148 2019/07/01 21:13:03 mpi Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.149 2019/11/05 08:18:47 mpi Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
@@ -455,7 +455,6 @@ int uvm_coredump_walkmap(struct proc *_p,
uvm_coredump_setup_cb *_setup,
uvm_coredump_walk_cb *_walk, void *_cookie);
void uvm_grow(struct proc *, vaddr_t);
-void uvm_deallocate(vm_map_t, vaddr_t, vsize_t);
struct uvm_object *uvn_attach(struct vnode *, vm_prot_t);
void uvm_pagezero_thread(void *);
void kmeminit_nkmempages(void);
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index c9dfd786fab..88bfaf8be69 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.66 2019/06/21 09:39:49 visa Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.67 2019/11/05 08:18:47 mpi Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -94,7 +94,7 @@ sys_obreak(struct proc *p, void *v, register_t *retval)
}
vm->vm_dsize += atop(new - old);
} else {
- uvm_deallocate(&vm->vm_map, new, old - new);
+ uvm_unmap(&vm->vm_map, new, old);
vm->vm_dsize -= atop(old - new);
}
diff --git a/sys/uvm/uvm_user.c b/sys/uvm/uvm_user.c
deleted file mode 100644
index 8be62c06924..00000000000
--- a/sys/uvm/uvm_user.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: uvm_user.c,v 1.14 2014/09/14 14:17:27 jsg Exp $ */
-/* $NetBSD: uvm_user.c,v 1.8 2000/06/27 17:29:37 mrg Exp $ */
-
-/*
- * Copyright (c) 1997 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * from: Id: uvm_user.c,v 1.1.2.1 1997/08/14 19:10:41 chuck Exp
- */
-
-/*
- * uvm_user.c: high level uvm_allocate/uvm_deallocate interface into vm.
- */
-
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm.h>
-
-/*
- * uvm_deallocate: deallocate memory (unmap)
- */
-void
-uvm_deallocate(struct vm_map *map, vaddr_t start, vsize_t size)
-{
-
- if (map == NULL)
- panic("uvm_deallocate with null map");
-
- if (size == 0)
- return;
-
- uvm_unmap(map, trunc_page(start), round_page(start+size));
-}