2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
23 * @APPLE_LICENSE_HEADER_END@
26 * @OSF_FREE_COPYRIGHT@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
31 * All Rights Reserved.
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.
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.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
56 * File: mach/mach_port.defs
59 * Exported kernel calls.
68 #include <mach/std_types.defs>
69 #include <mach/mach_types.defs>
70 #include <mach_debug/mach_debug_types.defs>
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.]
84 target_task : vm_map_t;
85 inout address : vm_address_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
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.
101 target_task : vm_task_entry_t;
102 inout address : vm_address_t;
107 * Deallocate the specified range from the virtual
108 * address space of the target task.
110 routine vm_deallocate(
111 target_task : vm_task_entry_t;
112 address : vm_address_t;
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}
126 target_task : vm_task_entry_t;
127 address : vm_address_t;
129 set_maximum : boolean_t;
130 new_protection : vm_prot_t);
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.
140 target_task : vm_task_entry_t;
141 address : vm_address_t;
143 new_inheritance : vm_inherit_t);
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.]
153 target_task : vm_map_t;
154 address : vm_address_t;
156 out data : pointer_t);
159 * List corrollary to vm_read, returns mapped contents of specified
160 * ranges within target address space.
162 routine vm_read_list(
163 target_task : vm_map_t;
164 inout data_list : vm_read_entry_t;
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.]
175 target_task : vm_map_t;
176 address : vm_address_t;
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
190 target_task : vm_map_t;
191 source_address : vm_address_t;
193 dest_address : vm_address_t);
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.]
203 routine vm_read_overwrite(
204 target_task : vm_map_t;
205 address : vm_address_t;
208 out outsize : vm_size_t);
212 target_task : vm_map_t;
213 address : vm_address_t;
215 sync_flags : vm_sync_t );
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.
224 routine vm_behavior_set(
225 target_task : vm_map_t;
226 address : vm_address_t;
228 new_behavior : vm_behavior_t);
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.
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.
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.
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.
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.]
262 target_task : vm_task_entry_t;
263 inout address : vm_address_t;
267 object : mem_entry_name_port_t;
268 offset : vm_offset_t;
270 cur_protection : vm_prot_t;
271 max_protection : vm_prot_t;
272 inheritance : vm_inherit_t);
275 * Set/Get special properties of memory associated
276 * to some virtual address range, such as cachability,
277 * migrability, replicability. Machine-dependent.
279 routine vm_machine_attribute(
280 target_task : vm_map_t;
281 address : vm_address_t;
283 attribute : vm_machine_attribute_t;
284 inout value : vm_machine_attribute_val_t);
287 * Map portion of a task's address space.
290 target_task : vm_map_t;
291 inout target_address : vm_address_t;
294 anywhere : boolean_t;
296 src_address : vm_address_t;
298 out cur_protection : vm_prot_t;
299 out max_protection : vm_prot_t;
300 inheritance : vm_inherit_t);
303 * Require that all future virtual memory allocation
304 * allocates wired memory. Setting must_wire to FALSE
305 * disables the wired future feature.
308 target_task : vm_map_t;
309 must_wire : boolean_t);
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
319 routine mach_make_memory_entry(
320 target_task :vm_map_t;
321 inout size :vm_size_t;
323 permission :vm_prot_t;
324 out object_handle :mach_port_move_send_t;
325 parent_entry :mem_entry_name_port_t);
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.
331 routine vm_map_page_query(
332 target_map :vm_map_t;
334 out disposition :integer_t;
335 out ref_count :integer_t);
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.
343 routine mach_vm_region_info(
345 address : vm_address_t;
346 out region : vm_info_region_t;
347 out objects : vm_info_object_array_t);
349 routine vm_mapped_pages_info(
351 out pages : page_address_array_t);
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
361 routine vm_region_object_create(
362 target_task :vm_map_t;
364 out region_object :mach_port_move_send_t);
367 * A recursive form of vm_region which probes submaps withint the
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);
379 * The routines below are temporary, meant for transitional use
380 * as their counterparts are moved from 32 to 64 bit data path
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);
391 routine mach_vm_region_info_64(
393 address : vm_address_t;
394 out region : vm_info_region_64_t;
395 out objects : vm_info_object_array_t);
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
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);
418 target_task : vm_task_entry_t;
419 inout address : vm_address_t;
423 object : mem_entry_name_port_t;
424 offset : memory_object_offset_t;
426 cur_protection : vm_prot_t;
427 max_protection : vm_prot_t;
428 inheritance : vm_inherit_t);
430 routine vm_map_get_upl(
431 target_task : vm_map_t;
432 address : vm_address_t;
433 inout size : vm_size_t;
435 out page_info : upl_page_info_array_t, CountInOut;
436 inout flags : integer_t;
437 force_data_sync : integer_t);
440 target_task : vm_map_t;
442 inout address : vm_address_t);
444 routine vm_upl_unmap(
445 target_task : vm_map_t;