| VM_MAP(9) | Kernel Developer's Manual | VM_MAP(9) |
vm_map — virtual
address space portion of virtual memory subsystem
#include
<sys/param.h>
#include <vm/vm.h>
#include <vm/vm_map.h>
The vm_map subsystem is used to manage
virtual address spaces. This section describes the main data structures used
within the code.
The struct vm_map is a generic representation of an address space. This address space may belong to a user process or the kernel. The kernel actually uses several maps, which are maintained as subordinate maps, created using the vm_map_submap(9) function.
struct vm_map {
struct vm_map_entry header;
struct sx lock;
struct mtx system_mtx;
int nentries;
vm_size_t size;
u_int timestamp;
u_char needs_wakeup;
u_char system_map;
vm_flags_t flags;
vm_map_entry_t root;
pmap_t pmap;
int busy;
};
The fields of struct vm_map are as follows:
Possible map flags:
MAP_WIREFUTUREMAP_BUSY_WAKEUPThe following flags can be passed to vm_map_find(9) and vm_map_insert(9) to specify the copy-on-write properties of regions within the map:
MAP_COPY_ON_WRITEMAP_NOFAULTMAP_PREFAULTMAP_PREFAULT_PARTIALMAP_DISABLE_SYNCERMAP_DISABLE_COREDUMPMAP_PREFAULT_MADVISEMAP_ACC_CHARGEDMAP_ACC_NO_CHARGEThe struct vm_map_entry is a generic representation of a region. The region managed by each entry is associated with a union vm_map_object, described below.
struct vm_map_entry {
struct vm_map_entry *prev;
struct vm_map_entry *next;
struct vm_map_entry *left;
struct vm_map_entry *right;
vm_offset_t start;
vm_offset_t end;
vm_offset_t avail_ssize;
vm_size_t adj_free;
vm_size_t max_free;
union vm_map_object object;
vm_ooffset_t offset;
vm_eflags_t eflags;
/* Only in task maps: */
vm_prot_t protection;
vm_prot_t max_protection;
vm_inherit_t inheritance;
int wired_count;
vm_pindex_t lastr;
};
The fields of struct vm_map_entry are as follows:
The following five members are only valid for entries forming part of a user process's address space:
The following flags may be applied to each entry, by specifying them as a mask within the eflags member:
MAP_ENTRY_NOSYNCMAP_ENTRY_IS_SUB_MAPMAP_ENTRY_COWMAP_ENTRY_NEEDS_COPYMAP_ENTRY_NOFAULTMAP_ENTRY_USER_WIREDMAP_ENTRY_BEHAV_NORMALMAP_ENTRY_BEHAV_SEQUENTIALMAP_ENTRY_BEHAV_RANDOMMAP_ENTRY_IN_TRANSITIONMAP_ENTRY_NEEDS_WAKEUPMAP_ENTRY_NOCOREDUMPThe inheritance member has type vm_inherit_t. This governs the inheritance behaviour for a map entry during fork processing. The following values are defined for vm_inherit_t:
VM_INHERIT_SHAREVM_INHERIT_COPYVM_INHERIT_NONEVM_INHERIT_DEFAULTVM_INHERIT_COPY.The union vm_map_object is used to specify the structure which a struct vm_map_entry is associated with.
The fields of union vm_map_object are as follows:
union vm_map_object {
struct vm_object *vm_object;
struct vm_map *sub_map;
};
Normally, the sub_map member is only used by system maps to indicate that a memory range is managed by a subordinate system map. Within a user process map, each struct vm_map_entry is backed by a struct vm_object.
pmap(9), vm_map_check_protection(9), vm_map_create(9), vm_map_delete(9), vm_map_entry_resize_free(9), vm_map_find(9), vm_map_findspace(9), vm_map_inherit(9), vm_map_init(9), vm_map_insert(9), vm_map_lock(9), vm_map_lookup(9), vm_map_madvise(9), vm_map_max(9), vm_map_min(9), vm_map_pmap(9), vm_map_protect(9), vm_map_remove(9), vm_map_simplify_entry(9), vm_map_stack(9), vm_map_submap(9), vm_map_sync(9), vm_map_wire(9)
This manual page was written by Bruce M Simpson <bms@spc.org>.
| July 3, 2018 | Debian |