2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * @OSF_FREE_COPYRIGHT@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
36 * All Rights Reserved.
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
61 * File: mach/mach_port.defs
64 * Exported kernel calls.
70 #endif /* KERNEL_SERVER */
73 #include <mach/std_types.defs>
74 #include <mach/mach_types.defs>
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).
82 ledgers : ledger_array_t;
83 inherit_memory : boolean_t;
84 out child_task : task_t);
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.
91 routine task_terminate(
92 target_task : task_t);
95 * Returns the set of threads belonging to the target task.
99 out act_list : thread_act_array_t);
102 * Stash a handful of ports for the target task; child
103 * tasks inherit this stash at task_create time.
105 routine mach_ports_register(
106 target_task : task_t;
107 init_port_set : mach_port_array_t =
108 ^array[] of mach_port_t);
111 * Retrieve the stashed ports for the target task.
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);
119 * Returns information about the target task.
122 target_task : task_name_t;
123 flavor : task_flavor_t;
124 out task_info_out : task_info_t, CountInOut);
127 * Set task information.
129 routine task_set_info(
130 target_task : task_t;
131 flavor : task_flavor_t;
132 task_info_in : task_info_t);
135 * Increment the suspend count for the target task.
136 * No threads within a task may run when the suspend
137 * count for that task is non-zero.
139 routine task_suspend(
140 target_task : task_t);
144 * Decrement the suspend count for the target task,
145 * if the count is currently non-zero. If the resulting
146 * suspend count is zero, then threads within the task
147 * that also have non-zero suspend counts may execute.
150 target_task : task_t);
153 * Returns the current value of the selected special port
154 * associated with the target task.
156 routine task_get_special_port(
159 out special_port : mach_port_t);
162 * Set one of the special ports associated with the
165 routine task_set_special_port(
168 special_port : mach_port_t);
171 * Create a new thread within the target task, returning
172 * the port representing the first thr_act in that new thread. The
173 * initial execution state of the thread is undefined.
175 routine thread_create(
176 parent_task : task_t;
177 out child_act : thread_act_t);
180 * Create a new thread within the target task, returning
181 * the port representing that new thread. The new thread
182 * is not suspended; its initial execution state is given
183 * by flavor and new_state. Returns the port representing
186 routine thread_create_running(
187 parent_task : task_t;
188 flavor : thread_state_flavor_t;
189 new_state : thread_state_t;
190 out child_act : thread_act_t);
193 * Set an exception handler for a task on one or more exception types.
194 * These handlers are invoked for all threads in the task if there are
195 * no thread-specific exception handlers or those handlers returned an
198 routine task_set_exception_ports(
200 exception_mask : exception_mask_t;
201 new_port : mach_port_t;
202 behavior : exception_behavior_t;
203 new_flavor : thread_state_flavor_t);
207 * Lookup some of the old exception handlers for a task
209 routine task_get_exception_ports(
211 exception_mask : exception_mask_t;
212 out masks : exception_mask_array_t;
213 out old_handlers : exception_handler_array_t, SameCount;
214 out old_behaviors : exception_behavior_array_t, SameCount;
215 out old_flavors : exception_flavor_array_t, SameCount);
219 * Set an exception handler for a thread on one or more exception types.
220 * At the same time, return the previously defined exception handlers for
223 routine task_swap_exception_ports(
225 exception_mask : exception_mask_t;
226 new_port : mach_port_t;
227 behavior : exception_behavior_t;
228 new_flavor : thread_state_flavor_t;
229 out masks : exception_mask_array_t;
230 out old_handlerss : exception_handler_array_t, SameCount;
231 out old_behaviors : exception_behavior_array_t, SameCount;
232 out old_flavors : exception_flavor_array_t, SameCount);
235 * Create and destroy lock_set and semaphore synchronizers on a
236 * per-task basis (i.e. the task owns them).
238 routine lock_set_create(
240 out new_lock_set : lock_set_t;
244 routine lock_set_destroy(
246 lock_set : lock_set_t);
248 routine semaphore_create(
250 out semaphore : semaphore_t;
254 routine semaphore_destroy(
256 semaphore : semaphore_consume_ref_t);
259 * Set/get policy information for a task.
260 * (Approved Mac OS X microkernel interface)
263 routine task_policy_set(
265 flavor : task_policy_flavor_t;
266 policy_info : task_policy_t);
268 routine task_policy_get(
270 flavor : task_policy_flavor_t;
271 out policy_info : task_policy_t, CountInOut;
272 inout get_default : boolean_t);
279 reply : mach_port_make_send_t);
282 * JMM - Everything from here down is likely to go away soon
285 * OBSOLETE interface.
290 base : policy_base_t;
291 set_limit : boolean_t;
296 * Establish a user-level handler for the specified
299 routine task_set_emulation(
300 target_port : task_t;
301 routine_entry_pt: vm_address_t;
302 routine_number : int);
305 * Get user-level handler entry points for all
306 * emulated system calls.
308 routine task_get_emulation_vector(
310 out vector_start : int;
311 out emulation_vector: emulation_vector_t);
314 * Establish user-level handlers for the specified
315 * system calls. Non-emulated system calls are specified
316 * with emulation_vector[i] == EML_ROUTINE_NULL.
318 routine task_set_emulation_vector(
321 emulation_vector: emulation_vector_t);
325 * Establish restart pc for interrupted atomic sequences.
327 routine task_set_ras_pc(
328 target_task : task_t;
329 basepc : vm_address_t;
330 boundspc : vm_address_t);
333 skip; /* was kernel_task_create() */
336 * JMM - Want to eliminate processor_set so keep them at the end.
340 * Assign task to processor set.
344 new_set : processor_set_t;
345 assign_threads : boolean_t);
348 * Assign task to default set.
350 routine task_assign_default(
352 assign_threads : boolean_t);
355 * Get current assignment for task.
357 routine task_get_assignment(
359 out assigned_set : processor_set_name_t);
362 * OBSOLETE interface.
364 routine task_set_policy(
366 pset : processor_set_t;
368 base : policy_base_t;
369 limit : policy_limit_t;