FreeBSD virtual memory subsystem code
vm_map.h File Reference
#include <sys/lock.h>
#include <sys/sx.h>
#include <sys/_mutex.h>
Include dependency graph for vm_map.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  vm_map_object
 
struct  vm_map_entry
 
struct  vm_map
 
struct  vmspace
 

Macros

#define MAP_ENTRY_NOSYNC   0x00000001
 
#define MAP_ENTRY_IS_SUB_MAP   0x00000002
 
#define MAP_ENTRY_COW   0x00000004
 
#define MAP_ENTRY_NEEDS_COPY   0x00000008
 
#define MAP_ENTRY_NOFAULT   0x00000010
 
#define MAP_ENTRY_USER_WIRED   0x00000020
 
#define MAP_ENTRY_BEHAV_NORMAL   0x00000000 /* default behavior */
 
#define MAP_ENTRY_BEHAV_SEQUENTIAL
 
#define MAP_ENTRY_BEHAV_RANDOM
 
#define MAP_ENTRY_BEHAV_RESERVED   0x000000c0 /* future use */
 
#define MAP_ENTRY_BEHAV_MASK   0x000000c0
 
#define MAP_ENTRY_IN_TRANSITION
 
#define MAP_ENTRY_NEEDS_WAKEUP
 
#define MAP_ENTRY_NOCOREDUMP
 
#define MAP_ENTRY_VN_EXEC   0x00000800 /* text vnode mapping */
 
#define MAP_ENTRY_GROWS_DOWN   0x00001000 /* top-down stacks */
 
#define MAP_ENTRY_GROWS_UP   0x00002000 /* bottom-up stacks */
 
#define MAP_ENTRY_WIRE_SKIPPED   0x00004000
 
#define MAP_ENTRY_WRITECNT
 
#define MAP_ENTRY_GUARD   0x00010000
 
#define MAP_ENTRY_STACK_GAP_DN   0x00020000
 
#define MAP_ENTRY_STACK_GAP_UP   0x00040000
 
#define MAP_ENTRY_HEADER   0x00080000
 
#define MAP_ENTRY_SPLIT_BOUNDARY_MASK   0x00300000
 
#define MAP_ENTRY_SPLIT_BOUNDARY_SHIFT   20
 
#define MAP_WIREFUTURE   0x01 /* wire all future pages */
 
#define MAP_BUSY_WAKEUP   0x02 /* thread(s) waiting on busy state */
 
#define MAP_IS_SUB_MAP   0x04 /* has parent */
 
#define MAP_ASLR   0x08 /* enabled ASLR */
 
#define MAP_ASLR_IGNSTART   0x10 /* ASLR ignores data segment */
 
#define MAP_REPLENISH   0x20 /* kmapent zone needs to be refilled */
 
#define MAP_WXORX   0x40 /* enforce W^X */
 
#define MAP_ASLR_STACK   0x80 /* stack location is randomized */
 
#define vm_map_lock(map)   _vm_map_lock(map, LOCK_FILE, LOCK_LINE)
 
#define vm_map_unlock(map)   _vm_map_unlock(map, LOCK_FILE, LOCK_LINE)
 
#define vm_map_unlock_and_wait(map, timo)    _vm_map_unlock_and_wait(map, timo, LOCK_FILE, LOCK_LINE)
 
#define vm_map_lock_read(map)   _vm_map_lock_read(map, LOCK_FILE, LOCK_LINE)
 
#define vm_map_unlock_read(map)   _vm_map_unlock_read(map, LOCK_FILE, LOCK_LINE)
 
#define vm_map_trylock(map)   _vm_map_trylock(map, LOCK_FILE, LOCK_LINE)
 
#define vm_map_trylock_read(map)    _vm_map_trylock_read(map, LOCK_FILE, LOCK_LINE)
 
#define vm_map_lock_upgrade(map)    _vm_map_lock_upgrade(map, LOCK_FILE, LOCK_LINE)
 
#define vm_map_lock_downgrade(map)    _vm_map_lock_downgrade(map, LOCK_FILE, LOCK_LINE)
 
#define MAP_INHERIT_SHARE   0x00000001
 
#define MAP_COPY_ON_WRITE   0x00000002
 
#define MAP_NOFAULT   0x00000004
 
#define MAP_PREFAULT   0x00000008
 
#define MAP_PREFAULT_PARTIAL   0x00000010
 
#define MAP_DISABLE_SYNCER   0x00000020
 
#define MAP_CHECK_EXCL   0x00000040
 
#define MAP_CREATE_GUARD   0x00000080
 
#define MAP_DISABLE_COREDUMP   0x00000100
 
#define MAP_PREFAULT_MADVISE   0x00000200 /* from (user) madvise request */
 
#define MAP_WRITECOUNT   0x00000400
 
#define MAP_REMAP   0x00000800
 
#define MAP_STACK_GROWS_DOWN   0x00001000
 
#define MAP_STACK_GROWS_UP   0x00002000
 
#define MAP_ACC_CHARGED   0x00004000
 
#define MAP_ACC_NO_CHARGE   0x00008000
 
#define MAP_CREATE_STACK_GAP_UP   0x00010000
 
#define MAP_CREATE_STACK_GAP_DN   0x00020000
 
#define MAP_VN_EXEC   0x00040000
 
#define MAP_SPLIT_BOUNDARY_MASK   0x00180000
 
#define MAP_SPLIT_BOUNDARY_SHIFT   19
 
#define VM_FAULT_NORMAL   0x00 /* Nothing special */
 
#define VM_FAULT_WIRE   0x01 /* Wire the mapped page */
 
#define VM_FAULT_DIRTY   0x02 /* Dirty the page; use w/VM_PROT_COPY */
 
#define VM_FAULT_NOFILL   0x04 /* Fail if the pager doesn't have a copy */
 
#define VM_FAULT_READ_AHEAD_MIN   7
 
#define VM_FAULT_READ_AHEAD_INIT   15
 
#define VM_FAULT_READ_AHEAD_MAX   min(atop(maxphys) - 1, UINT8_MAX)
 
#define VMFS_NO_SPACE   0 /* don't find; use the given range */
 
#define VMFS_ANY_SPACE   1 /* find a range with any alignment */
 
#define VMFS_OPTIMAL_SPACE   2 /* find a range with optimal alignment*/
 
#define VMFS_SUPER_SPACE   3 /* find a superpage-aligned range */
 
#define VMFS_ALIGNED_SPACE(x)   ((x) << 8) /* find a range with fixed alignment */
 
#define VM_MAP_WIRE_SYSTEM   0 /* wiring in a kernel map */
 
#define VM_MAP_WIRE_USER   1 /* wiring in a user map */
 
#define VM_MAP_WIRE_NOHOLES   0 /* region must not have holes */
 
#define VM_MAP_WIRE_HOLESOK   2 /* region may have holes */
 
#define VM_MAP_WIRE_WRITE   4 /* Validate writable. */
 
#define VM_MAP_ENTRY_FOREACH(it, map)
 
#define VM_MAP_PROTECT_SET_PROT   0x0001
 
#define VM_MAP_PROTECT_SET_MAXPROT   0x0002
 

Typedefs

typedef u_char vm_flags_t
 
typedef u_int vm_eflags_t
 
typedef int vm_map_entry_reader(void *token, vm_map_entry_t addr, vm_map_entry_t dest)
 

Functions

static __inline u_char vm_map_entry_behavior (vm_map_entry_t entry)
 
static __inline int vm_map_entry_user_wired_count (vm_map_entry_t entry)
 
static __inline int vm_map_entry_system_wired_count (vm_map_entry_t entry)
 
static __inline vm_offset_t vm_map_max (const struct vm_map *map)
 
static __inline vm_offset_t vm_map_min (const struct vm_map *map)
 
static __inline pmap_t vm_map_pmap (vm_map_t map)
 
static __inline void vm_map_modflags (vm_map_t map, vm_flags_t set, vm_flags_t clear)
 
static bool vm_map_range_valid (vm_map_t map, vm_offset_t start, vm_offset_t end)
 
static __inline pmap_t vmspace_pmap (struct vmspace *vmspace)
 
void _vm_map_lock (vm_map_t map, const char *file, int line)
 
void _vm_map_unlock (vm_map_t map, const char *file, int line)
 
int _vm_map_unlock_and_wait (vm_map_t map, int timo, const char *file, int line)
 
void _vm_map_lock_read (vm_map_t map, const char *file, int line)
 
void _vm_map_unlock_read (vm_map_t map, const char *file, int line)
 
int _vm_map_trylock (vm_map_t map, const char *file, int line)
 
int _vm_map_trylock_read (vm_map_t map, const char *file, int line)
 
int _vm_map_lock_upgrade (vm_map_t map, const char *file, int line)
 
void _vm_map_lock_downgrade (vm_map_t map, const char *file, int line)
 
int vm_map_locked (vm_map_t map)
 
void vm_map_wakeup (vm_map_t map)
 
void vm_map_busy (vm_map_t map)
 
void vm_map_unbusy (vm_map_t map)
 
void vm_map_wait_busy (vm_map_t map)
 
vm_offset_t vm_map_max_KBI (const struct vm_map *map)
 
vm_offset_t vm_map_min_KBI (const struct vm_map *map)
 
pmap_t vm_map_pmap_KBI (vm_map_t map)
 
bool vm_map_range_valid_KBI (vm_map_t map, vm_offset_t start, vm_offset_t end)
 
long vmspace_resident_count (struct vmspace *vmspace)
 
boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t)
 
int vm_map_delete (vm_map_t, vm_offset_t, vm_offset_t)
 
int vm_map_find (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int)
 
int vm_map_find_min (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int)
 
int vm_map_find_aligned (vm_map_t map, vm_offset_t *addr, vm_size_t length, vm_offset_t max_addr, vm_offset_t alignment)
 
int vm_map_fixed (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t, vm_prot_t, vm_prot_t, int)
 
vm_offset_t vm_map_findspace (vm_map_t, vm_offset_t, vm_size_t)
 
int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t)
 
void vm_map_init (vm_map_t, pmap_t, vm_offset_t, vm_offset_t)
 
int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_offset_t, vm_prot_t, vm_prot_t, int)
 
int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, vm_pindex_t *, vm_prot_t *, boolean_t *)
 
int vm_map_lookup_locked (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, vm_pindex_t *, vm_prot_t *, boolean_t *)
 
void vm_map_lookup_done (vm_map_t, vm_map_entry_t)
 
boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *)
 
static vm_map_entry_t vm_map_entry_first (vm_map_t map)
 
static vm_map_entry_t vm_map_entry_succ (vm_map_entry_t entry)
 
int vm_map_protect (vm_map_t map, vm_offset_t start, vm_offset_t end, vm_prot_t new_prot, vm_prot_t new_maxprot, int flags)
 
int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t)
 
void vm_map_try_merge_entries (vm_map_t map, vm_map_entry_t prev, vm_map_entry_t entry)
 
void vm_map_startup (void)
 
int vm_map_submap (vm_map_t, vm_offset_t, vm_offset_t, vm_map_t)
 
int vm_map_sync (vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t)
 
int vm_map_madvise (vm_map_t, vm_offset_t, vm_offset_t, int)
 
int vm_map_stack (vm_map_t, vm_offset_t, vm_size_t, vm_prot_t, vm_prot_t, int)
 
int vm_map_unwire (vm_map_t map, vm_offset_t start, vm_offset_t end, int flags)
 
int vm_map_wire (vm_map_t map, vm_offset_t start, vm_offset_t end, int flags)
 
int vm_map_wire_locked (vm_map_t map, vm_offset_t start, vm_offset_t end, int flags)
 
long vmspace_swap_count (struct vmspace *vmspace)
 
void vm_map_entry_set_vnode_text (vm_map_entry_t entry, bool add)
 

Macro Definition Documentation

◆ MAP_ACC_CHARGED

#define MAP_ACC_CHARGED   0x00004000

Definition at line 373 of file vm_map.h.

◆ MAP_ACC_NO_CHARGE

#define MAP_ACC_NO_CHARGE   0x00008000

Definition at line 374 of file vm_map.h.

◆ MAP_ASLR

#define MAP_ASLR   0x08 /* enabled ASLR */

Definition at line 222 of file vm_map.h.

◆ MAP_ASLR_IGNSTART

#define MAP_ASLR_IGNSTART   0x10 /* ASLR ignores data segment */

Definition at line 223 of file vm_map.h.

◆ MAP_ASLR_STACK

#define MAP_ASLR_STACK   0x80 /* stack location is randomized */

Definition at line 226 of file vm_map.h.

◆ MAP_BUSY_WAKEUP

#define MAP_BUSY_WAKEUP   0x02 /* thread(s) waiting on busy state */

Definition at line 220 of file vm_map.h.

◆ MAP_CHECK_EXCL

#define MAP_CHECK_EXCL   0x00000040

Definition at line 365 of file vm_map.h.

◆ MAP_COPY_ON_WRITE

#define MAP_COPY_ON_WRITE   0x00000002

Definition at line 360 of file vm_map.h.

◆ MAP_CREATE_GUARD

#define MAP_CREATE_GUARD   0x00000080

Definition at line 366 of file vm_map.h.

◆ MAP_CREATE_STACK_GAP_DN

#define MAP_CREATE_STACK_GAP_DN   0x00020000

Definition at line 376 of file vm_map.h.

◆ MAP_CREATE_STACK_GAP_UP

#define MAP_CREATE_STACK_GAP_UP   0x00010000

Definition at line 375 of file vm_map.h.

◆ MAP_DISABLE_COREDUMP

#define MAP_DISABLE_COREDUMP   0x00000100

Definition at line 367 of file vm_map.h.

◆ MAP_DISABLE_SYNCER

#define MAP_DISABLE_SYNCER   0x00000020

Definition at line 364 of file vm_map.h.

◆ MAP_ENTRY_BEHAV_MASK

#define MAP_ENTRY_BEHAV_MASK   0x000000c0

Definition at line 131 of file vm_map.h.

◆ MAP_ENTRY_BEHAV_NORMAL

#define MAP_ENTRY_BEHAV_NORMAL   0x00000000 /* default behavior */

Definition at line 127 of file vm_map.h.

◆ MAP_ENTRY_BEHAV_RANDOM

#define MAP_ENTRY_BEHAV_RANDOM
Value:
0x00000080 /* expect random
access */

Definition at line 129 of file vm_map.h.

◆ MAP_ENTRY_BEHAV_RESERVED

#define MAP_ENTRY_BEHAV_RESERVED   0x000000c0 /* future use */

Definition at line 130 of file vm_map.h.

◆ MAP_ENTRY_BEHAV_SEQUENTIAL

#define MAP_ENTRY_BEHAV_SEQUENTIAL
Value:
0x00000040 /* expect sequential
access */

Definition at line 128 of file vm_map.h.

◆ MAP_ENTRY_COW

#define MAP_ENTRY_COW   0x00000004

Definition at line 122 of file vm_map.h.

◆ MAP_ENTRY_GROWS_DOWN

#define MAP_ENTRY_GROWS_DOWN   0x00001000 /* top-down stacks */

Definition at line 136 of file vm_map.h.

◆ MAP_ENTRY_GROWS_UP

#define MAP_ENTRY_GROWS_UP   0x00002000 /* bottom-up stacks */

Definition at line 137 of file vm_map.h.

◆ MAP_ENTRY_GUARD

#define MAP_ENTRY_GUARD   0x00010000

Definition at line 141 of file vm_map.h.

◆ MAP_ENTRY_HEADER

#define MAP_ENTRY_HEADER   0x00080000

Definition at line 144 of file vm_map.h.

◆ MAP_ENTRY_IN_TRANSITION

#define MAP_ENTRY_IN_TRANSITION
Value:
0x00000100 /* entry being
changed */

Definition at line 132 of file vm_map.h.

◆ MAP_ENTRY_IS_SUB_MAP

#define MAP_ENTRY_IS_SUB_MAP   0x00000002

Definition at line 121 of file vm_map.h.

◆ MAP_ENTRY_NEEDS_COPY

#define MAP_ENTRY_NEEDS_COPY   0x00000008

Definition at line 123 of file vm_map.h.

◆ MAP_ENTRY_NEEDS_WAKEUP

#define MAP_ENTRY_NEEDS_WAKEUP
Value:
0x00000200 /* waiters in
transition */

Definition at line 133 of file vm_map.h.

◆ MAP_ENTRY_NOCOREDUMP

#define MAP_ENTRY_NOCOREDUMP
Value:
0x00000400 /* don't include in
a core */

Definition at line 134 of file vm_map.h.

◆ MAP_ENTRY_NOFAULT

#define MAP_ENTRY_NOFAULT   0x00000010

Definition at line 124 of file vm_map.h.

◆ MAP_ENTRY_NOSYNC

#define MAP_ENTRY_NOSYNC   0x00000001

Definition at line 120 of file vm_map.h.

◆ MAP_ENTRY_SPLIT_BOUNDARY_MASK

#define MAP_ENTRY_SPLIT_BOUNDARY_MASK   0x00300000

Definition at line 146 of file vm_map.h.

◆ MAP_ENTRY_SPLIT_BOUNDARY_SHIFT

#define MAP_ENTRY_SPLIT_BOUNDARY_SHIFT   20

Definition at line 148 of file vm_map.h.

◆ MAP_ENTRY_STACK_GAP_DN

#define MAP_ENTRY_STACK_GAP_DN   0x00020000

Definition at line 142 of file vm_map.h.

◆ MAP_ENTRY_STACK_GAP_UP

#define MAP_ENTRY_STACK_GAP_UP   0x00040000

Definition at line 143 of file vm_map.h.

◆ MAP_ENTRY_USER_WIRED

#define MAP_ENTRY_USER_WIRED   0x00000020

Definition at line 125 of file vm_map.h.

◆ MAP_ENTRY_VN_EXEC

#define MAP_ENTRY_VN_EXEC   0x00000800 /* text vnode mapping */

Definition at line 135 of file vm_map.h.

◆ MAP_ENTRY_WIRE_SKIPPED

#define MAP_ENTRY_WIRE_SKIPPED   0x00004000

Definition at line 139 of file vm_map.h.

◆ MAP_ENTRY_WRITECNT

#define MAP_ENTRY_WRITECNT
Value:
0x00008000 /* tracked writeable
mapping */

Definition at line 140 of file vm_map.h.

◆ MAP_INHERIT_SHARE

#define MAP_INHERIT_SHARE   0x00000001

Definition at line 359 of file vm_map.h.

◆ MAP_IS_SUB_MAP

#define MAP_IS_SUB_MAP   0x04 /* has parent */

Definition at line 221 of file vm_map.h.

◆ MAP_NOFAULT

#define MAP_NOFAULT   0x00000004

Definition at line 361 of file vm_map.h.

◆ MAP_PREFAULT

#define MAP_PREFAULT   0x00000008

Definition at line 362 of file vm_map.h.

◆ MAP_PREFAULT_MADVISE

#define MAP_PREFAULT_MADVISE   0x00000200 /* from (user) madvise request */

Definition at line 368 of file vm_map.h.

◆ MAP_PREFAULT_PARTIAL

#define MAP_PREFAULT_PARTIAL   0x00000010

Definition at line 363 of file vm_map.h.

◆ MAP_REMAP

#define MAP_REMAP   0x00000800

Definition at line 370 of file vm_map.h.

◆ MAP_REPLENISH

#define MAP_REPLENISH   0x20 /* kmapent zone needs to be refilled */

Definition at line 224 of file vm_map.h.

◆ MAP_SPLIT_BOUNDARY_MASK

#define MAP_SPLIT_BOUNDARY_MASK   0x00180000

Definition at line 378 of file vm_map.h.

◆ MAP_SPLIT_BOUNDARY_SHIFT

#define MAP_SPLIT_BOUNDARY_SHIFT   19

Definition at line 380 of file vm_map.h.

◆ MAP_STACK_GROWS_DOWN

#define MAP_STACK_GROWS_DOWN   0x00001000

Definition at line 371 of file vm_map.h.

◆ MAP_STACK_GROWS_UP

#define MAP_STACK_GROWS_UP   0x00002000

Definition at line 372 of file vm_map.h.

◆ MAP_VN_EXEC

#define MAP_VN_EXEC   0x00040000

Definition at line 377 of file vm_map.h.

◆ MAP_WIREFUTURE

#define MAP_WIREFUTURE   0x01 /* wire all future pages */

Definition at line 219 of file vm_map.h.

◆ MAP_WRITECOUNT

#define MAP_WRITECOUNT   0x00000400

Definition at line 369 of file vm_map.h.

◆ MAP_WXORX

#define MAP_WXORX   0x40 /* enforce W^X */

Definition at line 225 of file vm_map.h.

◆ VM_FAULT_DIRTY

#define VM_FAULT_DIRTY   0x02 /* Dirty the page; use w/VM_PROT_COPY */

Definition at line 387 of file vm_map.h.

◆ VM_FAULT_NOFILL

#define VM_FAULT_NOFILL   0x04 /* Fail if the pager doesn't have a copy */

Definition at line 388 of file vm_map.h.

◆ VM_FAULT_NORMAL

#define VM_FAULT_NORMAL   0x00 /* Nothing special */

Definition at line 385 of file vm_map.h.

◆ VM_FAULT_READ_AHEAD_INIT

#define VM_FAULT_READ_AHEAD_INIT   15

Definition at line 395 of file vm_map.h.

◆ VM_FAULT_READ_AHEAD_MAX

#define VM_FAULT_READ_AHEAD_MAX   min(atop(maxphys) - 1, UINT8_MAX)

Definition at line 396 of file vm_map.h.

◆ VM_FAULT_READ_AHEAD_MIN

#define VM_FAULT_READ_AHEAD_MIN   7

Definition at line 394 of file vm_map.h.

◆ VM_FAULT_WIRE

#define VM_FAULT_WIRE   0x01 /* Wire the mapped page */

Definition at line 386 of file vm_map.h.

◆ VM_MAP_ENTRY_FOREACH

#define VM_MAP_ENTRY_FOREACH (   it,
  map 
)
Value:
for ((it) = vm_map_entry_first(map); \
(it) != &(map)->header; \
(it) = vm_map_entry_succ(it))
static vm_map_entry_t vm_map_entry_succ(vm_map_entry_t entry)
Definition: vm_map.h:492
static vm_map_entry_t vm_map_entry_first(vm_map_t map)
Definition: vm_map.h:485

Definition at line 505 of file vm_map.h.

◆ vm_map_lock

#define vm_map_lock (   map)    _vm_map_lock(map, LOCK_FILE, LOCK_LINE)

Definition at line 339 of file vm_map.h.

◆ vm_map_lock_downgrade

#define vm_map_lock_downgrade (   map)     _vm_map_lock_downgrade(map, LOCK_FILE, LOCK_LINE)

Definition at line 350 of file vm_map.h.

◆ vm_map_lock_read

#define vm_map_lock_read (   map)    _vm_map_lock_read(map, LOCK_FILE, LOCK_LINE)

Definition at line 343 of file vm_map.h.

◆ vm_map_lock_upgrade

#define vm_map_lock_upgrade (   map)     _vm_map_lock_upgrade(map, LOCK_FILE, LOCK_LINE)

Definition at line 348 of file vm_map.h.

◆ VM_MAP_PROTECT_SET_MAXPROT

#define VM_MAP_PROTECT_SET_MAXPROT   0x0002

Definition at line 511 of file vm_map.h.

◆ VM_MAP_PROTECT_SET_PROT

#define VM_MAP_PROTECT_SET_PROT   0x0001

Definition at line 510 of file vm_map.h.

◆ vm_map_trylock

#define vm_map_trylock (   map)    _vm_map_trylock(map, LOCK_FILE, LOCK_LINE)

Definition at line 345 of file vm_map.h.

◆ vm_map_trylock_read

#define vm_map_trylock_read (   map)     _vm_map_trylock_read(map, LOCK_FILE, LOCK_LINE)

Definition at line 346 of file vm_map.h.

◆ vm_map_unlock

#define vm_map_unlock (   map)    _vm_map_unlock(map, LOCK_FILE, LOCK_LINE)

Definition at line 340 of file vm_map.h.

◆ vm_map_unlock_and_wait

#define vm_map_unlock_and_wait (   map,
  timo 
)     _vm_map_unlock_and_wait(map, timo, LOCK_FILE, LOCK_LINE)

Definition at line 341 of file vm_map.h.

◆ vm_map_unlock_read

#define vm_map_unlock_read (   map)    _vm_map_unlock_read(map, LOCK_FILE, LOCK_LINE)

Definition at line 344 of file vm_map.h.

◆ VM_MAP_WIRE_HOLESOK

#define VM_MAP_WIRE_HOLESOK   2 /* region may have holes */

Definition at line 417 of file vm_map.h.

◆ VM_MAP_WIRE_NOHOLES

#define VM_MAP_WIRE_NOHOLES   0 /* region must not have holes */

Definition at line 416 of file vm_map.h.

◆ VM_MAP_WIRE_SYSTEM

#define VM_MAP_WIRE_SYSTEM   0 /* wiring in a kernel map */

Definition at line 413 of file vm_map.h.

◆ VM_MAP_WIRE_USER

#define VM_MAP_WIRE_USER   1 /* wiring in a user map */

Definition at line 414 of file vm_map.h.

◆ VM_MAP_WIRE_WRITE

#define VM_MAP_WIRE_WRITE   4 /* Validate writable. */

Definition at line 419 of file vm_map.h.

◆ VMFS_ALIGNED_SPACE

#define VMFS_ALIGNED_SPACE (   x)    ((x) << 8) /* find a range with fixed alignment */

Definition at line 408 of file vm_map.h.

◆ VMFS_ANY_SPACE

#define VMFS_ANY_SPACE   1 /* find a range with any alignment */

Definition at line 405 of file vm_map.h.

◆ VMFS_NO_SPACE

#define VMFS_NO_SPACE   0 /* don't find; use the given range */

Definition at line 404 of file vm_map.h.

◆ VMFS_OPTIMAL_SPACE

#define VMFS_OPTIMAL_SPACE   2 /* find a range with optimal alignment*/

Definition at line 406 of file vm_map.h.

◆ VMFS_SUPER_SPACE

#define VMFS_SUPER_SPACE   3 /* find a superpage-aligned range */

Definition at line 407 of file vm_map.h.

Typedef Documentation

◆ vm_eflags_t

typedef u_int vm_eflags_t

Definition at line 83 of file vm_map.h.

◆ vm_flags_t

typedef u_char vm_flags_t

Definition at line 82 of file vm_map.h.

◆ vm_map_entry_reader

typedef int vm_map_entry_reader(void *token, vm_map_entry_t addr, vm_map_entry_t dest)

Definition at line 421 of file vm_map.h.

Function Documentation

◆ _vm_map_lock()

void _vm_map_lock ( vm_map_t  map,
const char *  file,
int  line 
)

Definition at line 528 of file vm_map.c.

References vm_map::lock, vm_map::system_map, vm_map::system_mtx, and vm_map::timestamp.

◆ _vm_map_lock_downgrade()

void _vm_map_lock_downgrade ( vm_map_t  map,
const char *  file,
int  line 
)

◆ _vm_map_lock_read()

void _vm_map_lock_read ( vm_map_t  map,
const char *  file,
int  line 
)

Definition at line 680 of file vm_map.c.

References vm_map::lock, vm_map::system_map, and vm_map::system_mtx.

◆ _vm_map_lock_upgrade()

int _vm_map_lock_upgrade ( vm_map_t  map,
const char *  file,
int  line 
)

Definition at line 738 of file vm_map.c.

References vm_map::lock, vm_map::system_map, vm_map::system_mtx, vm_map::timestamp, and vm_map_process_deferred().

Here is the call graph for this function:

◆ _vm_map_trylock()

int _vm_map_trylock ( vm_map_t  map,
const char *  file,
int  line 
)

Definition at line 704 of file vm_map.c.

References vm_map::lock, vm_map::system_map, vm_map::system_mtx, and vm_map::timestamp.

◆ _vm_map_trylock_read()

int _vm_map_trylock_read ( vm_map_t  map,
const char *  file,
int  line 
)

Definition at line 717 of file vm_map.c.

References vm_map::lock, vm_map::system_map, and vm_map::system_mtx.

◆ _vm_map_unlock()

void _vm_map_unlock ( vm_map_t  map,
const char *  file,
int  line 
)

◆ _vm_map_unlock_and_wait()

int _vm_map_unlock_and_wait ( vm_map_t  map,
int  timo,
const char *  file,
int  line 
)

◆ _vm_map_unlock_read()

void _vm_map_unlock_read ( vm_map_t  map,
const char *  file,
int  line 
)

Definition at line 690 of file vm_map.c.

References vm_map::flags, vm_map::lock, MAP_REPLENISH, vm_map::system_map, vm_map::system_mtx, and vm_map_process_deferred().

Here is the call graph for this function:

◆ vm_map_busy()

void vm_map_busy ( vm_map_t  map)

Definition at line 846 of file vm_map.c.

References vm_map::busy, and VM_MAP_ASSERT_LOCKED.

Referenced by vm_map_wire_locked().

Here is the caller graph for this function:

◆ vm_map_check_protection()

boolean_t vm_map_check_protection ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end,
vm_prot_t  protection 
)

Definition at line 4012 of file vm_map.c.

References vm_map_entry::end, vm_map_entry::protection, vm_map_entry_succ(), and vm_map_lookup_entry().

Referenced by kern_munmap(), kernacc(), and useracc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_delete()

◆ vm_map_entry_behavior()

static __inline u_char vm_map_entry_behavior ( vm_map_entry_t  entry)
static

Definition at line 152 of file vm_map.h.

Referenced by vm_fault_getpages(), and vm_fault_readahead().

Here is the caller graph for this function:

◆ vm_map_entry_first()

static vm_map_entry_t vm_map_entry_first ( vm_map_t  map)
inlinestatic

Definition at line 485 of file vm_map.h.

◆ vm_map_entry_set_vnode_text()

void vm_map_entry_set_vnode_text ( vm_map_entry_t  entry,
bool  add 
)

Definition at line 539 of file vm_map.c.

References vm_object::backing_object, vm_map_entry::eflags, vm_object::flags, MAP_ENTRY_IS_SUB_MAP, MAP_ENTRY_VN_EXEC, OBJ_ANON, vm_map_entry::object, vm_map_object::vm_object, and vm_pager_getvp().

Referenced by vm_map_process_deferred(), and vmspace_fork().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_entry_succ()

◆ vm_map_entry_system_wired_count()

static __inline int vm_map_entry_system_wired_count ( vm_map_entry_t  entry)
static

Definition at line 166 of file vm_map.h.

Referenced by vm_map_delete().

Here is the caller graph for this function:

◆ vm_map_entry_user_wired_count()

static __inline int vm_map_entry_user_wired_count ( vm_map_entry_t  entry)
static

Definition at line 158 of file vm_map.h.

References vm_map_entry::eflags, and MAP_ENTRY_BEHAV_MASK.

◆ vm_map_find()

◆ vm_map_find_aligned()

int vm_map_find_aligned ( vm_map_t  map,
vm_offset_t *  addr,
vm_size_t  length,
vm_offset_t  max_addr,
vm_offset_t  alignment 
)

Definition at line 2061 of file vm_map.c.

◆ vm_map_find_min()

int vm_map_find_min ( vm_map_t  map,
vm_object_t  object,
vm_ooffset_t  offset,
vm_offset_t *  addr,
vm_size_t  length,
vm_offset_t  min_addr,
vm_offset_t  max_addr,
int  find_space,
vm_prot_t  prot,
vm_prot_t  max,
int  cow 
)

Definition at line 2241 of file vm_map.c.

References KERN_SUCCESS, and vm_map_find().

Referenced by vm_mmap_object().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_findspace()

◆ vm_map_fixed()

int vm_map_fixed ( vm_map_t  map,
vm_object_t  object,
vm_ooffset_t  offset,
vm_offset_t  start,
vm_size_t  length,
vm_prot_t  prot,
vm_prot_t  max,
int  cow 
)

Definition at line 1937 of file vm_map.c.

Referenced by vm_mmap_object().

Here is the caller graph for this function:

◆ vm_map_inherit()

int vm_map_inherit ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end,
vm_inherit_t  new_inheritance 
)

◆ vm_map_init()

void vm_map_init ( vm_map_t  map,
pmap_t  pmap,
vm_offset_t  min,
vm_offset_t  max 
)

Definition at line 912 of file vm_map.c.

References _vm_map_init(), vm_map::lock, and vm_map::system_mtx.

Referenced by kmem_init(), and kmem_subinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_insert()

int vm_map_insert ( vm_map_t  map,
vm_object_t  object,
vm_ooffset_t  offset,
vm_offset_t  start,
vm_offset_t  end,
vm_prot_t  prot,
vm_prot_t  max,
int  cow 
)

Definition at line 1608 of file vm_map.c.

References vm_map_entry::cred, vm_object::cred, vm_map_entry::eflags, vm_map_entry::end, ENTRY_CHARGED, vm_map::flags, vm_object::flags, vm_map_entry::inheritance, KERN_INVALID_ADDRESS, KERN_INVALID_ARGUMENT, KERN_NO_SPACE, KERN_PROTECTION_FAILURE, KERN_RESOURCE_SHORTAGE, KERN_SUCCESS, kernel_map, kernel_object, kernel_vm_end, MAP_ACC_CHARGED, MAP_ACC_NO_CHARGE, MAP_COPY_ON_WRITE, MAP_CREATE_GUARD, MAP_CREATE_STACK_GAP_DN, MAP_CREATE_STACK_GAP_UP, MAP_DISABLE_COREDUMP, MAP_DISABLE_SYNCER, MAP_ENTRY_COW, MAP_ENTRY_GROWS_DOWN, MAP_ENTRY_GROWS_UP, MAP_ENTRY_GUARD, MAP_ENTRY_NEEDS_COPY, MAP_ENTRY_NOCOREDUMP, MAP_ENTRY_NOFAULT, MAP_ENTRY_NOSYNC, MAP_ENTRY_SPLIT_BOUNDARY_SHIFT, MAP_ENTRY_STACK_GAP_DN, MAP_ENTRY_STACK_GAP_UP, MAP_ENTRY_USER_WIRED, MAP_ENTRY_VN_EXEC, MAP_ENTRY_WRITECNT, MAP_INHERIT_SHARE, MAP_NOFAULT, MAP_PREFAULT, MAP_PREFAULT_PARTIAL, MAP_SPLIT_BOUNDARY_MASK, MAP_SPLIT_BOUNDARY_SHIFT, MAP_STACK_GROWS_DOWN, MAP_STACK_GROWS_UP, MAP_VN_EXEC, MAP_WRITECOUNT, MAP_WXORX, vm_map_entry::max_protection, vm_map_entry::next_read, OBJ_ANON, OBJ_ONEMAPPING, vm_map_entry::object, OFF_TO_IDX, vm_map_entry::offset, pmap_growkernel(), vm_map_entry::protection, vm_map_entry::read_ahead, vm_object::ref_count, vm_object::shadow_count, vm_map::size, vm_map_entry::start, swap_reserve(), VM_FAULT_READ_AHEAD_INIT, VM_INHERIT_DEFAULT, VM_INHERIT_SHARE, VM_MAP_ASSERT_LOCKED, vm_map_entry_create(), vm_map_entry_link(), vm_map_entry_resize(), vm_map_entry_succ(), vm_map_lookup_entry(), vm_map_pmap_enter(), vm_map_range_valid(), vm_map_try_merge_entries(), vm_map_object::vm_object, vm_object_clear_flag(), vm_object_coalesce(), vm_object_reference(), VM_OBJECT_WLOCK, VM_OBJECT_WUNLOCK, VM_PROT_EXECUTE, VM_PROT_NONE, VM_PROT_WRITE, vm_map_entry::wired_count, and vm_map_entry::wiring_thread.

Referenced by kern_break(), kmap_alloc_wait(), kmapent_alloc(), kmem_init(), uma_startup2(), and vm_map_find().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_locked()

int vm_map_locked ( vm_map_t  map)

Definition at line 785 of file vm_map.c.

References vm_map::lock, vm_map::system_map, and vm_map::system_mtx.

Referenced by kmapent_alloc(), and vm_map_lookup_entry().

Here is the caller graph for this function:

◆ vm_map_lookup()

◆ vm_map_lookup_done()

void vm_map_lookup_done ( vm_map_t  map,
vm_map_entry_t  entry 
)

Definition at line 5159 of file vm_map.c.

Referenced by unlock_map(), and vm_fault_soft_fast().

Here is the caller graph for this function:

◆ vm_map_lookup_entry()

◆ vm_map_lookup_locked()

int vm_map_lookup_locked ( vm_map_t var_map,
vm_offset_t  vaddr,
vm_prot_t  fault_typea,
vm_map_entry_t out_entry,
vm_object_t object,
vm_pindex_t *  pindex,
vm_prot_t out_prot,
boolean_t *  wired 
)

◆ vm_map_madvise()

◆ vm_map_max()

static __inline vm_offset_t vm_map_max ( const struct vm_map map)
static

◆ vm_map_max_KBI()

vm_offset_t vm_map_max_KBI ( const struct vm_map map)

Definition at line 5168 of file vm_map.c.

References vm_map_unlock_read.

◆ vm_map_min()

static __inline vm_offset_t vm_map_min ( const struct vm_map map)
static

◆ vm_map_min_KBI()

vm_offset_t vm_map_min_KBI ( const struct vm_map map)

Definition at line 5175 of file vm_map.c.

References vm_map_max().

Here is the call graph for this function:

◆ vm_map_modflags()

static __inline void vm_map_modflags ( vm_map_t  map,
vm_flags_t  set,
vm_flags_t  clear 
)
static

Definition at line 257 of file vm_map.h.

References vm_map::pmap.

Referenced by sys_mlockall(), sys_munlockall(), vm_map_unbusy(), and vm_map_wait_busy().

Here is the caller graph for this function:

◆ vm_map_pmap()

static __inline pmap_t vm_map_pmap ( vm_map_t  map)
static

Definition at line 251 of file vm_map.h.

References vm_map_entry::end, and vm_map::header.

Referenced by kmem_subinit(), vm_map_delete(), and vm_swapout_map_deactivate_pages().

Here is the caller graph for this function:

◆ vm_map_pmap_KBI()

pmap_t vm_map_pmap_KBI ( vm_map_t  map)

Definition at line 5182 of file vm_map.c.

References vm_map_min().

Here is the call graph for this function:

◆ vm_map_protect()

◆ vm_map_range_valid()

static bool vm_map_range_valid ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end 
)
inlinestatic

Definition at line 263 of file vm_map.h.

References vm_map::flags.

Referenced by kern_madvise(), kern_mmap(), kern_munmap(), vm_fault_quick_hold_pages(), vm_map_find(), and vm_map_insert().

Here is the caller graph for this function:

◆ vm_map_range_valid_KBI()

bool vm_map_range_valid_KBI ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end 
)

Definition at line 5189 of file vm_map.c.

References vm_map::pmap.

◆ vm_map_remove()

int vm_map_remove ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end 
)

Definition at line 3986 of file vm_map.c.

References vm_map_delete(), vm_map_lock, VM_MAP_RANGE_CHECK, and vm_map_unlock.

Referenced by kmapent_free(), and vmspace_dofree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_stack()

int vm_map_stack ( vm_map_t  map,
vm_offset_t  addrbos,
vm_size_t  max_ssize,
vm_prot_t  prot,
vm_prot_t  max,
int  cow 
)

Definition at line 4455 of file vm_map.c.

◆ vm_map_startup()

void vm_map_startup ( void  )

Definition at line 259 of file vm_map.c.

References kmapent_alloc(), kmapent_free(), KMAPENT_RESERVE, kmapentzone, map_sleep_mtx, mapentzone, UMA_ALIGN_PTR, uma_prealloc(), uma_zcreate(), UMA_ZONE_NOBUCKET, UMA_ZONE_NOFREE, uma_zone_reserve(), uma_zone_set_allocf(), uma_zone_set_freef(), UMA_ZONE_VM, vmspace_zinit(), and vmspace_zone.

Referenced by vm_mem_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_submap()

int vm_map_submap ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end,
vm_map_t  submap 
)

◆ vm_map_sync()

◆ vm_map_try_merge_entries()

void vm_map_try_merge_entries ( vm_map_t  map,
vm_map_entry_t  prev,
vm_map_entry_t  entry 
)

Definition at line 2317 of file vm_map.c.

References vm_map_entry::eflags, MAP_ENTRY_NOMERGE_MASK, UNLINK_MERGE_NEXT, VM_MAP_ASSERT_LOCKED, vm_map_entry_unlink(), vm_map_mergeable_neighbors(), and vm_map_merged_neighbor_dispose().

Referenced by vm_map_inherit(), vm_map_insert(), vm_map_madvise(), vm_map_protect(), and vm_map_wire_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_unbusy()

void vm_map_unbusy ( vm_map_t  map)

Definition at line 854 of file vm_map.c.

References vm_map::busy, vm_map::flags, MAP_BUSY_WAKEUP, VM_MAP_ASSERT_LOCKED, and vm_map_modflags().

Referenced by vm_map_wire_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_unwire()

int vm_map_unwire ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end,
int  flags 
)

Definition at line 3215 of file vm_map.c.

Referenced by kern_munlock(), sys_munlockall(), and vsunlock().

Here is the caller graph for this function:

◆ vm_map_wait_busy()

void vm_map_wait_busy ( vm_map_t  map)

Definition at line 866 of file vm_map.c.

References vm_map::busy, vm_map::lock, MAP_BUSY_WAKEUP, vm_map::system_map, vm_map::system_mtx, vm_map::timestamp, VM_MAP_ASSERT_LOCKED, and vm_map_modflags().

Referenced by vm_map_protect(), and vmspace_fork().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vm_map_wakeup()

void vm_map_wakeup ( vm_map_t  map)

Definition at line 832 of file vm_map.c.

References map_sleep_mtx, and vm_map::root.

Referenced by kmap_free_wakeup(), and vm_map_wire_locked().

Here is the caller graph for this function:

◆ vm_map_wire()

int vm_map_wire ( vm_map_t  map,
vm_offset_t  start,
vm_offset_t  end,
int  flags 
)

Definition at line 3408 of file vm_map.c.

Referenced by kern_mlock(), sys_mlockall(), and vslock().

Here is the caller graph for this function:

◆ vm_map_wire_locked()

◆ vmspace_pmap()

static __inline pmap_t vmspace_pmap ( struct vmspace vmspace)
static

Definition at line 303 of file vm_map.h.

Referenced by kern_mincore(), vm_fault_prefault(), vmspace_alloc(), vmspace_dofree(), vmspace_exit(), vmspace_resident_count(), and vmspace_zinit().

Here is the caller graph for this function:

◆ vmspace_resident_count()

long vmspace_resident_count ( struct vmspace vmspace)

Definition at line 881 of file vm_map.c.

References pmap_resident_count, and vmspace_pmap().

Referenced by swapout(), and vm_daemon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vmspace_swap_count()