1/* 2 * Copyright (c) 2000-2009 Apple 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 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 [email protected] 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 * File: mach/mach_host.defs 61 * 62 * Abstract: 63 * Mach host operations support. Includes processor allocation and 64 * control. 65 */ 66 67subsystem 68#if KERNEL_SERVER || KOBJECT_SERVER 69 KernelServer 70#endif /* KERNEL_SERVER || KOBJECT_SERVER */ 71 mach_host 200; 72 73#if KERNEL_SERVER 74#define VM_KERNEL_SERVER 1 75#endif 76 77/* 78 * Basic types 79 */ 80 81#include <mach/std_types.defs> 82#include <mach/mach_types.defs> 83#include <mach/clock_types.defs> 84#include <mach_debug/mach_debug_types.defs> 85 86/* 87 * References to host objects are returned by: 88 * mach_host_self() - trap 89 */ 90 91/* 92 * Return information about this host. 93 */ 94routine host_info( 95 host : host_t; 96 flavor : host_flavor_t; 97 out host_info_out : host_info_t, CountInOut); 98 99/* 100 * Get string describing current kernel version. 101 */ 102routine host_kernel_version( 103 host : host_t; 104 out kernel_version : kernel_version_t); 105 106/* 107 * Get host page size 108 * (compatibility for running old libraries on new kernels - 109 * host_page_size() is now a library routine based on constants) 110 */ 111#if KERNEL 112routine host_page_size( 113#else 114routine _host_page_size( 115#endif 116 host : host_t; 117 out out_page_size : vm_size_t); 118 119/* 120 * Allow pagers to create named entries that point to un-mapped 121 * abstract memory object. The named entries are generally mappable 122 * and can be subsetted through the mach_make_memory_entry call 123 */ 124routine mach_memory_object_memory_entry( 125 host :host_t; 126 internal :boolean_t; 127 size :VM_USE_TMPTYPE(vm_size_t); 128 permission :VM_USE_TMPTYPE(vm_prot_t); 129 pager :memory_object_t; 130 out entry_handle :mach_port_move_send_t); 131 132 133/* 134 * Get processor info for all the processors on this host. 135 * The returned data is an OOL array of processor info. 136 */ 137routine host_processor_info( 138 host : host_t; 139 flavor : processor_flavor_t; 140 out out_processor_count : natural_t; 141 out out_processor_info : processor_info_array_t); 142 143/* 144 * Return host IO main access port 145 */ 146routine 147#if SANDBOX_SUPPORTS_HOST_IOMAIN || !SANDBOX_COMPILER 148host_get_io_main( 149#else 150host_get_io_master( 151#endif 152 host : host_t; 153 out io_main : io_main_t); 154 155/* 156 * Get service port for a processor set. 157 * Available to all. 158 */ 159routine host_get_clock_service( 160 host : host_t; 161 clock_id : clock_id_t; 162 out clock_serv : clock_serv_t); 163 164/* 165 * kernel module interface (obsolete as of SnowLeopard) 166 * see mach/kmod.h 167 */ 168/* kmod_ MIG calls now return KERN_NOT_SUPPORTED on PPC/i386/x86_64. */ 169routine kmod_get_info( 170 host : host_t; 171 out modules : kmod_args_t); 172 173 174skip; /* was host_zone_info */ 175 176/* 177 * Returns information about the global VP table. 178 * Only supported in MACH_VM_DEBUG kernels, 179 * otherwise returns KERN_FAILURE. 180 */ 181routine host_virtual_physical_table_info( 182 host : host_t; 183 out info : hash_info_bucket_array_t, 184 Dealloc); 185 186 187skip; /* was host_ipc_hash_info */ 188skip; /* was enable_bluebox */ 189skip; /* was disable_bluebox */ 190 191/* 192 * Get default processor set for host. 193 */ 194routine processor_set_default( 195 host : host_t; 196 out default_set : processor_set_name_t); 197 198/* 199 * OBSOLETE interfaces, removed from kernel 200 */ 201#if KERNEL_SERVER 202skip; /* processor_set_create */ 203#else 204 205routine processor_set_create( 206 host : host_t; 207 out new_set : processor_set_t; 208 out new_name : processor_set_name_t); 209#endif 210 211routine mach_memory_object_memory_entry_64( 212 host :host_t; 213 internal :boolean_t; 214 size :VM_USE_TMPTYPE(memory_object_size_t); 215 permission :VM_USE_TMPTYPE(vm_prot_t); 216 pager :memory_object_t; 217 out entry_handle :mach_port_move_send_t); 218 219/* 220 * Return statistics from this host. 221 */ 222routine 223#ifdef KERNEL_SERVER 224host_statistics_from_user( 225#else 226host_statistics( 227#endif 228 host_priv : host_t; 229 flavor : host_flavor_t; 230 out host_info_out : host_info_t, CountInOut); 231 232routine host_request_notification( 233 host : host_t; 234 notify_type : host_flavor_t; 235 notify_port : mach_port_make_send_once_t); 236 237routine host_lockgroup_info( 238 host : host_t; 239 out lockgroup_info : lockgroup_info_array_t, 240 Dealloc); 241 242/* 243 * Return 64-bit statistics from this host. 244 */ 245routine 246#ifdef KERNEL_SERVER 247host_statistics64_from_user( 248#else 249host_statistics64( 250#endif 251 host_priv : host_t; 252 flavor : host_flavor_t; 253 out host_info64_out : host_info64_t, CountInOut); 254 255/* 256 * Returns information about the memory allocation zones. 257 * Data returned is compatible with various caller and kernel 258 * address space sizes. 259 */ 260routine mach_zone_info( 261 host : mach_port_t; 262 out names : mach_zone_name_array_t, 263 Dealloc; 264 out info : mach_zone_info_array_t, 265 Dealloc); 266 267#ifdef PRIVATE 268/* 269 * Forces a zone allocator garbage collections pass. 270 * Pages with no in-use allocations are returned to 271 * the VM system for re-use. 272 */ 273routine mach_zone_force_gc( 274 host : host_t); 275#else 276skip; 277#endif 278 279/* 280 * Create a new voucher by running a series of commands against 281 * <key, previous-voucher> pairs of resource attributes. 282 */ 283#if !KERNEL && !LIBSYSCALL_INTERFACE 284routine _kernelrpc_host_create_mach_voucher( 285#else 286routine host_create_mach_voucher( 287#endif 288 host : host_t; 289 recipes : mach_voucher_attr_raw_recipe_array_t; 290 out voucher : ipc_voucher_t); 291 292/* OBSOLETE */ 293#if KERNEL_SERVER 294skip; /* was host_register_mach_voucher_attr_manager */ 295skip; /* was host_register_well_known_mach_voucher_attr_manager */ 296#else 297routine host_register_mach_voucher_attr_manager( 298 host : host_t; 299 attr_manager : mach_voucher_attr_manager_t; 300 default_value : mach_voucher_attr_value_handle_t; 301 out new_key : mach_voucher_attr_key_t; 302 out new_attr_control: ipc_voucher_attr_control_t); 303 304routine host_register_well_known_mach_voucher_attr_manager( 305 host : host_t; 306 attr_manager : mach_voucher_attr_manager_t; 307 default_value : mach_voucher_attr_value_handle_t; 308 key : mach_voucher_attr_key_t; 309 out new_attr_control: ipc_voucher_attr_control_t); 310#endif 311 312/* 313 * Update the global ATM diagnostic flag, readable from the commpage 314 */ 315routine host_set_atm_diagnostic_flag( 316 host : host_t; 317 in diagnostic_flag : uint32_t); 318 319#if !KERNEL && LIBSYSCALL_INTERFACE 320routine host_get_atm_diagnostic_flag( 321 host : host_t; 322 out diagnostic_flag : uint32_t); 323#else 324skip; 325#endif 326 327routine mach_memory_info( 328 host : mach_port_t; 329 out names : mach_zone_name_array_t, 330 Dealloc; 331 out info : mach_zone_info_array_t, 332 Dealloc; 333 out memory_info : mach_memory_info_array_t, 334 Dealloc); 335 336/* 337 * Update the global multiuser flags, readable from the commpage 338 */ 339routine host_set_multiuser_config_flags( 340 host_priv : host_priv_t; 341 in multiuser_flags : uint32_t); 342 343#if !KERNEL && LIBSYSCALL_INTERFACE 344routine host_get_multiuser_config_flags( 345 host : host_t; 346 out multiuser_flags : uint32_t); 347#else 348skip; 349#endif // !KERNEL && LIBSYSCALL_INTERFACE 350 351#if !KERNEL && LIBSYSCALL_INTERFACE 352routine host_check_multiuser_mode( 353 host : host_t; 354 out multiuser_mode : uint32_t); 355#else 356skip; 357#endif // !KERNEL && LIBSYSCALL_INTERFACE 358 359/* 360 * Returns information about a specific zone. 361 * The zone name is passed in via the argument name, 362 * info returns the zone info. 363 */ 364routine mach_zone_info_for_zone( 365 host : host_priv_t; 366 name : mach_zone_name_t; 367 out info : mach_zone_info_t); 368 369#ifdef PRIVATE 370/* 371 * Returns information about the largest zone. 372 * name returns the zone name, info returns the zone info. 373 */ 374routine mach_zone_info_for_largest_zone( 375 host : host_priv_t; 376 out name : mach_zone_name_t; 377 out info : mach_zone_info_t); 378#else 379skip; 380#endif 381 382#ifdef PRIVATE 383/* 384 * Returns names of zones that have zlog enabled. 385 */ 386routine mach_zone_get_zlog_zones( 387 host : host_priv_t; 388 out names : mach_zone_name_array_t, 389 Dealloc); 390#else 391skip; 392#endif 393 394#ifdef PRIVATE 395/* 396 * Returns BTLog records for a specific zone. 397 * The zone name is passed in via the argument name, 398 * recs returns an array of zone_btrecord_t's. 399 */ 400routine mach_zone_get_btlog_records( 401 host : host_priv_t; 402 name : mach_zone_name_t; 403 out recs : zone_btrecord_array_t, 404 Dealloc); 405#else 406skip; 407#endif 408 409/* vim: set ft=c : */ 410