summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2019-11-05 08:18:47 +0000
committermpi <mpi@openbsd.org>2019-11-05 08:18:47 +0000
commit782069b16bde153d645fb4952ffca97be40e7f30 (patch)
treeb194ba301b0a252a80848fe201691c493a860bcc /sys
parentGive some END()s to assembly symbols. (diff)
downloadwireguard-openbsd-782069b16bde153d645fb4952ffca97be40e7f30.tar.xz
wireguard-openbsd-782069b16bde153d645fb4952ffca97be40e7f30.zip
Kill uvm_deallocate(9) and use uvm_unmap() directly.
ok kettenis@, semarie@, deraadt@
Diffstat (limited to 'sys')
-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
6 files changed, 10 insertions, 68 deletions
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));
-}