xref: /netbsd-src/sys/uvm/uvm_user.c (revision 3ba477b15400d27bc1a6cf719738b659818242bd)
1*3ba477b1Schuck /*	$NetBSD: uvm_user.c,v 1.14 2011/02/02 15:13:34 chuck Exp $	*/
2f2caacc7Smrg 
3f2caacc7Smrg /*
4f2caacc7Smrg  * Copyright (c) 1997 Charles D. Cranor and Washington University.
5f2caacc7Smrg  * All rights reserved.
6f2caacc7Smrg  *
7f2caacc7Smrg  * Redistribution and use in source and binary forms, with or without
8f2caacc7Smrg  * modification, are permitted provided that the following conditions
9f2caacc7Smrg  * are met:
10f2caacc7Smrg  * 1. Redistributions of source code must retain the above copyright
11f2caacc7Smrg  *    notice, this list of conditions and the following disclaimer.
12f2caacc7Smrg  * 2. Redistributions in binary form must reproduce the above copyright
13f2caacc7Smrg  *    notice, this list of conditions and the following disclaimer in the
14f2caacc7Smrg  *    documentation and/or other materials provided with the distribution.
15f2caacc7Smrg  *
16f2caacc7Smrg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17f2caacc7Smrg  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18f2caacc7Smrg  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19f2caacc7Smrg  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20f2caacc7Smrg  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21f2caacc7Smrg  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22f2caacc7Smrg  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23f2caacc7Smrg  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24f2caacc7Smrg  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25f2caacc7Smrg  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
261f6b921cSmrg  *
271f6b921cSmrg  * from: Id: uvm_user.c,v 1.1.2.1 1997/08/14 19:10:41 chuck Exp
28f2caacc7Smrg  */
29f2caacc7Smrg 
30f2caacc7Smrg /*
31f2caacc7Smrg  * uvm_user.c: high level uvm_allocate/uvm_deallocate interface into vm.
32f2caacc7Smrg  */
33f2caacc7Smrg 
34b616d1caSlukem #include <sys/cdefs.h>
35*3ba477b1Schuck __KERNEL_RCSID(0, "$NetBSD: uvm_user.c,v 1.14 2011/02/02 15:13:34 chuck Exp $");
36f2caacc7Smrg 
37f2caacc7Smrg #include <sys/param.h>
38f2caacc7Smrg #include <sys/systm.h>
39f2caacc7Smrg #include <sys/proc.h>
40f2caacc7Smrg 
41f2caacc7Smrg #include <uvm/uvm.h>
42f2caacc7Smrg 
43f2caacc7Smrg /*
44f2caacc7Smrg  * uvm_deallocate: deallocate memory (unmap)
45f2caacc7Smrg  */
46f2caacc7Smrg 
47ac3bc537Schs void
uvm_deallocate(struct vm_map * map,vaddr_t start,vsize_t size)48e569faccSthorpej uvm_deallocate(struct vm_map *map, vaddr_t start, vsize_t size)
49f2caacc7Smrg {
508106d135Smrg 
51ac3bc537Schs 	if (size == 0)
52ac3bc537Schs 		return;
53f2caacc7Smrg 
54ac3bc537Schs 	uvm_unmap(map, trunc_page(start), round_page(start + size));
55f2caacc7Smrg }
56