|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * @OSF_FREE_COPYRIGHT@
24: */
25: /*
26: * Mach Operating System
27: * Copyright (c) 1991,1990,1989 Carnegie Mellon University
28: * All Rights Reserved.
29: *
30: * Permission to use, copy, modify and distribute this software and its
31: * documentation is hereby granted, provided that both the copyright
32: * notice and this permission notice appear in all copies of the
33: * software, derivative works or modified versions, and any portions
34: * thereof, and that both notices appear in supporting documentation.
35: *
36: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39: *
40: * Carnegie Mellon requests users of this software to return to
41: *
42: * Software Distribution Coordinator or [email protected]
43: * School of Computer Science
44: * Carnegie Mellon University
45: * Pittsburgh PA 15213-3890
46: *
47: * any improvements or extensions that they make and grant Carnegie Mellon
48: * the rights to redistribute these changes.
49: */
50: /*
51: */
52: /*
53: * File: mach/mach_port.defs
54: * Author: Rich Draves
55: *
56: * Exported kernel calls.
57: */
58:
59: subsystem
60: #if KERNEL_SERVER
61: KernelServer
62: #endif KERNEL_SERVER
63: task 3400;
64:
65: #include <mach/std_types.defs>
66: #include <mach/mach_types.defs>
67: /*
68: * Create a new task with an empty set of IPC rights,
69: * and having an address space constructed from the
70: * target task (or empty, if inherit_memory is FALSE).
71: */
72: routine task_create(
73: target_task : task_t;
74: ledgers : ledger_array_t;
75: inherit_memory : boolean_t;
76: out child_task : task_t);
77:
78: /*
79: * Destroy the target task, causing all of its threads
80: * to be destroyed, all of its IPC rights to be deallocated,
81: * and all of its address space to be deallocated.
82: */
83: routine task_terminate(
84: target_task : task_t);
85:
86: /*
87: * Returns the set of threads belonging to the target task.
88: */
89: routine task_threads(
90: target_task : task_t;
91: out act_list : thread_act_array_t);
92:
93: /*
94: * Stash a handful of ports for the target task; child
95: * tasks inherit this stash at task_create time.
96: */
97: routine mach_ports_register(
98: target_task : task_t;
99: init_port_set : mach_port_array_t =
100: ^array[] of mach_port_t);
101:
102: /*
103: * Retrieve the stashed ports for the target task.
104: */
105: routine mach_ports_lookup(
106: target_task : task_t;
107: out init_port_set : mach_port_array_t =
108: ^array[] of mach_port_t);
109:
110: /*
111: * Returns information about the target task.
112: */
113: routine task_info(
114: target_task : task_t;
115: flavor : task_flavor_t;
116: out task_info_out : task_info_t, CountInOut);
117:
118: /*
119: * Set task information.
120: */
121: routine task_set_info(
122: target_task : task_t;
123: flavor : task_flavor_t;
124: task_info_in : task_info_t);
125:
126: /*
127: * Increment the suspend count for the target task.
128: * No threads within a task may run when the suspend
129: * count for that task is non-zero.
130: */
131: routine task_suspend(
132: target_task : task_t);
133:
134:
135: /*
136: * Decrement the suspend count for the target task,
137: * if the count is currently non-zero. If the resulting
138: * suspend count is zero, then threads within the task
139: * that also have non-zero suspend counts may execute.
140: */
141: routine task_resume(
142: target_task : task_t);
143:
144: /*
145: * Returns the current value of the selected special port
146: * associated with the target task.
147: */
148: routine task_get_special_port(
149: task : task_t;
150: which_port : int;
151: out special_port : mach_port_t);
152:
153: /*
154: * Set one of the special ports associated with the
155: * target task.
156: */
157: routine task_set_special_port(
158: task : task_t;
159: which_port : int;
160: special_port : mach_port_t);
161:
162: /*
163: * Create a new thread within the target task, returning
164: * the port representing the first thr_act in that new thread. The
165: * initial execution state of the thread is undefined.
166: */
167: routine thread_create(
168: parent_task : task_t;
169: out child_act : thread_act_t);
170:
171: /*
172: * Create a new thread within the target task, returning
173: * the port representing that new thread. The new thread
174: * is not suspended; its initial execution state is given
175: * by flavor and new_state. Returns the port representing
176: * the new thread.
177: */
178: routine thread_create_running(
179: parent_task : task_t;
180: flavor : thread_state_flavor_t;
181: new_state : thread_state_t;
182: out child_act : thread_act_t);
183:
184: /*
185: * Set an exception handler for a task on one or more exception types.
186: * These handlers are invoked for all threads in the task if there are
187: * no thread-specific exception handlers or those handlers returned an
188: * error.
189: */
190: routine task_set_exception_ports(
191: task : task_t;
192: exception_mask : exception_mask_t;
193: new_port : mach_port_t;
194: behavior : exception_behavior_t;
195: new_flavor : thread_state_flavor_t);
196:
197:
198: /*
199: * Lookup some of the old exception handlers for a task
200: */
201: routine task_get_exception_ports(
202: task : task_t;
203: exception_mask : exception_mask_t;
204: out masks : exception_mask_array_t;
205: out old_handlers : exception_handler_array_t, SameCount;
206: out old_behaviors : exception_behavior_array_t, SameCount;
207: out old_flavors : exception_flavor_array_t, SameCount);
208:
209:
210: /*
211: * Set an exception handler for a thread on one or more exception types.
212: * At the same time, return the previously defined exception handlers for
213: * those types.
214: */
215: routine task_swap_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: out masks : exception_mask_array_t;
222: out old_handlerss : exception_handler_array_t, SameCount;
223: out old_behaviors : exception_behavior_array_t, SameCount;
224: out old_flavors : exception_flavor_array_t, SameCount);
225:
226: /*
227: * Create and destroy lock_set and semaphore synchronizers on a
228: * per-task basis (i.e. the task owns them).
229: */
230: routine lock_set_create(
231: task : task_t;
232: out new_lock_set : lock_set_t;
233: n_ulocks : int;
234: policy : int);
235:
236: routine lock_set_destroy(
237: task : task_t;
238: lock_set : lock_set_t);
239:
240: routine semaphore_create(
241: task : task_t;
242: out semaphore : semaphore_t;
243: policy : int;
244: value : int);
245:
246: routine semaphore_destroy(
247: task : task_t;
248: semaphore : semaphore_consume_ref_t);
249:
250: /*
251: * Set scheduling policy and parameters for the given task.
252: * Policy must be a policy which is enabled for the
253: * processor set. Change contained threads if requested.
254: * (This should replace `task_policy()' with the addition
255: * of the MK Scheduling Framework to the kernel.)
256: */
257: routine task_set_sched(
258: task : task_t;
259: policy : policy_t;
260: sched_attr : sched_attr_t;
261: set_limit : boolean_t;
262: change : boolean_t);
263:
264: /*
265: * Get scheduling policy and parameters for the given task.
266: * (This was added as part of the MK Scheduling Framework.)
267: */
268: routine task_get_sched(
269: task : task_t;
270: policy : policy_t;
271: sched_attr : sched_attr_t;
272: sched_attr_size : int);
273:
274:
275: /*
276: * Task profiling.
277: */
278: routine task_sample(
279: task : task_t;
280: reply : mach_port_make_send_t);
281:
282: /*
283: * JMM - Everything from here down is likely to go away soon
284: */
285: /*
286: * Set scheduling policy and parameters, both base and limit, for
287: * the given task. Policy must be a policy which is enabled for the
288: * processor set. Change contained threads if requested.
289: */
290: routine task_policy(
291: task : task_t;
292: policy : policy_t;
293: base : policy_base_t;
294: set_limit : boolean_t;
295: change : boolean_t);
296:
297:
298: /*
299: * Establish a user-level handler for the specified
300: * system call.
301: */
302: routine task_set_emulation(
303: target_port : task_t;
304: routine_entry_pt: vm_address_t;
305: routine_number : int);
306:
307: /*
308: * Get user-level handler entry points for all
309: * emulated system calls.
310: */
311: routine task_get_emulation_vector(
312: task : task_t;
313: out vector_start : int;
314: out emulation_vector: emulation_vector_t);
315:
316: /*
317: * Establish user-level handlers for the specified
318: * system calls. Non-emulated system calls are specified
319: * with emulation_vector[i] == EML_ROUTINE_NULL.
320: */
321: routine task_set_emulation_vector(
322: task : task_t;
323: vector_start : int;
324: emulation_vector: emulation_vector_t);
325:
326:
327: /*
328: * Establish restart pc for interrupted atomic sequences.
329: */
330: routine task_set_ras_pc(
331: target_task : task_t;
332: basepc : vm_address_t;
333: boundspc : vm_address_t);
334:
335:
336: /*
337: * JMM - Want to eliminate kernel tasks and processor_set so
338: * keep them at the end.
339: */
340: /*
341: * Create a new task in the kernel's address space with
342: * an empty set of IPC rights, with a map allocated from
343: * the kernel's map starting at map_base of length map_size.
344: */
345: routine kernel_task_create(
346: target_task : task_t;
347: map_base : vm_offset_t;
348: map_size : vm_size_t;
349: out child_task : task_t);
350:
351: /*
352: * Assign task to processor set.
353: */
354: routine task_assign(
355: task : task_t;
356: new_set : processor_set_t;
357: assign_threads : boolean_t);
358:
359: /*
360: * Assign task to default set.
361: */
362: routine task_assign_default(
363: task : task_t;
364: assign_threads : boolean_t);
365:
366: /*
367: * Get current assignment for task.
368: */
369: routine task_get_assignment(
370: task : task_t;
371: out assigned_set : processor_set_name_t);
372:
373: /*
374: * Set scheduling policy and parameters, both base and limit, for
375: * the given task. Policy can be any policy implemented by the
376: * processor set, whether enabled or not. Change contained threads
377: * if requested.
378: *
379: * JMM - Note that when processor sets go away, this should go on
380: * the host_priv port (passing in the task, not vice-versa).
381: */
382: routine task_set_policy(
383: task : task_t;
384: pset : processor_set_t;
385: policy : policy_t;
386: base : policy_base_t;
387: limit : policy_limit_t;
388: change : boolean_t);
389:
390: /*
391: * Registers the caller-specified RPC subsystem as a new object.
392: */
393: routine mach_subsystem_create(
394: task : task_t;
395: user_subsys : user_subsystem_t;
396: out subsys : subsystem_t);
397:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.