]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb 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 | |
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 | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
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. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* | |
31 | * @OSF_COPYRIGHT@ | |
32 | */ | |
33 | /* | |
34 | * Mach Operating System | |
35 | * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University | |
36 | * All Rights Reserved. | |
37 | * | |
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. | |
43 | * | |
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. | |
47 | * | |
48 | * Carnegie Mellon requests users of this software to return to | |
49 | * | |
50 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
51 | * School of Computer Science | |
52 | * Carnegie Mellon University | |
53 | * Pittsburgh PA 15213-3890 | |
54 | * | |
55 | * any improvements or extensions that they make and grant Carnegie Mellon | |
56 | * the rights to redistribute these changes. | |
57 | */ | |
58 | /* | |
59 | */ | |
60 | ||
61 | /* | |
62 | * Matchmaker definitions file for Mach kernel interface. | |
63 | */ | |
64 | subsystem | |
65 | #if KERNEL_USER | |
66 | KernelUser | |
67 | #endif /* KERNEL_USER */ | |
68 | #if KERNEL_SERVER | |
69 | KernelServer | |
70 | #endif /* KERNEL_SERVER */ | |
71 | host_priv 400; | |
72 | ||
73 | #ifdef KERNEL_USER | |
74 | userprefix r_; | |
75 | #endif /* KERNEL_USER */ | |
76 | ||
77 | #include <mach/std_types.defs> | |
78 | #include <mach/mach_types.defs> | |
79 | #include <mach/clock_types.defs> | |
80 | #include <mach_debug/mach_debug_types.defs> | |
81 | ||
82 | /* | |
83 | * Get boot configuration information from kernel. | |
84 | */ | |
85 | routine host_get_boot_info( | |
86 | host_priv : host_priv_t; | |
87 | out boot_info : kernel_boot_info_t); | |
88 | ||
89 | /* | |
90 | * Reboot this host. | |
91 | * Only available to privileged users. | |
92 | */ | |
93 | routine host_reboot( | |
94 | host_priv : host_priv_t; | |
95 | options : int); | |
96 | ||
97 | ||
98 | /* | |
99 | * Return privileged statistics from this host. | |
100 | */ | |
101 | routine host_priv_statistics( | |
102 | host_priv : host_priv_t; | |
103 | flavor : host_flavor_t; | |
104 | out host_info_out : host_info_t, CountInOut); | |
105 | ||
106 | /* | |
107 | * Sets the default memory manager, the port to which | |
108 | * newly-created temporary memory objects are delivered. | |
109 | * [See (memory_object_default)memory_object_create.] | |
110 | * Also sets the default cluster size used for pagein/pageout | |
111 | * to this port. | |
112 | * The old memory manager port is returned. | |
113 | */ | |
114 | routine host_default_memory_manager( | |
115 | host_priv : host_priv_t; | |
116 | inout default_manager : memory_object_default_t = | |
117 | MACH_MSG_TYPE_MAKE_SEND; | |
118 | cluster_size : vm_size_t); | |
119 | ||
120 | ||
121 | /* | |
122 | * Specify that the range of the virtual address space | |
123 | * of the target task must not cause page faults for | |
124 | * the indicated accesses. | |
125 | * | |
126 | * [ To unwire the pages, specify VM_PROT_NONE. ] | |
127 | */ | |
128 | routine vm_wire( | |
129 | host_priv : host_priv_t; | |
130 | task : vm_map_t; | |
131 | address : vm_address_t; | |
132 | size : vm_size_t; | |
91447636 | 133 | desired_access : vm_prot_t); |
1c79356b A |
134 | |
135 | /* | |
136 | * Specify that the target thread must always be able | |
137 | * to run and to allocate memory. | |
138 | */ | |
139 | routine thread_wire( | |
140 | host_priv : host_priv_t; | |
141 | thread : thread_act_t; | |
142 | wired : boolean_t); | |
143 | ||
144 | /* | |
145 | * Allocate zero-filled, wired, contiguous physical memory | |
146 | * in the address space of the target task, either at the | |
147 | * specified address, or wherever space can be found (if | |
148 | * anywhere is TRUE), of the specified size. The address | |
149 | * at which the allocation actually took place is returned. | |
150 | * All pages will be entered into the task's pmap immediately, | |
151 | * with VM_PROT_ALL. | |
152 | * | |
153 | * In addition to all the failure modes of its cousin, | |
154 | * vm_allocate, this call may also fail if insufficient | |
155 | * contiguous memory exists to satisfy the request. | |
156 | * | |
157 | * Memory obtained from this call should be freed the | |
158 | * normal way, via vm_deallocate. | |
159 | * | |
160 | * N.B. This is an EXPERIMENTAL interface! | |
161 | */ | |
162 | routine vm_allocate_cpm( | |
163 | host_priv : host_priv_t; | |
164 | task : vm_map_t; | |
165 | inout address : vm_address_t; | |
166 | size : vm_size_t; | |
167 | anywhere : boolean_t); | |
168 | ||
169 | /* | |
170 | * Get list of processors on this host. | |
171 | */ | |
172 | routine host_processors( | |
91447636 A |
173 | host_priv : host_priv_t; |
174 | out out_processor_list : processor_array_t); | |
1c79356b A |
175 | |
176 | ||
177 | /* | |
55e303ae | 178 | * Get control port for a system-wide clock. |
1c79356b A |
179 | * Privileged. |
180 | */ | |
181 | routine host_get_clock_control( | |
182 | host_priv : host_priv_t; | |
183 | clock_id : clock_id_t; | |
184 | out clock_ctrl : clock_ctrl_t); | |
185 | ||
186 | ||
187 | /* | |
188 | * kernel module interface | |
189 | * | |
190 | * see mach/kmod.h: | |
191 | */ | |
192 | routine kmod_create( | |
193 | host_priv : host_priv_t; | |
194 | info : vm_address_t; | |
195 | out module : kmod_t); | |
196 | ||
197 | routine kmod_destroy( | |
198 | host_priv : host_priv_t; | |
199 | module : kmod_t); | |
200 | ||
201 | routine kmod_control( | |
202 | host_priv : host_priv_t; | |
203 | module : kmod_t; | |
204 | flavor : kmod_control_flavor_t; | |
205 | inout data : kmod_args_t); | |
206 | ||
207 | /* | |
208 | * Get a given special port for a given node. | |
55e303ae | 209 | * Special ports are defined in host_special_ports.h; |
1c79356b A |
210 | * examples include the master device port. |
211 | * There are a limited number of slots available for system servers. | |
212 | */ | |
213 | routine host_get_special_port( | |
214 | host_priv : host_priv_t; | |
215 | node : int; | |
216 | which : int; | |
217 | out port : mach_port_t); | |
218 | ||
219 | /* | |
55e303ae A |
220 | * Set a given special port for the local node. |
221 | * See host_get_special_port. | |
1c79356b A |
222 | */ |
223 | routine host_set_special_port( | |
224 | host_priv : host_priv_t; | |
225 | which : int; | |
226 | port : mach_port_t); | |
227 | ||
228 | /* | |
229 | * Set an exception handler for a host on one or more exception types. | |
230 | * These handlers are invoked for all threads on the host if there are | |
231 | * no task or thread-specific exception handlers or those handlers returned | |
232 | * an error. | |
233 | */ | |
234 | routine host_set_exception_ports( | |
235 | host_priv : host_priv_t; | |
236 | exception_mask : exception_mask_t; | |
237 | new_port : mach_port_t; | |
238 | behavior : exception_behavior_t; | |
239 | new_flavor : thread_state_flavor_t); | |
240 | ||
241 | ||
242 | /* | |
243 | * Lookup some of the old exception handlers for a host | |
244 | */ | |
245 | routine host_get_exception_ports( | |
246 | host_priv : host_priv_t; | |
247 | exception_mask : exception_mask_t; | |
248 | out masks : exception_mask_array_t; | |
249 | out old_handlers : exception_handler_array_t, SameCount; | |
250 | out old_behaviors : exception_behavior_array_t, SameCount; | |
251 | out old_flavors : exception_flavor_array_t, SameCount); | |
252 | ||
253 | ||
254 | /* | |
255 | * Set an exception handler for a host on one or more exception types. | |
256 | * At the same time, return the previously defined exception handlers for | |
257 | * those types. | |
258 | */ | |
259 | routine host_swap_exception_ports( | |
260 | host_priv : host_priv_t; | |
261 | exception_mask : exception_mask_t; | |
262 | new_port : mach_port_t; | |
263 | behavior : exception_behavior_t; | |
264 | new_flavor : thread_state_flavor_t; | |
265 | out masks : exception_mask_array_t; | |
266 | out old_handlerss : exception_handler_array_t, SameCount; | |
267 | out old_behaviors : exception_behavior_array_t, SameCount; | |
268 | out old_flavors : exception_flavor_array_t, SameCount); | |
269 | ||
270 | /* | |
271 | * Loads a symbol table for an external file into the kernel debugger. | |
272 | * The symbol table data is an array of characters. It is assumed that | |
273 | * the caller and the kernel debugger agree on its format. | |
274 | * This call is only supported in MACH_DEBUG and MACH_KDB kernels, | |
275 | * otherwise KERN_FAILURE is returned. | |
276 | */ | |
277 | routine host_load_symbol_table( | |
278 | host : host_priv_t; | |
279 | task : task_t; | |
280 | name : symtab_name_t; | |
281 | symtab : pointer_t); | |
282 | ||
283 | /* | |
91447636 A |
284 | * Specify that the range of the virtual address space |
285 | * of the target task must not cause page faults for | |
286 | * the indicated accesses. | |
287 | * | |
288 | * [ To unwire the pages, specify VM_PROT_NONE. ] | |
1c79356b | 289 | */ |
91447636 | 290 | routine mach_vm_wire( |
1c79356b | 291 | host_priv : host_priv_t; |
91447636 A |
292 | task : vm_map_t; |
293 | address : mach_vm_address_t; | |
294 | size : mach_vm_size_t; | |
295 | desired_access : vm_prot_t); | |
1c79356b A |
296 | |
297 | /* | |
298 | * JMM - Keep all processor_set related items at the end for easy | |
299 | * removal. | |
300 | */ | |
301 | /* | |
302 | * List all processor sets on host. | |
303 | */ | |
304 | routine host_processor_sets( | |
305 | host_priv : host_priv_t; | |
306 | out processor_sets : processor_set_name_array_t); | |
307 | ||
308 | /* | |
309 | * Get control port for a processor set. | |
310 | */ | |
311 | routine host_processor_set_priv( | |
312 | host_priv : host_priv_t; | |
313 | set_name : processor_set_name_t; | |
314 | out set : processor_set_t); | |
55e303ae A |
315 | |
316 | /************************** Warning *************************************/ | |
317 | /* The following routines are going away in a future release */ | |
318 | /* use the appropriate variant of host_set_special_port instead */ | |
319 | /************************************************************************/ | |
320 | ||
1c79356b A |
321 | /* |
322 | * Set the dynamic_pager control port. Other entities | |
323 | * can request a send right to this port to talk with | |
324 | * the dynamic_pager utility, setting behavioral parameters | |
325 | * within the dynamic pager and getting low/high backing store | |
326 | * resource notifications. | |
327 | */ | |
328 | routine set_dp_control_port( | |
329 | host : host_priv_t; | |
330 | in control_port : mach_port_t); | |
331 | ||
332 | /* | |
333 | * Get the dynamic_pager control port. This port | |
334 | * allows the holder to talk directly with the dynamic | |
335 | * pager utility. | |
336 | */ | |
337 | routine get_dp_control_port( | |
338 | host : host_priv_t; | |
339 | out contorl_port :mach_port_t); | |
340 | ||
341 | /* | |
342 | * Set the UserNotification daemon access port for this host. | |
343 | * If this value is already set, the kernel will discard its | |
344 | * reference to the previously registered port. | |
345 | */ | |
346 | routine host_set_UNDServer( | |
347 | host : host_priv_t; | |
348 | in server : UNDServerRef); | |
349 | ||
350 | /* | |
351 | * Get the UserNotification daemon access port for this host. | |
352 | * This can then be used to communicate with that daemon, which | |
353 | * in turn communicates with the User through whatever means | |
354 | * available (pop-up-menus for GUI systems, text for non-GUI, etc..). | |
355 | * | |
356 | * Access to this port is restricted to privileged clients because | |
357 | * it is a special purpose port intended for kernel clients. User | |
358 | * level clients should go directly to the CFUserNotifcation services. | |
359 | */ | |
360 | routine host_get_UNDServer( | |
361 | host : host_priv_t; | |
362 | out server : UNDServerRef); |