]>
Commit | Line | Data |
---|---|---|
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 | ||
64 | subsystem | |
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 | ||
316670eb A |
74 | #if !KERNEL && !LIBSYSCALL_INTERFACE |
75 | #define PREFIX(NAME) _kernelrpc_ ## NAME | |
76 | #else | |
77 | #define PREFIX(NAME) NAME | |
78 | #endif | |
79 | ||
1c79356b A |
80 | /* |
81 | * Returns information about the contents of the virtual | |
82 | * address space of the target task at the specified | |
83 | * address. The returned protection, inheritance, sharing | |
84 | * and memory object values apply to the entire range described | |
85 | * by the address range returned; the memory object offset | |
86 | * corresponds to the beginning of the address range. | |
87 | * [If the specified address is not allocated, the next | |
88 | * highest address range is described. If no addresses beyond | |
89 | * the one specified are allocated, the call returns KERN_NO_SPACE.] | |
90 | */ | |
91 | routine vm_region( | |
92 | target_task : vm_map_t; | |
93 | inout address : vm_address_t; | |
94 | out size : vm_size_t; | |
95 | flavor : vm_region_flavor_t; | |
96 | out info : vm_region_info_t, CountInOut; | |
97 | out object_name : memory_object_name_t = | |
98 | MACH_MSG_TYPE_MOVE_SEND | |
99 | ctype: mach_port_t); | |
100 | ||
101 | /* | |
102 | * Allocate zero-filled memory in the address space | |
103 | * of the target task, either at the specified address, | |
104 | * or wherever space can be found (if anywhere is TRUE), | |
105 | * of the specified size. The address at which the | |
106 | * allocation actually took place is returned. | |
107 | */ | |
316670eb A |
108 | |
109 | #if !KERNEL && !LIBSYSCALL_INTERFACE | |
110 | skip; | |
111 | #else | |
112 | routine PREFIX(vm_allocate)( | |
1c79356b A |
113 | target_task : vm_task_entry_t; |
114 | inout address : vm_address_t; | |
115 | size : vm_size_t; | |
116 | flags : int); | |
117 | ||
316670eb A |
118 | #endif |
119 | ||
1c79356b A |
120 | /* |
121 | * Deallocate the specified range from the virtual | |
122 | * address space of the target task. | |
123 | */ | |
316670eb A |
124 | |
125 | #if !KERNEL && !LIBSYSCALL_INTERFACE | |
126 | skip; | |
127 | #else | |
128 | routine PREFIX(vm_deallocate)( | |
1c79356b A |
129 | target_task : vm_task_entry_t; |
130 | address : vm_address_t; | |
131 | size : vm_size_t); | |
132 | ||
316670eb A |
133 | #endif |
134 | ||
1c79356b A |
135 | /* |
136 | * Set the current or maximum protection attribute | |
137 | * for the specified range of the virtual address | |
138 | * space of the target task. The current protection | |
139 | * limits the memory access rights of threads within | |
140 | * the task; the maximum protection limits the accesses | |
141 | * that may be given in the current protection. | |
142 | * Protections are specified as a set of {read, write, execute} | |
143 | * *permissions*. | |
144 | */ | |
316670eb A |
145 | |
146 | #if !KERNEL && !LIBSYSCALL_INTERFACE | |
147 | skip; | |
148 | #else | |
149 | routine PREFIX(vm_protect)( | |
1c79356b A |
150 | target_task : vm_task_entry_t; |
151 | address : vm_address_t; | |
152 | size : vm_size_t; | |
153 | set_maximum : boolean_t; | |
154 | new_protection : vm_prot_t); | |
316670eb | 155 | #endif |
1c79356b A |
156 | |
157 | /* | |
158 | * Set the inheritance attribute for the specified range | |
159 | * of the virtual address space of the target task. | |
160 | * The inheritance value is one of {none, copy, share}, and | |
161 | * specifies how the child address space should acquire | |
162 | * this memory at the time of a task_create call. | |
163 | */ | |
164 | routine vm_inherit( | |
165 | target_task : vm_task_entry_t; | |
166 | address : vm_address_t; | |
167 | size : vm_size_t; | |
168 | new_inheritance : vm_inherit_t); | |
169 | ||
170 | /* | |
171 | * Returns the contents of the specified range of the | |
172 | * virtual address space of the target task. [The | |
173 | * range must be aligned on a virtual page boundary, | |
174 | * and must be a multiple of pages in extent. The | |
175 | * protection on the specified range must permit reading.] | |
176 | */ | |
39236c6e | 177 | routine PREFIX(vm_read) ( |
1c79356b A |
178 | target_task : vm_map_t; |
179 | address : vm_address_t; | |
180 | size : vm_size_t; | |
181 | out data : pointer_t); | |
182 | ||
183 | /* | |
184 | * List corrollary to vm_read, returns mapped contents of specified | |
185 | * ranges within target address space. | |
186 | */ | |
187 | routine vm_read_list( | |
188 | target_task : vm_map_t; | |
189 | inout data_list : vm_read_entry_t; | |
190 | count : natural_t); | |
191 | ||
192 | /* | |
193 | * Writes the contents of the specified range of the | |
194 | * virtual address space of the target task. [The | |
195 | * range must be aligned on a virtual page boundary, | |
196 | * and must be a multiple of pages in extent. The | |
197 | * protection on the specified range must permit writing.] | |
198 | */ | |
199 | routine vm_write( | |
200 | target_task : vm_map_t; | |
201 | address : vm_address_t; | |
202 | data : pointer_t); | |
203 | ||
204 | /* | |
205 | * Copy the contents of the source range of the virtual | |
206 | * address space of the target task to the destination | |
207 | * range in that same address space. [Both of the | |
208 | * ranges must be aligned on a virtual page boundary, | |
209 | * and must be multiples of pages in extent. The | |
210 | * protection on the source range must permit reading, | |
211 | * and the protection on the destination range must | |
212 | * permit writing.] | |
213 | */ | |
214 | routine vm_copy( | |
215 | target_task : vm_map_t; | |
216 | source_address : vm_address_t; | |
217 | size : vm_size_t; | |
218 | dest_address : vm_address_t); | |
219 | ||
220 | /* | |
221 | * Returns the contents of the specified range of the | |
222 | * virtual address space of the target task. [There | |
223 | * are no alignment restrictions, and the results will | |
224 | * overwrite the area pointed to by data - which must | |
225 | * already exist. The protection on the specified range | |
226 | * must permit reading.] | |
227 | */ | |
228 | routine vm_read_overwrite( | |
229 | target_task : vm_map_t; | |
230 | address : vm_address_t; | |
231 | size : vm_size_t; | |
232 | data : vm_address_t; | |
233 | out outsize : vm_size_t); | |
234 | ||
235 | ||
236 | routine vm_msync( | |
237 | target_task : vm_map_t; | |
238 | address : vm_address_t; | |
239 | size : vm_size_t; | |
240 | sync_flags : vm_sync_t ); | |
241 | ||
242 | /* | |
243 | * Set the paging behavior attribute for the specified range | |
244 | * of the virtual address space of the target task. | |
245 | * The behavior value is one of {default, random, forward | |
246 | * sequential, reverse sequential} and indicates the expected | |
247 | * page reference pattern for the specified range. | |
248 | */ | |
249 | routine vm_behavior_set( | |
250 | target_task : vm_map_t; | |
251 | address : vm_address_t; | |
252 | size : vm_size_t; | |
253 | new_behavior : vm_behavior_t); | |
254 | ||
255 | ||
256 | /* | |
257 | * Map a user-defined memory object into the virtual address | |
258 | * space of the target task. If desired (anywhere is TRUE), | |
259 | * the kernel will find a suitable address range of the | |
260 | * specified size; else, the specific address will be allocated. | |
261 | * | |
262 | * The beginning address of the range will be aligned on a virtual | |
263 | * page boundary, be at or beyond the address specified, and | |
264 | * meet the mask requirements (bits turned on in the mask must not | |
265 | * be turned on in the result); the size of the range, in bytes, | |
266 | * will be rounded up to an integral number of virtual pages. | |
267 | * | |
268 | * The memory in the resulting range will be associated with the | |
269 | * specified memory object, with the beginning of the memory range | |
270 | * referring to the specified offset into the memory object. | |
271 | * | |
272 | * The mapping will take the current and maximum protections and | |
273 | * the inheritance attributes specified; see the vm_protect and | |
274 | * vm_inherit calls for a description of these attributes. | |
275 | * | |
276 | * If desired (copy is TRUE), the memory range will be filled | |
277 | * with a copy of the data from the memory object; this copy will | |
278 | * be private to this mapping in this target task. Otherwise, | |
279 | * the memory in this mapping will be shared with other mappings | |
280 | * of the same memory object at the same offset (in this task or | |
281 | * in other tasks). [The Mach kernel only enforces shared memory | |
282 | * consistency among mappings on one host with similar page alignments. | |
283 | * The user-defined memory manager for this object is responsible | |
284 | * for further consistency.] | |
285 | */ | |
39236c6e | 286 | routine PREFIX(vm_map) ( |
1c79356b A |
287 | target_task : vm_task_entry_t; |
288 | inout address : vm_address_t; | |
289 | size : vm_size_t; | |
290 | mask : vm_address_t; | |
291 | flags : int; | |
0b4e3aa0 | 292 | object : mem_entry_name_port_t; |
1c79356b A |
293 | offset : vm_offset_t; |
294 | copy : boolean_t; | |
295 | cur_protection : vm_prot_t; | |
296 | max_protection : vm_prot_t; | |
297 | inheritance : vm_inherit_t); | |
298 | ||
299 | /* | |
300 | * Set/Get special properties of memory associated | |
301 | * to some virtual address range, such as cachability, | |
302 | * migrability, replicability. Machine-dependent. | |
303 | */ | |
304 | routine vm_machine_attribute( | |
305 | target_task : vm_map_t; | |
306 | address : vm_address_t; | |
307 | size : vm_size_t; | |
308 | attribute : vm_machine_attribute_t; | |
309 | inout value : vm_machine_attribute_val_t); | |
310 | ||
311 | /* | |
312 | * Map portion of a task's address space. | |
313 | */ | |
39236c6e | 314 | routine PREFIX(vm_remap) ( |
1c79356b A |
315 | target_task : vm_map_t; |
316 | inout target_address : vm_address_t; | |
317 | size : vm_size_t; | |
318 | mask : vm_address_t; | |
060df5ea | 319 | flags : int; |
1c79356b A |
320 | src_task : vm_map_t; |
321 | src_address : vm_address_t; | |
322 | copy : boolean_t; | |
323 | out cur_protection : vm_prot_t; | |
324 | out max_protection : vm_prot_t; | |
325 | inheritance : vm_inherit_t); | |
326 | ||
327 | /* | |
328 | * Require that all future virtual memory allocation | |
329 | * allocates wired memory. Setting must_wire to FALSE | |
330 | * disables the wired future feature. | |
331 | */ | |
332 | routine task_wire( | |
333 | target_task : vm_map_t; | |
334 | must_wire : boolean_t); | |
335 | ||
336 | ||
337 | /* | |
338 | * Allow application level processes to create named entries which | |
339 | * correspond to mapped portions of their address space. These named | |
340 | * entries can then be manipulated, shared with other processes in | |
341 | * other address spaces and ultimately mapped in ohter address spaces | |
342 | */ | |
343 | ||
344 | routine mach_make_memory_entry( | |
345 | target_task :vm_map_t; | |
346 | inout size :vm_size_t; | |
347 | offset :vm_offset_t; | |
348 | permission :vm_prot_t; | |
91447636 | 349 | out object_handle :mem_entry_name_port_move_send_t; |
1c79356b A |
350 | parent_entry :mem_entry_name_port_t); |
351 | ||
352 | /* | |
353 | * Give the caller information on the given location in a virtual | |
354 | * address space. If a page is mapped return ref and dirty info. | |
355 | */ | |
356 | routine vm_map_page_query( | |
357 | target_map :vm_map_t; | |
358 | offset :vm_offset_t; | |
359 | out disposition :integer_t; | |
360 | out ref_count :integer_t); | |
361 | ||
362 | /* | |
363 | * Returns information about a region of memory. | |
364 | * Includes info about the chain of objects rooted at that region. | |
365 | * Only available in MACH_VM_DEBUG compiled kernels, | |
366 | * otherwise returns KERN_FAILURE. | |
367 | */ | |
368 | routine mach_vm_region_info( | |
369 | task : vm_map_t; | |
370 | address : vm_address_t; | |
371 | out region : vm_info_region_t; | |
372 | out objects : vm_info_object_array_t); | |
373 | ||
374 | routine vm_mapped_pages_info( | |
375 | task : vm_map_t; | |
376 | out pages : page_address_array_t); | |
377 | ||
91447636 | 378 | #if 0 |
1c79356b A |
379 | /* |
380 | * Allow application level processes to create named entries which | |
381 | * are backed by sub-maps which describe regions of address space. | |
382 | * These regions of space can have objects mapped into them and | |
383 | * in turn, can be mapped into target address spaces | |
384 | */ | |
385 | ||
1c79356b A |
386 | routine vm_region_object_create( |
387 | target_task :vm_map_t; | |
388 | in size :vm_size_t; | |
389 | out region_object :mach_port_move_send_t); | |
91447636 A |
390 | #else |
391 | skip; /* was vm_region_object_create */ | |
392 | #endif | |
1c79356b A |
393 | |
394 | /* | |
395 | * A recursive form of vm_region which probes submaps withint the | |
396 | * address space. | |
397 | */ | |
398 | routine vm_region_recurse( | |
399 | target_task : vm_map_t; | |
400 | inout address : vm_address_t; | |
401 | out size : vm_size_t; | |
402 | inout nesting_depth : natural_t; | |
403 | out info : vm_region_recurse_info_t,CountInOut); | |
404 | ||
405 | ||
406 | /* | |
407 | * The routines below are temporary, meant for transitional use | |
408 | * as their counterparts are moved from 32 to 64 bit data path | |
409 | */ | |
410 | ||
411 | ||
412 | routine vm_region_recurse_64( | |
413 | target_task : vm_map_t; | |
414 | inout address : vm_address_t; | |
415 | out size : vm_size_t; | |
416 | inout nesting_depth : natural_t; | |
91447636 | 417 | out info : vm_region_recurse_info_t,CountInOut); |
1c79356b A |
418 | |
419 | routine mach_vm_region_info_64( | |
420 | task : vm_map_t; | |
421 | address : vm_address_t; | |
422 | out region : vm_info_region_64_t; | |
423 | out objects : vm_info_object_array_t); | |
424 | ||
425 | routine vm_region_64( | |
426 | target_task : vm_map_t; | |
427 | inout address : vm_address_t; | |
428 | out size : vm_size_t; | |
429 | flavor : vm_region_flavor_t; | |
91447636 | 430 | out info : vm_region_info_t, CountInOut; |
1c79356b A |
431 | out object_name : memory_object_name_t = |
432 | MACH_MSG_TYPE_MOVE_SEND | |
433 | ctype: mach_port_t); | |
434 | ||
435 | routine mach_make_memory_entry_64( | |
436 | target_task :vm_map_t; | |
437 | inout size :memory_object_size_t; | |
438 | offset :memory_object_offset_t; | |
439 | permission :vm_prot_t; | |
440 | out object_handle :mach_port_move_send_t; | |
441 | parent_entry :mem_entry_name_port_t); | |
442 | ||
443 | ||
444 | ||
445 | routine vm_map_64( | |
446 | target_task : vm_task_entry_t; | |
447 | inout address : vm_address_t; | |
448 | size : vm_size_t; | |
449 | mask : vm_address_t; | |
450 | flags : int; | |
0b4e3aa0 | 451 | object : mem_entry_name_port_t; |
1c79356b A |
452 | offset : memory_object_offset_t; |
453 | copy : boolean_t; | |
454 | cur_protection : vm_prot_t; | |
455 | max_protection : vm_prot_t; | |
456 | inheritance : vm_inherit_t); | |
457 | ||
91447636 A |
458 | #if 0 |
459 | /* | |
460 | * The UPL interfaces are not ready for user-level export. | |
461 | */ | |
0b4e3aa0 A |
462 | routine vm_map_get_upl( |
463 | target_task : vm_map_t; | |
2d21ac55 | 464 | address : vm_map_offset_t; |
0b4e3aa0 A |
465 | inout size : vm_size_t; |
466 | out upl : upl_t; | |
467 | out page_info : upl_page_info_array_t, CountInOut; | |
468 | inout flags : integer_t; | |
469 | force_data_sync : integer_t); | |
470 | ||
471 | routine vm_upl_map( | |
472 | target_task : vm_map_t; | |
473 | upl : upl_t; | |
474 | inout address : vm_address_t); | |
475 | ||
476 | routine vm_upl_unmap( | |
477 | target_task : vm_map_t; | |
478 | upl : upl_t); | |
91447636 A |
479 | #else |
480 | skip; /* was vm_map_get_upl */ | |
481 | skip; /* was vm_upl_map */ | |
482 | skip; /* was vm_upl_unmap */ | |
483 | #endif | |
484 | ||
485 | /* | |
486 | * Control behavior and investigate state of a "purgable" object in | |
487 | * the virtual address space of the target task. A purgable object is | |
488 | * created via a call to vm_allocate() with VM_FLAGS_PURGABLE | |
489 | * specified. See the routine implementation for a complete | |
490 | * definition of the routine. | |
491 | */ | |
39037602 | 492 | routine PREFIX(vm_purgable_control) ( |
91447636 A |
493 | target_task : vm_map_t; |
494 | address : vm_address_t; | |
495 | control : vm_purgable_t; | |
496 | inout state : int); | |
497 | ||
2d21ac55 | 498 | /* vim: set ft=c : */ |