]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/vm_map.defs
xnu-4570.71.2.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 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
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 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.
8f6c56a5 14 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
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/*
91447636 59 * File: mach/vm_map.defs
1c79356b 60 *
91447636 61 * Exported (native-sized) kernel VM calls.
1c79356b
A
62 */
63
64subsystem
65#if KERNEL_SERVER
66 KernelServer
55e303ae 67#endif /* KERNEL_SERVER */
1c79356b
A
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
5ba3f43e 74#define CONCAT(a,b) a ## b
316670eb 75#if !KERNEL && !LIBSYSCALL_INTERFACE
5ba3f43e 76#define PREFIX(NAME) CONCAT(_kernelrpc_, NAME)
316670eb
A
77#else
78#define PREFIX(NAME) NAME
79#endif
80
5ba3f43e
A
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
1c79356b
A
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 */
98routine 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 */
316670eb
A
115
116#if !KERNEL && !LIBSYSCALL_INTERFACE
117skip;
118#else
5ba3f43e 119routine PREFIX(KERNEL_SERVER_SUFFIX(vm_allocate))(
1c79356b
A
120 target_task : vm_task_entry_t;
121 inout address : vm_address_t;
122 size : vm_size_t;
123 flags : int);
124
316670eb
A
125#endif
126
1c79356b
A
127/*
128 * Deallocate the specified range from the virtual
129 * address space of the target task.
130 */
316670eb
A
131
132#if !KERNEL && !LIBSYSCALL_INTERFACE
133skip;
134#else
135routine PREFIX(vm_deallocate)(
1c79356b
A
136 target_task : vm_task_entry_t;
137 address : vm_address_t;
138 size : vm_size_t);
139
316670eb
A
140#endif
141
1c79356b
A
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 */
316670eb
A
152
153#if !KERNEL && !LIBSYSCALL_INTERFACE
154skip;
155#else
156routine PREFIX(vm_protect)(
1c79356b
A
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);
316670eb 162#endif
1c79356b
A
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 */
171routine 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 */
39236c6e 184routine PREFIX(vm_read) (
1c79356b
A
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 */
194routine 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 */
206routine 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 */
221routine 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 */
235routine 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
243routine 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 */
256routine 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 */
5ba3f43e 293routine PREFIX(KERNEL_SERVER_SUFFIX(vm_map)) (
1c79356b
A
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;
0b4e3aa0 299 object : mem_entry_name_port_t;
1c79356b
A
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 */
311routine 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 */
5ba3f43e 321routine PREFIX(KERNEL_SERVER_SUFFIX(vm_remap)) (
1c79356b
A
322 target_task : vm_map_t;
323 inout target_address : vm_address_t;
324 size : vm_size_t;
325 mask : vm_address_t;
060df5ea 326 flags : int;
1c79356b
A
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 */
339routine 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
351routine 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;
91447636 356 out object_handle :mem_entry_name_port_move_send_t;
1c79356b
A
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 */
363routine 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 */
375routine 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
381routine vm_mapped_pages_info(
382 task : vm_map_t;
383 out pages : page_address_array_t);
384
91447636 385#if 0
1c79356b
A
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
1c79356b
A
393routine 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);
91447636
A
397#else
398skip; /* was vm_region_object_create */
399#endif
1c79356b
A
400
401/*
402 * A recursive form of vm_region which probes submaps withint the
403 * address space.
404 */
405routine 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
419routine 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;
91447636 424 out info : vm_region_recurse_info_t,CountInOut);
1c79356b
A
425
426routine 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
432routine 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;
91447636 437 out info : vm_region_info_t, CountInOut;
1c79356b
A
438 out object_name : memory_object_name_t =
439 MACH_MSG_TYPE_MOVE_SEND
440 ctype: mach_port_t);
441
442routine 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
5ba3f43e 452routine KERNEL_SERVER_SUFFIX(vm_map_64)(
1c79356b
A
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;
0b4e3aa0 458 object : mem_entry_name_port_t;
1c79356b
A
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
91447636
A
465#if 0
466/*
467 * The UPL interfaces are not ready for user-level export.
468 */
0b4e3aa0
A
469routine vm_map_get_upl(
470 target_task : vm_map_t;
2d21ac55 471 address : vm_map_offset_t;
0b4e3aa0
A
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
478routine vm_upl_map(
479 target_task : vm_map_t;
480 upl : upl_t;
481 inout address : vm_address_t);
482
483routine vm_upl_unmap(
484 target_task : vm_map_t;
485 upl : upl_t);
91447636
A
486#else
487skip; /* was vm_map_get_upl */
488skip; /* was vm_upl_map */
489skip; /* 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 */
39037602 499routine PREFIX(vm_purgable_control) (
91447636
A
500 target_task : vm_map_t;
501 address : vm_address_t;
502 control : vm_purgable_t;
503 inout state : int);
504
a39ff7e2
A
505
506routine vm_map_exec_lockdown(
507 target_task : vm_map_t);
508
509
2d21ac55 510/* vim: set ft=c : */