]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
b0d623f7 | 2 | * Copyright (c) 2000-2004 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_COPYRIGHT@ | |
30 | */ | |
31 | /* | |
32 | * Mach Operating System | |
33 | * Copyright (c) 1991,1990,1989,1988 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 | /* | |
60 | * Matchmaker definitions file for Mach kernel interface. | |
61 | */ | |
62 | subsystem | |
63 | #if KERNEL_USER | |
64 | KernelUser | |
65 | #endif /* KERNEL_USER */ | |
66 | #if KERNEL_SERVER | |
67 | KernelServer | |
68 | #endif /* KERNEL_SERVER */ | |
69 | host_priv 400; | |
70 | ||
71 | #ifdef KERNEL_USER | |
72 | userprefix r_; | |
73 | #endif /* KERNEL_USER */ | |
74 | ||
5ba3f43e A |
75 | #define CONCAT(a,b) a ## b |
76 | #if KERNEL_SERVER | |
77 | #define KERNEL_SERVER_SUFFIX(NAME) CONCAT(NAME, _external) | |
78 | #else | |
79 | #define KERNEL_SERVER_SUFFIX(NAME) NAME | |
80 | #endif | |
81 | ||
1c79356b A |
82 | #include <mach/std_types.defs> |
83 | #include <mach/mach_types.defs> | |
84 | #include <mach/clock_types.defs> | |
85 | #include <mach_debug/mach_debug_types.defs> | |
86 | ||
87 | /* | |
88 | * Get boot configuration information from kernel. | |
89 | */ | |
90 | routine host_get_boot_info( | |
91 | host_priv : host_priv_t; | |
92 | out boot_info : kernel_boot_info_t); | |
93 | ||
94 | /* | |
95 | * Reboot this host. | |
96 | * Only available to privileged users. | |
97 | */ | |
98 | routine host_reboot( | |
99 | host_priv : host_priv_t; | |
100 | options : int); | |
101 | ||
102 | ||
103 | /* | |
104 | * Return privileged statistics from this host. | |
105 | */ | |
106 | routine host_priv_statistics( | |
107 | host_priv : host_priv_t; | |
108 | flavor : host_flavor_t; | |
109 | out host_info_out : host_info_t, CountInOut); | |
110 | ||
111 | /* | |
112 | * Sets the default memory manager, the port to which | |
113 | * newly-created temporary memory objects are delivered. | |
114 | * [See (memory_object_default)memory_object_create.] | |
115 | * Also sets the default cluster size used for pagein/pageout | |
116 | * to this port. | |
117 | * The old memory manager port is returned. | |
118 | */ | |
119 | routine host_default_memory_manager( | |
120 | host_priv : host_priv_t; | |
121 | inout default_manager : memory_object_default_t = | |
122 | MACH_MSG_TYPE_MAKE_SEND; | |
b0d623f7 | 123 | cluster_size : memory_object_cluster_size_t); |
1c79356b A |
124 | |
125 | ||
126 | /* | |
127 | * Specify that the range of the virtual address space | |
128 | * of the target task must not cause page faults for | |
129 | * the indicated accesses. | |
130 | * | |
131 | * [ To unwire the pages, specify VM_PROT_NONE. ] | |
132 | */ | |
133 | routine vm_wire( | |
134 | host_priv : host_priv_t; | |
135 | task : vm_map_t; | |
136 | address : vm_address_t; | |
137 | size : vm_size_t; | |
91447636 | 138 | desired_access : vm_prot_t); |
1c79356b A |
139 | |
140 | /* | |
141 | * Specify that the target thread must always be able | |
142 | * to run and to allocate memory. | |
143 | */ | |
144 | routine thread_wire( | |
145 | host_priv : host_priv_t; | |
146 | thread : thread_act_t; | |
147 | wired : boolean_t); | |
148 | ||
149 | /* | |
150 | * Allocate zero-filled, wired, contiguous physical memory | |
151 | * in the address space of the target task, either at the | |
152 | * specified address, or wherever space can be found (if | |
153 | * anywhere is TRUE), of the specified size. The address | |
154 | * at which the allocation actually took place is returned. | |
155 | * All pages will be entered into the task's pmap immediately, | |
156 | * with VM_PROT_ALL. | |
157 | * | |
158 | * In addition to all the failure modes of its cousin, | |
159 | * vm_allocate, this call may also fail if insufficient | |
160 | * contiguous memory exists to satisfy the request. | |
161 | * | |
162 | * Memory obtained from this call should be freed the | |
163 | * normal way, via vm_deallocate. | |
164 | * | |
165 | * N.B. This is an EXPERIMENTAL interface! | |
166 | */ | |
167 | routine vm_allocate_cpm( | |
168 | host_priv : host_priv_t; | |
169 | task : vm_map_t; | |
170 | inout address : vm_address_t; | |
171 | size : vm_size_t; | |
b0d623f7 | 172 | flags : int); |
1c79356b A |
173 | |
174 | /* | |
175 | * Get list of processors on this host. | |
176 | */ | |
177 | routine host_processors( | |
91447636 A |
178 | host_priv : host_priv_t; |
179 | out out_processor_list : processor_array_t); | |
1c79356b A |
180 | |
181 | ||
182 | /* | |
55e303ae | 183 | * Get control port for a system-wide clock. |
1c79356b A |
184 | * Privileged. |
185 | */ | |
186 | routine host_get_clock_control( | |
187 | host_priv : host_priv_t; | |
188 | clock_id : clock_id_t; | |
189 | out clock_ctrl : clock_ctrl_t); | |
190 | ||
191 | ||
192 | /* | |
b0d623f7 A |
193 | * kernel module interface (obsolete as of SnowLeopard) |
194 | * see mach/kmod.h | |
1c79356b | 195 | */ |
b0d623f7 | 196 | /* kmod_ MIG calls now return KERN_NOT_SUPPORTED on PPC/i386/x86_64. */ |
1c79356b A |
197 | routine kmod_create( |
198 | host_priv : host_priv_t; | |
199 | info : vm_address_t; | |
200 | out module : kmod_t); | |
201 | ||
202 | routine kmod_destroy( | |
203 | host_priv : host_priv_t; | |
204 | module : kmod_t); | |
205 | ||
206 | routine kmod_control( | |
207 | host_priv : host_priv_t; | |
208 | module : kmod_t; | |
209 | flavor : kmod_control_flavor_t; | |
210 | inout data : kmod_args_t); | |
211 | ||
212 | /* | |
213 | * Get a given special port for a given node. | |
55e303ae | 214 | * Special ports are defined in host_special_ports.h; |
1c79356b A |
215 | * examples include the master device port. |
216 | * There are a limited number of slots available for system servers. | |
217 | */ | |
f427ee49 A |
218 | routine |
219 | #if KERNEL_SERVER && MACH_KERNEL_PRIVATE | |
220 | host_get_special_port_from_user( | |
221 | #else | |
222 | host_get_special_port( | |
223 | #endif | |
1c79356b A |
224 | host_priv : host_priv_t; |
225 | node : int; | |
226 | which : int; | |
227 | out port : mach_port_t); | |
228 | ||
229 | /* | |
55e303ae A |
230 | * Set a given special port for the local node. |
231 | * See host_get_special_port. | |
1c79356b | 232 | */ |
f427ee49 A |
233 | routine |
234 | #if KERNEL_SERVER && MACH_KERNEL_PRIVATE | |
235 | host_set_special_port_from_user( | |
236 | #else | |
237 | host_set_special_port( | |
238 | #endif | |
1c79356b A |
239 | host_priv : host_priv_t; |
240 | which : int; | |
241 | port : mach_port_t); | |
242 | ||
243 | /* | |
244 | * Set an exception handler for a host on one or more exception types. | |
245 | * These handlers are invoked for all threads on the host if there are | |
246 | * no task or thread-specific exception handlers or those handlers returned | |
247 | * an error. | |
248 | */ | |
249 | routine host_set_exception_ports( | |
250 | host_priv : host_priv_t; | |
251 | exception_mask : exception_mask_t; | |
252 | new_port : mach_port_t; | |
253 | behavior : exception_behavior_t; | |
254 | new_flavor : thread_state_flavor_t); | |
255 | ||
256 | ||
257 | /* | |
258 | * Lookup some of the old exception handlers for a host | |
259 | */ | |
260 | routine host_get_exception_ports( | |
261 | host_priv : host_priv_t; | |
262 | exception_mask : exception_mask_t; | |
263 | out masks : exception_mask_array_t; | |
264 | out old_handlers : exception_handler_array_t, SameCount; | |
265 | out old_behaviors : exception_behavior_array_t, SameCount; | |
266 | out old_flavors : exception_flavor_array_t, SameCount); | |
267 | ||
268 | ||
269 | /* | |
270 | * Set an exception handler for a host on one or more exception types. | |
271 | * At the same time, return the previously defined exception handlers for | |
272 | * those types. | |
273 | */ | |
274 | routine host_swap_exception_ports( | |
275 | host_priv : host_priv_t; | |
276 | exception_mask : exception_mask_t; | |
277 | new_port : mach_port_t; | |
278 | behavior : exception_behavior_t; | |
279 | new_flavor : thread_state_flavor_t; | |
280 | out masks : exception_mask_array_t; | |
281 | out old_handlerss : exception_handler_array_t, SameCount; | |
282 | out old_behaviors : exception_behavior_array_t, SameCount; | |
283 | out old_flavors : exception_flavor_array_t, SameCount); | |
284 | ||
316670eb | 285 | skip; /* old host_load_symbol_table */ |
1c79356b A |
286 | |
287 | /* | |
91447636 A |
288 | * Specify that the range of the virtual address space |
289 | * of the target task must not cause page faults for | |
290 | * the indicated accesses. | |
291 | * | |
292 | * [ To unwire the pages, specify VM_PROT_NONE. ] | |
1c79356b | 293 | */ |
5ba3f43e | 294 | routine KERNEL_SERVER_SUFFIX(mach_vm_wire)( |
1c79356b | 295 | host_priv : host_priv_t; |
91447636 A |
296 | task : vm_map_t; |
297 | address : mach_vm_address_t; | |
298 | size : mach_vm_size_t; | |
299 | desired_access : vm_prot_t); | |
1c79356b A |
300 | |
301 | /* | |
302 | * JMM - Keep all processor_set related items at the end for easy | |
303 | * removal. | |
304 | */ | |
305 | /* | |
306 | * List all processor sets on host. | |
307 | */ | |
308 | routine host_processor_sets( | |
309 | host_priv : host_priv_t; | |
310 | out processor_sets : processor_set_name_array_t); | |
311 | ||
312 | /* | |
313 | * Get control port for a processor set. | |
314 | */ | |
315 | routine host_processor_set_priv( | |
316 | host_priv : host_priv_t; | |
317 | set_name : processor_set_name_t; | |
318 | out set : processor_set_t); | |
55e303ae A |
319 | |
320 | /************************** Warning *************************************/ | |
321 | /* The following routines are going away in a future release */ | |
322 | /* use the appropriate variant of host_set_special_port instead */ | |
323 | /************************************************************************/ | |
1c79356b | 324 | |
5ba3f43e A |
325 | skip;/* old set_dp_control_port */ |
326 | skip;/* old get_dp_control_port */ | |
1c79356b A |
327 | |
328 | /* | |
329 | * Set the UserNotification daemon access port for this host. | |
330 | * If this value is already set, the kernel will discard its | |
331 | * reference to the previously registered port. | |
332 | */ | |
333 | routine host_set_UNDServer( | |
334 | host : host_priv_t; | |
335 | in server : UNDServerRef); | |
336 | ||
337 | /* | |
338 | * Get the UserNotification daemon access port for this host. | |
339 | * This can then be used to communicate with that daemon, which | |
340 | * in turn communicates with the User through whatever means | |
341 | * available (pop-up-menus for GUI systems, text for non-GUI, etc..). | |
342 | * | |
343 | * Access to this port is restricted to privileged clients because | |
344 | * it is a special purpose port intended for kernel clients. User | |
345 | * level clients should go directly to the CFUserNotifcation services. | |
346 | */ | |
347 | routine host_get_UNDServer( | |
348 | host : host_priv_t; | |
349 | out server : UNDServerRef); | |
2d21ac55 | 350 | |
b0d623f7 A |
351 | /* |
352 | * Perform an operation with a kernel extension, on the kext loading system, | |
353 | * or request information about loaded kexts or the state of the kext loading | |
354 | * system. | |
355 | * Active operations (load, unload, disable/enable) require host_priv/root access. | |
356 | * Info retrieval does not. | |
357 | * | |
358 | * WARNING: THIS ROUTINE IS PRIVATE TO THE KEXT-MANAGEMENT STACK AND IS | |
359 | * SUBJECT TO CHANGE AT ANY TIME. | |
360 | */ | |
361 | routine kext_request( | |
362 | host_priv : host_priv_t; | |
363 | in user_log_flags : uint32_t; | |
364 | in request_data : pointer_t; | |
365 | out response_data : pointer_t; | |
366 | out log_data : pointer_t; | |
367 | out op_result : kern_return_t); | |
368 | ||
2d21ac55 | 369 | /* vim: set ft=c : */ |