45 |
struct vm_map *map; /* Submap */ |
struct vm_map *map; /* Submap */ |
46 |
vm_address_t start; /* Start address for entry. */ |
vm_address_t start; /* Start address for entry. */ |
47 |
vm_address_t end; /* End address for entry. */ |
vm_address_t end; /* End address for entry. */ |
48 |
|
vm_address_t offset; /* Offset into object. */ |
49 |
vm_prot_t protection; /* Protection bits. */ |
vm_prot_t protection; /* Protection bits. */ |
50 |
vm_prot_t max_protection; /* Maximum protection bits. */ |
vm_prot_t max_protection; /* Maximum protection bits. */ |
51 |
vm_inherit_t inherit; /* Inherit flags. */ |
vm_inherit_t inherit; /* Inherit flags. */ |
80 |
#define VM_MAP_KERNEL() (map_kernel) |
#define VM_MAP_KERNEL() (map_kernel) |
81 |
|
|
82 |
/* Initialize the VM map part of the VM system. */ |
/* Initialize the VM map part of the VM system. */ |
|
|
|
83 |
extern void vm_map_init (void); |
extern void vm_map_init (void); |
84 |
|
|
85 |
/* Create a new VM map object. PMAP is the physical map that will |
/* Create a new VM map object. PMAP is the physical map that will |
86 |
belong to this address space. MIN and MAX specifies the limit of |
belong to this address space. MIN and MAX specifies the limit of |
87 |
the address space. Returns NULL if we fail to allocate memory. */ |
the address space. Returns NULL if we fail to allocate memory. */ |
|
|
|
88 |
extern struct vm_map *vm_map_create (struct pmap *pmap, vm_address_t min, |
extern struct vm_map *vm_map_create (struct pmap *pmap, vm_address_t min, |
89 |
vm_address_t max); |
vm_address_t max); |
90 |
|
|
91 |
|
|
92 |
/* Release reference to MAP. If reference counter drops to zero, |
/* Release reference to MAP. If reference counter drops to zero, |
93 |
release all resourecs held by map. */ |
release all resourecs held by map. */ |
|
|
|
94 |
extern void vm_map_release (struct vm_map *map); |
extern void vm_map_release (struct vm_map *map); |
95 |
|
|
96 |
|
/* Obtail a reference to MAP. */ |
97 |
|
extern void vm_map_reference (struct vm_map *map); |
98 |
|
|
99 |
/* Fork SRC_MAP. Return clone of it. We loop though all the map entries |
/* Fork SRC_MAP. Return clone of it. We loop though all the map entries |
100 |
and clone them according to the inherit flag. */ |
and clone them according to the inherit flag. */ |
|
|
|
101 |
extern struct vm_map *vm_map_fork (struct vm_map *src_map); |
extern struct vm_map *vm_map_fork (struct vm_map *src_map); |
102 |
|
|
103 |
/* Insert OBJECT at OFFSET in MAP. SIZE is the size of the object. |
/* Insert OBJECT at OFFSET in MAP. SIZE is the size of the object. |
104 |
MAX_PROTECTON and PROTECTION is pretty much self-explaining. */ |
MAX_PROTECTON and PROTECTION is pretty much self-explaining. */ |
|
|
|
105 |
extern kern_return_t vm_map_enter (struct vm_map *map, vm_address_t offset, |
extern kern_return_t vm_map_enter (struct vm_map *map, vm_address_t offset, |
106 |
vm_size_t size, struct vm_object *object, |
vm_size_t size, struct vm_object *object, |
107 |
vm_prot_t max_protection, |
vm_prot_t max_protection, |
112 |
false we try to insert OBJECT at *OFFSETP, otherwise the new offset |
false we try to insert OBJECT at *OFFSETP, otherwise the new offset |
113 |
for OBJECT is return in *OFFSETP. SIZE is the size of the object. |
for OBJECT is return in *OFFSETP. SIZE is the size of the object. |
114 |
MAX_PROTECTON and PROTECTION is pretty much self-explaining. */ |
MAX_PROTECTON and PROTECTION is pretty much self-explaining. */ |
115 |
|
extern kern_return_t vm_map_allocate (struct vm_map *map, |
116 |
extern kern_return_t vm_map_allocate (struct vm_map *map, vm_address_t *offsetp, |
vm_address_t *offsetp, |
117 |
vm_size_t size, struct vm_object *object, |
vm_size_t size, |
118 |
|
struct vm_object *object, |
119 |
vm_prot_t max_protection, |
vm_prot_t max_protection, |
120 |
vm_prot_t protection, vm_inherit_t inherit, |
vm_prot_t protection, |
121 |
|
vm_inherit_t inherit, |
122 |
bool anywhere_p); |
bool anywhere_p); |
123 |
|
|
124 |
|
/* Deallocate range [OFFSET, OFFSET+SIZE) from MAP. */ |
125 |
|
extern kern_return_t vm_map_deallocate (struct vm_map *map, |
126 |
|
vm_offset_t offset, vm_size_t size); |
127 |
|
|
128 |
|
/* Sets the protection for address region [START, START+SIZE) in MAP. |
129 |
|
If SETMAX_P is specified, the maximum protection is to be set; |
130 |
|
otherwise, only the current protection is affected. */ |
131 |
|
extern kern_return_t vm_map_protect (struct vm_map *map, vm_offset_t start, |
132 |
|
vm_size_t size, vm_prot_t new_prot, |
133 |
|
int setmax_p); |
134 |
|
|
135 |
/* Function searches for a entry located at OFFSET in MAP. If found, |
/* Function searches for a entry located at OFFSET in MAP. If found, |
136 |
information about it is returned in OBJECTP, ADDRESSP, PROTP and |
information about it is returned in OBJECTP, ADDRESSP, PROTP and |
137 |
WIREDP. ENTRYP is a pointer to the entry structure. */ |
WIREDP. ENTRYP is a pointer to the entry structure. */ |
|
|
|
138 |
extern kern_return_t vm_map_lookup (struct vm_map **map, vm_address_t offset, |
extern kern_return_t vm_map_lookup (struct vm_map **map, vm_address_t offset, |
139 |
vm_prot_t fault_prot, |
vm_prot_t fault_prot, |
140 |
struct vm_object **objectp, |
struct vm_object **objectp, |
141 |
vm_address_t *addressp, vm_prot_t *protp, |
vm_address_t *addressp, vm_prot_t *protp, |
142 |
bool *wiredp, struct vm_map_entry **entryp); |
bool *wiredp, |
143 |
|
struct vm_map_entry **entryp); |
144 |
|
|
145 |
|
/* Copyin region [OFFSET, OFFSET+SIZE) into a holding map that is returned. |
146 |
|
If DEALLOCATE_P is true we deallocate region in SRC_MAP. */ |
147 |
|
extern struct vm_map *vm_map_copyin (struct vm_map *src_map, |
148 |
|
vm_offset_t offset, vm_size_t size, |
149 |
|
int deallocate_p); |
150 |
|
|
151 |
#endif /* KERN_VM_MAP_H */ |
#endif /* KERN_VM_MAP_H */ |