2 * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
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.
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.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
57 * NOTICE: This file was modified by McAfee Research in 2004 to introduce
58 * support for mandatory and extensible security protections. This notice
59 * is included in support of clause 2.2 (b) of the Apple Public License,
65 * Mach kernel interface type declarations
68 #ifndef _MACH_MACH_TYPES_DEFS_
69 #define _MACH_MACH_TYPES_DEFS_
72 #include <mach/std_types.defs>
74 type memory_object_offset_t = uint64_t;
75 type memory_object_size_t = uint64_t;
76 type memory_object_cluster_size_t = uint32_t;
77 type memory_object_fault_info_t = array[16] of integer_t;
81 /* Universal Page Lists - restricted to (in-kernel) pagers for now */
82 type upl_size_t = uint32_t;
83 type upl_offset_t = uint32_t;
84 type upl_page_info_t = struct[2] of integer_t;
85 type upl_page_info_array_t = array[*:256] of upl_page_info_t;
87 type upl_t = mach_port_t
88 intran: upl_t convert_port_to_upl(mach_port_t)
89 outtran: mach_port_t convert_upl_to_port(upl_t)
90 destructor: upl_deallocate(upl_t)
93 #endif /* KERNEL_PRIVATE */
95 type mach_port_status_t = struct[10] of integer_t; /* obsolete */
96 type mach_port_info_ext_t = struct[17] of integer_t;
98 /* mach_port_info_t: can hold either a
99 * mach_port_status_t (9 ints) or a
100 * mach_port_limits_t (1 int) or a
101 * mach_port_info_ext_t (17 ints). If new flavors of
102 * mach_port_{get,set}_attributes are added, the size of
103 * this array may have to be increased. (See mach/port.h)
105 type mach_port_flavor_t = int;
106 type mach_port_info_t = array[*:17] of integer_t;
109 * mach_msg_max_trailer_t: can hold
110 * mach_msg_trailer_type_t (1 int)
111 * mach_msg_trailer_size_t (1 int)
112 * mach_port_seqno_t (1 int)
113 * security_token_t (2 ints)
114 * audit_token_t (8 ints)
115 * mach_port_context_t (2 ints)
117 * msg_labels_t (1 int)
119 type mach_msg_trailer_type_t = int;
120 type mach_msg_trailer_info_t = array[*:68] of char;
122 type task_t = mach_port_t
124 intran: task_t convert_port_to_task(mach_port_t)
125 outtran: mach_port_t convert_task_to_port(task_t)
126 destructor: task_deallocate(task_t)
127 #endif /* KERNEL_SERVER */
130 type task_name_t = mach_port_t
132 intran: task_name_t convert_port_to_task_name(mach_port_t)
133 outtran: mach_port_t convert_task_name_to_port(task_name_t)
134 destructor: task_name_deallocate(task_name_t)
135 #endif /* KERNEL_SERVER */
138 type task_inspect_t = mach_port_t
140 intran: task_inspect_t convert_port_to_task_inspect(mach_port_t)
141 outtran: mach_port_t convert_task_inspect_to_port(task_inspect_t)
142 destructor: task_inspect_deallocate(task_inspect_t)
143 #endif /* KERNEL_SERVER */
146 type thread_t = mach_port_t
148 intran: thread_t convert_port_to_thread(mach_port_t)
149 outtran: mach_port_t convert_thread_to_port(thread_t)
150 destructor: thread_deallocate(thread_t)
151 #endif /* KERNEL_SERVER */
154 type thread_inspect_t = mach_port_t
156 intran: thread_inspect_t convert_port_to_thread_inspect(mach_port_t)
157 outtran: mach_port_t convert_thread_inspect_to_port(thread_inspect_t)
158 destructor: thread_inspect_deallocate(thread_inspect_t)
159 #endif /* KERNEL_SERVER */
162 type thread_act_t = mach_port_t
164 intran: thread_act_t convert_port_to_thread(mach_port_t)
165 outtran: mach_port_t convert_thread_to_port(thread_act_t)
166 destructor: thread_deallocate(thread_act_t)
167 #endif /* KERNEL_SERVER */
170 type thread_act_consume_ref_t = mach_port_move_send_t
171 cusertype: thread_act_t
173 intran: thread_act_t convert_port_to_thread(mach_port_t)
174 destructor: thread_deallocate(thread_act_t)
175 #endif /* KERNEL_SERVER */
178 type suid_cred_path_t = c_string[*:1024];
179 type suid_cred_uid_t = uint32_t;
180 type suid_cred_t = mach_port_t
182 outtran: mach_port_t convert_suid_cred_to_port(suid_cred_t)
183 #endif /* KERNEL_SERVER */
187 /* thread_state_t: This inline array can hold
188 * a machine-dependent amount of data, defined in
189 * mach/machine/???? (currently THREAD_STATE_MAX,
190 * in mach/thread_state.h)
192 #include <mach/machine/thread_state.h>
193 type thread_state_flavor_t = int;
194 type thread_state_t = array[*:THREAD_STATE_MAX] of natural_t;
196 type task_array_t = ^array[] of task_t;
197 type thread_array_t = ^array[] of thread_t;
198 type thread_act_array_t = ^array[] of thread_act_t;
199 type act_params_t = array[6] of int;
201 type vm_map_t = mach_port_t
203 intran: vm_map_t convert_port_to_map(mach_port_t)
204 destructor: vm_map_deallocate(vm_map_t)
205 #endif /* KERNEL_SERVER */
208 type vm_task_entry_t = mach_port_t
211 intran: vm_map_t convert_port_entry_to_map(mach_port_t)
212 destructor: vm_map_deallocate(vm_map_t)
213 #endif /* KERNEL_SERVER */
216 type ipc_space_t = mach_port_t
218 intran: ipc_space_t convert_port_to_space(mach_port_t)
219 destructor: space_deallocate(ipc_space_t)
220 #endif /* KERNEL_SERVER */
223 type ipc_space_inspect_t = mach_port_t
225 intran: ipc_space_inspect_t convert_port_to_space_inspect(mach_port_t)
226 destructor: space_inspect_deallocate(ipc_space_inspect_t)
227 #endif /* KERNEL_SERVER */
230 type arcade_register_t = mach_port_t
232 intran: arcade_register_t convert_port_to_arcade_register(mach_port_t)
233 #endif /* KERNEL_SERVER */
236 type vm_prot_t = int;
237 type vm_inherit_t = int;
238 type vm_purgable_t = int;
239 type xxx_vm_statistics_data_t = struct[13] of integer_t;
240 type vm_behavior_t = int;
241 type vm_statistics_data_t = struct[15] of integer_t;
242 type vm_machine_attribute_t = int;
243 type vm_machine_attribute_val_t = int;
244 type vm_sync_t = int;
246 /* thread_info_t: this inline array can hold any of:
247 * thread_basic_info_t (10 ints)
248 * policy_timeshare_info_t (5 ints)
249 * policy_fifo_info_t (4 ints)
250 * policy_rr_info_t (5 ints)
251 * thread_extended_info (12 ints + 64 chars)
252 * if other thread_info flavors are added, this
253 * definition may need to be changed. (See
254 * mach/thread_info.h and mach/policy.h) */
255 type thread_flavor_t = int;
256 type thread_info_t = array[*:32] of integer_t;
258 type thread_policy_flavor_t = natural_t;
259 type thread_policy_t = array[*:16] of integer_t;
261 /* task_info_t: this inline array can hold any of:
262 * task_basic_info_32_t (8 ints)
263 * task_basic_info_64_t (10 ints)
264 * task_events_info_t (8 ints)
265 * task_thread_times_info_t (4 ints)
266 * policy_timeshare_info_t (5 ints)
267 * policy_fifo_info_t (4 ints)
268 * policy_rr_info_t (5 ints)
269 * task security token (2 ints)
270 * task audit token (8 ints)
271 * dyld info (2 64-bit ints and 1 int)
272 * task_extmod_info_t (8 64-bit ints)
273 * task_basic_info_64_2_t
274 * mach_task_basic_info_t (12 ints)
275 * task_power_info_t (18 ints)
276 * task_vm_info_t (87 ints)
277 * If other task_info flavors are added, this
278 * definition may need to be changed. (See
279 * mach/task_info.h and mach/policy.h) */
280 type task_flavor_t = int;
281 type task_info_t = array[*:87] of integer_t;
283 type task_purgable_info_t = struct[68] of integer_t;
285 type task_policy_flavor_t = natural_t;
286 type task_policy_t = array[*:16] of integer_t;
288 type task_inspect_flavor_t = natural_t;
289 type task_inspect_info_t = array[*:4] of integer_t;
291 type task_exc_guard_behavior_t = uint32_t;
293 type mem_entry_name_port_t = mach_port_t
295 intran: mem_entry_name_port_t null_conversion(mach_port_t)
296 outtran: mach_port_t null_conversion(mem_entry_name_port_t)
297 #endif /* KERNEL_SERVER */
300 type mem_entry_name_port_move_send_t = mach_port_move_send_t
301 cusertype: mem_entry_name_port_t
303 intran: mem_entry_name_port_t null_conversion(mach_port_t)
304 outtran: mach_port_t null_conversion(mem_entry_name_port_t)
305 #endif /* KERNEL_SERVER */
308 type memory_object_default_t = mach_port_t
310 intran: memory_object_default_t null_conversion(mach_port_t)
311 outtran: mach_port_t null_conversion(memory_object_default_t)
312 #endif /* KERNEL_PRIVATE */
315 type memory_object_t = mach_port_t
317 intran: memory_object_t convert_port_to_memory_object(mach_port_t)
318 outtran: mach_port_t convert_memory_object_to_port(memory_object_t)
319 #endif /* KERNEL_PRIVATE */
323 type memory_object_control_t = mach_port_t
325 intran: memory_object_control_t convert_port_to_mo_control(mach_port_t)
326 outtran: mach_port_t convert_mo_control_to_port(memory_object_control_t)
327 destructor: memory_object_control_deallocate(memory_object_control_t)
328 #endif /* KERNEL_PRIVATE */
331 type memory_object_name_t = mach_port_t
336 type memory_object_copy_strategy_t = int;
337 type memory_object_return_t = int;
339 type machine_info_data_t = struct[5] of integer_t;
340 type machine_slot_data_t = struct[8] of integer_t;
342 type host_t = mach_port_t
344 intran: host_t convert_port_to_host(mach_port_t)
345 outtran: mach_port_t convert_host_to_port(host_t)
346 #endif /* KERNEL_SERVER */
349 type host_priv_t = mach_port_t
351 intran: host_priv_t convert_port_to_host_priv(mach_port_t)
352 #endif /* KERNEL_SERVER */
355 type host_security_t = mach_port_t
357 intran: host_security_t convert_port_to_host_security(mach_port_t)
358 #endif /* KERNEL_SERVER */
362 * host_info_t: variable-sized inline array that can contain:
364 * host_basic_info_old_t (5 ints)
365 * host_basic_info_t (12 ints)
366 * host_sched_info_t (2 ints)
367 * kernel_resource_sizes_t (5 ints)
368 * host_load_info_t (6 ints)
369 * vm_statistics32_t (15 ints)
370 * host_purgable_info_t (68 ints)
371 * host_expired_task_info uses a task_power_info (18 ints)
373 * If other host_info flavors are added, this definition may
374 * need to be changed. (See mach/{host_info,vm_statistics}.h)
376 type host_flavor_t = int;
377 type host_info_t = array[*:68] of integer_t;
379 * host_info64_t: variable-sized inline array that can contain:
381 * vm_statistics_t (6 ints and 9 longs)
382 * vm_extmod_statistics_t (6 64-bit ints)
384 type host_info64_t = array[*:256] of integer_t;
386 type processor_t = mach_port_t
388 intran: processor_t convert_port_to_processor(mach_port_t)
389 outtran: mach_port_t convert_processor_to_port(processor_t)
390 #endif /* KERNEL_SERVER */
393 type processor_array_t = ^array[] of processor_t;
396 * processor_info_t: variable-sized inline array that can
399 * - processor_basic_info_t: (5 ints)
400 * - processor_cpu_load_info_t: (4 ints)
401 * - processor_machine_info_t: (12 ints)
402 * - processor_cpu_stat_t: (10 ints)
403 * - processor_cpu_stat64_t: (20 ints)
405 * If other processor_info flavors are added, this definition
406 * may need to be changed.
408 * See mach/processor_info.h and mach/arm/processor_info.h.
411 type processor_flavor_t = int;
412 type processor_info_t = array[*:20] of integer_t;
413 type processor_info_array_t = ^array[] of integer_t;
415 type processor_set_t = mach_port_t
417 intran: processor_set_t convert_port_to_pset(mach_port_t)
418 outtran: mach_port_t convert_pset_to_port(processor_set_t)
419 destructor: pset_deallocate(processor_set_t)
420 #endif /* KERNEL_SERVER */
423 type processor_set_array_t = ^array[] of processor_set_t;
425 type processor_set_name_t = mach_port_t
427 intran: processor_set_name_t convert_port_to_pset_name(mach_port_t)
428 outtran: mach_port_t convert_pset_name_to_port(processor_set_name_t)
429 destructor: pset_deallocate(processor_set_name_t)
430 #endif /* KERNEL_SERVER */
433 type processor_set_name_array_t = ^array[] of processor_set_name_t;
435 /* processor_set_info_t: variable-size inline array
437 * processor_set_basic_info (5 ints)
438 * processor_set_load_info (4 ints)
439 * policy_timeshare_base_t (1 int)
440 * policy_fifo_base_t (1 int)
441 * policy_rr_base_t (1 int)
442 * policy_timeshare_base_t (1 int)
443 * policy_fifo_base_t (1 int)
444 * policy_rr_base_t (1 int)
446 * If other flavors are added, this definition may
447 * need to be changed. (see mach/processor.h) */
448 type processor_set_flavor_t = int;
449 type processor_set_info_t = array[*:5] of integer_t;
451 type bootstrap_t = mach_port_t;
453 type kernel_version_t = c_string[*:512];
454 type kernel_boot_info_t = c_string[*:4096];
456 type time_value_t = struct[2] of integer_t;
458 type mach_port_qos_t = struct[2] of integer_t;
460 type mach_port_options_t = struct[3] of uint64_t;
461 type mach_port_options_ptr_t = ^ mach_port_options_t;
463 type emulation_vector_t = ^array[] of vm_offset_t;
465 type inline_existence_map_t = array[*:512] of char;
468 /* policy_info_t: variable-size inline array. Can hold:
469 * policy_timeshare_info_t (5 ints)
470 * policy_fifo_info_t (4 ints)
471 * policy_rr_info_t (5 ints) */
472 type policy_base_t = array[*:5] of integer_t;
473 type policy_info_t = array[*:2] of integer_t;
474 type policy_limit_t = array[*:1] of integer_t;
476 type ledger_t = mach_port_t
478 intran: ledger_t convert_port_to_ledger(mach_port_t)
479 outtran: mach_port_t convert_ledger_to_port(ledger_t)
480 #endif /* KERNEL_SERVER */
483 type ledger_array_t = ^array[] of ledger_t;
484 type ledger_item_t = integer_t;
487 type ledger_amount_t = int64_t;
489 type security_token_t = struct[2] of uint32_t;
490 type audit_token_t = struct[8] of uint32_t;
492 type msg_labels_t = mach_port_t;
494 /* memory_object_info_t: variable-size inline array:
495 * memory_object_attr_info_t (5 ints)
496 * XXX actually it's 6 ints temporarily (object_ready!)
497 * memory_object_behave_info_t (4 ints)
498 * memory_object_perf_info_t (2 ints)
499 * old_memory_object_attr_info_t (3 ints)
500 * If other flavors are added, this definition may
501 * need to be changed. (see mach/memory_object.h) */
502 type memory_object_flavor_t = int;
503 type memory_object_info_t = array[*:6] of int;
505 /* vm_region_info_t: variable-size inline array that can hold:
506 * vm_region_basic_info_t (8 ints)
507 * If other flavors are added, this definition may
508 * need to be changed. (see mach/vm_region.h) */
509 type vm_region_flavor_t = int;
510 type vm_region_info_t = array[*:10] of int;
511 type vm_region_recurse_info_t = array[*:19] of int;
513 type vm_page_info_flavor_t = int;
514 type vm_page_info_t = array[*:32] of int;
516 type mach_vm_read_entry_t = array[512] of mach_vm_offset_t;
517 type vm_read_entry_t = array[512] of vm_offset_t;
519 type vm32_read_entry_t = array[512] of vm32_offset_t;
522 type exception_mask_t = int;
523 type exception_behavior_t = int;
525 type exception_handler_t = mach_port_t;
527 type exception_handler_array_t =
528 array[*:32] of exception_handler_t;
530 type exception_behavior_array_t =
531 array[*:32] of exception_behavior_t;
533 type exception_flavor_array_t =
534 array[*:32] of thread_state_flavor_t;
536 type exception_mask_array_t =
537 array[*:32] of exception_mask_t;
539 type semaphore_t = mach_port_t
541 intran: semaphore_t convert_port_to_semaphore(mach_port_t)
542 outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
543 destructor: semaphore_dereference(semaphore_t)
544 #endif /* KERNEL_SERVER */
547 type semaphore_consume_ref_t = mach_port_move_send_t
548 cusertype: semaphore_t
550 intran: semaphore_t convert_port_to_semaphore(mach_port_t)
551 outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
552 #endif /* KERNEL_SERVER */
555 type lock_set_t = mach_port_t
557 intran: lock_set_t convert_port_to_lock_set(mach_port_t)
558 outtran: mach_port_t convert_lock_set_to_port(lock_set_t)
559 destructor: lock_set_dereference(lock_set_t)
560 #endif /* KERNEL_SERVER */
563 type task_suspension_token_t = mach_port_move_send_once_t
565 intran: task_suspension_token_t convert_port_to_task_suspension_token(mach_port_t)
566 outtran: mach_port_t convert_task_suspension_token_to_port(task_suspension_token_t)
567 #endif /* KERNEL_SERVER */
570 type vfs_path_t = c_string[4096];
571 type nspace_path_t = c_string[1024]; /* 1024 == PATH_MAX */
573 /* public voucher types */
575 /* Mach voucher object */
576 type mach_voucher_t = mach_port_t;
577 type mach_voucher_name_t = mach_port_name_t;
579 type mach_voucher_attr_manager_t = mach_port_t;
580 type mach_voucher_attr_control_t = mach_port_t;
582 /* IPC voucher internal object */
583 type ipc_voucher_t = mach_port_t
585 intran: ipc_voucher_t convert_port_to_voucher(mach_port_t)
586 outtran: mach_port_t convert_voucher_to_port(ipc_voucher_t)
587 destructor: ipc_voucher_release(ipc_voucher_t)
588 #endif /* KERNEL_SERVER */
591 /* IPC voucher attribute control internal object */
592 type ipc_voucher_attr_control_t = mach_port_t
594 intran: ipc_voucher_attr_control_t convert_port_to_voucher_attr_control(mach_port_t)
595 outtran: mach_port_t convert_voucher_attr_control_to_port(ipc_voucher_attr_control_t)
596 destructor: ipc_voucher_attr_control_release(ipc_voucher_attr_control_t)
597 #endif /* KERNEL_SERVER */
600 type mach_voucher_attr_key_t = uint32_t;
602 type mach_voucher_attr_command_t = uint32_t;
603 type mach_voucher_attr_recipe_command_t = uint32_t;
605 type mach_voucher_attr_content_size_t = uint32_t;
606 type mach_voucher_attr_content_t = array[*:4096] of uint8_t;
607 type mach_voucher_attr_content_array_t = array[*:5120] of uint8_t;
609 type mach_voucher_attr_raw_recipe_size_t = uint32_t;
610 type mach_voucher_attr_raw_recipe_t = array[*:4096] of uint8_t;
611 type mach_voucher_attr_raw_recipe_array_t = array[*:5120] of uint8_t;
613 type mach_voucher_selector_t = uint32_t;
615 type mach_voucher_attr_value_handle_t = uint64_t;
616 type mach_voucher_attr_value_handle_array_t = array[*:4] of mach_voucher_attr_value_handle_t;
617 type mach_voucher_attr_value_reference_t = uint32_t;
619 /* kernel module loader */
621 type kmod_control_flavor_t = int;
623 type kmod_args_t = ^array[] of MACH_MSG_TYPE_BYTE
626 type io_master_t = mach_port_t;
627 type UNDServerRef = mach_port_t;
629 /* These must be kept in sync with definitions in osfmk/mach/dyld_kernel.h */
630 type dyld_kernel_image_info_t = struct[40] of MACH_MSG_TYPE_BYTE;
631 type dyld_kernel_image_info_array_t = ^array[] of dyld_kernel_image_info_t;
632 type dyld_kernel_process_info_t = struct[64] of MACH_MSG_TYPE_BYTE;
635 #ifdef MACH_KERNEL_PRIVATE
636 simport <ipc/ipc_voucher.h>; /* for voucher conversions */
637 simport <kern/ipc_kobject.h>; /* for null conversion */
638 simport <kern/ipc_tt.h>; /* for task/thread conversion */
639 simport <kern/ipc_host.h>; /* for host/processor/pset conversions */
640 simport <kern/ipc_sync.h>; /* for lock_set and semaphore conversions */
641 simport <kern/ledger.h>; /* for ledger conversions */
642 simport <kern/processor.h>; /* for processor conversions */
643 simport <kern/sync_lock.h>; /* for lock-set conversions */
644 simport <kern/sync_sema.h>; /* for semaphore conversions */
645 simport <vm/memory_object.h>; /* for memory object type conversions */
646 simport <vm/vm_map.h>; /* for vm_map conversions */
648 simport <kern/arcade.h>; /* for arcade_register conversions */
650 #endif /* MACH_KERNEL_PRIVATE */
652 simport <kern/ipc_mig.h>; /* pick up kernel-specific MIG things */
654 simport <kern/suid_cred.h>;
655 #endif /* KERNEL_SERVER */
658 import <mach/mach_types.h>;
660 #endif /* _MACH_MACH_TYPES_DEFS_ */
662 /* vim: set ft=c : */