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