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