]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
2d21ac55 | 2 | * Copyright (c) 2000-2007 Apple 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 | /* | |
59 | * File: mach/mach_port.defs | |
60 | * Author: Rich Draves | |
61 | * | |
62 | * Exported kernel calls. | |
63 | */ | |
64 | ||
65 | subsystem | |
66 | #if KERNEL_SERVER | |
67 | KernelServer | |
55e303ae | 68 | #endif /* KERNEL_SERVER */ |
1c79356b A |
69 | task 3400; |
70 | ||
71 | #include <mach/std_types.defs> | |
72 | #include <mach/mach_types.defs> | |
6d2010ae A |
73 | #include <mach_debug/mach_debug_types.defs> |
74 | ||
1c79356b A |
75 | /* |
76 | * Create a new task with an empty set of IPC rights, | |
77 | * and having an address space constructed from the | |
78 | * target task (or empty, if inherit_memory is FALSE). | |
79 | */ | |
80 | routine task_create( | |
81 | target_task : task_t; | |
82 | ledgers : ledger_array_t; | |
83 | inherit_memory : boolean_t; | |
84 | out child_task : task_t); | |
85 | ||
86 | /* | |
87 | * Destroy the target task, causing all of its threads | |
88 | * to be destroyed, all of its IPC rights to be deallocated, | |
89 | * and all of its address space to be deallocated. | |
90 | */ | |
91 | routine task_terminate( | |
92 | target_task : task_t); | |
93 | ||
94 | /* | |
95 | * Returns the set of threads belonging to the target task. | |
96 | */ | |
97 | routine task_threads( | |
813fb2f6 | 98 | target_task : task_inspect_t; |
1c79356b A |
99 | out act_list : thread_act_array_t); |
100 | ||
101 | /* | |
102 | * Stash a handful of ports for the target task; child | |
103 | * tasks inherit this stash at task_create time. | |
104 | */ | |
105 | routine mach_ports_register( | |
106 | target_task : task_t; | |
107 | init_port_set : mach_port_array_t = | |
108 | ^array[] of mach_port_t); | |
109 | ||
110 | /* | |
111 | * Retrieve the stashed ports for the target task. | |
112 | */ | |
113 | routine mach_ports_lookup( | |
114 | target_task : task_t; | |
115 | out init_port_set : mach_port_array_t = | |
116 | ^array[] of mach_port_t); | |
117 | ||
118 | /* | |
119 | * Returns information about the target task. | |
120 | */ | |
5ba3f43e A |
121 | #ifdef KERNEL_SERVER |
122 | routine task_info_from_user( | |
123 | target_task : mach_port_t; | |
124 | flavor : task_flavor_t; | |
125 | out task_info_out : task_info_t, CountInOut); | |
126 | #else | |
1c79356b | 127 | routine task_info( |
0c530ab8 | 128 | target_task : task_name_t; |
1c79356b A |
129 | flavor : task_flavor_t; |
130 | out task_info_out : task_info_t, CountInOut); | |
131 | ||
5ba3f43e | 132 | #endif |
1c79356b A |
133 | /* |
134 | * Set task information. | |
135 | */ | |
136 | routine task_set_info( | |
137 | target_task : task_t; | |
138 | flavor : task_flavor_t; | |
139 | task_info_in : task_info_t); | |
140 | ||
141 | /* | |
142 | * Increment the suspend count for the target task. | |
143 | * No threads within a task may run when the suspend | |
144 | * count for that task is non-zero. | |
145 | */ | |
146 | routine task_suspend( | |
147 | target_task : task_t); | |
148 | ||
149 | ||
150 | /* | |
151 | * Decrement the suspend count for the target task, | |
152 | * if the count is currently non-zero. If the resulting | |
153 | * suspend count is zero, then threads within the task | |
154 | * that also have non-zero suspend counts may execute. | |
155 | */ | |
156 | routine task_resume( | |
157 | target_task : task_t); | |
158 | ||
159 | /* | |
160 | * Returns the current value of the selected special port | |
161 | * associated with the target task. | |
162 | */ | |
163 | routine task_get_special_port( | |
813fb2f6 | 164 | task : task_inspect_t; |
1c79356b A |
165 | which_port : int; |
166 | out special_port : mach_port_t); | |
167 | ||
168 | /* | |
169 | * Set one of the special ports associated with the | |
170 | * target task. | |
171 | */ | |
172 | routine task_set_special_port( | |
173 | task : task_t; | |
174 | which_port : int; | |
175 | special_port : mach_port_t); | |
176 | ||
177 | /* | |
178 | * Create a new thread within the target task, returning | |
179 | * the port representing the first thr_act in that new thread. The | |
180 | * initial execution state of the thread is undefined. | |
181 | */ | |
6d2010ae A |
182 | routine |
183 | #ifdef KERNEL_SERVER | |
184 | thread_create_from_user( | |
185 | #else | |
186 | thread_create( | |
187 | #endif | |
1c79356b A |
188 | parent_task : task_t; |
189 | out child_act : thread_act_t); | |
190 | ||
191 | /* | |
192 | * Create a new thread within the target task, returning | |
193 | * the port representing that new thread. The new thread | |
194 | * is not suspended; its initial execution state is given | |
195 | * by flavor and new_state. Returns the port representing | |
196 | * the new thread. | |
197 | */ | |
6d2010ae A |
198 | routine |
199 | #ifdef KERNEL_SERVER | |
200 | thread_create_running_from_user( | |
201 | #else | |
202 | thread_create_running( | |
203 | #endif | |
1c79356b A |
204 | parent_task : task_t; |
205 | flavor : thread_state_flavor_t; | |
206 | new_state : thread_state_t; | |
207 | out child_act : thread_act_t); | |
208 | ||
209 | /* | |
210 | * Set an exception handler for a task on one or more exception types. | |
211 | * These handlers are invoked for all threads in the task if there are | |
212 | * no thread-specific exception handlers or those handlers returned an | |
213 | * error. | |
214 | */ | |
215 | routine task_set_exception_ports( | |
216 | task : task_t; | |
217 | exception_mask : exception_mask_t; | |
218 | new_port : mach_port_t; | |
219 | behavior : exception_behavior_t; | |
220 | new_flavor : thread_state_flavor_t); | |
221 | ||
222 | ||
223 | /* | |
224 | * Lookup some of the old exception handlers for a task | |
225 | */ | |
226 | routine task_get_exception_ports( | |
813fb2f6 | 227 | task : task_inspect_t; |
1c79356b A |
228 | exception_mask : exception_mask_t; |
229 | out masks : exception_mask_array_t; | |
230 | out old_handlers : exception_handler_array_t, SameCount; | |
231 | out old_behaviors : exception_behavior_array_t, SameCount; | |
232 | out old_flavors : exception_flavor_array_t, SameCount); | |
233 | ||
234 | ||
235 | /* | |
236 | * Set an exception handler for a thread on one or more exception types. | |
237 | * At the same time, return the previously defined exception handlers for | |
238 | * those types. | |
239 | */ | |
240 | routine task_swap_exception_ports( | |
241 | task : task_t; | |
242 | exception_mask : exception_mask_t; | |
243 | new_port : mach_port_t; | |
244 | behavior : exception_behavior_t; | |
245 | new_flavor : thread_state_flavor_t; | |
246 | out masks : exception_mask_array_t; | |
247 | out old_handlerss : exception_handler_array_t, SameCount; | |
248 | out old_behaviors : exception_behavior_array_t, SameCount; | |
249 | out old_flavors : exception_flavor_array_t, SameCount); | |
250 | ||
251 | /* | |
39236c6e | 252 | * OBSOLETE interface. |
1c79356b A |
253 | */ |
254 | routine lock_set_create( | |
255 | task : task_t; | |
256 | out new_lock_set : lock_set_t; | |
257 | n_ulocks : int; | |
258 | policy : int); | |
259 | ||
39236c6e A |
260 | /* |
261 | * OBSOLETE interface. | |
262 | */ | |
1c79356b A |
263 | routine lock_set_destroy( |
264 | task : task_t; | |
265 | lock_set : lock_set_t); | |
266 | ||
39236c6e A |
267 | /* |
268 | * Create and destroy semaphore synchronizers on a | |
269 | * per-task basis (i.e. the task owns them). | |
270 | */ | |
271 | ||
1c79356b A |
272 | routine semaphore_create( |
273 | task : task_t; | |
274 | out semaphore : semaphore_t; | |
275 | policy : int; | |
276 | value : int); | |
277 | ||
278 | routine semaphore_destroy( | |
279 | task : task_t; | |
280 | semaphore : semaphore_consume_ref_t); | |
281 | ||
282 | /* | |
283 | * Set/get policy information for a task. | |
284 | * (Approved Mac OS X microkernel interface) | |
285 | */ | |
286 | ||
287 | routine task_policy_set( | |
288 | task : task_t; | |
289 | flavor : task_policy_flavor_t; | |
290 | policy_info : task_policy_t); | |
291 | ||
292 | routine task_policy_get( | |
293 | task : task_t; | |
294 | flavor : task_policy_flavor_t; | |
295 | out policy_info : task_policy_t, CountInOut; | |
296 | inout get_default : boolean_t); | |
297 | ||
298 | /* | |
2d21ac55 | 299 | * Removed from the kernel. |
1c79356b | 300 | */ |
2d21ac55 A |
301 | #if KERNEL_SERVER |
302 | skip; | |
303 | #else | |
1c79356b A |
304 | routine task_sample( |
305 | task : task_t; | |
306 | reply : mach_port_make_send_t); | |
2d21ac55 | 307 | #endif |
1c79356b A |
308 | |
309 | /* | |
310 | * JMM - Everything from here down is likely to go away soon | |
311 | */ | |
312 | /* | |
313 | * OBSOLETE interface. | |
314 | */ | |
315 | routine task_policy( | |
316 | task : task_t; | |
317 | policy : policy_t; | |
318 | base : policy_base_t; | |
319 | set_limit : boolean_t; | |
320 | change : boolean_t); | |
321 | ||
322 | ||
323 | /* | |
324 | * Establish a user-level handler for the specified | |
325 | * system call. | |
326 | */ | |
327 | routine task_set_emulation( | |
328 | target_port : task_t; | |
329 | routine_entry_pt: vm_address_t; | |
330 | routine_number : int); | |
331 | ||
332 | /* | |
333 | * Get user-level handler entry points for all | |
334 | * emulated system calls. | |
335 | */ | |
336 | routine task_get_emulation_vector( | |
337 | task : task_t; | |
338 | out vector_start : int; | |
339 | out emulation_vector: emulation_vector_t); | |
340 | ||
341 | /* | |
342 | * Establish user-level handlers for the specified | |
343 | * system calls. Non-emulated system calls are specified | |
344 | * with emulation_vector[i] == EML_ROUTINE_NULL. | |
345 | */ | |
346 | routine task_set_emulation_vector( | |
347 | task : task_t; | |
348 | vector_start : int; | |
349 | emulation_vector: emulation_vector_t); | |
350 | ||
351 | ||
352 | /* | |
353 | * Establish restart pc for interrupted atomic sequences. | |
354 | */ | |
355 | routine task_set_ras_pc( | |
356 | target_task : task_t; | |
357 | basepc : vm_address_t; | |
358 | boundspc : vm_address_t); | |
359 | ||
360 | ||
6d2010ae A |
361 | /* |
362 | * Return zone info as seen/used by this task. | |
363 | */ | |
364 | routine task_zone_info( | |
365 | target_task : task_t; | |
366 | out names : mach_zone_name_array_t, | |
367 | Dealloc; | |
368 | out info : task_zone_info_array_t, | |
369 | Dealloc); | |
370 | ||
91447636 | 371 | |
1c79356b | 372 | /* |
91447636 | 373 | * JMM - Want to eliminate processor_set so keep them at the end. |
1c79356b | 374 | */ |
1c79356b A |
375 | |
376 | /* | |
377 | * Assign task to processor set. | |
378 | */ | |
379 | routine task_assign( | |
380 | task : task_t; | |
381 | new_set : processor_set_t; | |
382 | assign_threads : boolean_t); | |
383 | ||
384 | /* | |
385 | * Assign task to default set. | |
386 | */ | |
387 | routine task_assign_default( | |
388 | task : task_t; | |
389 | assign_threads : boolean_t); | |
390 | ||
391 | /* | |
392 | * Get current assignment for task. | |
393 | */ | |
394 | routine task_get_assignment( | |
395 | task : task_t; | |
396 | out assigned_set : processor_set_name_t); | |
397 | ||
398 | /* | |
399 | * OBSOLETE interface. | |
400 | */ | |
401 | routine task_set_policy( | |
402 | task : task_t; | |
403 | pset : processor_set_t; | |
404 | policy : policy_t; | |
405 | base : policy_base_t; | |
406 | limit : policy_limit_t; | |
407 | change : boolean_t); | |
408 | ||
b0d623f7 A |
409 | /* |
410 | * Read the selected state which is to be installed on new | |
411 | * threads in the task as they are created. | |
412 | */ | |
413 | routine task_get_state( | |
414 | task : task_t; | |
415 | flavor : thread_state_flavor_t; | |
416 | out old_state : thread_state_t, CountInOut); | |
417 | ||
418 | /* | |
419 | * Set the selected state information to be installed on | |
420 | * all subsequently created threads in the task. | |
421 | */ | |
422 | routine task_set_state( | |
423 | task : task_t; | |
424 | flavor : thread_state_flavor_t; | |
425 | new_state : thread_state_t); | |
426 | ||
39236c6e A |
427 | /* |
428 | * Change the task's physical footprint limit (in MB). | |
429 | */ | |
430 | routine task_set_phys_footprint_limit( | |
431 | task : task_t; | |
432 | new_limit : int; | |
433 | out old_limit : int); | |
434 | ||
39236c6e A |
435 | routine task_suspend2( |
436 | target_task : task_t; | |
437 | out suspend_token : task_suspension_token_t); | |
438 | ||
439 | routine task_resume2( | |
440 | suspend_token : task_suspension_token_t); | |
441 | ||
442 | routine task_purgable_info( | |
443 | task : task_t; | |
444 | out stats : task_purgable_info_t); | |
fe8ab488 A |
445 | |
446 | routine task_get_mach_voucher( | |
447 | task : task_t; | |
448 | which : mach_voucher_selector_t; | |
449 | out voucher : ipc_voucher_t); | |
450 | ||
451 | routine task_set_mach_voucher( | |
452 | task : task_t; | |
453 | voucher : ipc_voucher_t); | |
454 | ||
455 | routine task_swap_mach_voucher( | |
456 | task : task_t; | |
457 | new_voucher : ipc_voucher_t; | |
458 | inout old_voucher : ipc_voucher_t); | |
459 | ||
39037602 A |
460 | routine task_generate_corpse( |
461 | task :task_t; | |
462 | out corpse_task_port:mach_port_t); | |
463 | ||
464 | routine task_map_corpse_info( | |
465 | task :task_t; | |
466 | corspe_task :task_t; | |
467 | out kcd_addr_begin :vm_address_t; | |
468 | out kcd_size :uint32_t); | |
469 | ||
470 | routine task_register_dyld_image_infos( | |
471 | task :task_t; | |
472 | dyld_images :dyld_kernel_image_info_array_t); | |
473 | ||
474 | routine task_unregister_dyld_image_infos( | |
475 | task :task_t; | |
476 | dyld_images :dyld_kernel_image_info_array_t); | |
477 | ||
478 | routine task_get_dyld_image_infos( | |
813fb2f6 | 479 | task :task_inspect_t; |
39037602 A |
480 | out dyld_images :dyld_kernel_image_info_array_t); |
481 | ||
482 | routine task_register_dyld_shared_cache_image_info( | |
483 | task :task_t; | |
484 | dyld_cache_image :dyld_kernel_image_info_t; | |
485 | no_cache :boolean_t; | |
486 | private_cache :boolean_t); | |
487 | ||
488 | routine task_register_dyld_set_dyld_state( | |
489 | task :task_t; | |
490 | dyld_state :uint8_t); | |
491 | ||
492 | routine task_register_dyld_get_process_state( | |
493 | task :task_t; | |
494 | out dyld_process_state :dyld_kernel_process_info_t); | |
495 | ||
496 | routine task_map_corpse_info_64( | |
497 | task :task_t; | |
498 | corspe_task :task_t; | |
499 | out kcd_addr_begin :mach_vm_address_t; | |
500 | out kcd_size :mach_vm_size_t); | |
501 | ||
5ba3f43e A |
502 | routine task_inspect( |
503 | task : task_inspect_t; | |
504 | flavor : task_inspect_flavor_t; | |
505 | out info_out : task_inspect_info_t, CountInOut); | |
506 | ||
fe8ab488 A |
507 | /* vim: set ft=c : */ |
508 |