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