xref: /minix3/sys/uvm/uvm_map.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: uvm_map.h,v 1.72 2012/10/29 16:00:05 para Exp $	*/
26c8f7fc3SBen Gras 
36c8f7fc3SBen Gras /*
46c8f7fc3SBen Gras  * Copyright (c) 1997 Charles D. Cranor and Washington University.
56c8f7fc3SBen Gras  * Copyright (c) 1991, 1993, The Regents of the University of California.
66c8f7fc3SBen Gras  *
76c8f7fc3SBen Gras  * All rights reserved.
86c8f7fc3SBen Gras  *
96c8f7fc3SBen Gras  * This code is derived from software contributed to Berkeley by
106c8f7fc3SBen Gras  * The Mach Operating System project at Carnegie-Mellon University.
116c8f7fc3SBen Gras  *
126c8f7fc3SBen Gras  * Redistribution and use in source and binary forms, with or without
136c8f7fc3SBen Gras  * modification, are permitted provided that the following conditions
146c8f7fc3SBen Gras  * are met:
156c8f7fc3SBen Gras  * 1. Redistributions of source code must retain the above copyright
166c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer.
176c8f7fc3SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
186c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer in the
196c8f7fc3SBen Gras  *    documentation and/or other materials provided with the distribution.
206c8f7fc3SBen Gras  * 3. Neither the name of the University nor the names of its contributors
216c8f7fc3SBen Gras  *    may be used to endorse or promote products derived from this software
226c8f7fc3SBen Gras  *    without specific prior written permission.
236c8f7fc3SBen Gras  *
246c8f7fc3SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
256c8f7fc3SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
266c8f7fc3SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
276c8f7fc3SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
286c8f7fc3SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
296c8f7fc3SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
306c8f7fc3SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
316c8f7fc3SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
326c8f7fc3SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
336c8f7fc3SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
346c8f7fc3SBen Gras  * SUCH DAMAGE.
356c8f7fc3SBen Gras  *
366c8f7fc3SBen Gras  *	@(#)vm_map.h    8.3 (Berkeley) 3/15/94
376c8f7fc3SBen Gras  * from: Id: uvm_map.h,v 1.1.2.3 1998/02/07 01:16:55 chs Exp
386c8f7fc3SBen Gras  *
396c8f7fc3SBen Gras  *
406c8f7fc3SBen Gras  * Copyright (c) 1987, 1990 Carnegie-Mellon University.
416c8f7fc3SBen Gras  * All rights reserved.
426c8f7fc3SBen Gras  *
436c8f7fc3SBen Gras  * Permission to use, copy, modify and distribute this software and
446c8f7fc3SBen Gras  * its documentation is hereby granted, provided that both the copyright
456c8f7fc3SBen Gras  * notice and this permission notice appear in all copies of the
466c8f7fc3SBen Gras  * software, derivative works or modified versions, and any portions
476c8f7fc3SBen Gras  * thereof, and that both notices appear in supporting documentation.
486c8f7fc3SBen Gras  *
496c8f7fc3SBen Gras  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
506c8f7fc3SBen Gras  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
516c8f7fc3SBen Gras  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
526c8f7fc3SBen Gras  *
536c8f7fc3SBen Gras  * Carnegie Mellon requests users of this software to return to
546c8f7fc3SBen Gras  *
556c8f7fc3SBen Gras  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
566c8f7fc3SBen Gras  *  School of Computer Science
576c8f7fc3SBen Gras  *  Carnegie Mellon University
586c8f7fc3SBen Gras  *  Pittsburgh PA 15213-3890
596c8f7fc3SBen Gras  *
606c8f7fc3SBen Gras  * any improvements or extensions that they make and grant Carnegie the
616c8f7fc3SBen Gras  * rights to redistribute these changes.
626c8f7fc3SBen Gras  */
636c8f7fc3SBen Gras 
646c8f7fc3SBen Gras #ifndef _UVM_UVM_MAP_H_
656c8f7fc3SBen Gras #define _UVM_UVM_MAP_H_
666c8f7fc3SBen Gras 
676c8f7fc3SBen Gras /*
686c8f7fc3SBen Gras  * uvm_map.h
696c8f7fc3SBen Gras  */
706c8f7fc3SBen Gras 
716c8f7fc3SBen Gras #ifdef _KERNEL
726c8f7fc3SBen Gras 
736c8f7fc3SBen Gras /*
746c8f7fc3SBen Gras  * macros
756c8f7fc3SBen Gras  */
766c8f7fc3SBen Gras 
776c8f7fc3SBen Gras /*
786c8f7fc3SBen Gras  * UVM_MAP_CLIP_START: ensure that the entry begins at or after
796c8f7fc3SBen Gras  * the starting address, if it doesn't we split the entry.
806c8f7fc3SBen Gras  *
816c8f7fc3SBen Gras  * => map must be locked by caller
826c8f7fc3SBen Gras  */
836c8f7fc3SBen Gras 
846c8f7fc3SBen Gras #define UVM_MAP_CLIP_START(MAP,ENTRY,VA) { \
856c8f7fc3SBen Gras 	if ((VA) > (ENTRY)->start && (VA) < (ENTRY)->end) { \
866c8f7fc3SBen Gras 		uvm_map_clip_start(MAP,ENTRY,VA); \
876c8f7fc3SBen Gras 	} \
886c8f7fc3SBen Gras }
896c8f7fc3SBen Gras 
906c8f7fc3SBen Gras /*
916c8f7fc3SBen Gras  * UVM_MAP_CLIP_END: ensure that the entry ends at or before
926c8f7fc3SBen Gras  *      the ending address, if it does't we split the entry.
936c8f7fc3SBen Gras  *
946c8f7fc3SBen Gras  * => map must be locked by caller
956c8f7fc3SBen Gras  */
966c8f7fc3SBen Gras 
976c8f7fc3SBen Gras #define UVM_MAP_CLIP_END(MAP,ENTRY,VA) { \
986c8f7fc3SBen Gras 	if ((VA) > (ENTRY)->start && (VA) < (ENTRY)->end) { \
996c8f7fc3SBen Gras 		uvm_map_clip_end(MAP,ENTRY,VA); \
1006c8f7fc3SBen Gras 	} \
1016c8f7fc3SBen Gras }
1026c8f7fc3SBen Gras 
1036c8f7fc3SBen Gras /*
1046c8f7fc3SBen Gras  * extract flags
1056c8f7fc3SBen Gras  */
1066c8f7fc3SBen Gras #define UVM_EXTRACT_REMOVE	0x01	/* remove mapping from old map */
1076c8f7fc3SBen Gras #define UVM_EXTRACT_CONTIG	0x02	/* try to keep it contig */
1086c8f7fc3SBen Gras #define UVM_EXTRACT_QREF	0x04	/* use quick refs */
1096c8f7fc3SBen Gras #define UVM_EXTRACT_FIXPROT	0x08	/* set prot to maxprot as we go */
1106c8f7fc3SBen Gras #define UVM_EXTRACT_RESERVED	0x10	/* caller did uvm_map_reserve() */
1116c8f7fc3SBen Gras 
1126c8f7fc3SBen Gras #endif /* _KERNEL */
1136c8f7fc3SBen Gras 
1146c8f7fc3SBen Gras #include <sys/rbtree.h>
1156c8f7fc3SBen Gras #include <sys/pool.h>
1166c8f7fc3SBen Gras #include <sys/rwlock.h>
1176c8f7fc3SBen Gras #include <sys/mutex.h>
1186c8f7fc3SBen Gras #include <sys/condvar.h>
1196c8f7fc3SBen Gras 
1206c8f7fc3SBen Gras #include <uvm/uvm_anon.h>
1216c8f7fc3SBen Gras 
1226c8f7fc3SBen Gras /*
1236c8f7fc3SBen Gras  * Address map entries consist of start and end addresses,
1246c8f7fc3SBen Gras  * a VM object (or sharing map) and offset into that object,
1256c8f7fc3SBen Gras  * and user-exported inheritance and protection information.
1266c8f7fc3SBen Gras  * Also included is control information for virtual copy operations.
1276c8f7fc3SBen Gras  */
1286c8f7fc3SBen Gras struct vm_map_entry {
1296c8f7fc3SBen Gras 	struct rb_node		rb_node;	/* tree information */
1306c8f7fc3SBen Gras 	vsize_t			gap;		/* free space after */
1316c8f7fc3SBen Gras 	vsize_t			maxgap;		/* space in subtree */
1326c8f7fc3SBen Gras 	struct vm_map_entry	*prev;		/* previous entry */
1336c8f7fc3SBen Gras 	struct vm_map_entry	*next;		/* next entry */
1346c8f7fc3SBen Gras 	vaddr_t			start;		/* start address */
1356c8f7fc3SBen Gras 	vaddr_t			end;		/* end address */
1366c8f7fc3SBen Gras 	union {
1376c8f7fc3SBen Gras 		struct uvm_object *uvm_obj;	/* uvm object */
1386c8f7fc3SBen Gras 		struct vm_map	*sub_map;	/* belongs to another map */
1396c8f7fc3SBen Gras 	} object;				/* object I point to */
1406c8f7fc3SBen Gras 	voff_t			offset;		/* offset into object */
1416c8f7fc3SBen Gras 	int			etype;		/* entry type */
1426c8f7fc3SBen Gras 	vm_prot_t		protection;	/* protection code */
1436c8f7fc3SBen Gras 	vm_prot_t		max_protection;	/* maximum protection */
1446c8f7fc3SBen Gras 	vm_inherit_t		inheritance;	/* inheritance */
1456c8f7fc3SBen Gras 	int			wired_count;	/* can be paged if == 0 */
1466c8f7fc3SBen Gras 	struct vm_aref		aref;		/* anonymous overlay */
1476c8f7fc3SBen Gras 	int			advice;		/* madvise advice */
1486c8f7fc3SBen Gras 	uint32_t		map_attrib;	/* uvm-external map attributes */
1496c8f7fc3SBen Gras #define uvm_map_entry_stop_copy flags
1506c8f7fc3SBen Gras 	u_int8_t		flags;		/* flags */
1516c8f7fc3SBen Gras 
1526c8f7fc3SBen Gras #define	UVM_MAP_KERNEL		0x01		/* kernel map entry */
1536c8f7fc3SBen Gras #define	UVM_MAP_STATIC		0x04		/* special static entries */
1546c8f7fc3SBen Gras #define	UVM_MAP_NOMERGE		0x08		/* this entry is not mergable */
1556c8f7fc3SBen Gras 
1566c8f7fc3SBen Gras };
1576c8f7fc3SBen Gras 
1586c8f7fc3SBen Gras #define	VM_MAPENT_ISWIRED(entry)	((entry)->wired_count != 0)
1596c8f7fc3SBen Gras 
1606c8f7fc3SBen Gras /*
1616c8f7fc3SBen Gras  *	Maps are doubly-linked lists of map entries, kept sorted
1626c8f7fc3SBen Gras  *	by address.  A single hint is provided to start
1636c8f7fc3SBen Gras  *	searches again from the last successful search,
1646c8f7fc3SBen Gras  *	insertion, or removal.
1656c8f7fc3SBen Gras  *
1666c8f7fc3SBen Gras  *	LOCKING PROTOCOL NOTES:
1676c8f7fc3SBen Gras  *	-----------------------
1686c8f7fc3SBen Gras  *
1696c8f7fc3SBen Gras  *	VM map locking is a little complicated.  There are both shared
1706c8f7fc3SBen Gras  *	and exclusive locks on maps.  However, it is sometimes required
1716c8f7fc3SBen Gras  *	to downgrade an exclusive lock to a shared lock, and upgrade to
1726c8f7fc3SBen Gras  *	an exclusive lock again (to perform error recovery).  However,
1736c8f7fc3SBen Gras  *	another thread *must not* queue itself to receive an exclusive
1746c8f7fc3SBen Gras  *	lock while before we upgrade back to exclusive, otherwise the
1756c8f7fc3SBen Gras  *	error recovery becomes extremely difficult, if not impossible.
1766c8f7fc3SBen Gras  *
1776c8f7fc3SBen Gras  *	In order to prevent this scenario, we introduce the notion of
1786c8f7fc3SBen Gras  *	a `busy' map.  A `busy' map is read-locked, but other threads
1796c8f7fc3SBen Gras  *	attempting to write-lock wait for this flag to clear before
1806c8f7fc3SBen Gras  *	entering the lock manager.  A map may only be marked busy
1816c8f7fc3SBen Gras  *	when the map is write-locked (and then the map must be downgraded
1826c8f7fc3SBen Gras  *	to read-locked), and may only be marked unbusy by the thread
1836c8f7fc3SBen Gras  *	which marked it busy (holding *either* a read-lock or a
1846c8f7fc3SBen Gras  *	write-lock, the latter being gained by an upgrade).
1856c8f7fc3SBen Gras  *
1866c8f7fc3SBen Gras  *	Access to the map `flags' member is controlled by the `flags_lock'
1876c8f7fc3SBen Gras  *	simple lock.  Note that some flags are static (set once at map
1886c8f7fc3SBen Gras  *	creation time, and never changed), and thus require no locking
1896c8f7fc3SBen Gras  *	to check those flags.  All flags which are r/w must be set or
1906c8f7fc3SBen Gras  *	cleared while the `flags_lock' is asserted.  Additional locking
1916c8f7fc3SBen Gras  *	requirements are:
1926c8f7fc3SBen Gras  *
1936c8f7fc3SBen Gras  *		VM_MAP_PAGEABLE		r/o static flag; no locking required
1946c8f7fc3SBen Gras  *
1956c8f7fc3SBen Gras  *		VM_MAP_WIREFUTURE	r/w; may only be set or cleared when
1966c8f7fc3SBen Gras  *					map is write-locked.  may be tested
1976c8f7fc3SBen Gras  *					without asserting `flags_lock'.
1986c8f7fc3SBen Gras  *
1996c8f7fc3SBen Gras  *		VM_MAP_DYING		r/o; set when a vmspace is being
2006c8f7fc3SBen Gras  *					destroyed to indicate that updates
2016c8f7fc3SBen Gras  *					to the pmap can be skipped.
2026c8f7fc3SBen Gras  *
2036c8f7fc3SBen Gras  *		VM_MAP_TOPDOWN		r/o; set when the vmspace is
2046c8f7fc3SBen Gras  *					created if the unspecified map
2056c8f7fc3SBen Gras  *					allocations are to be arranged in
2066c8f7fc3SBen Gras  *					a "top down" manner.
2076c8f7fc3SBen Gras  */
2086c8f7fc3SBen Gras struct vm_map {
2096c8f7fc3SBen Gras 	struct pmap *		pmap;		/* Physical map */
2106c8f7fc3SBen Gras 	krwlock_t		lock;		/* Non-intrsafe lock */
2116c8f7fc3SBen Gras 	struct lwp *		busy;		/* LWP holding map busy */
2126c8f7fc3SBen Gras 	kmutex_t		misc_lock;	/* Lock for ref_count, cv */
2136c8f7fc3SBen Gras 	kcondvar_t		cv;		/* For signalling */
2146c8f7fc3SBen Gras 	int			flags;		/* flags */
2156c8f7fc3SBen Gras 	struct rb_tree		rb_tree;	/* Tree for entries */
2166c8f7fc3SBen Gras 	struct vm_map_entry	header;		/* List of entries */
2176c8f7fc3SBen Gras 	int			nentries;	/* Number of entries */
2186c8f7fc3SBen Gras 	vsize_t			size;		/* virtual size */
2196c8f7fc3SBen Gras 	int			ref_count;	/* Reference count */
2206c8f7fc3SBen Gras 	struct vm_map_entry *	hint;		/* hint for quick lookups */
2216c8f7fc3SBen Gras 	struct vm_map_entry *	first_free;	/* First free space hint */
2226c8f7fc3SBen Gras 	unsigned int		timestamp;	/* Version number */
2236c8f7fc3SBen Gras };
2246c8f7fc3SBen Gras 
2256c8f7fc3SBen Gras #if defined(_KERNEL)
2266c8f7fc3SBen Gras 
2276c8f7fc3SBen Gras #include <sys/callback.h>
2286c8f7fc3SBen Gras 
2296c8f7fc3SBen Gras #endif /* defined(_KERNEL) */
2306c8f7fc3SBen Gras 
2316c8f7fc3SBen Gras #define	VM_MAP_IS_KERNEL(map)	(vm_map_pmap(map) == pmap_kernel())
2326c8f7fc3SBen Gras 
2336c8f7fc3SBen Gras /* vm_map flags */
2346c8f7fc3SBen Gras #define	VM_MAP_PAGEABLE		0x01		/* ro: entries are pageable */
2356c8f7fc3SBen Gras #define	VM_MAP_WIREFUTURE	0x04		/* rw: wire future mappings */
2366c8f7fc3SBen Gras #define	VM_MAP_DYING		0x20		/* rw: map is being destroyed */
2376c8f7fc3SBen Gras #define	VM_MAP_TOPDOWN		0x40		/* ro: arrange map top-down */
2386c8f7fc3SBen Gras #define	VM_MAP_WANTVA		0x100		/* rw: want va */
2396c8f7fc3SBen Gras 
2406c8f7fc3SBen Gras #ifdef _KERNEL
2416c8f7fc3SBen Gras struct uvm_map_args {
2426c8f7fc3SBen Gras 	struct vm_map_entry *uma_prev;
2436c8f7fc3SBen Gras 
2446c8f7fc3SBen Gras 	vaddr_t uma_start;
2456c8f7fc3SBen Gras 	vsize_t uma_size;
2466c8f7fc3SBen Gras 
2476c8f7fc3SBen Gras 	struct uvm_object *uma_uobj;
2486c8f7fc3SBen Gras 	voff_t uma_uoffset;
2496c8f7fc3SBen Gras 
2506c8f7fc3SBen Gras 	uvm_flag_t uma_flags;
2516c8f7fc3SBen Gras };
2526c8f7fc3SBen Gras #endif /* _KERNEL */
2536c8f7fc3SBen Gras 
2546c8f7fc3SBen Gras /*
2556c8f7fc3SBen Gras  * globals:
2566c8f7fc3SBen Gras  */
2576c8f7fc3SBen Gras 
2586c8f7fc3SBen Gras #ifdef _KERNEL
2596c8f7fc3SBen Gras 
2606c8f7fc3SBen Gras #include <sys/proc.h>
2616c8f7fc3SBen Gras 
2626c8f7fc3SBen Gras #ifdef PMAP_GROWKERNEL
2636c8f7fc3SBen Gras extern vaddr_t	uvm_maxkaddr;
2646c8f7fc3SBen Gras #endif
2656c8f7fc3SBen Gras 
2666c8f7fc3SBen Gras /*
2676c8f7fc3SBen Gras  * protos: the following prototypes define the interface to vm_map
2686c8f7fc3SBen Gras  */
2696c8f7fc3SBen Gras 
2706c8f7fc3SBen Gras void		uvm_map_deallocate(struct vm_map *);
2716c8f7fc3SBen Gras 
2726c8f7fc3SBen Gras int		uvm_map_willneed(struct vm_map *, vaddr_t, vaddr_t);
2736c8f7fc3SBen Gras int		uvm_map_clean(struct vm_map *, vaddr_t, vaddr_t, int);
2746c8f7fc3SBen Gras void		uvm_map_clip_start(struct vm_map *, struct vm_map_entry *,
2756c8f7fc3SBen Gras 		    vaddr_t);
2766c8f7fc3SBen Gras void		uvm_map_clip_end(struct vm_map *, struct vm_map_entry *,
2776c8f7fc3SBen Gras 		    vaddr_t);
2786c8f7fc3SBen Gras int		uvm_map_extract(struct vm_map *, vaddr_t, vsize_t,
2796c8f7fc3SBen Gras 		    struct vm_map *, vaddr_t *, int);
2806c8f7fc3SBen Gras struct vm_map_entry *
2816c8f7fc3SBen Gras 		uvm_map_findspace(struct vm_map *, vaddr_t, vsize_t,
2826c8f7fc3SBen Gras 		    vaddr_t *, struct uvm_object *, voff_t, vsize_t, int);
2836c8f7fc3SBen Gras int		uvm_map_inherit(struct vm_map *, vaddr_t, vaddr_t,
2846c8f7fc3SBen Gras 		    vm_inherit_t);
2856c8f7fc3SBen Gras int		uvm_map_advice(struct vm_map *, vaddr_t, vaddr_t, int);
2866c8f7fc3SBen Gras void		uvm_map_init(void);
2876c8f7fc3SBen Gras void		uvm_map_init_caches(void);
2886c8f7fc3SBen Gras bool		uvm_map_lookup_entry(struct vm_map *, vaddr_t,
2896c8f7fc3SBen Gras 		    struct vm_map_entry **);
2906c8f7fc3SBen Gras void		uvm_map_reference(struct vm_map *);
2916c8f7fc3SBen Gras int		uvm_map_reserve(struct vm_map *, vsize_t, vaddr_t, vsize_t,
2926c8f7fc3SBen Gras 		    vaddr_t *, uvm_flag_t);
2936c8f7fc3SBen Gras void		uvm_map_setup(struct vm_map *, vaddr_t, vaddr_t, int);
2946c8f7fc3SBen Gras int		uvm_map_submap(struct vm_map *, vaddr_t, vaddr_t,
2956c8f7fc3SBen Gras 		    struct vm_map *);
2966c8f7fc3SBen Gras void		uvm_unmap1(struct vm_map *, vaddr_t, vaddr_t, int);
2976c8f7fc3SBen Gras #define	uvm_unmap(map, s, e)	uvm_unmap1((map), (s), (e), 0)
2986c8f7fc3SBen Gras void		uvm_unmap_detach(struct vm_map_entry *,int);
2996c8f7fc3SBen Gras void		uvm_unmap_remove(struct vm_map *, vaddr_t, vaddr_t,
3006c8f7fc3SBen Gras 		    struct vm_map_entry **, int);
3016c8f7fc3SBen Gras 
3026c8f7fc3SBen Gras int		uvm_map_prepare(struct vm_map *, vaddr_t, vsize_t,
3036c8f7fc3SBen Gras 		    struct uvm_object *, voff_t, vsize_t, uvm_flag_t,
3046c8f7fc3SBen Gras 		    struct uvm_map_args *);
3056c8f7fc3SBen Gras int		uvm_map_enter(struct vm_map *, const struct uvm_map_args *,
3066c8f7fc3SBen Gras 		    struct vm_map_entry *);
3076c8f7fc3SBen Gras 
3086c8f7fc3SBen Gras int		uvm_mapent_trymerge(struct vm_map *,
3096c8f7fc3SBen Gras 		    struct vm_map_entry *, int);
3106c8f7fc3SBen Gras #define	UVM_MERGE_COPYING	1
3116c8f7fc3SBen Gras 
3126c8f7fc3SBen Gras bool		vm_map_starved_p(struct vm_map *);
3136c8f7fc3SBen Gras 
3146c8f7fc3SBen Gras /*
3156c8f7fc3SBen Gras  * VM map locking operations.
3166c8f7fc3SBen Gras  */
3176c8f7fc3SBen Gras 
3186c8f7fc3SBen Gras bool		vm_map_lock_try(struct vm_map *);
3196c8f7fc3SBen Gras void		vm_map_lock(struct vm_map *);
3206c8f7fc3SBen Gras void		vm_map_unlock(struct vm_map *);
3216c8f7fc3SBen Gras void		vm_map_unbusy(struct vm_map *);
3226c8f7fc3SBen Gras void		vm_map_lock_read(struct vm_map *);
3236c8f7fc3SBen Gras void		vm_map_unlock_read(struct vm_map *);
3246c8f7fc3SBen Gras void		vm_map_busy(struct vm_map *);
3256c8f7fc3SBen Gras bool		vm_map_locked_p(struct vm_map *);
3266c8f7fc3SBen Gras 
3276c8f7fc3SBen Gras void		uvm_map_lock_entry(struct vm_map_entry *);
3286c8f7fc3SBen Gras void		uvm_map_unlock_entry(struct vm_map_entry *);
3296c8f7fc3SBen Gras 
3306c8f7fc3SBen Gras #endif /* _KERNEL */
3316c8f7fc3SBen Gras 
3326c8f7fc3SBen Gras /*
3336c8f7fc3SBen Gras  *	Functions implemented as macros
3346c8f7fc3SBen Gras  */
3356c8f7fc3SBen Gras #define		vm_map_min(map)		((map)->header.end)
3366c8f7fc3SBen Gras #define		vm_map_max(map)		((map)->header.start)
3376c8f7fc3SBen Gras #define		vm_map_setmin(map, v)	((map)->header.end = (v))
3386c8f7fc3SBen Gras #define		vm_map_setmax(map, v)	((map)->header.start = (v))
3396c8f7fc3SBen Gras 
3406c8f7fc3SBen Gras #define		vm_map_pmap(map)	((map)->pmap)
3416c8f7fc3SBen Gras 
3426c8f7fc3SBen Gras #endif /* _UVM_UVM_MAP_H_ */
343