]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/vm_map.defs
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / mach / vm_map.defs
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
1c79356b
A
29 */
30/*
31 * @OSF_FREE_COPYRIGHT@
32 */
33/*
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58/*
59 */
60/*
91447636 61 * File: mach/vm_map.defs
1c79356b 62 *
91447636 63 * Exported (native-sized) kernel VM calls.
1c79356b
A
64 */
65
66subsystem
67#if KERNEL_SERVER
68 KernelServer
55e303ae 69#endif /* KERNEL_SERVER */
1c79356b
A
70 vm_map 3800;
71
72#include <mach/std_types.defs>
73#include <mach/mach_types.defs>
74#include <mach_debug/mach_debug_types.defs>
75
76/*
77 * Returns information about the contents of the virtual
78 * address space of the target task at the specified
79 * address. The returned protection, inheritance, sharing
80 * and memory object values apply to the entire range described
81 * by the address range returned; the memory object offset
82 * corresponds to the beginning of the address range.
83 * [If the specified address is not allocated, the next
84 * highest address range is described. If no addresses beyond
85 * the one specified are allocated, the call returns KERN_NO_SPACE.]
86 */
87routine vm_region(
88 target_task : vm_map_t;
89 inout address : vm_address_t;
90 out size : vm_size_t;
91 flavor : vm_region_flavor_t;
92 out info : vm_region_info_t, CountInOut;
93 out object_name : memory_object_name_t =
94 MACH_MSG_TYPE_MOVE_SEND
95 ctype: mach_port_t);
96
97/*
98 * Allocate zero-filled memory in the address space
99 * of the target task, either at the specified address,
100 * or wherever space can be found (if anywhere is TRUE),
101 * of the specified size. The address at which the
102 * allocation actually took place is returned.
103 */
104routine vm_allocate(
105 target_task : vm_task_entry_t;
106 inout address : vm_address_t;
107 size : vm_size_t;
108 flags : int);
109
110/*
111 * Deallocate the specified range from the virtual
112 * address space of the target task.
113 */
114routine vm_deallocate(
115 target_task : vm_task_entry_t;
116 address : vm_address_t;
117 size : vm_size_t);
118
119/*
120 * Set the current or maximum protection attribute
121 * for the specified range of the virtual address
122 * space of the target task. The current protection
123 * limits the memory access rights of threads within
124 * the task; the maximum protection limits the accesses
125 * that may be given in the current protection.
126 * Protections are specified as a set of {read, write, execute}
127 * *permissions*.
128 */
129routine vm_protect(
130 target_task : vm_task_entry_t;
131 address : vm_address_t;
132 size : vm_size_t;
133 set_maximum : boolean_t;
134 new_protection : vm_prot_t);
135
136/*
137 * Set the inheritance attribute for the specified range
138 * of the virtual address space of the target task.
139 * The inheritance value is one of {none, copy, share}, and
140 * specifies how the child address space should acquire
141 * this memory at the time of a task_create call.
142 */
143routine vm_inherit(
144 target_task : vm_task_entry_t;
145 address : vm_address_t;
146 size : vm_size_t;
147 new_inheritance : vm_inherit_t);
148
149/*
150 * Returns the contents of the specified range of the
151 * virtual address space of the target task. [The
152 * range must be aligned on a virtual page boundary,
153 * and must be a multiple of pages in extent. The
154 * protection on the specified range must permit reading.]
155 */
156routine vm_read(
157 target_task : vm_map_t;
158 address : vm_address_t;
159 size : vm_size_t;
160 out data : pointer_t);
161
162/*
163 * List corrollary to vm_read, returns mapped contents of specified
164 * ranges within target address space.
165 */
166routine vm_read_list(
167 target_task : vm_map_t;
168 inout data_list : vm_read_entry_t;
169 count : natural_t);
170
171/*
172 * Writes the contents of the specified range of the
173 * virtual address space of the target task. [The
174 * range must be aligned on a virtual page boundary,
175 * and must be a multiple of pages in extent. The
176 * protection on the specified range must permit writing.]
177 */
178routine vm_write(
179 target_task : vm_map_t;
180 address : vm_address_t;
181 data : pointer_t);
182
183/*
184 * Copy the contents of the source range of the virtual
185 * address space of the target task to the destination
186 * range in that same address space. [Both of the
187 * ranges must be aligned on a virtual page boundary,
188 * and must be multiples of pages in extent. The
189 * protection on the source range must permit reading,
190 * and the protection on the destination range must
191 * permit writing.]
192 */
193routine vm_copy(
194 target_task : vm_map_t;
195 source_address : vm_address_t;
196 size : vm_size_t;
197 dest_address : vm_address_t);
198
199/*
200 * Returns the contents of the specified range of the
201 * virtual address space of the target task. [There
202 * are no alignment restrictions, and the results will
203 * overwrite the area pointed to by data - which must
204 * already exist. The protection on the specified range
205 * must permit reading.]
206 */
207routine vm_read_overwrite(
208 target_task : vm_map_t;
209 address : vm_address_t;
210 size : vm_size_t;
211 data : vm_address_t;
212 out outsize : vm_size_t);
213
214
215routine vm_msync(
216 target_task : vm_map_t;
217 address : vm_address_t;
218 size : vm_size_t;
219 sync_flags : vm_sync_t );
220
221/*
222 * Set the paging behavior attribute for the specified range
223 * of the virtual address space of the target task.
224 * The behavior value is one of {default, random, forward
225 * sequential, reverse sequential} and indicates the expected
226 * page reference pattern for the specified range.
227 */
228routine vm_behavior_set(
229 target_task : vm_map_t;
230 address : vm_address_t;
231 size : vm_size_t;
232 new_behavior : vm_behavior_t);
233
234
235/*
236 * Map a user-defined memory object into the virtual address
237 * space of the target task. If desired (anywhere is TRUE),
238 * the kernel will find a suitable address range of the
239 * specified size; else, the specific address will be allocated.
240 *
241 * The beginning address of the range will be aligned on a virtual
242 * page boundary, be at or beyond the address specified, and
243 * meet the mask requirements (bits turned on in the mask must not
244 * be turned on in the result); the size of the range, in bytes,
245 * will be rounded up to an integral number of virtual pages.
246 *
247 * The memory in the resulting range will be associated with the
248 * specified memory object, with the beginning of the memory range
249 * referring to the specified offset into the memory object.
250 *
251 * The mapping will take the current and maximum protections and
252 * the inheritance attributes specified; see the vm_protect and
253 * vm_inherit calls for a description of these attributes.
254 *
255 * If desired (copy is TRUE), the memory range will be filled
256 * with a copy of the data from the memory object; this copy will
257 * be private to this mapping in this target task. Otherwise,
258 * the memory in this mapping will be shared with other mappings
259 * of the same memory object at the same offset (in this task or
260 * in other tasks). [The Mach kernel only enforces shared memory
261 * consistency among mappings on one host with similar page alignments.
262 * The user-defined memory manager for this object is responsible
263 * for further consistency.]
264 */
265routine vm_map(
266 target_task : vm_task_entry_t;
267 inout address : vm_address_t;
268 size : vm_size_t;
269 mask : vm_address_t;
270 flags : int;
0b4e3aa0 271 object : mem_entry_name_port_t;
1c79356b
A
272 offset : vm_offset_t;
273 copy : boolean_t;
274 cur_protection : vm_prot_t;
275 max_protection : vm_prot_t;
276 inheritance : vm_inherit_t);
277
278/*
279 * Set/Get special properties of memory associated
280 * to some virtual address range, such as cachability,
281 * migrability, replicability. Machine-dependent.
282 */
283routine vm_machine_attribute(
284 target_task : vm_map_t;
285 address : vm_address_t;
286 size : vm_size_t;
287 attribute : vm_machine_attribute_t;
288 inout value : vm_machine_attribute_val_t);
289
290/*
291 * Map portion of a task's address space.
292 */
293routine vm_remap(
294 target_task : vm_map_t;
295 inout target_address : vm_address_t;
296 size : vm_size_t;
297 mask : vm_address_t;
298 anywhere : boolean_t;
299 src_task : vm_map_t;
300 src_address : vm_address_t;
301 copy : boolean_t;
302 out cur_protection : vm_prot_t;
303 out max_protection : vm_prot_t;
304 inheritance : vm_inherit_t);
305
306/*
307 * Require that all future virtual memory allocation
308 * allocates wired memory. Setting must_wire to FALSE
309 * disables the wired future feature.
310 */
311routine task_wire(
312 target_task : vm_map_t;
313 must_wire : boolean_t);
314
315
316/*
317 * Allow application level processes to create named entries which
318 * correspond to mapped portions of their address space. These named
319 * entries can then be manipulated, shared with other processes in
320 * other address spaces and ultimately mapped in ohter address spaces
321 */
322
323routine mach_make_memory_entry(
324 target_task :vm_map_t;
325 inout size :vm_size_t;
326 offset :vm_offset_t;
327 permission :vm_prot_t;
91447636 328 out object_handle :mem_entry_name_port_move_send_t;
1c79356b
A
329 parent_entry :mem_entry_name_port_t);
330
331/*
332 * Give the caller information on the given location in a virtual
333 * address space. If a page is mapped return ref and dirty info.
334 */
335routine vm_map_page_query(
336 target_map :vm_map_t;
337 offset :vm_offset_t;
338 out disposition :integer_t;
339 out ref_count :integer_t);
340
341/*
342 * Returns information about a region of memory.
343 * Includes info about the chain of objects rooted at that region.
344 * Only available in MACH_VM_DEBUG compiled kernels,
345 * otherwise returns KERN_FAILURE.
346 */
347routine mach_vm_region_info(
348 task : vm_map_t;
349 address : vm_address_t;
350 out region : vm_info_region_t;
351 out objects : vm_info_object_array_t);
352
353routine vm_mapped_pages_info(
354 task : vm_map_t;
355 out pages : page_address_array_t);
356
91447636 357#if 0
1c79356b
A
358/*
359 * Allow application level processes to create named entries which
360 * are backed by sub-maps which describe regions of address space.
361 * These regions of space can have objects mapped into them and
362 * in turn, can be mapped into target address spaces
363 */
364
1c79356b
A
365routine vm_region_object_create(
366 target_task :vm_map_t;
367 in size :vm_size_t;
368 out region_object :mach_port_move_send_t);
91447636
A
369#else
370skip; /* was vm_region_object_create */
371#endif
1c79356b
A
372
373/*
374 * A recursive form of vm_region which probes submaps withint the
375 * address space.
376 */
377routine vm_region_recurse(
378 target_task : vm_map_t;
379 inout address : vm_address_t;
380 out size : vm_size_t;
381 inout nesting_depth : natural_t;
382 out info : vm_region_recurse_info_t,CountInOut);
383
384
385/*
386 * The routines below are temporary, meant for transitional use
387 * as their counterparts are moved from 32 to 64 bit data path
388 */
389
390
391routine vm_region_recurse_64(
392 target_task : vm_map_t;
393 inout address : vm_address_t;
394 out size : vm_size_t;
395 inout nesting_depth : natural_t;
91447636 396 out info : vm_region_recurse_info_t,CountInOut);
1c79356b
A
397
398routine mach_vm_region_info_64(
399 task : vm_map_t;
400 address : vm_address_t;
401 out region : vm_info_region_64_t;
402 out objects : vm_info_object_array_t);
403
404routine vm_region_64(
405 target_task : vm_map_t;
406 inout address : vm_address_t;
407 out size : vm_size_t;
408 flavor : vm_region_flavor_t;
91447636 409 out info : vm_region_info_t, CountInOut;
1c79356b
A
410 out object_name : memory_object_name_t =
411 MACH_MSG_TYPE_MOVE_SEND
412 ctype: mach_port_t);
413
414routine mach_make_memory_entry_64(
415 target_task :vm_map_t;
416 inout size :memory_object_size_t;
417 offset :memory_object_offset_t;
418 permission :vm_prot_t;
419 out object_handle :mach_port_move_send_t;
420 parent_entry :mem_entry_name_port_t);
421
422
423
424routine vm_map_64(
425 target_task : vm_task_entry_t;
426 inout address : vm_address_t;
427 size : vm_size_t;
428 mask : vm_address_t;
429 flags : int;
0b4e3aa0 430 object : mem_entry_name_port_t;
1c79356b
A
431 offset : memory_object_offset_t;
432 copy : boolean_t;
433 cur_protection : vm_prot_t;
434 max_protection : vm_prot_t;
435 inheritance : vm_inherit_t);
436
91447636
A
437#if 0
438/*
439 * The UPL interfaces are not ready for user-level export.
440 */
0b4e3aa0
A
441routine vm_map_get_upl(
442 target_task : vm_map_t;
443 address : vm_address_t;
444 inout size : vm_size_t;
445 out upl : upl_t;
446 out page_info : upl_page_info_array_t, CountInOut;
447 inout flags : integer_t;
448 force_data_sync : integer_t);
449
450routine vm_upl_map(
451 target_task : vm_map_t;
452 upl : upl_t;
453 inout address : vm_address_t);
454
455routine vm_upl_unmap(
456 target_task : vm_map_t;
457 upl : upl_t);
91447636
A
458#else
459skip; /* was vm_map_get_upl */
460skip; /* was vm_upl_map */
461skip; /* was vm_upl_unmap */
462#endif
463
464/*
465 * Control behavior and investigate state of a "purgable" object in
466 * the virtual address space of the target task. A purgable object is
467 * created via a call to vm_allocate() with VM_FLAGS_PURGABLE
468 * specified. See the routine implementation for a complete
469 * definition of the routine.
470 */
471routine vm_purgable_control(
472 target_task : vm_map_t;
473 address : vm_address_t;
474 control : vm_purgable_t;
475 inout state : int);
476
0b4e3aa0 477