kernel - Refactor vm_fault and vm_map a bit.
[dragonfly.git] / sys / vm / vm_map.h
blob2b82914fb2674d8db9a28766a20b411a1f0a96b2
1 /*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 2003-2017 The DragonFly Project. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
7 * The Mach Operating System project at Carnegie-Mellon University.
9 * This code is derived from software contributed to The DragonFly Project
10 * by Matthew Dillon <dillon@backplane.com>
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
36 * @(#)vm_map.h 8.9 (Berkeley) 5/17/95
39 * Copyright (c) 1987, 1990 Carnegie-Mellon University.
40 * All rights reserved.
42 * Authors: Avadis Tevanian, Jr., Michael Wayne Young
44 * Permission to use, copy, modify and distribute this software and
45 * its documentation is hereby granted, provided that both the copyright
46 * notice and this permission notice appear in all copies of the
47 * software, derivative works or modified versions, and any portions
48 * thereof, and that both notices appear in supporting documentation.
50 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
51 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
52 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
54 * Carnegie Mellon requests users of this software to return to
56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
64 * $FreeBSD: src/sys/vm/vm_map.h,v 1.54.2.5 2003/01/13 22:51:17 dillon Exp $
68 * Virtual memory map module definitions.
71 #ifndef _VM_VM_MAP_H_
72 #define _VM_VM_MAP_H_
74 #ifndef _SYS_TYPES_H_
75 #include <sys/types.h>
76 #endif
77 #ifdef _KERNEL
78 #ifndef _SYS_KERNEL_H_
79 #include <sys/kernel.h> /* ticks */
80 #endif
81 #endif
82 #ifndef _SYS_TREE_H_
83 #include <sys/tree.h>
84 #endif
85 #ifndef _SYS_LOCK_H_
86 #include <sys/lock.h>
87 #endif
88 #ifndef _SYS_VKERNEL_H_
89 #include <sys/vkernel.h>
90 #endif
91 #ifndef _VM_VM_H_
92 #include <vm/vm.h>
93 #endif
94 #ifndef _MACHINE_PMAP_H_
95 #include <machine/pmap.h>
96 #endif
97 #ifndef _VM_VM_OBJECT_H_
98 #include <vm/vm_object.h>
99 #endif
100 #ifndef _SYS_NULL_H_
101 #include <sys/_null.h>
102 #endif
104 struct vm_map_rb_tree;
105 RB_PROTOTYPE(vm_map_rb_tree, vm_map_entry, rb_entry, rb_vm_map_compare);
108 * Types defined:
110 * vm_map_t the high-level address map data structure.
111 * vm_map_entry_t an entry in an address map.
114 typedef u_int vm_flags_t;
115 typedef u_int vm_eflags_t;
118 * A vm_map_entry may reference an object, a submap, a uksmap, or a
119 * direct user-kernel shared map.
121 union vm_map_object {
122 struct vm_object *vm_object; /* object object */
123 struct vm_map *sub_map; /* belongs to another map */
124 int (*uksmap)(struct cdev *dev, vm_page_t fake);
125 void *map_object; /* generic */
128 union vm_map_aux {
129 vm_offset_t avail_ssize; /* amt can grow if this is a stack */
130 vpte_t master_pde; /* virtual page table root */
131 struct cdev *dev;
132 void *map_aux;
136 * vm_map_entry identifiers, used as a debugging aid
138 typedef enum {
139 VM_SUBSYS_UNKNOWN,
140 VM_SUBSYS_KMALLOC,
141 VM_SUBSYS_STACK,
142 VM_SUBSYS_IMGACT,
143 VM_SUBSYS_EFI,
144 VM_SUBSYS_RESERVED,
145 VM_SUBSYS_INIT,
146 VM_SUBSYS_PIPE,
147 VM_SUBSYS_PROC,
148 VM_SUBSYS_SHMEM,
149 VM_SUBSYS_SYSMAP,
150 VM_SUBSYS_MMAP,
151 VM_SUBSYS_BRK,
152 VM_SUBSYS_BOGUS,
153 VM_SUBSYS_BUF,
154 VM_SUBSYS_BUFDATA,
155 VM_SUBSYS_GD,
156 VM_SUBSYS_IPIQ,
157 VM_SUBSYS_PVENTRY,
158 VM_SUBSYS_PML4,
159 VM_SUBSYS_MAPDEV,
160 VM_SUBSYS_ZALLOC,
162 VM_SUBSYS_DM,
163 VM_SUBSYS_CONTIG,
164 VM_SUBSYS_DRM,
165 VM_SUBSYS_DRM_GEM,
166 VM_SUBSYS_DRM_SCAT,
167 VM_SUBSYS_DRM_VMAP,
168 VM_SUBSYS_DRM_TTM,
169 VM_SUBSYS_HAMMER,
171 VM_SUBSYS_LIMIT /* end of list */
172 } vm_subsys_t;
175 * Address map entries consist of start and end addresses,
176 * a VM object (or sharing map) and offset into that object,
177 * and user-exported inheritance and protection information.
178 * Also included is control information for virtual copy operations.
180 * When used with MAP_STACK, avail_ssize is used to determine the
181 * limits of stack growth.
183 * When used with VM_MAPTYPE_VPAGETABLE, avail_ssize stores the
184 * page directory index.
186 struct vm_map_entry {
187 struct vm_map_entry *prev; /* previous entry */
188 struct vm_map_entry *next; /* next entry */
189 RB_ENTRY(vm_map_entry) rb_entry;
190 vm_offset_t start; /* start address */
191 vm_offset_t end; /* end address */
192 union vm_map_aux aux; /* auxillary data */
193 union vm_map_object object; /* object I point to */
194 vm_ooffset_t offset; /* offset into object */
195 vm_eflags_t eflags; /* map entry flags */
196 vm_maptype_t maptype; /* type of VM mapping */
197 vm_prot_t protection; /* protection code */
198 vm_prot_t max_protection; /* maximum protection */
199 vm_inherit_t inheritance; /* inheritance */
200 int wired_count; /* can be paged if = 0 */
201 vm_subsys_t id; /* subsystem id */
204 #define MAP_ENTRY_NOSYNC 0x0001
205 #define MAP_ENTRY_STACK 0x0002
206 #define MAP_ENTRY_COW 0x0004
207 #define MAP_ENTRY_NEEDS_COPY 0x0008
208 #define MAP_ENTRY_NOFAULT 0x0010
209 #define MAP_ENTRY_USER_WIRED 0x0020
211 #define MAP_ENTRY_BEHAV_NORMAL 0x0000 /* default behavior */
212 #define MAP_ENTRY_BEHAV_SEQUENTIAL 0x0040 /* expect sequential access */
213 #define MAP_ENTRY_BEHAV_RANDOM 0x0080 /* expect random access */
214 #define MAP_ENTRY_BEHAV_RESERVED 0x00C0 /* future use */
216 #define MAP_ENTRY_BEHAV_MASK 0x00C0
218 #define MAP_ENTRY_IN_TRANSITION 0x0100 /* entry being changed */
219 #define MAP_ENTRY_NEEDS_WAKEUP 0x0200 /* waiter's in transition */
220 #define MAP_ENTRY_NOCOREDUMP 0x0400 /* don't include in a core */
221 #define MAP_ENTRY_KSTACK 0x0800 /* guarded kernel stack */
224 * flags for vm_map_[un]clip_range()
226 #define MAP_CLIP_NO_HOLES 0x0001
229 * This reserve count for vm_map_entry_reserve() should cover all nominal
230 * single-insertion operations, including any necessary clipping.
232 #define MAP_RESERVE_COUNT 4
233 #define MAP_RESERVE_SLOP 64
234 #define MAP_RESERVE_HYST (MAP_RESERVE_SLOP - MAP_RESERVE_SLOP / 8)
236 static __inline u_char
237 vm_map_entry_behavior(struct vm_map_entry *entry)
239 return entry->eflags & MAP_ENTRY_BEHAV_MASK;
242 static __inline void
243 vm_map_entry_set_behavior(struct vm_map_entry *entry, u_char behavior)
245 entry->eflags = (entry->eflags & ~MAP_ENTRY_BEHAV_MASK) |
246 (behavior & MAP_ENTRY_BEHAV_MASK);
250 * VA interlock for map (VPAGETABLE / vkernel support)
252 struct vm_map_ilock {
253 struct vm_map_ilock *next;
254 int flags;
255 vm_offset_t ran_beg;
256 vm_offset_t ran_end; /* non-inclusive */
259 #define ILOCK_WAITING 0x00000001
262 * Hinting mechanism used by vm_map_findspace() to figure out where to start
263 * an iteration looking for a hole big enough for the requested allocation.
264 * This can be important in situations where large amounts of kernel memory
265 * are being managed. For example, if the system is managing tens of
266 * thousands of processes or threads.
268 * If a hint is present it guarantees that no compatible hole exists prior
269 * to the (start) address. The (start) address itself is not necessarily
270 * a hole.
272 #define VM_MAP_FFCOUNT 4
273 #define VM_MAP_FFMASK (VM_MAP_FFCOUNT - 1)
275 struct vm_map_freehint {
276 vm_offset_t start;
277 vm_offset_t length;
278 vm_offset_t align;
279 int unused01;
281 typedef struct vm_map_freehint vm_map_freehint_t;
284 * Maps are doubly-linked lists of map entries, kept sorted by address.
285 * A single hint is provided to start searches again from the last
286 * successful search, insertion, or removal.
288 * NOTE: The lock structure cannot be the first element of vm_map
289 * because this can result in a running lockup between two or more
290 * system processes trying to kmem_alloc_wait() due to kmem_alloc_wait()
291 * and free tsleep/waking up 'map' and the underlying lockmgr also
292 * sleeping and waking up on 'map'. The lockup occurs when the map fills
293 * up. The 'exec' map, for example.
295 * NOTE: The vm_map structure can be hard-locked with the lockmgr lock
296 * or soft-serialized with the token, or both.
298 struct vm_map {
299 struct vm_map_entry header; /* List of entries */
300 RB_HEAD(vm_map_rb_tree, vm_map_entry) rb_root;
301 struct lock lock; /* Lock for map data */
302 int nentries; /* Number of entries */
303 unsigned int timestamp; /* Version number */
304 vm_size_t size; /* virtual size */
305 u_char system_map; /* Am I a system map? */
306 u_char freehint_newindex;
307 u_char unused02;
308 u_char unused03;
309 vm_flags_t flags; /* flags for this vm_map */
310 vm_map_freehint_t freehint[VM_MAP_FFCOUNT];
311 struct pmap *pmap; /* Physical map */
312 u_int president_cache; /* Remember president count */
313 u_int president_ticks; /* Save ticks for cache */
314 struct vm_map_ilock *ilock_base;/* interlocks */
315 struct spinlock ilock_spin; /* interlocks (spinlock for) */
316 struct lwkt_token token; /* Soft serializer */
317 vm_offset_t pgout_offset; /* for RLIMIT_RSS scans */
318 #define min_offset header.start
319 #define max_offset header.end
323 * vm_flags_t values
325 #define MAP_WIREFUTURE 0x0001 /* wire all future pages */
328 * Shareable process virtual address space.
330 * Refd pointers from vmresident, proc
332 struct vmspace {
333 struct vm_map vm_map; /* VM address map */
334 struct pmap vm_pmap; /* private physical map */
335 int vm_flags;
336 caddr_t vm_shm; /* SYS5 shared memory private data XXX */
337 /* we copy from vm_startcopy to the end of the structure on fork */
338 #define vm_startcopy vm_rssize
339 segsz_t vm_rssize; /* current resident set size in pages */
340 segsz_t vm_swrss; /* resident set size before last swap */
341 segsz_t vm_tsize; /* text size (pages) XXX */
342 segsz_t vm_dsize; /* data size (pages) XXX */
343 segsz_t vm_ssize; /* stack size (pages) */
344 caddr_t vm_taddr; /* user virtual address of text XXX */
345 caddr_t vm_daddr; /* user virtual address of data XXX */
346 caddr_t vm_maxsaddr; /* user VA at max stack growth */
347 caddr_t vm_minsaddr; /* user VA at max stack growth */
348 #define vm_endcopy vm_unused01
349 int vm_unused01;
350 int vm_unused02;
351 int vm_pagesupply;
352 u_int vm_holdcnt; /* temporary hold count and exit sequencing */
353 u_int vm_refcnt; /* normal ref count */
356 #define VM_REF_DELETED 0x80000000U
358 #define VMSPACE_EXIT1 0x0001 /* partial exit */
359 #define VMSPACE_EXIT2 0x0002 /* full exit */
361 #define VMSPACE_HOLDEXIT 0x80000000
364 * Resident executable holding structure. A user program can take a snapshot
365 * of just its VM address space (typically done just after dynamic link
366 * libraries have completed loading) and register it as a resident
367 * executable associated with the program binary's vnode, which is also
368 * locked into memory. Future execs of the vnode will start with a copy
369 * of the resident vmspace instead of running the binary from scratch,
370 * avoiding both the kernel ELF loader *AND* all shared library mapping and
371 * relocation code, and will call a different entry point (the stack pointer
372 * is reset to the top of the stack) supplied when the vmspace was registered.
374 struct vmresident {
375 struct vnode *vr_vnode; /* associated vnode */
376 TAILQ_ENTRY(vmresident) vr_link; /* linked list of res sts */
377 struct vmspace *vr_vmspace; /* vmspace to fork */
378 intptr_t vr_entry_addr; /* registered entry point */
379 struct sysentvec *vr_sysent; /* system call vects */
380 int vr_id; /* registration id */
381 int vr_refs; /* temporary refs */
384 #ifdef _KERNEL
386 * Macros: vm_map_lock, etc.
387 * Function:
388 * Perform locking on the data portion of a map. Note that
389 * these macros mimic procedure calls returning void. The
390 * semicolon is supplied by the user of these macros, not
391 * by the macros themselves. The macros can safely be used
392 * as unbraced elements in a higher level statement.
395 #define ASSERT_VM_MAP_LOCKED(map) KKASSERT(lockowned(&(map)->lock))
397 #ifdef DIAGNOSTIC
398 /* #define MAP_LOCK_DIAGNOSTIC 1 */
399 #ifdef MAP_LOCK_DIAGNOSTIC
400 #define vm_map_lock(map) \
401 do { \
402 kprintf ("locking map LK_EXCLUSIVE: 0x%x\n", map); \
403 if (lockmgr(&(map)->lock, LK_EXCLUSIVE) != 0) { \
404 panic("vm_map_lock: failed to get lock"); \
406 (map)->timestamp++; \
407 } while(0)
408 #else
409 #define vm_map_lock(map) \
410 do { \
411 if (lockmgr(&(map)->lock, LK_EXCLUSIVE) != 0) { \
412 panic("vm_map_lock: failed to get lock"); \
414 (map)->timestamp++; \
415 } while(0)
416 #endif
417 #else
418 #define vm_map_lock(map) \
419 do { \
420 lockmgr(&(map)->lock, LK_EXCLUSIVE); \
421 (map)->timestamp++; \
422 } while(0)
423 #endif /* DIAGNOSTIC */
425 #if defined(MAP_LOCK_DIAGNOSTIC)
426 #define vm_map_unlock(map) \
427 do { \
428 kprintf ("locking map LK_RELEASE: 0x%x\n", map); \
429 lockmgr(&(map)->lock, LK_RELEASE); \
430 } while (0)
431 #define vm_map_lock_read(map) \
432 do { \
433 kprintf ("locking map LK_SHARED: 0x%x\n", map); \
434 lockmgr(&(map)->lock, LK_SHARED); \
435 } while (0)
436 #define vm_map_unlock_read(map) \
437 do { \
438 kprintf ("locking map LK_RELEASE: 0x%x\n", map); \
439 lockmgr(&(map)->lock, LK_RELEASE); \
440 } while (0)
441 #else
442 #define vm_map_unlock(map) \
443 lockmgr(&(map)->lock, LK_RELEASE)
444 #define vm_map_lock_read(map) \
445 lockmgr(&(map)->lock, LK_SHARED)
446 #define vm_map_unlock_read(map) \
447 lockmgr(&(map)->lock, LK_RELEASE)
448 #endif
450 #define vm_map_lock_read_try(map) \
451 lockmgr(&(map)->lock, LK_SHARED | LK_NOWAIT)
453 static __inline__ int
454 vm_map_lock_read_to(vm_map_t map)
456 int error;
458 #if defined(MAP_LOCK_DIAGNOSTIC)
459 kprintf ("locking map LK_SHARED: 0x%x\n", map);
460 #endif
461 error = lockmgr(&(map)->lock, LK_SHARED | LK_TIMELOCK);
462 return error;
465 static __inline__ int
466 vm_map_lock_upgrade(vm_map_t map) {
467 int error;
468 #if defined(MAP_LOCK_DIAGNOSTIC)
469 kprintf("locking map LK_EXCLUPGRADE: 0x%x\n", map);
470 #endif
471 error = lockmgr(&map->lock, LK_EXCLUPGRADE);
472 if (error == 0)
473 map->timestamp++;
474 return error;
477 #if defined(MAP_LOCK_DIAGNOSTIC)
478 #define vm_map_lock_downgrade(map) \
479 do { \
480 kprintf ("locking map LK_DOWNGRADE: 0x%x\n", map); \
481 lockmgr(&(map)->lock, LK_DOWNGRADE); \
482 } while (0)
483 #else
484 #define vm_map_lock_downgrade(map) \
485 lockmgr(&(map)->lock, LK_DOWNGRADE)
486 #endif
488 #endif /* _KERNEL */
491 * Functions implemented as macros
493 #define vm_map_min(map) ((map)->min_offset)
494 #define vm_map_max(map) ((map)->max_offset)
495 #define vm_map_pmap(map) ((map)->pmap)
498 * Must not block
500 static __inline struct pmap *
501 vmspace_pmap(struct vmspace *vmspace)
503 return &vmspace->vm_pmap;
507 * Caller must hold the vmspace->vm_map.token
509 static __inline long
510 vmspace_resident_count(struct vmspace *vmspace)
512 return pmap_resident_count(vmspace_pmap(vmspace));
516 * Calculates the proportional RSS and returning the
517 * accrued result. This is a loose value for statistics/display
518 * purposes only and will only be updated if we can acquire
519 * a non-blocking map lock.
521 * (used by userland or the kernel)
523 static __inline u_int
524 vmspace_president_count(struct vmspace *vmspace)
526 vm_map_t map = &vmspace->vm_map;
527 vm_map_entry_t cur;
528 vm_object_t object;
529 u_int count = 0;
531 #ifdef _KERNEL
532 if (map->president_ticks == ticks / hz || vm_map_lock_read_try(map))
533 return(map->president_cache);
534 #endif
536 for (cur = map->header.next; cur != &map->header; cur = cur->next) {
537 switch(cur->maptype) {
538 case VM_MAPTYPE_NORMAL:
539 case VM_MAPTYPE_VPAGETABLE:
540 if ((object = cur->object.vm_object) == NULL)
541 break;
542 if (object->type != OBJT_DEFAULT &&
543 object->type != OBJT_SWAP) {
544 break;
547 #if 0
549 * synchronize non-zero case, contents of field
550 * can change at any time due to pmap ops.
552 if ((n = object->agg_pv_list_count) != 0) {
553 #ifdef _KERNEL
554 cpu_ccfence();
555 #endif
556 count += object->resident_page_count / n;
558 #endif
559 break;
560 default:
561 break;
564 #ifdef _KERNEL
565 map->president_cache = count;
566 map->president_ticks = ticks / hz;
567 vm_map_unlock_read(map);
568 #endif
570 return(count);
574 * Number of kernel maps and entries to statically allocate, required
575 * during boot to bootstrap the VM system.
577 #define MAX_KMAP 10
578 #define MAX_MAPENT (SMP_MAXCPU * 32 + 1024)
581 * Copy-on-write flags for vm_map operations
583 #define MAP_UNUSED_01 0x0001
584 #define MAP_COPY_ON_WRITE 0x0002
585 #define MAP_NOFAULT 0x0004
586 #define MAP_PREFAULT 0x0008
587 #define MAP_PREFAULT_PARTIAL 0x0010
588 #define MAP_DISABLE_SYNCER 0x0020
589 #define MAP_IS_STACK 0x0040
590 #define MAP_IS_KSTACK 0x0080
591 #define MAP_DISABLE_COREDUMP 0x0100
592 #define MAP_PREFAULT_MADVISE 0x0200 /* from (user) madvise request */
593 #define MAP_PREFAULT_RELOCK 0x0200
596 * vm_fault option flags
598 #define VM_FAULT_NORMAL 0x00 /* Nothing special */
599 #define VM_FAULT_CHANGE_WIRING 0x01 /* Change the wiring as appropriate */
600 #define VM_FAULT_USER_WIRE 0x02 /* Likewise, but for user purposes */
601 #define VM_FAULT_BURST 0x04 /* Burst fault can be done */
602 #define VM_FAULT_DIRTY 0x08 /* Dirty the page */
603 #define VM_FAULT_UNSWAP 0x10 /* Remove backing store from the page */
604 #define VM_FAULT_BURST_QUICK 0x20 /* Special case shared vm_object */
605 #define VM_FAULT_WIRE_MASK (VM_FAULT_CHANGE_WIRING|VM_FAULT_USER_WIRE)
606 #define VM_FAULT_USERMODE 0x40
608 #ifdef _KERNEL
610 boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t,
611 vm_prot_t, boolean_t);
612 struct pmap;
613 struct globaldata;
614 void vm_map_entry_allocate_object(vm_map_entry_t);
615 void vm_map_entry_reserve_cpu_init(struct globaldata *gd);
616 int vm_map_entry_reserve(int);
617 int vm_map_entry_kreserve(int);
618 void vm_map_entry_release(int);
619 void vm_map_entry_krelease(int);
620 int vm_map_delete (vm_map_t, vm_offset_t, vm_offset_t, int *);
621 int vm_map_find (vm_map_t, void *, void *,
622 vm_ooffset_t, vm_offset_t *, vm_size_t,
623 vm_size_t, boolean_t,
624 vm_maptype_t, vm_subsys_t id,
625 vm_prot_t, vm_prot_t, int);
626 int vm_map_findspace (vm_map_t, vm_offset_t, vm_size_t, vm_size_t,
627 int, vm_offset_t *);
628 vm_offset_t vm_map_hint(struct proc *, vm_offset_t, vm_prot_t);
629 int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t);
630 void vm_map_init (struct vm_map *, vm_offset_t, vm_offset_t, pmap_t);
631 int vm_map_insert (vm_map_t, int *, void *, void *,
632 vm_ooffset_t, vm_offset_t, vm_offset_t,
633 vm_maptype_t, vm_subsys_t id,
634 vm_prot_t, vm_prot_t, int);
635 int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *,
636 vm_pindex_t *, vm_prot_t *, boolean_t *);
637 void vm_map_lookup_done (vm_map_t, vm_map_entry_t, int);
638 boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *);
639 int vm_map_wire (vm_map_t, vm_offset_t, vm_offset_t, int);
640 int vm_map_unwire (vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
641 int vm_map_clean (vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t);
642 int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t);
643 int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t);
644 void vm_map_startup (void);
645 int vm_map_submap (vm_map_t, vm_offset_t, vm_offset_t, vm_map_t);
646 int vm_map_madvise (vm_map_t, vm_offset_t, vm_offset_t, int, off_t);
647 void vm_map_simplify_entry (vm_map_t, vm_map_entry_t, int *);
648 void vm_init2 (void);
649 int vm_uiomove (vm_map_t, vm_object_t, off_t, int, vm_offset_t, int *);
650 int vm_map_stack (vm_map_t, vm_offset_t, vm_size_t, int,
651 vm_prot_t, vm_prot_t, int);
652 int vm_map_growstack (vm_map_t map, vm_offset_t addr);
653 vm_offset_t vmspace_swap_count (struct vmspace *vmspace);
654 vm_offset_t vmspace_anonymous_count (struct vmspace *vmspace);
655 void vm_map_set_wired_quick(vm_map_t map, vm_offset_t addr, vm_size_t size, int *);
656 void vm_map_transition_wait(vm_map_t map, int relock);
658 void vm_map_interlock(vm_map_t map, struct vm_map_ilock *ilock,
659 vm_offset_t ran_beg, vm_offset_t ran_end);
660 void vm_map_deinterlock(vm_map_t map, struct vm_map_ilock *ilock);
663 #if defined(__x86_64__) && defined(_KERNEL_VIRTUAL)
664 int vkernel_module_memory_alloc(vm_offset_t *, size_t);
665 void vkernel_module_memory_free(vm_offset_t, size_t);
666 #endif
668 #endif
669 #endif /* _VM_VM_MAP_H_ */