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.
65 #endif /* KERNEL_SERVER */
68 #include <mach/std_types.defs>
69 #include <mach/mach_types.defs>
71 * Create a new task with an empty set of IPC rights,
72 * and having an address space constructed from the
73 * target task (or empty, if inherit_memory is FALSE).
77 ledgers : ledger_array_t;
78 inherit_memory : boolean_t;
79 out child_task : task_t);
82 * Destroy the target task, causing all of its threads
83 * to be destroyed, all of its IPC rights to be deallocated,
84 * and all of its address space to be deallocated.
86 routine task_terminate(
87 target_task : task_t);
90 * Returns the set of threads belonging to the target task.
94 out act_list : thread_act_array_t);
97 * Stash a handful of ports for the target task; child
98 * tasks inherit this stash at task_create time.
100 routine mach_ports_register(
101 target_task : task_t;
102 init_port_set : mach_port_array_t =
103 ^array[] of mach_port_t);
106 * Retrieve the stashed ports for the target task.
108 routine mach_ports_lookup(
109 target_task : task_t;
110 out init_port_set : mach_port_array_t =
111 ^array[] of mach_port_t);
114 * Returns information about the target task.
117 target_task : task_t;
118 flavor : task_flavor_t;
119 out task_info_out : task_info_t, CountInOut);
122 * Set task information.
124 routine task_set_info(
125 target_task : task_t;
126 flavor : task_flavor_t;
127 task_info_in : task_info_t);
130 * Increment the suspend count for the target task.
131 * No threads within a task may run when the suspend
132 * count for that task is non-zero.
134 routine task_suspend(
135 target_task : task_t);
139 * Decrement the suspend count for the target task,
140 * if the count is currently non-zero. If the resulting
141 * suspend count is zero, then threads within the task
142 * that also have non-zero suspend counts may execute.
145 target_task : task_t);
148 * Returns the current value of the selected special port
149 * associated with the target task.
151 routine task_get_special_port(
154 out special_port : mach_port_t);
157 * Set one of the special ports associated with the
160 routine task_set_special_port(
163 special_port : mach_port_t);
166 * Create a new thread within the target task, returning
167 * the port representing the first thr_act in that new thread. The
168 * initial execution state of the thread is undefined.
170 routine thread_create(
171 parent_task : task_t;
172 out child_act : thread_act_t);
175 * Create a new thread within the target task, returning
176 * the port representing that new thread. The new thread
177 * is not suspended; its initial execution state is given
178 * by flavor and new_state. Returns the port representing
181 routine thread_create_running(
182 parent_task : task_t;
183 flavor : thread_state_flavor_t;
184 new_state : thread_state_t;
185 out child_act : thread_act_t);
188 * Set an exception handler for a task on one or more exception types.
189 * These handlers are invoked for all threads in the task if there are
190 * no thread-specific exception handlers or those handlers returned an
193 routine task_set_exception_ports(
195 exception_mask : exception_mask_t;
196 new_port : mach_port_t;
197 behavior : exception_behavior_t;
198 new_flavor : thread_state_flavor_t);
202 * Lookup some of the old exception handlers for a task
204 routine task_get_exception_ports(
206 exception_mask : exception_mask_t;
207 out masks : exception_mask_array_t;
208 out old_handlers : exception_handler_array_t, SameCount;
209 out old_behaviors : exception_behavior_array_t, SameCount;
210 out old_flavors : exception_flavor_array_t, SameCount);
214 * Set an exception handler for a thread on one or more exception types.
215 * At the same time, return the previously defined exception handlers for
218 routine task_swap_exception_ports(
220 exception_mask : exception_mask_t;
221 new_port : mach_port_t;
222 behavior : exception_behavior_t;
223 new_flavor : thread_state_flavor_t;
224 out masks : exception_mask_array_t;
225 out old_handlerss : exception_handler_array_t, SameCount;
226 out old_behaviors : exception_behavior_array_t, SameCount;
227 out old_flavors : exception_flavor_array_t, SameCount);
230 * Create and destroy lock_set and semaphore synchronizers on a
231 * per-task basis (i.e. the task owns them).
233 routine lock_set_create(
235 out new_lock_set : lock_set_t;
239 routine lock_set_destroy(
241 lock_set : lock_set_t);
243 routine semaphore_create(
245 out semaphore : semaphore_t;
249 routine semaphore_destroy(
251 semaphore : semaphore_consume_ref_t);
254 * Set/get policy information for a task.
255 * (Approved Mac OS X microkernel interface)
258 routine task_policy_set(
260 flavor : task_policy_flavor_t;
261 policy_info : task_policy_t);
263 routine task_policy_get(
265 flavor : task_policy_flavor_t;
266 out policy_info : task_policy_t, CountInOut;
267 inout get_default : boolean_t);
274 reply : mach_port_make_send_t);
277 * JMM - Everything from here down is likely to go away soon
280 * OBSOLETE interface.
285 base : policy_base_t;
286 set_limit : boolean_t;
291 * Establish a user-level handler for the specified
294 routine task_set_emulation(
295 target_port : task_t;
296 routine_entry_pt: vm_address_t;
297 routine_number : int);
300 * Get user-level handler entry points for all
301 * emulated system calls.
303 routine task_get_emulation_vector(
305 out vector_start : int;
306 out emulation_vector: emulation_vector_t);
309 * Establish user-level handlers for the specified
310 * system calls. Non-emulated system calls are specified
311 * with emulation_vector[i] == EML_ROUTINE_NULL.
313 routine task_set_emulation_vector(
316 emulation_vector: emulation_vector_t);
320 * Establish restart pc for interrupted atomic sequences.
322 routine task_set_ras_pc(
323 target_task : task_t;
324 basepc : vm_address_t;
325 boundspc : vm_address_t);
329 * JMM - Want to eliminate kernel tasks and processor_set so
330 * keep them at the end.
333 * Create a new task in the kernel's address space with
334 * an empty set of IPC rights, with a map allocated from
335 * the kernel's map starting at map_base of length map_size.
337 routine kernel_task_create(
338 target_task : task_t;
339 map_base : vm_offset_t;
340 map_size : vm_size_t;
341 out child_task : task_t);
344 * Assign task to processor set.
348 new_set : processor_set_t;
349 assign_threads : boolean_t);
352 * Assign task to default set.
354 routine task_assign_default(
356 assign_threads : boolean_t);
359 * Get current assignment for task.
361 routine task_get_assignment(
363 out assigned_set : processor_set_name_t);
366 * OBSOLETE interface.
368 routine task_set_policy(
370 pset : processor_set_t;
372 base : policy_base_t;
373 limit : policy_limit_t;