"Initial check in for Widevine Third Party source"

git-svn-id: https://widevine-mirrored-source.googlecode.com/svn/trunk@8929 8780d7d1-120b-16fd-4e4d-63eabaf331ad
diff --git a/xnu-792.18.15/osfmk/mach/Makefile b/xnu-792.18.15/osfmk/mach/Makefile
new file mode 100644
index 0000000..89a374c
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/Makefile
@@ -0,0 +1,330 @@
+export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
+export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
+export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
+export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
+
+
+include $(MakeInc_cmd)
+include $(MakeInc_def)
+
+INSTINC_SUBDIRS = \
+	machine
+
+INSTINC_SUBDIRS_PPC = \
+	ppc
+
+INSTINC_SUBDIRS_I386 = \
+	i386
+
+EXPINC_SUBDIRS = \
+	machine
+
+EXPINC_SUBDIRS_PPC = \
+	ppc
+
+EXPINC_SUBDIRS_I386 = \
+	i386
+
+MIG_TYPES = \
+	clock_types.defs \
+	mach_types.defs \
+	std_types.defs
+
+MIG_DEFS =	\
+	audit_triggers.defs \
+	clock.defs \
+	clock_priv.defs \
+	clock_reply.defs \
+	exc.defs \
+	host_notify_reply.defs \
+	host_priv.defs \
+	host_security.defs \
+	ledger.defs \
+	lock_set.defs \
+	mach_host.defs \
+	mach_port.defs \
+	mach_vm.defs \
+	notify.defs \
+	processor.defs \
+	processor_set.defs \
+	task.defs \
+	thread_act.defs \
+	vm_map.defs
+
+MACH_PRIVATE_DEFS = \
+	mach_notify.defs \
+	memory_object.defs \
+	memory_object_control.defs \
+	memory_object_default.defs \
+	memory_object_name.defs \
+	upl.defs
+
+#
+# MIG-generated headers that are traditionally used by user
+# level code.
+#
+MIG_USHDRS = \
+	audit_triggers_server.h \
+	clock_reply_server.h \
+	exc_server.h \
+	memory_object_server.h \
+	memory_object_default_server.h \
+	notify_server.h
+
+MIG_UUHDRS = \
+	clock.h \
+	clock_priv.h \
+	host_priv.h \
+	host_security.h \
+	ledger.h \
+	lock_set.h \
+	mach_host.h \
+	mach_port.h \
+	mach_vm.h \
+	memory_object_control.h \
+	memory_object_name.h \
+	processor.h \
+	processor_set.h \
+	task.h \
+	thread_act.h \
+	upl.h \
+	vm_map.h
+
+MIGINCLUDES = ${MIG_UUHDRS} ${MIG_USHDRS}
+
+DATAFILES = \
+        boolean.h \
+        clock_types.h \
+        error.h \
+	exception.h \
+	exception_types.h \
+	host_notify.h \
+        host_info.h \
+	host_reboot.h \
+	host_special_ports.h \
+	kern_return.h \
+        kmod.h \
+        mach_param.h \
+	mach_time.h \
+	mach_traps.h \
+        mach_types.h \
+	machine.h \
+        mach_syscalls.h \
+        memory_object_types.h \
+        message.h \
+	mig.h \
+	mig_errors.h \
+	ndr.h \
+        notify.h \
+	policy.h \
+	port.h \
+        processor_info.h \
+	rpc.h \
+        semaphore.h \
+	shared_memory_server.h \
+	std_types.h \
+	sync_policy.h \
+        syscall_sw.h \
+	task_info.h \
+	task_ledger.h \
+	task_policy.h \
+	task_special_ports.h \
+        thread_info.h \
+	thread_policy.h \
+	thread_special_ports.h \
+        thread_status.h \
+	thread_switch.h \
+	time_value.h \
+        vm_attributes.h \
+        vm_behavior.h \
+	vm_inherit.h \
+	vm_param.h \
+        vm_prot.h \
+	vm_purgable.h \
+        vm_region.h \
+	vm_statistics.h \
+	vm_sync.h \
+	vm_types.h \
+	${MIG_TYPES} \
+	${MIG_DEFS}
+
+INSTALL_MI_LIST	= \
+	bootstrap.h \
+	${DATAFILES}
+
+INSTALL_KF_MI_LIST = \
+	mach_interface.h \
+	$(filter-out mach_traps.h mach_syscalls.h thread_switch.h, ${DATAFILES})
+
+INSTALL_KF_MI_LCL_LIST = \
+	mach_interface.h \
+	$(filter-out mach_traps.h mach_syscalls.h thread_switch.h, ${DATAFILES})
+
+INSTALL_MI_GEN_LIST =
+
+INSTALL_MI_DIR = mach
+
+EXPORT_MI_LIST	= \
+	mach_interface.h \
+	${DATAFILES}
+
+EXPORT_MI_GEN_LIST = \
+	${MIGINCLUDES}
+
+EXPORT_MI_DIR = mach
+
+.ORDER: ${MIGINCLUDES}
+
+${MIGINCLUDES} : ${MIG_TYPES}
+
+.ORDER: ${MIG_UUHDRS}
+
+${MIG_UUHDRS} : \
+	%.h : %.defs
+	$(MIG) $(MIGFLAGS)		\
+		-server /dev/null	\
+		-user /dev/null		\
+		-header $@ 		\
+		$<
+
+.ORDER: ${MIG_USHDRS}
+
+${MIG_USHDRS} : \
+	%_server.h : %.defs
+	$(MIG) $(MIGFLAGS)		\
+		-server /dev/null	\
+		-user /dev/null		\
+		-header /dev/null	\
+		-sheader $@ 		\
+		$<
+
+#
+# Build path
+#
+COMP_SUBDIRS_I386 = \
+	i386
+
+INCFLAGS_MAKEFILE= -I..
+
+MIGKSFLAGS      = -DMACH_KERNEL_PRIVATE -DKERNEL_SERVER=1
+MIGKUFLAGS      = -DMACH_KERNEL_PRIVATE -DKERNEL_USER=1 -maxonstack 1024
+#
+# MIG-generated headers that are traditionally used by kernel
+# level code.
+#
+MIG_KUHDRS = \
+	audit_triggers.h \
+	clock_reply.h \
+	exc.h \
+	host_notify_reply.h \
+	mach_notify.h \
+	memory_object.h \
+	memory_object_control.h \
+	memory_object_default.h \
+	upl.h \
+	vm_map.h
+
+MIG_KUSRC = \
+	audit_triggers_user.c \
+	clock_reply_user.c \
+	exc_user.c \
+	host_notify_reply_user.c \
+	mach_notify_user.c \
+	memory_object_user.c \
+	memory_object_control_user.c \
+	memory_object_default_user.c \
+	upl_user.c \
+	vm_map_user.c
+
+MIG_KSHDRS = \
+	clock_server.h \
+	clock_priv_server.h \
+	exc_server.h \
+	host_priv_server.h \
+	host_security_server.h \
+	ledger_server.h \
+	lock_set_server.h \
+	mach_host_server.h \
+	mach_notify_server.h \
+	mach_port_server.h \
+	mach_vm_server.h \
+	memory_object_server.h \
+	memory_object_control_server.h \
+	memory_object_default_server.h \
+	memory_object_name_server.h \
+	processor_server.h \
+	processor_set_server.h \
+	semaphore_server.h \
+	task_server.h \
+	thread_act_server.h \
+	upl_server.h \
+	vm_map_server.h
+
+MIG_KSSRC = \
+	clock_server.c \
+	clock_priv_server.c \
+	exc_server.c \
+	host_priv_server.c \
+	host_security_server.c \
+	ledger_server.c \
+	lock_set_server.c \
+	mach_host_server.c \
+	mach_notify_server.c \
+	mach_port_server.c \
+	mach_vm_server.c \
+	memory_object_server.c \
+	memory_object_control_server.c \
+	memory_object_default_server.c \
+	memory_object_name_server.c \
+	processor_server.c \
+	processor_set_server.c \
+	semaphore_server.c \
+	task_server.c \
+	thread_act_server.c \
+	upl_server.c \
+	vm_map_server.c
+
+#
+# JMM -
+# Since there are two generated header files with the same name, one for
+# install and export, the other for internal use (and they are different)
+# we can't explicitly list two rules for the same target.  So rules for
+# generating internal headers will be handled implicitly by creating rules
+# to generate the internal C sources, and the headers get created as a
+# side-effect.
+#
+#
+# This is all temporary scaffolding, as we are moving to a model where
+# the MIG-generated code is identical in all environments.  At first, it
+# will contain some environment-specific ifdefs, but over time should not
+# even require that as we move towards making all the environments look
+# the same.
+#
+COMP_FILES = ${MIG_KUSRC} ${MIG_KSSRC}
+
+${COMP_FILES} : ${MIG_TYPES}
+        
+.ORDER: ${MIG_KUSRC}                           
+
+${MIG_KUSRC} : \
+	%_user.c : %.defs
+	${MIG} ${MIGFLAGS} ${MIGKUFLAGS}        \
+		-user    $*_user.c              \
+		-header  $*.h              \
+		-server  /dev/null		\
+		-sheader /dev/null		\
+		$<
+
+.ORDER: ${MIG_KSSRC}                           
+        
+${MIG_KSSRC}: \
+	%_server.c : %.defs
+	${MIG} ${MIGFLAGS} ${MIGKSFLAGS}        \
+		-user    /dev/null              \
+		-header  /dev/null              \
+		-server  $*_server.c		\
+		-sheader $*_server.h		\
+		$<
+
+include $(MakeInc_rule)
+include $(MakeInc_dir)
diff --git a/xnu-792.18.15/osfmk/mach/Makefile.template b/xnu-792.18.15/osfmk/mach/Makefile.template
new file mode 100644
index 0000000..044b050
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/Makefile.template
@@ -0,0 +1,174 @@
+export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
+export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
+export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
+export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
+
+
+include $(MakeInc_cmd)
+include $(MakeInc_def)
+
+MIGKSFLAGS      = -DKERNEL_SERVER
+MIGKUFLAGS      = -DKERNEL_USER -maxonstack 1024
+
+MACH_FILES = mach_server.h mach_server.c
+
+MACH_PORT_FILES =mach_port_server.h mach_port_server.c
+
+EXC_FILES = exc_user.h exc_user.c  exc_server.c
+
+MEMORY_OBJECT_FILES = memory_object_user.h memory_object_user.c 
+
+MEMORY_OBJECT_DEFAULT_FILES = memory_object_default.h memory_object_default_user.c
+
+PROF_FILES = prof_user.c  prof.h
+
+MACH_HOST_FILES = mach_host_server.h mach_host_server.c
+
+CLOCK_FILES = clock_server.h clock_server.c
+
+CLOCK_REPLY_FILES = clock_reply.h clock_reply_user.c
+
+BOOTSTRAP_FILES = bootstrap_server.h bootstrap_server.c
+
+LEDGER_FILES = ledger_user.c ledger_server.h ledger_server.c
+
+SYNC_FILES = sync_server.h sync_server.c
+
+MACH_USER_FILES = mach_user.h mach_user.c
+ 
+OTHERS	= ${MACH_FILES} ${MACH_PORT_FILES} \
+	${EXC_FILES} \
+	${MEMORY_OBJECT_FILES} ${MEMORY_OBJECT_DEFAULT_FILES} \
+	${PROF_FILES} ${MACH_HOST_FILES} ${LEDGER_FILES} \
+	${CLOCK_FILES} ${CLOCK_REPLY_FILES} ${BOOTSTRAP_FILES} \
+	${BOOTSTRAP_FILES} ${SYNC_FILES} \
+	${MACH_USER_FILES} 
+        
+.ORDER: ${MACH_FILES}                           
+        
+${MACH_FILES}: mach/mach.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}            \
+		-header /dev/null                       \
+		-user /dev/null                         \
+		-sheader mach_server.h                  \
+		-server mach_server.c                   \
+		$<
+        
+.ORDER: ${MACH_PORT_FILES}
+
+${MACH_PORT_FILES}: mach/mach_port.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}            \
+		-header /dev/null                       \
+		-user /dev/null                         \
+		-sheader mach_port_server.h             \
+		-server mach_port_server.c              \
+		$<
+
+.ORDER: ${EXC_FILES}               
+${EXC_FILES}: mach/exc.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKUFLAGS}            \
+		-header exc_user.h                      \
+		-user exc_user.c                        \
+		-sheader exc_server.h                   \
+		-server exc_server.c                    \
+		$<
+
+.ORDER: ${MEMORY_OBJECT_FILES}
+        
+${MEMORY_OBJECT_FILES}: mach/memory_object.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKUFLAGS} -DSEQNOS   \
+		-header memory_object_user.h            \
+		-user memory_object_user.c              \
+		-server /dev/null                       \
+		$<    
+
+.ORDER: ${MEMORY_OBJECT_DEFAULT_FILES}
+ 
+${MEMORY_OBJECT_DEFAULT_FILES}: mach/memory_object_default.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKUFLAGS} -DSEQNOS   \
+		-header memory_object_default.h         \
+		-user memory_object_default_user.c      \
+		-server /dev/null                       \
+		$<
+                  
+.ORDER: ${PROF_FILES}
+        
+${PROF_FILES}: mach/prof.defs 
+	${_MIG_} ${_MIGFLAGS_} ${MIGKUFLAGS}            \
+		-header prof.h                          \
+		-iheader prof_internal.h                \
+		-user prof_user.c                       \
+		-server /dev/null                       \
+		$<
+
+.ORDER: ${MACH_HOST_FILES}
+ 
+${MACH_HOST_FILES}: mach/mach_host.defs         
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}            \
+		-header /dev/null                       \
+		-user /dev/null                         \
+		-sheader mach_host_server.h             \
+		-server mach_host_server.c              \
+		$<
+ 
+.ORDER: ${CLOCK_FILES}
+        
+${CLOCK_FILES}: mach/clock.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}            \
+		-header /dev/null                       \
+		-user /dev/null                         \
+		-sheader clock_server.h                 \
+		-server clock_server.c                  \
+		$<
+                
+.ORDER: ${CLOCK_REPLY_FILES}
+${CLOCK_REPLY_FILES}: mach/clock_reply.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKUFLAGS}            \
+		-header clock_reply.h                   \
+		-user clock_reply_user.c                \
+		-server /dev/null                       \
+		$<              
+                
+.ORDER: ${BOOTSTRAP_FILES}
+
+${BOOTSTRAP_FILES}: mach/bootstrap.defs
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}            \
+		-header /dev/null                       \
+		-user /dev/null                         \
+		-sheader bootstrap_server.h             \
+		-server bootstrap_server.c              \
+		$<
+
+.ORDER: ${LEDGER_FILES}
+
+${LEDGER_FILES}: mach/ledger.defs ${MACH_TYPES_DEFS}
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS} ${MIGKUFLAGS}      \
+		-header /dev/null                               \
+		-user ledger_user.c                             \
+		-sheader ledger_server.h                        \
+		-server ledger_server.c                         \
+		$<
+                  
+.ORDER: ${SYNC_FILES}
+        
+${SYNC_FILES}: mach/sync.defs 
+	${_MIG_} ${_MIGFLAGS_} ${MIGKSFLAGS}            \
+		-header /dev/null                       \
+		-user /dev/null                         \
+		-sheader sync_server.h                  \
+		-server sync_server.c                   \
+		$<
+
+${MACH_USER_FILES}:  mach/mach.defs
+	${_MIG_} -X ${_MIGFLAGS_} ${MIGKUFLAGS}         \
+		-header mach_user.h                     \
+		-user mach_user.c                       \
+		-server /dev/null                       \
+		$<
+
+
+ 
+include $(MakeInc_rule)
+include $(MakeInc_dir)
+
+
diff --git a/xnu-792.18.15/osfmk/mach/alert.h b/xnu-792.18.15/osfmk/mach/alert.h
new file mode 100644
index 0000000..4365af9
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/alert.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:31  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:45  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.1.5.2  1995/01/18  18:35:06  ezf
+ * 	updated Utah CR notice
+ * 	[1995/01/18  18:30:38  ezf]
+ *
+ * Revision 1.1.5.1  1994/09/23  02:33:53  ezf
+ * 	change marker to not FREE
+ * 	[1994/09/22  21:38:56  ezf]
+ * 
+ * Revision 1.1.2.1  1994/01/12  17:56:03  dwm
+ * 	Coloc: initial restructuring to follow Utah model.
+ * 	Alert bit definitions
+ * 	[1994/01/12  17:30:19  dwm]
+ * 
+ * $EndLog$
+ */
+/*
+ * Copyright (c) 1993 The University of Utah and
+ * the Computer Systems Laboratory (CSL).  All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ */
+
+#ifndef	_MACH_ALERT_H_
+#define _MACH_ALERT_H_
+
+#define ALERT_BITS	32	/* Minimum; more may actually be available */
+
+/* Request to abort _all_ operations */
+#define ALERT_ABORT_STRONG	0x00000001
+
+/* Request to abort restartable operations */
+#define ALERT_ABORT_SAFE	0x00000002
+
+/* User-defined alert bits */
+#define ALERT_USER		0xffff0000
+
+#endif	/* _MACH_ALERT_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/audit_triggers.defs b/xnu-792.18.15/osfmk/mach/audit_triggers.defs
new file mode 100644
index 0000000..2fa90e5
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/audit_triggers.defs
@@ -0,0 +1,43 @@
+/*
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+/*
+ *  Interface definition for the audit logging facility.
+ */
+
+subsystem
+#if	KERNEL_USER
+    KernelUser
+#endif	/* KERNEL_USER */
+    audit_triggers 123;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+simpleroutine	audit_triggers(
+		audit_port	: mach_port_t; 
+	in	flags		: int);
+
diff --git a/xnu-792.18.15/osfmk/mach/boolean.h b/xnu-792.18.15/osfmk/mach/boolean.h
new file mode 100644
index 0000000..641c396
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/boolean.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/boolean.h
+ *
+ *	Boolean data type.
+ *
+ */
+
+#ifndef	_MACH_BOOLEAN_H_
+#define	_MACH_BOOLEAN_H_
+
+/*
+ *	Pick up "boolean_t" type definition
+ */
+
+#ifndef	ASSEMBLER
+#include <mach/machine/boolean.h>
+#endif	/* ASSEMBLER */
+
+/*
+ *	Define TRUE and FALSE if not defined.
+ */
+
+#ifndef	TRUE
+#define TRUE	1
+#endif	/* TRUE */
+
+#ifndef	FALSE
+#define FALSE	0
+#endif	/* FALSE */
+
+#endif	/* _MACH_BOOLEAN_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/bootstrap.h b/xnu-792.18.15/osfmk/mach/bootstrap.h
new file mode 100644
index 0000000..67667c3
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/bootstrap.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * Mach bootstrap interfaces (obsolete: header included only for compatibility)
+ */
+#ifndef	_MACH_BOOTSTRAP_H_
+#define _MACH_BOOTSTRAP_H_
+
+#endif /* _MACH_BOOTSTRAP_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/clock.defs b/xnu-792.18.15/osfmk/mach/clock.defs
new file mode 100644
index 0000000..39a3672
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/clock.defs
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * 	File:		mach/clock.defs
+ *	Purpose:	Kernel clock subsystem definitions. This
+ *			file defines the clock request interface.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       clock 1000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach/clock_types.defs>
+
+/*
+ * References to clock objects are returned by:
+ *	host_get_clock_service(host_t,...)
+ *	host_get_clock_control(host_priv_t,...) - Priviledged subclass
+ */
+
+/*
+ *	Get the clock time.
+ *	Available to all.
+ */
+routine	clock_get_time(
+		clock_serv	: clock_serv_t;
+	out	cur_time	: mach_timespec_t);
+
+/*
+ *	Get clock attributes.
+ *	Available to all.
+ */
+routine	clock_get_attributes(
+		clock_serv	: clock_serv_t;
+	in	flavor		: clock_flavor_t;
+	out	clock_attr	: clock_attr_t, CountInOut);
+
+/*
+ *	Setup a clock alarm.
+ *	Available to all.
+ */
+routine clock_alarm(
+		clock_serv	: clock_serv_t;
+		alarm_type	: alarm_type_t;
+		alarm_time	: mach_timespec_t;
+                alarm_port      : clock_reply_t =
+			MACH_MSG_TYPE_MAKE_SEND_ONCE|polymorphic);
diff --git a/xnu-792.18.15/osfmk/mach/clock_priv.defs b/xnu-792.18.15/osfmk/mach/clock_priv.defs
new file mode 100644
index 0000000..19d562c
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/clock_priv.defs
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * 	File:		mach/clock_priv.defs
+ *	Purpose:	Kernel clock subsystem definitions. This
+ *			file defines the clock request interface.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       clock_priv 1200;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach/clock_types.defs>
+
+/*
+ * References to clock_priv objects are returned by:
+ *	host_get_clock_control(host_priv_t,...) - Priviledged subclass
+ */
+
+/*
+ *	Set the clock time.
+ *	Privileged.
+ */
+routine	clock_set_time(
+		clock_ctrl	: clock_ctrl_t;
+		new_time	: mach_timespec_t);
+
+/*
+ *	Set clock attributes.
+ *	Privileged.
+ */
+routine	clock_set_attributes(
+		clock_ctrl	: clock_ctrl_t;
+	in	flavor		: clock_flavor_t;
+	in	clock_attr	: clock_attr_t);
+
diff --git a/xnu-792.18.15/osfmk/mach/clock_reply.defs b/xnu-792.18.15/osfmk/mach/clock_reply.defs
new file mode 100644
index 0000000..e297f69
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/clock_reply.defs
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ *	File:		clock_reply.defs
+ *	Purpose:	Kernel clock subsystem definitions. This
+ *			file defines the clock reply interface.
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+		     clock_reply 3125107;  /* Matches up with old value */
+
+#include <mach/std_types.defs>
+#include <mach/clock_types.defs>
+
+
+/*
+ *	Reply routine for clock_alarm. 
+ */
+simpleroutine clock_alarm_reply(
+                alarm_port      : clock_reply_t;
+		alarm_code	: kern_return_t;
+		alarm_type	: alarm_type_t;
+		alarm_time	: mach_timespec_t);
diff --git a/xnu-792.18.15/osfmk/mach/clock_types.defs b/xnu-792.18.15/osfmk/mach/clock_types.defs
new file mode 100644
index 0000000..ceeaba9
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/clock_types.defs
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ *	File:		clock_types.defs
+ *	Purpose:
+ *		Clock kernel interface type declarations
+ */
+
+#ifndef	_MACH_CLOCK_TYPES_DEFS_
+#define _MACH_CLOCK_TYPES_DEFS_
+
+#include <mach/std_types.defs>
+
+type clock_serv_t = mach_port_t
+		cusertype: clock_serv_t
+#if	KERNEL_SERVER
+		intran: clock_serv_t convert_port_to_clock(mach_port_t)
+		outtran: mach_port_t convert_clock_to_port(clock_serv_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type clock_ctrl_t = mach_port_t
+		cusertype: clock_ctrl_t
+#if	KERNEL_SERVER
+		intran: clock_ctrl_t convert_port_to_clock_ctrl(mach_port_t)
+		outtran: mach_port_t convert_clock_ctrl_to_port(clock_ctrl_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type clock_reply_t = polymorphic|MACH_MSG_TYPE_MAKE_SEND_ONCE;
+
+type clock_flavor_t = int;
+type clock_attr_t = array[*:1] of int;
+type mach_timespec_t	= struct[2] of int;
+type time_t = int;
+type sleep_type_t = int;
+type alarm_type_t = int;
+type clock_res_t = int;
+type clock_id_t = int;
+
+import <mach/mach_types.h>;
+
+#endif	/* _MACH_CLOCK_TYPES_DEFS_ */
diff --git a/xnu-792.18.15/osfmk/mach/clock_types.h b/xnu-792.18.15/osfmk/mach/clock_types.h
new file mode 100644
index 0000000..12035da
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/clock_types.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ *	File:		clock_types.h
+ *	Purpose:	Clock facility header definitions. These
+ *				definitons are needed by both kernel and
+ *				user-level software.
+ */
+
+/*
+ *	All interfaces defined here are obsolete.
+ */
+
+#ifndef	_MACH_CLOCK_TYPES_H_
+#define	_MACH_CLOCK_TYPES_H_
+
+#include <stdint.h>
+#include <mach/time_value.h>
+
+/*
+ * Type definitions.
+ */
+typedef	int	alarm_type_t;		/* alarm time type */
+typedef int	sleep_type_t;		/* sleep time type */
+typedef	int	clock_id_t;			/* clock identification type */
+typedef int	clock_flavor_t;		/* clock flavor type */
+typedef int	*clock_attr_t;		/* clock attribute type */
+typedef int	clock_res_t;		/* clock resolution type */
+
+/*
+ * Normal time specification used by the kernel clock facility.
+ */
+struct mach_timespec {
+	unsigned int	tv_sec;			/* seconds */
+	clock_res_t		tv_nsec;		/* nanoseconds */
+};
+typedef struct mach_timespec	mach_timespec_t;
+
+/*
+ * Reserved clock id values for default clocks.
+ */
+#define SYSTEM_CLOCK		0
+#define CALENDAR_CLOCK		1
+
+#define REALTIME_CLOCK		0
+
+/*
+ * Attribute names.
+ */
+#define	CLOCK_GET_TIME_RES	1	/* get_time call resolution */
+/*							2	 * was map_time call resolution */
+#define CLOCK_ALARM_CURRES	3	/* current alarm resolution */
+#define CLOCK_ALARM_MINRES	4	/* minimum alarm resolution */
+#define CLOCK_ALARM_MAXRES	5	/* maximum alarm resolution */
+
+#define NSEC_PER_USEC	1000		/* nanoseconds per microsecond */
+#define USEC_PER_SEC	1000000		/* microseconds per second */
+#define NSEC_PER_SEC	1000000000	/* nanoseconds per second */
+
+#define BAD_MACH_TIMESPEC(t)						\
+	((t)->tv_nsec < 0 || (t)->tv_nsec >= NSEC_PER_SEC)
+
+/* t1 <=> t2, also (t1 - t2) in nsec with max of +- 1 sec */
+#define CMP_MACH_TIMESPEC(t1, t2)					\
+	((t1)->tv_sec > (t2)->tv_sec ? +NSEC_PER_SEC :	\
+	((t1)->tv_sec < (t2)->tv_sec ? -NSEC_PER_SEC :	\
+			(t1)->tv_nsec - (t2)->tv_nsec))
+
+/* t1  += t2 */
+#define ADD_MACH_TIMESPEC(t1, t2)								\
+  do {															\
+	if (((t1)->tv_nsec += (t2)->tv_nsec) >= NSEC_PER_SEC) {		\
+		(t1)->tv_nsec -= NSEC_PER_SEC;							\
+		(t1)->tv_sec  += 1;										\
+	}															\
+	(t1)->tv_sec += (t2)->tv_sec;								\
+  } while (0)
+
+/* t1  -= t2 */
+#define SUB_MACH_TIMESPEC(t1, t2)								\
+  do {															\
+	if (((t1)->tv_nsec -= (t2)->tv_nsec) < 0) {					\
+		(t1)->tv_nsec += NSEC_PER_SEC;							\
+		(t1)->tv_sec  -= 1;										\
+	}															\
+	(t1)->tv_sec -= (t2)->tv_sec;								\
+  } while (0)
+
+/*
+ * Alarm parameter defines.
+ */
+#define ALRMTYPE			0xff		/* type (8-bit field)	*/
+#define TIME_ABSOLUTE		0x00		/* absolute time */
+#define	TIME_RELATIVE		0x01		/* relative time */
+
+#define BAD_ALRMTYPE(t)		(((t) &~ TIME_RELATIVE) != 0)
+
+#endif /* _MACH_CLOCK_TYPES_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/error.h b/xnu-792.18.15/osfmk/mach/error.h
new file mode 100644
index 0000000..a32eaee
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/error.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * File:	mach/error.h
+ * Purpose:
+ *	error module definitions
+ *
+ */
+
+#ifndef	_MACH_ERROR_H_
+#define	_MACH_ERROR_H_
+
+#include <mach/kern_return.h>
+
+/*
+ *	error number layout as follows:
+ *
+ *	hi		 		       lo
+ *	| system(6) | subsystem(12) | code(14) |
+ */
+
+
+#define	err_none		(mach_error_t)0
+#define ERR_SUCCESS		(mach_error_t)0
+#define	ERR_ROUTINE_NIL		(mach_error_fn_t)0
+
+
+#define	err_system(x)		(((x)&0x3f)<<26)
+#define err_sub(x)		(((x)&0xfff)<<14)
+
+#define err_get_system(err)	(((err)>>26)&0x3f)
+#define err_get_sub(err)	(((err)>>14)&0xfff)
+#define err_get_code(err)	((err)&0x3fff)
+
+#define system_emask		(err_system(0x3f))
+#define sub_emask		(err_sub(0xfff))
+#define code_emask		(0x3fff)
+
+
+/*	major error systems	*/
+#define	err_kern		err_system(0x0)		/* kernel */
+#define	err_us			err_system(0x1)		/* user space library */
+#define	err_server		err_system(0x2)		/* user space servers */
+#define	err_ipc			err_system(0x3)		/* old ipc errors */
+#define err_mach_ipc		err_system(0x4)		/* mach-ipc errors */
+#define	err_dipc		err_system(0x7)		/* distributed ipc */
+#define err_local		err_system(0x3e)	/* user defined errors */
+#define	err_ipc_compat		err_system(0x3f)	/* (compatibility) mach-ipc errors */
+
+#define	err_max_system		0x3f
+
+
+/*	unix errors get lumped into one subsystem  */
+#define	unix_err(errno)		(err_kern|err_sub(3)|errno)
+
+typedef	kern_return_t	mach_error_t;
+typedef mach_error_t	(* mach_error_fn_t)( void );
+
+#endif	/* _MACH_ERROR_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/events_info.h b/xnu-792.18.15/osfmk/mach/events_info.h
new file mode 100644
index 0000000..c487720
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/events_info.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/*
+ *	Machine-independent event information structures and definitions.
+ *
+ *	The definitions in this file are exported to the user.  The kernel
+ *	will translate its internal data structures to these structures
+ *	as appropriate.
+ *
+ *	This data structure is used to track events that occur during
+ *	thread execution, and to summarize this information for tasks.
+ */
+
+#ifndef	_MACH_EVENTS_INFO_H_
+#define _MACH_EVENTS_INFO_H_
+
+#include <mach/message.h>
+
+struct events_info {
+	integer_t	faults;		/* number of page faults */
+	integer_t	zero_fills;	/* number of zero fill pages */
+	integer_t	reactivations;	/* number of reactivated pages */
+	integer_t	pageins;	/* number of actual pageins */
+	integer_t	cow_faults;	/* number of copy-on-write faults */
+	integer_t	messages_sent;	/* number of messages sent */
+	integer_t	messages_received; /* number of messages received */
+};
+typedef struct events_info		events_info_data_t;
+typedef struct events_info		*events_info_t;
+#define EVENTS_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(events_info_data_t) / sizeof(integer_t)))
+
+#endif	/*_MACH_EVENTS_INFO_H_*/
diff --git a/xnu-792.18.15/osfmk/mach/exc.defs b/xnu-792.18.15/osfmk/mach/exc.defs
new file mode 100644
index 0000000..20cc3c5
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/exc.defs
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * Abstract:
+ *	MiG definitions file for Mach exception interface.
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif
+		     exc 2401;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+ServerPrefix catch_;
+
+type exception_data_t		= array[*:2] of integer_t;
+type exception_type_t		= int;
+
+routine		exception_raise(
+#if	KERNEL_USER
+			exception_port	: mach_port_move_send_t;
+			thread		: mach_port_move_send_t;
+			task		: mach_port_move_send_t;
+#else	/* KERNEL_USER */
+			exception_port	: mach_port_t;
+			thread		: mach_port_t;
+			task		: mach_port_t;
+#endif	/* KERNEL_USER */
+			exception	: exception_type_t;
+			code		: exception_data_t
+			);
+
+routine		exception_raise_state(
+#if	KERNEL_USER
+			exception_port	: mach_port_move_send_t;
+#else	/* KERNEL_USER */
+			exception_port	: mach_port_t;
+#endif	/* KERNEL_USER */
+			exception	: exception_type_t;
+			code		: exception_data_t, const;
+		  inout flavor		: int;
+			old_state	: thread_state_t, const;
+		    out new_state	: thread_state_t);
+
+routine		exception_raise_state_identity(
+#if	KERNEL_USER
+			exception_port  : mach_port_move_send_t;
+			thread		: mach_port_move_send_t;
+			task		: mach_port_move_send_t;
+#else	/* KERNEL_USER */
+			exception_port  : mach_port_t;
+			thread          : mach_port_t;
+			task            : mach_port_t;
+#endif	/* KERNEL_USER */
+			exception       : exception_type_t;
+			code            : exception_data_t;
+		  inout flavor          : int;
+			old_state       : thread_state_t;
+		    out new_state       : thread_state_t);
+
diff --git a/xnu-792.18.15/osfmk/mach/exception.h b/xnu-792.18.15/osfmk/mach/exception.h
new file mode 100644
index 0000000..e7d5d23
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/exception.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+#ifndef	_MACH_EXCEPTION_H_
+#define	_MACH_EXCEPTION_H_
+
+#include <mach/exception_types.h>
+
+#endif	/* _MACH_EXCEPTION_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/exception_types.h b/xnu-792.18.15/osfmk/mach/exception_types.h
new file mode 100644
index 0000000..ea1f823
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/exception_types.h
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_EXCEPTION_TYPES_H_
+#define	_MACH_EXCEPTION_TYPES_H_
+
+#include <mach/machine/exception.h>
+
+/*
+ *	Machine-independent exception definitions.
+ */
+
+#define EXC_BAD_ACCESS		1	/* Could not access memory */
+		/* Code contains kern_return_t describing error. */
+		/* Subcode contains bad memory address. */
+
+#define EXC_BAD_INSTRUCTION	2	/* Instruction failed */
+		/* Illegal or undefined instruction or operand */
+
+#define EXC_ARITHMETIC		3	/* Arithmetic exception */
+		/* Exact nature of exception is in code field */
+
+#define EXC_EMULATION		4	/* Emulation instruction */
+		/* Emulation support instruction encountered */
+		/* Details in code and subcode fields	*/
+
+#define EXC_SOFTWARE		5	/* Software generated exception */
+		/* Exact exception is in code field. */
+		/* Codes 0 - 0xFFFF reserved to hardware */
+		/* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
+
+#define EXC_BREAKPOINT		6	/* Trace, breakpoint, etc. */
+		/* Details in code field. */
+
+#define EXC_SYSCALL		7	/* System calls. */
+
+#define EXC_MACH_SYSCALL	8	/* Mach system calls. */
+
+#define EXC_RPC_ALERT		9	/* RPC alert */
+
+/*
+ *	Machine-independent exception behaviors
+ */
+
+# define EXCEPTION_DEFAULT		1
+/*	Send a catch_exception_raise message including the identity.
+ */
+
+# define EXCEPTION_STATE		2
+/*	Send a catch_exception_raise_state message including the
+ *	thread state.
+ */
+
+# define EXCEPTION_STATE_IDENTITY	3
+/*	Send a catch_exception_raise_state_identity message including
+ *	the thread identity and state.
+ */
+
+/*
+ * Masks for exception definitions, above
+ * bit zero is unused, therefore 1 word = 31 exception types
+ */
+
+#define EXC_MASK_BAD_ACCESS		(1 << EXC_BAD_ACCESS)
+#define EXC_MASK_BAD_INSTRUCTION	(1 << EXC_BAD_INSTRUCTION)
+#define EXC_MASK_ARITHMETIC		(1 << EXC_ARITHMETIC)
+#define EXC_MASK_EMULATION		(1 << EXC_EMULATION)
+#define EXC_MASK_SOFTWARE		(1 << EXC_SOFTWARE)
+#define EXC_MASK_BREAKPOINT		(1 << EXC_BREAKPOINT)
+#define EXC_MASK_SYSCALL		(1 << EXC_SYSCALL)
+#define EXC_MASK_MACH_SYSCALL		(1 << EXC_MACH_SYSCALL)
+#define EXC_MASK_RPC_ALERT		(1 << EXC_RPC_ALERT)
+
+#define EXC_MASK_ALL	(EXC_MASK_BAD_ACCESS |			\
+			 EXC_MASK_BAD_INSTRUCTION |		\
+			 EXC_MASK_ARITHMETIC |			\
+			 EXC_MASK_EMULATION |			\
+			 EXC_MASK_SOFTWARE |			\
+			 EXC_MASK_BREAKPOINT |			\
+			 EXC_MASK_SYSCALL |			\
+			 EXC_MASK_MACH_SYSCALL |		\
+			 EXC_MASK_RPC_ALERT |			\
+			 EXC_MASK_MACHINE)
+
+
+#define FIRST_EXCEPTION		1	/* ZERO is illegal */
+
+/*
+ * Machine independent codes for EXC_SOFTWARE
+ * Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) 
+ * 0x10000 - 0x10002 in use for unix signals
+ */
+#define	EXC_SOFT_SIGNAL		0x10003	/* Unix signal exceptions */
+
+#ifndef	ASSEMBLER
+
+#include <mach/port.h>
+#include <mach/thread_status.h>
+#include <mach/machine/vm_types.h>
+/*
+ * Exported types
+ */
+
+typedef int			exception_type_t;
+typedef	integer_t		exception_data_type_t;
+typedef int			exception_behavior_t;
+typedef integer_t		*exception_data_t;
+typedef	unsigned int		exception_mask_t;
+typedef	exception_mask_t	*exception_mask_array_t;
+typedef exception_behavior_t	*exception_behavior_array_t;
+typedef thread_state_flavor_t	*exception_flavor_array_t;
+typedef mach_port_t		*exception_port_array_t;
+
+#endif	/* ASSEMBLER */
+
+#endif	/* _MACH_EXCEPTION_TYPES_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/flipc_cb.h b/xnu-792.18.15/osfmk/mach/flipc_cb.h
new file mode 100644
index 0000000..4c7f969
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/flipc_cb.h
@@ -0,0 +1,1220 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ *
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:29  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:45  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.1.11.1  1996/09/17  16:34:42  bruel
+ * 	fixed types.
+ * 	[96/09/17            bruel]
+ *
+ * Revision 1.1.6.1  1995/06/13  18:20:10  sjs
+ * 	Merged from flipc_shared.
+ * 	[95/06/07            sjs]
+ * 
+ * Revision 1.1.3.14  1995/05/19  00:58:14  sjs
+ * 	Added send_ready to shared area, used for fast check if there is something
+ * 	to do (and prevents the cache from getting stirred).
+ * 	[95/05/18            sjs]
+ * 
+ * Revision 1.1.3.13  1995/05/16  20:46:28  randys
+ * 	Export performance valid information through performance
+ * 	structure rather than kernel configuration section.
+ * 	[95/05/16            randys]
+ * 
+ * 	Added performance (FLIPC_PERF) config information to
+ * 	kernel_configuration section of comm buffer, so that user
+ * 	programs can find out if this information is being gathered.
+ * 	[95/05/16            randys]
+ * 
+ * Revision 1.1.3.12  1995/05/15  14:26:54  randys
+ * 	Updated comments on use of acquire pointer (it's completely
+ * 	ignored if dpb is set) and added macros for testing !dpb and
+ * 	enabled at the same time.
+ * 	[95/05/11            randys]
+ * 
+ * 	Change pme_process_ptr ==> sme_process_ptr (since it's being read
+ * 	by AIL now).
+ * 	[95/05/11            randys]
+ * 
+ * 	Added private copied of release and process pointers.
+ * 	[95/05/11            randys]
+ * 
+ * 	Rearrange endpoint structure to separate data with importantly
+ * 	different access patterns into different cache lines.  This
+ * 	involved duplicating some (effectively constant) entries, and
+ * 	creating two versions of some macros.
+ * 	[95/05/11            randys]
+ * 
+ * Revision 1.1.3.11  1995/05/08  16:06:33  randys
+ * 	Added comment explaining that an endpoint bufferlist must always
+ * 	have valid buffer pointers in all of its entries, to keep
+ * 	FLIPC_endpoint_buffer_available from going off the deep end.  No
+ * 	code changes.
+ * 	[95/04/18            randys]
+ * 
+ * Revision 1.1.3.10  1995/04/05  21:21:52  randys
+ * 	Added a field to the buffer control structure holding the
+ * 	scheduling policy chosen for the allocations lock.
+ * 	[95/04/05            randys]
+ * 
+ * Revision 1.1.3.9  1995/03/23  20:35:19  randys
+ * 	Added comments indicating duplication of declarations of
+ * 	flipc_cb_base & flipc_cb_size in this file and in flipc_usermsg.h
+ * 	Modified declaration of flipc_cb_size to be unsigned long.
+ * 	[95/03/21            randys]
+ * 
+ * Revision 1.1.3.8  1995/02/23  21:32:42  randys
+ * 	Added space for kernel configuration in communications buffer
+ * 	control structure.
+ * 	[95/02/22            randys]
+ * 
+ * Revision 1.1.3.7  1995/02/21  17:22:58  randys
+ * 	Re-indented code to four space indentation
+ * 	[1995/02/21  16:25:32  randys]
+ * 
+ * Revision 1.1.3.6  1995/02/13  22:57:29  randys
+ * 	Replaced all of NEXT_{ACQUIRE,RELEASE,PROCESS}_PTR macros with a
+ * 	 single NEXT_BUFFERLIST_PTR macro.
+ * 	[95/02/03            randys]
+ * 
+ * Revision 1.1.3.5  1995/01/26  21:01:44  randys
+ * 	Add performance structure into CB.
+ * 	[1995/01/24  21:14:31  randys]
+ * 
+ * 	Added flag in epgroup structure to note that epgroup
+ * 	has a semaphore associated with it.
+ * 	[1995/01/19  23:02:13  randys]
+ * 
+ * 	Add a space in the comm buffer header for the null_destination
+ * 	the ME sets up for the AIL.  Get rid of
+ * 	FLIPC_ADDRESS_ENDPOINT_PTR (it isn't used)
+ * 	[1995/01/19  20:22:30  randys]
+ * 
+ * 	Up the comm buffer size to 1 megabyte
+ * 	[1995/01/17  22:23:27  randys]
+ * 
+ * Revision 1.1.3.4  1995/01/12  21:19:01  randys
+ * 	Minor commenting changes from dlb
+ * 	[1995/01/06  18:18:12  randys]
+ * 
+ * Revision 1.1.3.3  1994/12/22  16:23:57  randys
+ * 	Fixed calculation of number of buffers on an endpoint
+ * 	to take size of buffer pointers into account.
+ * 	[1994/12/21  16:19:55  randys]
+ * 
+ * Revision 1.1.3.2  1994/12/20  19:01:56  randys
+ * 	Moved definition of flipc_simple_lock to flipc_cb.h
+ * 	[1994/12/20  17:34:41  randys]
+ * 
+ * 	Added a simple lock in the comm buffer to use for the
+ * 	allocations lock, along with directions as to how
+ * 	to use it (not like a normal simple lock).
+ * 	[1994/12/20  15:27:25  randys]
+ * 
+ * 	Added error log into communications buffer control
+ * 	structure, and changed FLIPC_ADDRESS_ENDPOINT_PTR to
+ * 	correctly compute the endpoint pointer based on the
+ * 	new ctl structure layout.
+ * 	[1994/12/19  23:47:45  randys]
+ * 
+ * 	Added filename in comment at top of each file
+ * 	[1994/12/19  20:28:20  randys]
+ * 
+ * 	Add version field to epgroup to check races on buffer acquire
+ * 	from epgroup.
+ * 	[1994/12/19  18:05:04  randys]
+ * 
+ * Revision 1.1.3.1  1994/12/12  17:46:12  randys
+ * 	Putting initial flipc implementation under flipc_shared
+ * 	[1994/12/12  16:27:46  randys]
+ * 
+ * Revision 1.1.1.2  1994/12/11  23:11:18  randys
+ * 	Initial flipc code checkin
+ * 
+ * $EndLog$
+ */
+
+/*
+ * mach/flipc_cb.h
+ *
+ * This file is intended to be the data structure layout for the flipc
+ * communcations buffer, both for the KKT implementation and
+ * for the eventual paragon implementation.  This file should include
+ * all of the information necessary for either humans or machines to
+ * understand the data structure layout.
+ *
+ * The communications buffer is the wired section of memory used for
+ * communication between the flipc applications interface layer and
+ * the flipc message engine.  No structure in it are visible to the
+ * user; the applications interface layer mediates all user access to
+ * the CB.
+ */
+
+#ifndef _MACH_FLIPC_CB_H_
+#define _MACH_FLIPC_CB_H_
+
+#include <mach/flipc_types.h>
+
+/*
+ * Flipc naming and argument ordering conventions (this applies mainly to
+ * user-interface.h, but seems inappropriate in a user-visible header file):
+ *
+ * All objects prefixed with "flipc"; uppercase for user-visible
+ * objects, lower case for internal ones.
+ *
+ * Types created with typedef will have _t suffixes.
+ *
+ * Words will be separated by '_'.
+ *
+ * Macro definitions will be all in caps.
+ *
+ * Enum members will have their initial letter (after Flipc) capitalized.
+ *
+ *
+ * For user-visible routines:
+ *
+ * The first word following the "flipc" will be the flipc object type that
+ * that routine operates on (specifically "domain", "epgroup",
+ * "endpoint", or "buffer").
+ *
+ * The object named by the first word of the call will, if an argument
+ * to the call, be the first argument.
+ *
+ * Output variables passed as pointers in the arglist will come last.
+ */
+
+/*
+ * The kinds of objects that exist in the communications buffer are:
+ *
+ * Endpoints -- Used for sending or receiving.
+ * Buffers -- Composed of a buffer header and buffer data.
+ * Endpoint groups -- Used for collecting multiple numbers of endpoints
+ * 	together for a select like operation.
+ */
+
+/*
+ * We can't use general pointers inside the communications buffer,
+ * since the address space on either side of the interface is
+ * different.  The places where we could use pointers are:
+ *
+ *	*) From endpoint sets to endpoints.
+ *	*) From endpoints to buffers.
+ *
+ * The kinds of pointers we could use are:
+ *	*) Byte offset from the beginning of the comm buffer.  This
+ * 	   is simple, but has the disadvantage of allowing the user to
+ * 	   play games with pointing endpoint buffer pointers into data
+ * 	   space, & etc.
+ *	*) Rigid arrays of each type of object, with the object
+ * 	   "pointer" being an index into the array.  This avoids the
+ * 	   above problem, but complicates memory allocation (forces
+ * 	   allocation to be contiguous, which may force pre-deciding
+ * 	   how much space each of the above types will take).
+ *
+ * Though we appear to be going for the rigid allocation for each type
+ * of data structure, I'm still going to do the "simple offset"
+ * solution to maintain maximum flexibility into the future.
+ * The single exception to this is that FLIPC addresses will be composed of
+ * node number and endpoint number, where the endpoint number will be
+ * the index into the endpoint array.
+ */
+
+typedef unsigned long flipc_cb_ptr;
+/* Define a null value, which doesn't point anywhere into the CB.  */
+#define FLIPC_CBPTR_NULL ((flipc_cb_ptr) -1)
+
+/*
+ * Synchronization between message engine and application.
+ *
+ * In general, it isn't reasonable to allow locking and unlocking of
+ * data structures between message engine and communications buffer,
+ * as this requires the message engine to trust arbitrary user
+ * threads.  The solution is to arrange all data structures so that
+ * they may be accessed by both parties without locking.  The way that
+ * this is usually done is that specific variables are considered to
+ * be owned by one of the ME or the AIL, and the other party is
+ * allowed to read the variable but not to modify it.  With this
+ * arrangement, implementing things like producer/consumer circular
+ * queues is possible; each agent (ME or AIL) goes around the list
+ * doing its thing, and avoids passing the pointer showing where the
+ * other agent is working.
+ *
+ * Following the above, we may divide structure members into five
+ * classes, and define prefixes for these five classes.
+ *
+ *	Description		Prefix
+ *      -------------------------------
+ *	Private to AIL		pail_
+ *	Private to ME		pme_
+ *	AIL owned, read by ME	sail_
+ *	ME owned, read by AIL	sme_
+ * 	Shared in other way	shrd_
+ *
+ * Shared variables may change their ownership based on their own
+ * or someone elses value (these variables may be thought of as
+ * being handed back and forth between the two entities) or on a
+ * configuration option of the structure (not handed back and forth,
+ * but still based on another variables value).
+ *
+ * In addition, I am going to put variables that are set at endpoint
+ * allocation and cleared at deallocation (but read by both sides) in
+ * a separate class; they are "AIL owned, read by ME" but are
+ * effectively constant over the synchronization protocols we care
+ * about.
+ *
+ * 	Constant after allocation	const_
+ *
+ * Note that this ignores memory consistency issues (when the two
+ * agents are actually on two separate processors).  These issues need
+ * to be explored in more detail; for now suffice it to say that the
+ * above methods work given a sequentially consistent memory model or
+ * a processor consistent memory model.
+ *
+ * Also note that an optimizing compiler may reorder our memory
+ * accesses, playing merry hell with the inter-node synchronization
+ * protocols (the compiler doesn't know about the other node, after
+ * all).  To avoid this, all structure members used for
+ * synchronization will be marked volatile; this will force the
+ * compiler to keep the order and number of accesses intact.  This
+ * will also force the compiler *not* to optimize way accesses to
+ * these variables, so it is wise to explicitly load the variable into
+ * a temporary once if you need to do multiple computations with it,
+ * and store it back afterwards when you are done.
+ */
+
+/*
+ * Memory allocation:
+ *
+ * For maximum simplicity in the first implementation, we need to know
+ * at comm buffer allocation time how many endpoints, endpoint_sets,
+ * and buffers we will want total, until the end of time.  This
+ * masively simplifies memory allocation; there will be a single array
+ * of each type of data and the communication buffer will be taken up
+ * by the concatenation of these arrays (with some fiddling to make
+ * sure that no data crosses a page boundary).
+ *
+ * For each data type there will be a free list to which pieces of
+ * data will be added to or removed from as needed.  Each data type
+ * will have a pointer in it to allow it to be linked onto the free
+ * list.
+ */
+
+/*
+ * Multiple thread access to data structures:
+ *
+ * There are several points in the communications buffer (notably
+ * endpoint accesses) when multiple application threads will be
+ * attempting operations on data structures at the same time.  To
+ * multiplex these operations, we need a per-data structure lock.
+ * Lock attributes:
+ * 	*) This lock will not be kernel based, as such a lock would be
+ * 	   too heavyweight to use for arbitrary sending and receiving
+ * 	   operations).
+ *	*) Because it is not kernel based, it may not be used to
+ * 	   multiplex accesses from threads at different kernel
+ * 	   priority levels.  Deadlock would result if a low-priority
+ * 	   thread gained the lock and then was prempted by a
+ * 	   high-priority thread that wanted to acquire it.
+ * 	*) Architecture-dependent interfaces need to be designed to
+ * 	   atomically lock and unlock this data structure.
+ *
+ * These are "simple locks" and are defined in flipc_dep.h.
+ */
+
+/*
+ * Lock type.  This placement (in flipc_cb.h) is a little bit of a
+ * hack, as it really should be defined with the machine dependent lock
+ * macros.  But then the machine independent lock macros have problems
+ * because they have to include it both before and after the prototypes.
+ * So rather than split the machine dependent stuff into multiple
+ * files, I'll define it here and hope that this definition works for
+ * whatever architectures we're on.
+ */
+typedef unsigned long flipc_simple_lock;
+
+/*
+ * Ownership of data structures.
+ *
+ * Please note that this is a can of worms, and that I (Randys)
+ * consider this (and it's interactions with endpoint group membership)
+ * the likeliest place for design bugs in FLIPC.  Any and all should
+ * take this as an open invitation and challenge to find bugs in what
+ * follows.
+ *
+ * Rules:
+ *
+ *	*) If you've disabled a structure and synched with the
+ *	   appropriate side of the ME, the ME won't touch it.
+ *
+ *	*) If you've taken a send endpoint off of the send endpoint
+ *	   list and sync'd with the ME, the ME won't touch it.
+ *
+ *[The rest of this applies to the AIL only; the above rules are the
+ * only ones the ME respects.  ]
+ *
+ *	*) Within the AIL, a disabled structure is owned by:
+ *		*) The routine that disabled it, before it is put on
+ *		   the free list.
+ *		*) The routine that dequeued it from the free list,
+ *		   before it is enabled.
+ *	   Taking of the simple lock is not required for ownership in
+ *	   these cases.  Taking of the simple lock is not required for
+ *	   the act of *enabling* the structure (you have ownership and
+ *	   are giving it away), however it is required for the act of
+ *	   disabling the structure (since it is the only valid way to
+ *	   take ownership of an enabled structure, and you can't
+ *	   modify the enabled bit without having ownership).
+ *
+ *	*) The simple lock in a structure always needs to be valid, as
+ *	   simple locks may be taken while the structure is in any
+ *	   state.  Simiarly, the enabled bit must always be valid,
+ *	   both because it's what the ME checks, and because it may be
+ *	   checked by the AIL while the structure is free.
+ *
+ *	*) Holding the simple lock on an enabled structure imparts
+ *	   ownership of that structure.  You are allowed to take the
+ *	   simple lock of a disabled structure, but ownership is not
+ *	   gained by doing so.
+ *
+ *	*) You are allowed to read the enabled/disabled bit without
+ *	   owning the structure (if the structure is disabled, there
+ *	   may be no way to gain the ownership).
+ *
+ *	*) Owning a structure allows you to do what you want with it,
+ *	   except:
+ *		*) As mentioned above, the simple lock and
+ *		   enabled/disabled bit must always be valid.
+ *		*) The ownership of the endpoint group related members
+ *		   of an endpoint structure is special; see below.
+ *	   	*) The allocations lock must be held to manipulate the
+ *	   	   next send endpoint field of any endpoint.
+ *
+ *	*) If an endpoint is on an endpoint group, the ownership of
+ *	   the the endpoint group related members of the structure
+ *	   (sail_endpoint_group and pail_next_eg_endpoint) go with the
+ *	   owndership of the endpoint group, not the endpoint.  For
+ *	   this purpose only, membership is defined atomically as the
+ *	   sail_endpoint_group pointer being set to an endpoint group.
+ *	   Thus one may remove an endpoint from an endpoint group
+ *	   without owning the endpoint (change the sail_endpoint_group
+ *	   pointer last).  One requires both locks to add an endpoint
+ *	   to an endpoint group, however.
+ *
+ *	   (Part of the motivation for this is that removal and
+ *	   addition of endpoints to endpoint groups requires
+ *	   modifications of pointers in other endpoint structures).
+ *
+ *	*) No structure may be put on the free list if marked with any
+ *	   association to any other structure.  Specifically, endpoint
+ *	   groups may have no endpoints belonging to them, and
+ *	   endpoints may not belong to an endpoint group or have
+ *	   buffers belonging to them.
+ *
+ *	*) One consequence of the above is that endpoint groups may
+ *	   not be marked as disabled while they have any endpoints on
+ *	   them, as freeing an endpoint requires it to be removed from
+ *	   its endpoint group, and if ownership of the endpoint group
+ *	   cannot be gained, that is impossible.
+ *
+ *	*) In theory, endpoints *may* be marked disabled while they
+ *	   are still on endpoint groups.  In practice, they are not.
+ *	   This is relied on by the code which frees endpoint groups,
+ *	   in a non-obvious way.  Specifically, that code assumes that
+ *	   there is no way that a call to free endpoint will return
+ *	   with the endpoint still on the endpoint group.  Since the
+ *	   only way for free endpoint to fail is if the endpoint is
+ *	   inactive, and since the endpoint is set inactive only after
+ *	   free endpoint (presumably a different one) confirms that it
+ *	   isn't on any endpoint group, this assumption is true.
+ *
+ *	   Got that?  Take home lesson: don't allow endpoints to be
+ *	   marked disabled while still on endpoint groups until you
+ *	   *do* get that, and are willing to take the responsibility
+ *	   of changing it so that it works under your new scheme.
+ *
+ *	*) Ownership of the freelist(s) are gained by holding the
+ *	   allocations lock for the buffer, and *only* in that way.
+ *	   No modification of freelist, send endpoint list, or send
+ *	   side ME sync bits is valid without holding the allocations
+ *	   lock.  In other words, while you can read things in the
+ *	   main communications buffer control structure at will, you
+ *	   may not change them without owning the allocations lock.
+ *
+ *	*) The state where a structure is disabled but off of the
+ *	   freelist may be valid as an intermediate (while an AIL
+ *	   routine is orchestrating a transition) but is not a valid
+ *	   static state.  This state must not survive the return to
+ *	   application code of the thread that disabled the structure.
+ */
+
+/*
+ * Flipc data buffer management.
+ *
+ * A buffer (whether being used for sending or receiving) may be in
+ * one of three states:
+ *
+ * READY -- Buffer held by application.
+ * PROCESSING -- Buffer held by endpoint, unprocessed.  For receive endpoints,
+ * 	   this means that the buffer is empty, waiting to be filled by
+ * 	   an incoming message.  For send endpoints, this means tht the
+ * 	   buffer is full, waiting to be sent out.
+ * COMPLETED -- Buffer held by the endpoint, processed.  For receive
+ * 	   endpoints, this means that the buffer is full, with newly
+ * 	   received data in it.  For send endpoints, this means that the
+ * 	   buffer is empty (*), with it's data having been sent out.
+ *
+ * 	   (*) In point of fact the data hasn't been touched, though bits
+ * 	   may have been fiddled with in the header data structure.  But
+ * 	   it's been sent.
+ * FREE -- The buffer is in the pool of free buffers, and may be
+ * allocated to any newly created endpoint.
+ *
+ * The transition diagram between these states is relatively simple:
+ *
+ *
+ * 		     release
+ *             /-----------------\|
+ * +----------+                  -+----------+
+ * |  READY   |                   |PROCESSING|<- - - - - -
+ * +----------+_                  +----------+		  \
+ *      ^     |\ - - - - - - - - /     |    | 		   \endpoint allocate
+ *      |	   (processed)		    \endpoint       \
+ *      |                              |     \ free         |
+ *      | acquire                      /      ------\
+ *      |				      	     \      |
+ *      |                            / (processed)    >+----------+
+ * +----------+				       	       |   FREE   |
+ * |COMPLETED |< - - - - - - - - - -          	       +----------+
+ * +----------+	                       endpoint allocate    /     ^
+ *	|     ^- - - - - - - - - - - - - - - - - - - - - - -	  |
+ *	|                                               	 /
+ *	\		endpoint free                          	/
+ *	 ------------------------------------------------------/
+ *
+ * (If it doesn't look simple, imagine it without the FREE state; that
+ * state doesn't enter into almost any buffer manipulations)
+ *
+ * For send buffers, release==send, acquire==allocate, and
+ * processed==the sending done by the message engine.  For receive buffers,
+ * release==release, acquire==receive, and process==the actual
+ * arrival of the message handled by the messaging engine.
+ *
+ * The choice of path from the PROCESSING state is an endpoint
+ * specific configuration option; a particular endpoint may leave a
+ * processed buffer on the endpoint, or it may release it back to the
+ * application by dropping it from the endpoint.
+ *
+ * Buffers are assigned the PROCESSING state on a newly allocated
+ * receive endpoint (to be ready to receive messages) and the
+ * COMPLETED state on a newly allocated send endpoint.
+ *
+ * The state (other than FREE) that a particular buffer is in is
+ * determined by its place on a circular queue of buffer pointers that
+ * is part of the endpoint structure.  Buffers owned by the
+ * application (READY) are not pointed to by pointers on this queue.
+ * The buffer is released to the message engine by placement of a
+ * pointer to it on this queue.  When the message engine is done
+ * processing the buffer, it sets a flag in the buffer header.  If the
+ * endpoint is so configured, it then removes the buffer pointer from
+ * the queue; otherwise the AIL acquires the buffer (and removes the
+ * pointer from the queue) when it chooses.
+ *
+ *      . . . . . .
+ *     .           .
+ *    .             .
+ *    .             .       AIL releasing
+ *    .             .       ^
+ *    .         +-------+--/
+ *    .         |       |
+ *    .         |Buffers|
+ *    .         | to be |
+ *    .         |Sent or|
+ *    .         |Receivd|
+ *    .         | Into  |    ^ ME processing
+ *    .         +-------+ --/
+ *    .         |       |
+ *    .  AIL    | Sent  |  (These buffers have a flag set to indicate
+ *    .Acquiring|  or   |   that they have been processed.  This
+ *    .         |Filled |   section is optional; the endpoint may be
+ *    .         |buffers|   configured to drop buffers after processing)
+ *    .     ^   |       |
+ *    .      \--+-------+
+ *    .             .
+ *     .           .
+ *      . . . . . .
+ *
+ *
+ * The AIL will refuse to acquire a buffer that has not yet been
+ * processed by the ME.  Acquire will not work at all on endpoints
+ * that have been configured to drop buffers on completion.
+ *
+ * The buffer_available primitive is coded to avoid doing a
+ * (potentially costly) acquiring of the endpoint flipc lock.  Since
+ * telling where there is a buffer available requires two operations
+ * (comparison of the acquire and release pointers to see if there are
+ * any buffers on the endpoint, and then indirection of the acquire
+ * pointer to see if that buffer has bee processed yet), there is a
+ * potential race that will admit the possibility of indirecting
+ * through an invalid pointer.  For this reason, for the life of an
+ * endpoint, it is a requirement that all buffer pointers on the
+ * bufferlist point *somewhere* (ie. to some existing buffer), so that
+ * this indirection will not cause an access error.  The
+ * buffer_available primitive may return the wrong result, but (as
+ * long as the incorrectness is transitory), this is acceptable.
+ */
+
+/* Set up the states so that FLIPC_buffer_processed can just do an
+   & and a test.  */
+typedef enum {
+    flipc_Free = 0x0, flipc_Processing = 0x1,
+    flipc_Completed = 0x2, flipc_Ready = 0x3
+} flipc_buffer_state_t;
+#define FLIPC_BUFFER_PROCESSED_P(state) ((state) & 0x2)
+
+/*
+ * Data header/buffer layout.
+ *
+ * For this implementation, and probably for all time, the header
+ * immediately precedes the data in memory, and the mesaging engine
+ * will send both header and data.  Our priority is message dispatch
+ * speed rather than raw bandwidth (this is the small message side of
+ * a transfer mechanism), so we don't mind that we are throwing away
+ * some bandwidth by taking up transferred space with header data.
+ *
+ * The data size will be the maximum size allowed by the underlying
+ * transport, minus the header size (available at run time).  The user
+ * will be given a pointer to the data buffer, and will use this both
+ * for copying data in and out, and as an argument to the underlying
+ * flipc routines.  The flipc routines will access appropriately.
+ *
+ * The header structure follows; the user data type will be offset and
+ * cast appropriately to access this.
+ */
+
+typedef struct flipc_data_buffer {
+    union {
+	FLIPC_address_t destination; /* For sending.  */
+	flipc_cb_ptr free;	/* Link for header free list.  */
+    } u;
+
+    /* ME owned if flipc_Processing, AIL owned otherwise.  May not ever
+       assume the state flipc_Ready in an optimized implementation.  */
+    volatile flipc_buffer_state_t shrd_state;
+} *flipc_data_buffer_t;
+
+/*
+ * Endpoint structure.
+ *
+ * An endpoint is the data structure used for communicating buffers,
+ * either send or receive.  Note that all actual circular lists of
+ * buffer pointers on the endpoints are in their own array that gets
+ * partitioned out to the various endpoints.  This is because we want
+ * the endpoint structures themselves to be fixed size for easy
+ * indexing upon receit of a message.  This large scale array will be
+ * of size (max_buffers_per_endpoint) * (number_of_endpoints).  Both
+ * of these values are set during the domain initialization call.
+ *
+ * Note that the pointers contained in the buffer lists are pointers to
+ * buffer *headers*, not to the data.
+ */
+
+/*
+ * This structure is divided into four cache lines, separated by their
+ * usage type:
+ *
+ *	*) Private data that the AIL scribbles on.
+ *	*) Data the AIL writes (regularly) that the ME reads
+ *	   (occaisionally).  The canonical example is the release pointer.
+ *	*) Private data that the ME scribbles on.
+ *	*) Data the ME writes (regularly) that the AIL reads (occaisionally).
+ *	   The canonical example is the process pointer.
+ *
+ * There are a couple of other categories of stuff, that can be shoehorned
+ * into the above:
+ *	*) Constant data that both sides read regularly.  This can be
+ *	   duplicated in the two private areas (actually, it can be
+ *	   duplicated in any two areas that stay in the cache of the
+ *	   respective processors).
+ *	*) Stuff that is not accessed on the critical path; it can go
+ *	   almost anywhere (probably in one of the two ping-ponging
+ *	   cache lines).
+ *	*) Stuff that is read-only for a single processor goes in that
+ *	   processors private data section.
+ *
+ * Duplicate entries have a "p" or a "a" suffixed to the name to
+ * indicate that fact.  Note that these will usually, but not always,
+ * be "const" variables--they may be "const" variables only from the
+ * critical path viewpoint.
+ *
+ * We take cache line length as being 8 * sizeof(int).
+ */
+
+typedef struct flipc_endpoint {
+
+    /* ===Private AIL data===  */
+    /* Type of endpoint (send, recv, etc).  Duplicated in private
+       ME section.  */
+    FLIPC_endpoint_type_t constda_type;
+
+    /* This next value is two variables squeezed into a single word to
+     * save on memory accesses (since they are almost always read at
+     * the same time.  The two variables are:
+     *
+     * const_drop_processed_buffers -- Should the message engine drop
+     * buffers after processing them (as opposed to leaving them on
+     * the endpoint)?
+     *
+     * sail_enabled (volatile) -- Is the endpoint enabled?  This isn't
+     * marked constant because it is used for synchronization on
+     * endpoint deallocation.
+     *
+     * Note that to reduce test and branches, we these two variables
+     * are represented by two bits in the word (bit 0 and bit 16).  It
+     * is illegal to have bits other than 0 and 16 set in this word.
+     * This assumption is used in ENABLED_AND_NOT_DPB_P, and is enforced
+     * in DOE_CONSTRUCT (assumed to not be performance critical) below.
+     *
+     * Duplicated in private ME section.
+     */
+
+    volatile unsigned long sailda_dpb_or_enabled;
+
+#define EXTRACT_DPB(dpb_or_enabled) ((dpb_or_enabled) >> 16)
+#define EXTRACT_ENABLED(dpb_or_enabled)  ((dpb_or_enabled) & 0xffff)
+#define DISABLED_OR_DPB_P(dpb_or_enabled) ((dpb_or_enabled) ^ 0x1)
+#define DOE_CONSTRUCT(dpb, enabled) \
+    (((dpb) ? 0x10000 : 0) | ((enabled) ? 0x1 : 0))
+
+    flipc_simple_lock pail_lock; /* Simple lock for serializing
+				    multiple thread access to
+				    structure.  AIL owned.  */
+    /* First element in buffer list array that is ours.  Constant
+       from communications buffer initialization.  */
+    flipc_cb_ptr constda_my_buffer_list;
+    /* First element after my_buffer_list that is *not* in my buffer
+       list.  Constant from communications buffer initialization.  */
+    flipc_cb_ptr constda_next_buffer_list;
+
+    /* First location that has a valid buffer pointer in it.  This may
+       contain a pointer to a buffer available for acquisition, or it
+       may contain a pointer to a buffer that is still being
+       processed; the buffer header or process_ptr needs to be checked
+       to be sure.  This location is AIL owned.  It is ignored by all
+       (including the ME and initialization code) if
+       drop_processed_buffers, above, is set.  */
+    volatile flipc_cb_ptr shrd_acquire_ptr;
+
+    /* AIL private copy of process pointer.  This hopefully means that
+       the AIL won't need to read the real process pointer (and fault
+       in a cache line) very often.  */
+    flipc_cb_ptr pail_process_ptr;
+
+    unsigned int pad_pail_7;
+
+    /* ===End of cache line===*/
+    /* ===AIL writes, ME occaisionally reads=== */
+
+    /* Next location at which the AIL may insert a buffer pointer.  */
+    volatile flipc_cb_ptr sail_release_ptr;
+    unsigned int pad_sail_1;
+    unsigned int pad_sail_2;
+    unsigned int pad_sail_3;
+    unsigned int pad_sail_4;
+    unsigned int pad_sail_5;
+    unsigned int pad_sail_6;
+    unsigned int pad_sail_7;
+
+    /* ===End of cache line===*/
+    /* ===Private ME data=== */
+    /* See above comments (in private ail section).  */
+
+    FLIPC_endpoint_type_t constdm_type;
+    volatile unsigned long saildm_dpb_or_enabled;
+
+    volatile unsigned long sme_overruns; /* For a receive endpoint, counter for
+				     the number of messages that have
+				     arrived when there hasn't been
+				     space.  ME owned.   */
+    unsigned long pail_overruns_seen;	/* A count of the number of overruns
+				   that the AIL has noted and doesn't
+				   want to be bothered with again.
+				   The user only sees the difference
+				   between the previous count and this.  */
+
+    /*
+     * For send endpoints; linked into a list that is used by the ME
+     * to find stuff to do.  Also used for endpoint free list.
+     * Null if at end of list.  Not "const" because it's used as a
+     * synchronization variable during setup and teardown
+     * of send endpoints.
+     */
+    volatile flipc_cb_ptr sail_next_send_endpoint;
+
+    /* Constant buffer lsit pointers for ME.  See private ail comments.  */
+    flipc_cb_ptr constdm_my_buffer_list;
+    flipc_cb_ptr constdm_next_buffer_list;
+
+    /* Private ME copy of release pointer.  This hopefully means that
+       the ME won't have to read (and fault in a cache line) the
+       release pointer very often.  */
+
+    flipc_cb_ptr pme_release_ptr;
+    /* ===End of cache line===*/
+
+    /* ===ME writes, AIL occaisionally reads=== */
+    /*
+     * For endpoint group membership.
+     */
+    flipc_cb_ptr pail_next_eg_endpoint; /* Next endpoint in endpoint group.
+					   AIL owned.  */
+    flipc_cb_ptr sail_epgroup;	/* Direct pointer to endpoint group that
+				   we are part of.  FLIPC_CBPTR_NULL
+				   if none.  AIL owned.  */
+
+    /* First location that has a buffer pointer available for
+       processing. If this value is equal to the release_ptr there are no
+       buffers available for processing.  */
+    volatile flipc_cb_ptr sme_process_ptr;
+    unsigned int pad_sme_3;
+    unsigned int pad_sme_4;
+    unsigned int pad_sme_5;
+    unsigned int pad_sme_6;
+    unsigned int pad_sme_7;
+
+    /* ===End of cache line===*/
+    /* ===END=== */
+
+    /* The following macros may have possible performance loss in
+       multiple accesses (or indirection, but a good compiler will get
+       around that).  We need to have versions for each processor so
+       that the constant reads are done from the right copy.  */
+
+    /* General bufferlist pointer increment macro, with versions
+       for ME and AIL.  */
+
+#define NEXT_BUFFERLIST_PTR(bufferlist_ptr, endpoint, suf)	\
+    (((bufferlist_ptr) + sizeof(flipc_data_buffer_t)		\
+      == ((endpoint)->const ## suf ## _next_buffer_list)) ? 	\
+     ((endpoint)->const ## suf ## _my_buffer_list) :		\
+     (bufferlist_ptr) + sizeof(flipc_data_buffer_t))
+#define NEXT_BUFFERLIST_PTR_ME(bufferlist_ptr, endpoint) \
+    NEXT_BUFFERLIST_PTR(bufferlist_ptr, endpoint, dm)
+#define NEXT_BUFFERLIST_PTR_AIL(bufferlist_ptr, endpoint) \
+    NEXT_BUFFERLIST_PTR(bufferlist_ptr, endpoint, da)
+
+    /* Macros for each of "can I release onto this buffer?"  "Can I
+       acquire from this buffer?" and "Can I process an element on
+       this buffer?"  The first two presume they are being executed on
+       the main procesor, the third on the co-processor.
+       All have three arguments:
+       *) A variable which will be set to the release, acquire, or
+       process pointer after the macro *if* the operation is ok.
+       *) A temporary variable used inside the function.
+       *) The endpoint.
+
+       We presume the acquire macro won't be called if drop processed
+       buffers is enabled; the process and release macros deal
+       appropriately with that issue.  */
+
+    /* In general these macros will:
+       *) Not read a volatile structure member more than once.
+       *) If a variables owner is the other processor, these macros
+          will check a local copy of the variable first before checking
+          the other processors.
+       *) Will only update the local copy if the remote copy really is
+          different from the local one.
+	  */
+
+/* This macro implements the synchronization check; local cbptr is
+   the pointer owned by the local processor which we want to compare
+   with a pointer on the remote processor which we have a copy
+   of locally.  Reads the remote pointer zero or one times; other
+   reads are as necessary.  
+
+   The algorithm is: 
+   *) If the local copy says our pointer and the remote value aren't equal,
+      we're done.
+   *) Otherwise, check the remote copy.  If it says the values aren't
+      equal, update the local copy.  */
+
+#define ENDPOINT_SYNCNE_CHECK(local_cbptr, copy_rmt_cbptr,	\
+			      rmt_cbptr, tmp_cbptr)		\
+    ((local_cbptr) != (copy_rmt_cbptr)				\
+     || ((((tmp_cbptr) = (rmt_cbptr)) != (local_cbptr))		\
+	 && (((copy_rmt_cbptr) = (tmp_cbptr)), 1)))
+
+#define ENDPOINT_ACQUIRE_OK(acquire_cbptr, tmp_cbptr, endpoint)		\
+    ((acquire_cbptr) = (endpoint)->shrd_acquire_ptr,			\
+     ENDPOINT_SYNCNE_CHECK(acquire_cbptr, (endpoint)->pail_process_ptr,	\
+			   (endpoint)->sme_process_ptr, tmp_cbptr))
+
+#define ENDPOINT_PROCESS_OK(process_cbptr, tmp_cbptr, endpoint)		\
+    ((process_cbptr) = (endpoint)->sme_process_ptr,			\
+     ENDPOINT_SYNCNE_CHECK(process_cbptr, (endpoint)->pme_release_ptr,	\
+			   (endpoint)->sail_release_ptr, tmp_cbptr))
+      
+#define NODPB_ENDPOINT_RELEASE_OK(release_cbptr, tmp_cbptr, endpoint)	\
+    ((release_cbptr) = (endpoint)->sail_release_ptr,			\
+     (tmp_cbptr) = (endpoint)->shrd_acquire_ptr,			\
+     (NEXT_BUFFERLIST_PTR_AIL(release_cbptr, endpoint)			\
+      != (tmp_cbptr)))	    
+	    
+/* Don't use NEXT_BUFFERLIST_PTR here to save a temporary variable.  */ 
+#define DPB_ENDPOINT_RELEASE_OK(release_cbptr, tmp_cbptr, endpoint)	   \
+    (release_cbptr = (endpoint)->sail_release_ptr,			   \
+     ((release_cbptr + sizeof(flipc_data_buffer_t) ==			   \
+       (endpoint)->constda_next_buffer_list)				   \
+      ? ENDPOINT_SYNCNE_CHECK((endpoint)->constda_my_buffer_list,	   \
+			      (endpoint)->pail_process_ptr,		   \
+			      (endpoint)->sme_process_ptr,		   \
+			      tmp_cbptr)				   \
+      : ENDPOINT_SYNCNE_CHECK(release_cbptr + sizeof(flipc_data_buffer_t), \
+			      (endpoint)->pail_process_ptr,		   \
+			      (endpoint)->sme_process_ptr,		   \
+			      tmp_cbptr)))
+
+    /* This next is tricky; remember that acquire_ptr points
+       to an actual bufferptr on the list, whereas release_ptr does
+       not.  This macro is only used in FLIPC_endpoint_query, and so
+       doesn't need to have an ME version.  */
+
+#define BUFFERS_ON_ENDPOINT_AIL(acquire_ptr, release_ptr, endpoint)	\
+    ((release_ptr) > (acquire_ptr)					\
+     ? ((release_ptr) - (acquire_ptr)) / sizeof(flipc_cb_ptr)		\
+     : ((((release_ptr) - (endpoint)->constda_my_buffer_list)		\
+	 + ((endpoint)->constda_next_buffer_list - acquire_ptr))	\
+	/ sizeof(flipc_cb_ptr)))
+} *flipc_endpoint_t;
+
+
+/*
+ * Endpoint groups.
+ *
+ * Used to represent a group of endpoints, for linking sending/receiving
+ * with semaphores & etc.  Note that there needs to be a private data
+ * structure kept by the kernel that associates with each epgroup
+ * a semaphore to be used for wakeups on that endpoint set.
+ */
+
+typedef struct flipc_epgroup {
+    flipc_simple_lock pail_lock;	/* Lock to synchronize threads (at the
+					   same priority level) accessing this
+					   structure.  */
+    volatile unsigned long sail_enabled;	/* Set if structure is active.  */
+    unsigned long const_semaphore_associated; /* Flag to indicate whether or not
+					  there is a semaphore associated
+					  with this endpoint group in the
+					  kernel flipc routines.  */
+    volatile unsigned long sail_wakeup_req; /* Incremented when a thread wants to
+					be woken.  */
+    volatile unsigned long pme_wakeup_del; /* Incremented when the ME delivers a
+				       wakeup. */
+    unsigned long pail_version;		/* Incremented when epgroup membership
+					   is changed; checked when retrieving
+					   a buffer from an epgroup.  */
+    unsigned long sail_msgs_per_wakeup;	/* How many messages need to arrive
+					   before the ME delivers a wakeup.  */
+    unsigned long pme_msgs_since_wakeup;	/* How many messages have arrived
+					   since the last wakeup.  ME
+					   owned.  */
+
+    flipc_cb_ptr pail_first_endpoint; /* First endpoint in the group.  The
+					 other endpoints are linked along
+					 behind him.  AIL owned.  */
+    flipc_cb_ptr pail_free;	/* Used to link this endpoint onto
+				   the freelist.  */
+} *flipc_epgroup_t;
+
+/*
+ * Communication buffer control structure.
+ *
+ * This is in the communications buffer itself.  Note that any changes
+ * in this structure require it to be locked with the allocation lock,
+ * as access to this structure is shared by all threads using the CB.
+ */
+
+/*
+ * Individual data type layout.
+ *
+ * All we need here is a pointer to the start of each type of data
+ * struct, the number of those data structures in the communications
+ * buffer, and a pointer to the beginning of the freelist for that data
+ * structure.
+ *
+ * Note that the composite buffer list doesn't have a freelist associated
+ * with it, since each section of the buffer list is tightly bound to an
+ * endpoint, and is allocated and freed with that endpoint.  We still
+ * need the start and number information, though.
+ */
+struct flipc_cb_type_ctl {
+    flipc_cb_ptr start;		/* Where there array of this type of
+				   data structure starts.  */
+    unsigned long number;		/* How many of them we've got.  */
+    flipc_cb_ptr free;		/* Where the beginning of the freelist
+				   is.  */
+};
+
+/*
+ * Synchronization with message engine.
+ *
+ * At certain times (specifically during structure allocation/free or
+ * additions to the send list) you want to know that the messaging
+ * engine has picked up your changes.  However, the message engine has
+ * (effectively) two threads, one for each of the send and receive
+ * sides.  The mechanisms used for synchronizations with the two sides
+ * differ.  In an eventual co-processor implementation (with a single
+ * thread), only the send side mechanism will be used.
+ *
+ * To request a cached state flush by the send side of the mesasging
+ * engine, you flip the request_sync bit and it responds by flipping
+ * the response_sync bit.  The send ME checks this bit once every trip
+ * through the send endpoints.
+ *
+ * On the receive side, since receives take very little time and do
+ * not block (unlike sends) when we want to make sure the ME is
+ * holding no cached receive side state, we simply spin until we see
+ * that the ME receive side is no longer operating.  It sets a
+ * variable whenever it is in the process of receiving a message.
+ */
+
+/*
+ * Proper manipulation of the send endpoint list.
+ *
+ * Note that synchronizing with the message engine over access to the
+ * send endpoint list is especially tricky.  There is no problem with
+ * writing new values in all of the locations required to take a send
+ * endpoint off of the list.  However, we must be very sure before
+ * modifying the pointer *in* the send endpoint that the ME isn't
+ * currently working in that send endpoint (else it could be sent off
+ * into the void).  Two options here:
+ *
+ * 	*) Synchronize (using the below variables) for each send
+ * 	   endpoint removed, after the removal but before the
+ * 	   modification of the data in the internal structure.
+ *	*) If we can always be sure that the send endpoint link in the
+ *	   endpoint structure has a valid value, we can simply let the
+ * 	   chips fall where they may.  It will be null while free, and
+ * 	   have a value that points back into the send buffer list
+ * 	   when reallocated.  I'm not going to do this; it's sleezy
+ * 	   and will partially mess up fairness based on ME send
+ * 	   endpoint round-robinning.
+ */
+
+/*
+ * This entire structure is protected by an kernel level lock so there
+ * is no conflict between threads accessing it.  See flipc_kfr.c for
+ * details on this lock; how it is implemented and used depends on what
+ * kernel base we are on.
+ */
+
+/*
+ * Note that the last element of this structure is variable sized, so this
+ * structure itself is also variable sized.
+ */
+typedef struct flipc_comm_buffer_ctl {
+    /* Kernel flipc configuration that the user must match in order to
+       work with this kernel.  Checked as soon as the comm buffer is
+       mapped.  */
+    struct {
+	unsigned int real_time_primitives:1;
+	unsigned int message_engine_in_kernel:1;
+	unsigned int no_bus_locking:1; /* One way check -- if the kernel doesn't
+				   have this and the user does, that's
+				   an error.  */
+    } kernel_configuration;
+    volatile unsigned long	send_ready;	/* A send(s) is ready to go */
+
+    /* These first three structures are constant after communications buffer
+       initialization.  */
+    unsigned long data_buffer_size; /* Size of the data buffers.  */
+    unsigned long local_node_address; /* Local node number.  */
+    FLIPC_address_t null_destination; /* Local null destination value.  */
+
+#if REAL_TIME_PRIMITIVES
+    /* The scheduling policy used by the task initializing flipc for
+       the allocations lock.  */
+    int allocations_lock_policy;
+#else
+    /* A poor substitute for a kernel level allocations lock.
+       Note that this *cannot* be used as a regular simple lock;
+       instead, try to acquire it, call sleep(1), try again, etc.
+       Spinning on this lock will probably waste lots of cycles.  */
+    flipc_simple_lock pail_alloc_lock;
+#endif
+
+    /* All of the members of these structures except for the free pointer
+       are constant after initialization.  The free pointer is ail owned
+       and private.  */
+    struct flipc_cb_type_ctl endpoint;
+    struct flipc_cb_type_ctl epgroup;
+    struct flipc_cb_type_ctl bufferlist;
+    struct flipc_cb_type_ctl data_buffer;
+
+    /* Global synchronization with the message engine.  On the KKT
+       implementation we need one synchronizer for each thread.  */
+
+    /* Send side: */
+    volatile unsigned long sail_request_sync; /* request_sync = !request_sync when the
+					  AIL wants to synchronize with the
+					  CB.  */
+    volatile unsigned long sme_respond_sync; /* respond_sync = !respond_sync when
+					 the ME has noticed the sync
+					 request.  By responding to the
+					 sync, the ME is stating that it has
+					 no communications buffer state that
+					 was cached previous to it noticing
+					 the sync.    */
+
+    /* Receive side.  */
+    volatile unsigned long sme_receive_in_progress; /* Set by the ME before it looks at
+						any data structures; cleared
+						afterwards.  A simple spin in
+						the user space on this
+						variable will suffice, as the
+						time that the message
+						engine could be receiving
+						is low.  */
+
+    /* Send endpoint list starts here.  */
+    volatile flipc_cb_ptr sail_send_endpoint_list; /* Null if no send endpoints.
+						    */
+
+    /* Keep track of whatever performance information we choose.  */
+    struct FLIPC_domain_performance_info performance;
+
+    /* Keep track of various kinds of error information here.  */
+    struct FLIPC_domain_errors sme_error_log;
+
+} *flipc_comm_buffer_ctl_t;
+
+
+/*
+ * The communications buffer.
+ *
+ * The only restriction on the layout of the communications buffer is
+ * that the buffers themselves may not cross page boundaries.  So we
+ * will place the data buffers at the end of the communications
+ * buffer, and the other objects at the beginning, and there may be a
+ * little bit of extra space in the middle.
+ *
+ * Note that this layout may change in future versions of FLIPC.
+ *
+ * 	+---------------------------+
+ * 	|    flipc_comm_buffer_ctl  |
+ * 	+---------------------------+
+ * 	|       	            |
+ * 	|         Endpoints         |
+ * 	|       	            |
+ * 	+---------------------------+
+ * 	|       		    |
+ * 	|      Endpoint Groups      |
+ * 	|       	            |
+ * 	+---------------------------+
+ * 	|       	            |
+ * 	| Combined Buffer Lists     |
+ * 	|       	            |
+ * 	+---------------------------+
+ *	|			    |
+ *	| (Possible empty space)    |
+ *	|			    |
+ * 	+---------------------------+
+ * 	|                           |
+ * 	|    Data Buffers	    |
+ * 	|       	            |
+ * 	+---------------------------+
+ */
+
+/* The number of pages that the kernel will reserve for the comm
+   buffer.  The AIL needs to know this to know how much to map.  */
+#define COMM_BUFFER_SIZE 0x100000
+
+/*
+ * These variables are set, in a per-address space context, to the base
+ * and length of the communications buffer.  The ME needs to do bounds
+ * checking to make sure it isn't overrunning anything.  Note that the
+ * existence of these variables implies that an application will only
+ * open a single domain.
+ *
+ * These declarations are duplicated in flipc/flipc_usermsg.h, and
+ * should be kept in sync with that file.
+ */
+unsigned char *flipc_cb_base;
+unsigned long flipc_cb_length;		/* In bytes.  */
+
+/*
+ * Following is a set of macros to convert back and forth between
+ * real address pointers and flipc_cb_ptr's for each data type.  They
+ * rely on the flipc_cb_base being set correctly.
+ *
+ * A possible future improvement might be to have bounds checking occur
+ * inside these macros, but I'm not sure what I'd do if it failed.
+ */
+
+/* Easy going one way.  */
+#define FLIPC_CBPTR(ptr) \
+(((unsigned char *) (ptr)) - flipc_cb_base)
+
+/* Need to get the right types going the other way.  */
+#define FLIPC_ENDPOINT_PTR(cb_ptr) \
+((flipc_endpoint_t) ((cb_ptr) + flipc_cb_base))
+#define FLIPC_EPGROUP_PTR(cb_ptr) \
+((flipc_epgroup_t) ((cb_ptr) + flipc_cb_base))
+#define FLIPC_DATA_BUFFER_PTR(cb_ptr) \
+((flipc_data_buffer_t) ((cb_ptr) + flipc_cb_base))
+#define FLIPC_BUFFERLIST_PTR(cb_ptr) \
+((flipc_cb_ptr *) ((cb_ptr) + flipc_cb_base))
+
+
+/*
+ * Flipc addresses.
+ *
+ * The addresses used by flipc for communication are defined in the
+ * user visible header file as unsigned longs.  These macros pull that
+ * information apart for use of the FLIPC internal routines.
+ *
+ * I assume in the following that endpoints immediately follow the
+ * comm buffer control structure, because that makes indexing into
+ * them much easier.
+ */
+
+#define FLIPC_CREATE_ADDRESS(node, endpoint_idx) \
+((node << 16) | (endpoint_idx))
+#define FLIPC_ADDRESS_NODE(addr) (((unsigned long) (addr)) >> 16)
+#define FLIPC_ADDRESS_ENDPOINT(addr) (((unsigned long) (addr)) & 0xffff)
+
+#endif /* _MACH_FLIPC_CB_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/flipc_debug.h b/xnu-792.18.15/osfmk/mach/flipc_debug.h
new file mode 100644
index 0000000..969deda
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/flipc_debug.h
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+
+/*
+ * Really a C file, but I'd like to have this code available in both
+ * the kernel and the application, so I'll put it in a .h file.  This
+ * file needs to be included only once in the AIL or ME, into a .c file
+ * where it will be compiled.
+ */
+
+/* 
+ * Since these are debug functions, it doesn't matter which processor macro
+ * version I use; I don't mind spoiling cache while I'm debugging.
+ */
+
+#include <mach/flipc_cb.h>
+/*
+ * Print (using printf) all buffers in the communications buffer that
+ * are not on any endpoint or on the buffer freelist.  Only active
+ * endpoints are checked.
+ *
+ * Note that no locking is done; this function implicitly assumes the
+ * communications buffer is in a quiescent state.  It is expected that
+ * this function will normally be called from a debugger.
+ *
+ * As long as it is at it, this function prints buffers that are
+ * doubly owned (valid pointers to them from two places).
+ */
+
+/*
+ * Given that these functions will normally be called from the debugger,
+ * there isn't any need to globally visible prototypes for them.  To
+ * eliminate compilation warnings, we include prototypes for the functions
+ * here in the file.
+ */ 
+static void flipcdbg_update_bufferset_bitvec(flipc_comm_buffer_ctl_t,
+					     flipc_data_buffer_t);
+void flipcdbg_print_unowned_buffers(void);
+void flipcdbg_buffer_find_refs(flipc_cb_ptr buffer_cbptr);
+
+#ifdef __GNUC__
+__inline__
+#endif
+static void 
+flipcdbg_update_bufferset_bitvec(flipc_comm_buffer_ctl_t cb_ctl,
+				 flipc_data_buffer_t buffer)
+{
+    unsigned char *buffer_base = flipc_cb_base + cb_ctl->data_buffer.start;
+    int bitpos = ((((unsigned char *) buffer) - buffer_base)
+		  / cb_ctl->data_buffer_size);
+    int element = bitpos / (sizeof(unsigned long) * 8);
+    int subbitpos = bitpos - element * sizeof(unsigned long) * 8;
+
+    /* Is that position set already?  */
+    if (flipc_debug_buffer_bitvec[element] & (1 << subbitpos))
+	printf("Buffer 0x%x (idx: %d, cbptr: 0x%x) is multiply referenced.\n",
+	       buffer, bitpos, FLIPC_CBPTR(buffer));
+
+    /* Set it.  */
+    flipc_debug_buffer_bitvec[element] |= (1 << subbitpos);
+}
+
+void
+flipcdbg_print_unowned_buffers(void)
+{
+    flipc_comm_buffer_ctl_t cb_ctl =
+	(flipc_comm_buffer_ctl_t) flipc_cb_base;
+    int i;
+    unsigned long bitvec_length = ((cb_ctl->data_buffer.number + sizeof(unsigned long) * 8)
+			    / (sizeof(unsigned int) * 8));
+    flipc_data_buffer_t current_buffer;
+    flipc_endpoint_t current_endpoint;
+    flipc_cb_ptr current_cbptr;
+    int header_printed = 0;
+
+    /* Clean out the bitvec.  */
+    for (i = 0; i < bitvec_length; i++)
+	flipc_debug_buffer_bitvec[i] = 0;
+
+    /* Go through the freelist, setting bits for each buffer.  */
+    for (current_cbptr = cb_ctl->data_buffer.free;
+	 current_cbptr != FLIPC_CBPTR_NULL;
+	 current_cbptr = current_buffer->u.free) {
+	int bitpos;
+	int element, subbitpos;
+
+	current_buffer = FLIPC_DATA_BUFFER_PTR(current_cbptr);
+	flipcdbg_update_bufferset_bitvec(cb_ctl, current_buffer);
+    }
+    
+    /* Go through all the endpoints, again setting bits for each buffer.  */
+    for (current_endpoint = FLIPC_ENDPOINT_PTR(cb_ctl->endpoint.start);
+	 (current_endpoint
+	  < (FLIPC_ENDPOINT_PTR(cb_ctl->endpoint.start)
+	     + cb_ctl->endpoint.number));
+	 current_endpoint++) {
+	if (EXTRACT_ENABLED(current_endpoint->saildm_dpb_or_enabled)) {
+	    flipc_cb_ptr current_ptr =
+		(EXTRACT_DPB(current_endpoint->saildm_dpb_or_enabled)
+		 ? current_endpoint->sme_process_ptr 
+		 : current_endpoint->shrd_acquire_ptr);
+	    flipc_cb_ptr limit_ptr = current_endpoint->sail_release_ptr;
+
+	    while (current_ptr != limit_ptr) {
+		flipc_cb_ptr current_buffer_cbptr =
+		    *FLIPC_BUFFERLIST_PTR(current_ptr);
+		flipc_data_buffer_t current_buffer =
+		    FLIPC_DATA_BUFFER_PTR(current_buffer_cbptr);
+
+		/* Mark this as set.  */
+		flipcdbg_update_bufferset_bitvec(cb_ctl, current_buffer);
+
+		/* Increment the current pointer.  */
+		current_ptr = NEXT_BUFFERLIST_PTR_ME(current_ptr,
+						     current_endpoint);
+	    }
+	}
+    }
+
+    /* Ok, we should have marked every buffer that has a reference.
+       Print out all the ones that done have references.  */
+    for (i = 0; i < bitvec_length; i++) {
+	int this_limit =
+	    ((i == bitvec_length - 1)
+	     ? cb_ctl->data_buffer.number % (sizeof(unsigned long)*8)
+	     : sizeof(unsigned long)*8); 
+	if (flipc_debug_buffer_bitvec[i] != (unsigned long) -1) {
+	    int j;
+	    for (j = 0; j < this_limit; j++) {
+		if (!(flipc_debug_buffer_bitvec[i] & (1 << j))) {
+		    int buffer_bitpos = i * sizeof(unsigned long) * 8 + j;
+		    flipc_cb_ptr buffer_cbptr =
+			(buffer_bitpos * cb_ctl->data_buffer_size
+			 + cb_ctl->data_buffer.start);
+		    flipc_data_buffer_t buffer_ptr =
+			FLIPC_DATA_BUFFER_PTR(buffer_cbptr);
+		    
+		    /* Print header if necessary.  */
+		    if (!header_printed) {
+			header_printed = 1;
+			printf("Unreferenced buffers (ptr,idx,cbptr):");
+		    }
+
+		    /* Print buffer.  */
+		    printf(" (0x%x,%d,0x%x)", buffer_ptr, buffer_bitpos,
+			   buffer_cbptr);
+		}
+	    }
+	}
+    }
+    if (header_printed)
+	printf("\n");
+}
+
+void
+flipcdbg_buffer_find_refs(flipc_cb_ptr buffer_cbptr)
+{
+    flipc_comm_buffer_ctl_t cb_ctl =
+	(flipc_comm_buffer_ctl_t) flipc_cb_base;
+    int found_on_freelist = 0;
+    int found_on_endpoints = 0;
+    int i;
+    flipc_endpoint_t current_endpoint;
+
+    flipc_cb_ptr current_cbptr;
+    flipc_data_buffer_t current_buffer;
+
+    /* Go through the freelist, looking for buffer.  */
+    for (i = 0, current_cbptr = cb_ctl->data_buffer.free;
+	 current_cbptr != FLIPC_CBPTR_NULL;
+	 i++, current_cbptr = current_buffer->u.free) {
+	if (current_cbptr == buffer_cbptr) {
+	    printf("Buffer found on freelist in position %d\n", i);
+	    found_on_freelist = 1;
+	}
+	current_buffer = FLIPC_DATA_BUFFER_PTR(current_cbptr);
+	if (i > cb_ctl->data_buffer.number) {
+	    printf ("**Some form of corruption following freelist.**");
+	    return;
+	}
+    }
+    if (found_on_freelist)
+	printf("(Total buffers on freelist: %d/%d)\n", i,
+	       cb_ctl->data_buffer.number);
+    
+    /* Go through all the endpoints, again looking for the buffer.  */
+    for (current_endpoint = FLIPC_ENDPOINT_PTR(cb_ctl->endpoint.start);
+	 (current_endpoint
+	  < (FLIPC_ENDPOINT_PTR(cb_ctl->endpoint.start)
+	     + cb_ctl->endpoint.number));
+	 current_endpoint++) {
+	if (EXTRACT_ENABLED(current_endpoint->saildm_dpb_or_enabled)) {
+	    flipc_cb_ptr current_ptr =
+		(EXTRACT_DPB(current_endpoint->saildm_dpb_or_enabled)
+		 ? current_endpoint->sme_process_ptr 
+		 : current_endpoint->shrd_acquire_ptr);
+	    flipc_cb_ptr limit_ptr = current_endpoint->sail_release_ptr;
+
+	    while (current_ptr != limit_ptr) {
+		current_cbptr = *FLIPC_BUFFERLIST_PTR(current_ptr);
+
+		if (current_cbptr == buffer_cbptr) {
+		    printf("Buffer found on endpoint 0x%x (idx: %d)\n",
+			   current_endpoint,
+			   (current_endpoint
+			    - FLIPC_ENDPOINT_PTR(cb_ctl->endpoint.start)));
+		    found_on_endpoints = 1;
+		}
+
+		/* Increment the current pointer.  */
+		current_ptr = NEXT_BUFFERLIST_PTR_ME(current_ptr,
+						     current_endpoint);
+	    }
+	}
+    }
+}
+
+
+
diff --git a/xnu-792.18.15/osfmk/mach/flipc_device.h b/xnu-792.18.15/osfmk/mach/flipc_device.h
new file mode 100644
index 0000000..e76e520
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/flipc_device.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:29  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:45  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.1.5.1  1995/06/13  18:20:16  sjs
+ * 	Merged from flipc_shared.
+ * 	[95/06/07            sjs]
+ *
+ * Revision 1.1.3.4  1995/04/05  21:21:58  randys
+ * 	Added allocations_lock_policy argument to usermsg_Init_Buffer set
+ * 	status call.
+ * 	[95/04/05            randys]
+ * 
+ * Revision 1.1.3.3  1995/02/21  17:23:08  randys
+ * 	Re-indented code to four space indentation
+ * 	[1995/02/21  16:25:35  randys]
+ * 
+ * Revision 1.1.3.2  1994/12/20  19:02:03  randys
+ * 	Added filename in comment at top of each file
+ * 	[1994/12/19  20:28:25  randys]
+ * 
+ * Revision 1.1.3.1  1994/12/12  17:46:17  randys
+ * 	Putting initial flipc implementation under flipc_shared
+ * 	[1994/12/12  16:27:48  randys]
+ * 
+ * Revision 1.1.1.2  1994/12/11  23:11:21  randys
+ * 	Initial flipc code checkin
+ * 
+ * $EndLog$
+ */
+
+/*
+ * mach/flipc_device.h
+ *
+ * Declarations related to the device driver interface to FLIPC.
+ */
+
+#ifndef _MACH_FLIPC_DEVICE_H_
+#define _MACH_FLIPC_DEVICE_H_
+
+/*
+ * Definitions of constants both the ME and AIL need to know for
+ * communications through the device driver interface.  These are the
+ * possible values for the top 16 bits of the flavor parameter; the
+ * bottom 16 bits are extra information that may be needed (eg. to
+ * parameterize a request for semaphore in the get status routine).
+ */
+typedef enum {			/* Arguments.  */
+    /* Get status flavors.  */	
+    usermsg_Get_Initialized_Status = 1, /* (int *init_p) */
+    usermsg_Get_Epgroup_Semaphore, /* (mach_port_t *semaphore) */
+    usermsg_Return_Allocations_Lock, /* (void) */
+
+    /* Set status flavors.  */
+    usermsg_Init_Buffer,		/* (int max_endpoints,
+					   int max_epgroups,
+					   int max_buffers,
+					   int max_buffers_per_endpoint,
+					   int allocations_lock_policy) */
+    usermsg_Process_Work,		/* (void) */
+    usermsg_Acquire_Allocations_Lock, /* (void) */
+    usermsg_Release_Allocations_Lock, /* (void) */
+    usermsg_Epgroup_Associate_Semaphore /* (int epgroup_idx, mach_port_t port) */
+} usermsg_devop_t;
+
+#define FLIPC_DEVICE_FLAVOR(devop, param)  (((devop)<<16)|(param))
+
+#endif /* _MACH_FLIPC_DEVICE_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/flipc_locks.h b/xnu-792.18.15/osfmk/mach/flipc_locks.h
new file mode 100644
index 0000000..94d9a6e
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/flipc_locks.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:45  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.1.4.1  1995/06/13  18:20:29  sjs
+ * 	Merged from flipc_shared.
+ * 	[95/06/07            sjs]
+ *
+ * Revision 1.1.2.3  1995/03/09  19:42:30  rwd
+ * 	Move yield function out of macro and prototype.
+ * 	[1995/03/09  19:36:25  rwd]
+ * 
+ * Revision 1.1.2.2  1995/02/21  17:23:11  randys
+ * 	Re-indented code to four space indentation
+ * 	[1995/02/21  16:25:39  randys]
+ * 
+ * Revision 1.1.2.1  1994/12/20  19:02:06  randys
+ * 	Moved definition of flipc_simple_lock to flipc_cb.h
+ * 	[1994/12/20  17:34:44  randys]
+ * 
+ * 	Separated the lock macros out into machine dependent and independent files;
+ * 	this is the machine independent file.
+ * 	[1994/12/20  16:43:38  randys]
+ * 
+ * $EndLog$
+ */
+
+/*
+ * mach/flipc_locks.h
+ *
+ * The machine independent part of the flipc_simple_locks definitions.
+ * Most of the locks definitions is in flipc_dep.h, but what isn't
+ * dependent on the platform being used is here.
+ */
+
+/*
+ * Note that the locks defined in this file and in flipc_dep.h are only
+ * for use by user level code.  The reason why this file is visible to
+ * the kernel is that the kernel section of flipc needs to initialize
+ * these locks.
+ */
+
+#ifndef _MACH_FLIPC_LOCKS_H_
+#define _MACH_FLIPC_LOCKS_H_
+
+/* Get the simple lock type.  */
+#include <mach/flipc_cb.h>
+
+/*
+ * Lock function prototypes.  This needs to be before any lock definitions
+ * that happen to be macros.
+ */
+
+/* Initializes lock.  Always a macro (so that kernel code can use it without
+   library assistance).  */
+void flipc_simple_lock_init(flipc_simple_lock *lock);
+
+/* Returns 1 if lock gained, 0 otherwise.  */
+int flipc_simple_lock_try(flipc_simple_lock *lock);
+
+/* Returns 1 if lock is locked, 0 otherwise.  */
+int flipc_simple_lock_locked(flipc_simple_lock *lock);
+
+/* Releases the lock.  */
+void flipc_simple_lock_release(flipc_simple_lock *lock);
+
+/* Take the lock.  */
+void flipc_simple_lock_acquire(flipc_simple_lock *lock);
+
+/* Take two locks.  Does not hold one while spinning on the
+   other.  */
+void flipc_simple_lock_acquire_2(flipc_simple_lock *lock1,
+			   flipc_simple_lock *lock2);
+
+/* Get the machine dependent stuff.  The things that need to be
+ * defined in a machine dependent fashion are:
+ *
+ *   flipc_simple_lock_init	(must be a macro)
+ *   flipc_simple_lock_try
+ *   flipc_simple_lock_locked
+ *   flipc_simple_lock_release
+ *
+ * These last three don't necessarily have to be macros, but if they
+ * aren't definitions must be included in the machine dependent
+ * part of the user level library code.
+ */
+#include <mach/machine/flipc_dep.h>
+
+/*
+ * Set at flipc initialization time to thread_yield argument to
+ * FLIPC_domain_init
+ */
+
+extern void (*flipc_simple_lock_yield_fn)(void);
+
+/*
+ * Machine independent definitions; defined in terms of above routines.
+ */
+
+/* Take the lock.  Assumes an external define saying how long to
+   spin, and an external function to call when we've spun too long.  */
+#define flipc_simple_lock_acquire(lock)		\
+do {						\
+  int __spin_count = 0;				\
+						\
+  while (flipc_simple_lock_locked(lock)		\
+	 || !flipc_simple_lock_try(lock))	\
+    if (++__spin_count > LOCK_SPIN_LIMIT) {	\
+      (*flipc_simple_lock_yield_fn)();		\
+      __spin_count = 0;				\
+    }						\
+} while (0)
+
+/* Take two locks.  Hold neither while spinning on the other.  */
+#define flipc_simple_lock_acquire_2(lock1, lock2)	\
+do {							\
+  int __spin_count = 0;					\
+							\
+  while (1) {						\
+    while (flipc_simple_lock_locked(lock1)		\
+	   || !flipc_simple_lock_try(lock1))		\
+      if (++__spin_count > LOCK_SPIN_LIMIT) {		\
+	(*flipc_simple_lock_yield_fn)();		\
+	__spin_count = 0;				\
+      }							\
+							\
+    if (flipc_simple_lock_try(lock2))			\
+      break;						\
+    flipc_simple_lock_release(lock1);			\
+							\
+    while (flipc_simple_lock_locked(lock2)		\
+	   || !flipc_simple_lock_try(lock2))		\
+      if (++__spin_count > LOCK_SPIN_LIMIT) {		\
+	(*flipc_simple_lock_yield_fn)();		\
+	__spin_count = 0;				\
+      }							\
+							\
+    if (flipc_simple_lock_try(lock1))			\
+      break;						\
+    flipc_simple_lock_release(lock2);			\
+  }							\
+} while (0)
+
+#endif	/* _MACH_FLIPC_LOCKS_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/flipc_types.h b/xnu-792.18.15/osfmk/mach/flipc_types.h
new file mode 100644
index 0000000..1f7f978
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/flipc_types.h
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:45  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.1.7.1  1996/09/17  16:34:35  bruel
+ * 	fixed types.
+ * 	[96/09/17            bruel]
+ *
+ * Revision 1.1.5.1  1995/06/13  18:20:20  sjs
+ * 	Merged from flipc_shared.
+ * 	[95/06/07            sjs]
+ * 
+ * Revision 1.1.3.11  1995/05/23  19:55:36  randys
+ * 	Don't keep track of messages sent to a bad destination--that's
+ * 	purely a transport function now.
+ * 	[95/05/23            randys]
+ * 
+ * Revision 1.1.3.10  1995/05/23  15:40:20  randys
+ * 	Added field to FLIPC_domain_errors to indicate validity of other
+ * 	fields.
+ * 	[95/05/22            randys]
+ * 
+ * Revision 1.1.3.9  1995/05/16  20:46:35  randys
+ * 	Added a "performance_valid" field to the flipc performance
+ * 	structure.
+ * 	[95/05/16            randys]
+ * 
+ * Revision 1.1.3.8  1995/04/05  21:22:01  randys
+ * 	Added field to domain_info struct to include allocations lock
+ * 	sched policy.
+ * 	[95/04/05            randys]
+ * 
+ * Revision 1.1.3.7  1995/03/09  19:42:33  rwd
+ * 	Define SEMAPHORE_NULL (for now) and include mach_types.h instead
+ * 	of sema_types.h.
+ * 	[95/03/08            rwd]
+ * 
+ * Revision 1.1.3.6  1995/02/23  21:32:52  randys
+ * 	 Removed placeholder definition for locks--I don't believe that I
+ * 	 use locks unless I'm on top of a real time base, in which case
+ * 	 that base will define the type.
+ * 	[95/02/22            randys]
+ * 
+ * Revision 1.1.3.5  1995/02/21  17:23:13  randys
+ * 	Re-indented code to four space indentation
+ * 	[1995/02/21  16:25:36  randys]
+ * 
+ * Revision 1.1.3.4  1995/02/16  23:20:14  randys
+ * 	ANSIfy FLIPC_thread_yield_function.
+ * 	[95/02/14            randys]
+ * 
+ * 	Add FLIPC_thread_yield_function type.
+ * 	[95/02/14            randys]
+ * 
+ * Revision 1.1.3.3  1995/01/26  21:01:51  randys
+ * 	Added performance structure.
+ * 	[1995/01/24  21:14:12  randys]
+ * 
+ * 	Added FLIPC_epgroup_info struct
+ * 	[1995/01/24  18:30:02  randys]
+ * 
+ * 	Create a new structure (FLIPC_endpoint_info) to return
+ * 	information about an endpoint.
+ * 	[1995/01/20  19:26:35  randys]
+ * 
+ * 	Get rid of FLIPC_DESTINATION_NULL and add in
+ * 	FLIPC_ADDRESS_ERROR (return code from FLIPC_buffer_destination)
+ * 	[1995/01/19  20:23:24  randys]
+ * 
+ * 	Added domain index type for specifying domain in
+ * 	init and attach calls
+ * 	[1995/01/18  16:47:25  randys]
+ * 
+ * Revision 1.1.3.2  1994/12/20  19:02:09  randys
+ * 	Added error reporting structure type, and added
+ * 	room in the standard domain query for error log size.
+ * 	[1994/12/19  23:46:09  randys]
+ * 
+ * 	Added filename in comment at top of each file
+ * 	[1994/12/19  20:28:26  randys]
+ * 
+ * 	Support and doc for minor user interface changes for error conditions
+ * 	[1994/12/18  23:24:30  randys]
+ * 
+ * 	Yank the semaphore type definitions back out, and include the file
+ * 	that defines those types.
+ * 	[1994/12/13  17:50:03  randys]
+ * 
+ * Revision 1.1.3.1  1994/12/12  17:46:20  randys
+ * 	Put definitions of semaphore_t and SEMAPHORE_NULL back in; they aren't
+ * 	defined in user space yet.
+ * 	[1994/12/12  17:21:56  randys]
+ * 
+ * Revision 1.1.1.2  1994/12/11  23:11:23  randys
+ * 	Initial flipc code checkin
+ * 
+ * $EndLog$
+ */
+
+/*
+ * mach/flipc_types.h
+ *
+ * Definitions of those flipc types that need to be visible to both the AIL
+ * and kernel sides of flipc (which is just about everything).
+ */
+
+#ifndef _MACH_FLIPC_TYPES_H_
+#define _MACH_FLIPC_TYPES_H_
+
+#include <mach/port.h>
+
+/*
+ * Define a couple of generally useful types.
+ */
+#include <mach/mach_types.h>
+
+#ifndef MACH_KERNEL
+#define SEMAPHORE_NULL (semaphore_port_t)0
+#endif /* !defined(MACH_KERNEL) */
+
+/*
+ * Basic flipc types; visible to both user and kernel segments of the
+ * flipc implementation.
+ */
+/* Flipc addresses.  These name a node-endpoint combination for
+   sending.  */
+typedef unsigned int FLIPC_address_t;
+#define FLIPC_ADDRESS_ERROR ((FLIPC_address_t) -1)
+
+/* Flipc endpoints.  */
+typedef void *FLIPC_endpoint_t;
+#define FLIPC_ENDPOINT_NULL ((FLIPC_endpoint_t) 0)
+
+/* Buffer pointers (returned by query functions).  Users are allowed to
+   copy directly to/from this pointer; it points at their data.  */
+typedef void *FLIPC_buffer_t;   
+#define FLIPC_BUFFER_NULL ((FLIPC_buffer_t) 0)   
+
+/* Endpoint group identifiers.  */
+typedef void *FLIPC_epgroup_t;
+#define FLIPC_EPGROUP_NULL ((FLIPC_epgroup_t) 0)
+#define FLIPC_EPGROUP_ERROR ((FLIPC_epgroup_t) -1)
+
+/* Domain index; argument to initialization and attach routines.  */
+typedef unsigned int FLIPC_domain_index_t;
+
+/* Domain handle (mach port).  */
+typedef mach_port_t FLIPC_domain_t;
+
+/* The different types an endpoint can be.  FLIPC_Inactive is used when
+   the endpoint has not been configured and hence is on the freelist.  */
+typedef enum {
+    FLIPC_Inactive = -1,
+    FLIPC_Send,
+    FLIPC_Receive
+} FLIPC_endpoint_type_t;
+
+/* Structure for returning performance information about the flipc
+   domain; a placeholder for future entries as needed.
+   This information will only be valid if the kernel is configured to
+   keep flipc performance information.  */
+typedef struct FLIPC_domain_performance_info {
+    unsigned long performance_valid;	/* Non zero if the other information
+				   in this structure is valid.  */
+    unsigned long messages_sent;		/* Since last init.  */
+    unsigned long messages_received;	/* Since last init.  Includes overruns
+				   (because they are marked in the
+				   endpoint data structure).  Doesn't
+				   include other drops (they are
+				   marked in other places) */
+} *FLIPC_domain_performance_info_t;
+
+/* Flipc yield function.  */
+typedef void (*FLIPC_thread_yield_function)(void);
+
+/* Structure for returning information about the flipc domain.  */
+typedef struct FLIPC_domain_info {
+    int max_endpoints;
+    int max_epgroups;
+    int max_buffers;
+    int max_buffers_per_endpoint;
+    int msg_buffer_size;
+    FLIPC_thread_yield_function yield_fn;
+    int policy;			/* Allocations lock sched policy.
+				   Unused if REAL_TIME_PRIMITIVES are
+				   not being used.  */
+    struct FLIPC_domain_performance_info performance;
+    int error_log_size;		/* In bytes.  */
+} *FLIPC_domain_info_t;
+
+/* Structure for returning information about the error state of
+   the flipc domain.  Note that this is variable sized; the size
+   of the transport specific information is not known at compile
+   time.  */
+typedef struct FLIPC_domain_errors {
+    int error_full_config_p;		/* 1 if disabled and badtype below are
+					   valid; 0 if only msgdrop_inactive
+					   is valid.  */ 
+    int msgdrop_inactive;		/* Messages dropped because
+					   of the domain being locally
+					   inactive.  */
+    int msgdrop_disabled;		/* Messages dropped because of a
+					   disabled endpoint.  */
+    int msgdrop_badtype;		/* Messages dropped because they
+					   were sent to a send endpoint.  */
+
+    int transport_error_size;	/* Size of the following array of
+				   ints, in bytes.  */
+    int transport_error_info[1];	/* Really of transport_error_size.  */
+} *FLIPC_domain_errors_t;
+
+/* Structure for returning information about endpoints.  */
+typedef struct FLIPC_endpoint_info {
+    FLIPC_endpoint_type_t type;
+    unsigned int processed_buffers_dropped_p;
+    unsigned long number_buffers;
+    FLIPC_epgroup_t epgroup;
+} *FLIPC_endpoint_info_t;
+
+typedef struct FLIPC_epgroup_info {
+    unsigned long msgs_per_wakeup;
+} *FLIPC_epgroup_info_t;
+
+#endif /* _MACH_FLIPC_TYPES_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/host_info.h b/xnu-792.18.15/osfmk/mach/host_info.h
new file mode 100644
index 0000000..ce5d9b6
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/host_info.h
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	File:	mach/host_info.h
+ *
+ *	Definitions for host_info call.
+ */
+
+#ifndef	_MACH_HOST_INFO_H_
+#define	_MACH_HOST_INFO_H_
+
+#include <mach/message.h>
+#include <mach/vm_statistics.h>
+#include <mach/machine.h>
+#include <mach/machine/vm_types.h>
+#include <mach/time_value.h>
+
+#include <sys/cdefs.h>
+
+/*
+ *	Generic information structure to allow for expansion.
+ */
+typedef integer_t	*host_info_t;		/* varying array of int. */
+
+#define	HOST_INFO_MAX	(1024)		/* max array size */
+typedef integer_t	host_info_data_t[HOST_INFO_MAX];
+
+#define KERNEL_VERSION_MAX (512)
+typedef char	kernel_version_t[KERNEL_VERSION_MAX];
+
+#define KERNEL_BOOT_INFO_MAX (4096)
+typedef char	kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
+
+/*
+ *	Currently defined information.
+ */
+/* host_info() */
+typedef	integer_t	host_flavor_t;
+#define HOST_BASIC_INFO		1	/* basic info */
+#define HOST_SCHED_INFO		3	/* scheduling info */
+#define HOST_RESOURCE_SIZES	4	/* kernel struct sizes */
+#define HOST_PRIORITY_INFO	5	/* priority information */
+#define HOST_SEMAPHORE_TRAPS	7	/* Has semaphore traps */
+#define HOST_MACH_MSG_TRAP	8	/* Has mach_msg_trap */
+
+#ifdef MACH_KERNEL_PRIVATE
+struct host_basic_info_old {
+	integer_t	max_cpus;	/* max number of cpus possible */
+	integer_t	avail_cpus;	/* number of cpus now available */
+	natural_t	memory_size;	/* size of memory in bytes */
+	cpu_type_t	cpu_type;	/* cpu type */
+	cpu_subtype_t	cpu_subtype;	/* cpu subtype */
+};
+
+typedef	struct host_basic_info_old	host_basic_info_data_old_t;
+typedef struct host_basic_info_old	*host_basic_info_old_t;
+#define HOST_BASIC_INFO_OLD_COUNT ((mach_msg_type_number_t) \
+		(sizeof(host_basic_info_data_old_t)/sizeof(integer_t)))
+#endif
+
+#pragma pack(4)
+
+struct host_basic_info {
+	integer_t		max_cpus;		/* max number of CPUs possible */
+	integer_t		avail_cpus;		/* number of CPUs now available */
+	natural_t		memory_size;		/* size of memory in bytes, capped at 2 GB */
+	cpu_type_t		cpu_type;		/* cpu type */
+	cpu_subtype_t		cpu_subtype;		/* cpu subtype */
+	cpu_threadtype_t	cpu_threadtype;		/* cpu threadtype */
+	integer_t		physical_cpu;		/* number of physical CPUs now available */
+	integer_t		physical_cpu_max;	/* max number of physical CPUs possible */
+	integer_t		logical_cpu;		/* number of logical cpu now available */
+	integer_t		logical_cpu_max;	/* max number of physical CPUs possible */
+	uint64_t		max_mem;		/* actual size of physical memory */
+};
+
+#pragma pack()
+
+typedef	struct host_basic_info	host_basic_info_data_t;
+typedef struct host_basic_info	*host_basic_info_t;
+#define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
+		(sizeof(host_basic_info_data_t)/sizeof(integer_t)))
+
+struct host_sched_info {
+	integer_t	min_timeout;	/* minimum timeout in milliseconds */
+	integer_t	min_quantum;	/* minimum quantum in milliseconds */
+};
+
+typedef	struct host_sched_info	host_sched_info_data_t;
+typedef struct host_sched_info	*host_sched_info_t;
+#define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \
+		(sizeof(host_sched_info_data_t)/sizeof(integer_t)))
+
+struct kernel_resource_sizes {
+	natural_t	task;
+        natural_t	thread;
+        natural_t	port;
+        natural_t	memory_region;
+        natural_t	memory_object;
+};
+
+typedef struct kernel_resource_sizes	kernel_resource_sizes_data_t;
+typedef struct kernel_resource_sizes	*kernel_resource_sizes_t;
+#define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \
+		(sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t)))
+
+struct host_priority_info {
+    	integer_t	kernel_priority;
+    	integer_t	system_priority;
+    	integer_t	server_priority;
+    	integer_t	user_priority;
+    	integer_t	depress_priority;
+    	integer_t	idle_priority;
+    	integer_t	minimum_priority;
+	integer_t	maximum_priority;
+};
+
+typedef struct host_priority_info	host_priority_info_data_t;
+typedef struct host_priority_info	*host_priority_info_t;
+#define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \
+		(sizeof(host_priority_info_data_t)/sizeof(integer_t)))
+
+/* host_statistics() */
+#define	HOST_LOAD_INFO		1	/* System loading stats */
+#define HOST_VM_INFO		2	/* Virtual memory stats */
+#define HOST_CPU_LOAD_INFO	3	/* CPU load stats */
+
+struct host_load_info {
+	integer_t	avenrun[3];	/* scaled by LOAD_SCALE */
+	integer_t	mach_factor[3];	/* scaled by LOAD_SCALE */
+};
+
+typedef struct host_load_info	host_load_info_data_t;
+typedef struct host_load_info	*host_load_info_t;
+#define	HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
+		(sizeof(host_load_info_data_t)/sizeof(integer_t)))
+
+/* in <mach/vm_statistics.h> */
+#define	HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \
+		(sizeof(vm_statistics_data_t)/sizeof(integer_t)))
+#define	HOST_VM_INFO_REV0_COUNT ((mach_msg_type_number_t) \
+		(sizeof(vm_statistics_rev0_data_t)/sizeof(integer_t)))
+
+struct host_cpu_load_info {		/* number of ticks while running... */
+	natural_t	cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
+};
+
+typedef struct host_cpu_load_info	host_cpu_load_info_data_t;
+typedef struct host_cpu_load_info	*host_cpu_load_info_t;
+#define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
+		(sizeof (host_cpu_load_info_data_t) / sizeof (integer_t)))
+
+#endif	/* _MACH_HOST_INFO_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/host_notify.h b/xnu-792.18.15/osfmk/mach/host_notify.h
new file mode 100644
index 0000000..6c0ca74
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/host_notify.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef	_MACH_HOST_NOTIFY_H_
+#define	_MACH_HOST_NOTIFY_H_
+
+#define HOST_NOTIFY_CALENDAR_CHANGE		0
+#define HOST_NOTIFY_TYPE_MAX			0
+
+#define HOST_CALENDAR_CHANGED_REPLYID	950
+
+#endif /* _MACH_HOST_NOTIFY_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/host_notify_reply.defs b/xnu-792.18.15/osfmk/mach/host_notify_reply.defs
new file mode 100644
index 0000000..442379e
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/host_notify_reply.defs
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+subsystem
+#if	KERNEL_USER
+		KernelUser
+#endif	/* KERN_USER */
+			host_notify_reply 950;
+
+#include <mach/std_types.defs>
+
+simpleroutine host_calendar_changed(
+		notify_port	: mach_port_move_send_once_t);
diff --git a/xnu-792.18.15/osfmk/mach/host_priv.defs b/xnu-792.18.15/osfmk/mach/host_priv.defs
new file mode 100644
index 0000000..11b14f7
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/host_priv.defs
@@ -0,0 +1,360 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	Matchmaker definitions file for Mach kernel interface.
+ */
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       host_priv 400;
+
+#ifdef	KERNEL_USER
+userprefix r_;
+#endif	/* KERNEL_USER */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach/clock_types.defs>
+#include <mach_debug/mach_debug_types.defs>
+
+/*
+ *      Get boot configuration information from kernel.
+ */
+routine host_get_boot_info(
+		host_priv	: host_priv_t;
+	out	boot_info	: kernel_boot_info_t);
+
+/*
+ *	Reboot this host.
+ *	Only available to privileged users.
+ */
+routine host_reboot(
+		host_priv	: host_priv_t;
+		options		: int);
+
+
+/*
+ *	Return privileged statistics from this host.
+ */
+routine host_priv_statistics(
+		host_priv	: host_priv_t;
+		flavor		: host_flavor_t;
+	out	host_info_out	: host_info_t, CountInOut);
+
+/*
+ *	Sets the default memory manager, the port to which
+ *	newly-created temporary memory objects are delivered.
+ *	[See (memory_object_default)memory_object_create.]
+ *	Also sets the default cluster size used for pagein/pageout
+ *	to this port.
+ *	The old memory manager port is returned.
+ */
+routine host_default_memory_manager(
+		host_priv	: host_priv_t;
+	inout	default_manager	: memory_object_default_t = 
+					MACH_MSG_TYPE_MAKE_SEND;
+		cluster_size	: vm_size_t);
+
+
+/*
+ *	Specify that the range of the virtual address space
+ *	of the target task must not cause page faults for
+ *	the indicated accesses.
+ *
+ *	[ To unwire the pages, specify VM_PROT_NONE. ]
+ */
+routine	vm_wire(
+		host_priv	: host_priv_t;
+		task		: vm_map_t;
+		address		: vm_address_t;
+		size		: vm_size_t;
+		desired_access	: vm_prot_t);
+
+/*
+ *	Specify that the target thread must always be able
+ *	to run and to allocate memory.
+ */
+routine	thread_wire(
+		host_priv	: host_priv_t;
+		thread		: thread_act_t;
+		wired		: boolean_t);
+
+/*
+ *	Allocate zero-filled, wired, contiguous physical memory
+ *	in the address space of the target task, either at the
+ *	specified address, or wherever space can be found (if
+ *	anywhere is TRUE), of the specified size.  The address
+ *	at which the allocation actually took place is returned.
+ *	All pages will be entered into the task's pmap immediately,
+ *	with VM_PROT_ALL.
+ *
+ *	In addition to all the failure modes of its cousin,
+ *	vm_allocate, this call may also fail if insufficient
+ *	contiguous memory exists to satisfy the request.
+ *
+ *	Memory obtained from this call should be freed the
+ *	normal way, via vm_deallocate.
+ *
+ *	N.B.  This is an EXPERIMENTAL interface!
+ */
+routine	vm_allocate_cpm(
+		host_priv	: host_priv_t;
+		task		: vm_map_t;
+	inout	address		: vm_address_t;
+		size		: vm_size_t;
+		anywhere	: boolean_t);
+
+/*
+ *	Get list of processors on this host.
+ */
+routine host_processors(
+		host_priv		: host_priv_t;
+	out	out_processor_list	: processor_array_t);
+
+
+/*
+ *	Get control port for a system-wide clock.
+ *	Privileged.
+ */
+routine host_get_clock_control(
+		host_priv	: host_priv_t;
+		clock_id	: clock_id_t;
+	out	clock_ctrl	: clock_ctrl_t);
+
+
+/*
+ *	kernel module interface
+ * 
+ * 	see mach/kmod.h:
+ */
+routine kmod_create(
+		host_priv	: host_priv_t;
+		info		: vm_address_t;
+	out	module		: kmod_t);
+
+routine kmod_destroy(
+		host_priv	: host_priv_t;
+		module		: kmod_t);
+
+routine	kmod_control(
+		host_priv	: host_priv_t;
+		module		: kmod_t;
+		flavor		: kmod_control_flavor_t;
+	inout	data		: kmod_args_t);
+
+/*
+ * 	Get a given special port for a given node.
+ * 	Special ports are defined in host_special_ports.h;
+ * 	examples include the master device port.
+ * 	There are a limited number of slots available for system servers.
+ */
+routine host_get_special_port(
+                host_priv       : host_priv_t;
+                node            : int;
+                which           : int;
+        out     port            : mach_port_t);
+
+/*
+ * 	Set a given special port for the local node.
+ * 	See host_get_special_port.
+ */
+routine host_set_special_port(
+                host_priv       : host_priv_t;
+                which           : int;
+                port            : mach_port_t);
+
+/*
+ * Set an exception handler for a host on one or more exception types.
+ * These handlers are invoked for all threads on the host if there are
+ * no task or thread-specific exception handlers or those handlers returned
+ * an error.
+ */
+routine	host_set_exception_ports(
+		host_priv	: host_priv_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t);
+
+
+/*
+ * Lookup some of the old exception handlers for a host
+ */
+routine	host_get_exception_ports(
+		host_priv	: host_priv_t;
+		exception_mask	: exception_mask_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlers	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+
+/*
+ * Set an exception handler for a host on one or more exception types.
+ * At the same time, return the previously defined exception handlers for
+ * those types.
+ */
+routine	host_swap_exception_ports(
+		host_priv	: host_priv_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlerss	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+/*
+ *	Loads a symbol table for an external file into the kernel debugger.
+ *	The symbol table data is an array of characters.  It is assumed that
+ *	the caller and the kernel debugger agree on its format.
+ *      This call is only supported in MACH_DEBUG and MACH_KDB kernels,
+ *      otherwise KERN_FAILURE is returned.
+ */
+routine host_load_symbol_table(
+		host		: host_priv_t;
+		task		: task_t;
+		name		: symtab_name_t;
+		symtab		: pointer_t);
+
+/*
+ *	Specify that the range of the virtual address space
+ *	of the target task must not cause page faults for
+ *	the indicated accesses.
+ *
+ *	[ To unwire the pages, specify VM_PROT_NONE. ]
+ */
+routine	mach_vm_wire(
+		host_priv	: host_priv_t;
+		task		: vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		desired_access	: vm_prot_t);
+
+/*
+ * JMM - Keep all processor_set related items at the end for easy
+ * removal.
+ */
+/*
+ *	List all processor sets on host.
+ */
+routine host_processor_sets(
+		host_priv	: host_priv_t;
+	out	processor_sets	: processor_set_name_array_t);
+
+/*
+ *	Get control port for a processor set.
+ */
+routine host_processor_set_priv(
+		host_priv	: host_priv_t;
+		set_name	: processor_set_name_t;
+	out	set		: processor_set_t);
+
+/************************** Warning *************************************/
+/*       The following routines are going away in a future release	*/
+/*	use the appropriate variant of host_set_special_port instead	*/
+/************************************************************************/
+ 
+/*
+ *	Set the dynamic_pager control port. Other entities
+ *	can request a send right to this port to talk with
+ *	the dynamic_pager utility, setting behavioral parameters
+ *	within the dynamic pager and getting low/high backing store
+ *	resource notifications.
+ */
+routine set_dp_control_port(    
+		host		: host_priv_t;
+	in	control_port	: mach_port_t);
+
+/*
+ *	Get the dynamic_pager control port.  This port
+ *	allows the holder to talk directly with the dynamic
+ *	pager utility.
+ */
+routine get_dp_control_port(    
+		host		: host_priv_t;
+	out	contorl_port    :mach_port_t);
+
+/*
+ *	Set the UserNotification daemon access port for this host. 
+ *	If this value is already set, the kernel will discard its
+ *	reference to the previously registered port.
+ */
+routine host_set_UNDServer(    
+		host		: host_priv_t;
+	in	server		: UNDServerRef);
+
+/*
+ *	Get the UserNotification daemon access port for this host.
+ *	This can then be used to communicate with that daemon, which
+ *	in turn communicates with the User through whatever means
+ *	available (pop-up-menus for GUI systems, text for non-GUI, etc..).
+ *
+ *	Access to this port is restricted to privileged clients because
+ *	it is a special purpose port intended for kernel clients.  User
+ *	level clients should go directly to the CFUserNotifcation services.
+ */
+routine host_get_UNDServer(    
+		host		: host_priv_t;
+	out	server		: UNDServerRef);
diff --git a/xnu-792.18.15/osfmk/mach/host_reboot.h b/xnu-792.18.15/osfmk/mach/host_reboot.h
new file mode 100644
index 0000000..65609dd
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/host_reboot.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+#ifndef _MACH_HOST_REBOOT_
+#define _MACH_HOST_REBOOT_
+
+#define HOST_REBOOT_HALT        0x0008
+#define HOST_REBOOT_UPSDELAY    0x0100
+#define	HOST_REBOOT_DEBUGGER	0x1000
+
+#endif	/* _MACH_HOST_REBOOT_ */
diff --git a/xnu-792.18.15/osfmk/mach/host_security.defs b/xnu-792.18.15/osfmk/mach/host_security.defs
new file mode 100644
index 0000000..26e56cb
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/host_security.defs
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ * File:	mach/host_security.defs
+ *
+ * Abstract:
+ *	Mach host security operations support.
+ */
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		      host_security 600;
+
+/*
+ *	Basic types
+ */
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+
+/*
+ *	Create a new task with an explicit security token
+ */
+routine host_security_create_task_token(
+		host_security	: host_security_t;
+		parent_task	: task_t;
+		sec_token	: security_token_t;
+		audit_token	: audit_token_t;
+		host		: host_t;
+		ledgers		: ledger_array_t;
+		inherit_memory	: boolean_t;
+	out	child_task	: task_t);
+
+/*
+ *	Change a task's security token
+ */
+routine host_security_set_task_token(
+		host_security	: host_security_t;
+		target_task	: task_t;
+		sec_token	: security_token_t;
+		audit_token	: audit_token_t;
+		host		: host_t);
+
diff --git a/xnu-792.18.15/osfmk/mach/host_special_ports.h b/xnu-792.18.15/osfmk/mach/host_special_ports.h
new file mode 100644
index 0000000..44404ea
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/host_special_ports.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/host_special_ports.h
+ *
+ *	Defines codes for access to host-wide special ports.
+ */
+
+#ifndef _MACH_HOST_SPECIAL_PORTS_H_
+#define _MACH_HOST_SPECIAL_PORTS_H_
+
+/*
+ * Cannot be set or gotten from user space
+ */
+#define HOST_SECURITY_PORT               0
+
+/*
+ * Always provided by kernel (cannot be set from user-space).
+ */
+#define HOST_PORT                        1
+#define HOST_PRIV_PORT                   2
+#define HOST_IO_MASTER_PORT              3
+#define HOST_MAX_SPECIAL_KERNEL_PORT     7 /* room to grow */
+
+/*
+ * Not provided by kernel
+ */
+#define HOST_DYNAMIC_PAGER_PORT         (1 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_AUDIT_CONTROL_PORT         (2 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_USER_NOTIFICATION_PORT     (3 + HOST_MAX_SPECIAL_KERNEL_PORT)
+#define HOST_MAX_SPECIAL_PORT           (8 + HOST_MAX_SPECIAL_KERNEL_PORT)
+                                        /* room to grow here as well */
+
+/*
+ * Special node identifier to always represent the local node.
+ */
+#define HOST_LOCAL_NODE	                 -1
+			
+/*
+ * Definitions for ease of use.
+ *
+ * In the get call, the host parameter can be any host, but will generally
+ * be the local node host port. In the set call, the host must the per-node
+ * host port for the node being affected.
+ */
+#define host_get_host_port(host, port)	\
+	(host_get_special_port((host), 	\
+	HOST_LOCAL_NODE, HOST_PORT, (port)))
+#define host_set_host_port(host, port) (KERN_INVALID_ARGUMENT)
+
+#define host_get_host_priv_port(host, port)	\
+	(host_get_special_port((host), 		\
+	HOST_LOCAL_NODE, HOST_PRIV_PORT, (port)))
+#define host_set_host_priv_port(host, port) (KERN_INVALID_ARGUMENT)
+
+#define host_get_io_master_port(host, port)	\
+	(host_get_special_port((host), 		\
+	HOST_LOCAL_NODE, HOST_IO_MASTER_PORT, (port)))
+#define host_set_io_master_port(host, port) (KERN_INVALID_ARGUMENT)
+
+/*
+ * User-settable special ports.
+ */
+#define host_get_dynamic_pager_port(host, port)	\
+	(host_get_special_port((host),			\
+	HOST_LOCAL_NODE, HOST_DYNAMIC_PAGER_PORT, (port)))
+#define host_set_dynamic_pager_port(host, port)	\
+	(host_set_special_port((host), HOST_DYNAMIC_PAGER_PORT, (port)))
+
+#define host_get_audit_control_port(host, port)	\
+	(host_get_special_port((host), 		\
+	HOST_LOCAL_NODE, HOST_AUDIT_CONTROL_PORT, (port)))
+#define host_set_audit_control_port(host, port)	\
+	(host_set_special_port((host), HOST_AUDIT_CONTROL_PORT, (port)))
+
+#define host_get_user_notification_port(host, port)	\
+	(host_get_special_port((host), 			\
+	HOST_LOCAL_NODE, HOST_USER_NOTIFICATION_PORT, (port)))
+#define host_set_user_notification_port(host, port)	\
+	(host_set_special_port((host), HOST_USER_NOTIFICATION_PORT, (port)))
+
+#endif	/* _MACH_HOST_SPECIAL_PORTS_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/kern_return.h b/xnu-792.18.15/osfmk/mach/kern_return.h
new file mode 100644
index 0000000..5e7502b
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/kern_return.h
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	h/kern_return.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date:	1985
+ *
+ *	Kernel return codes.
+ *
+ */
+
+#ifndef	_MACH_KERN_RETURN_H_
+#define _MACH_KERN_RETURN_H_
+
+#include <mach/machine/kern_return.h>
+
+#define KERN_SUCCESS			0
+
+#define KERN_INVALID_ADDRESS		1
+		/* Specified address is not currently valid.
+		 */
+
+#define KERN_PROTECTION_FAILURE		2
+		/* Specified memory is valid, but does not permit the
+		 * required forms of access.
+		 */
+
+#define KERN_NO_SPACE			3
+		/* The address range specified is already in use, or
+		 * no address range of the size specified could be
+		 * found.
+		 */
+
+#define KERN_INVALID_ARGUMENT		4
+		/* The function requested was not applicable to this
+		 * type of argument, or an argument is invalid
+		 */
+
+#define KERN_FAILURE			5
+		/* The function could not be performed.  A catch-all.
+		 */
+
+#define KERN_RESOURCE_SHORTAGE		6
+		/* A system resource could not be allocated to fulfill
+		 * this request.  This failure may not be permanent.
+		 */
+
+#define KERN_NOT_RECEIVER		7
+		/* The task in question does not hold receive rights
+		 * for the port argument.
+		 */
+
+#define KERN_NO_ACCESS			8
+		/* Bogus access restriction.
+		 */
+
+#define KERN_MEMORY_FAILURE		9
+		/* During a page fault, the target address refers to a
+		 * memory object that has been destroyed.  This
+		 * failure is permanent.
+		 */
+
+#define KERN_MEMORY_ERROR		10
+		/* During a page fault, the memory object indicated
+		 * that the data could not be returned.  This failure
+		 * may be temporary; future attempts to access this
+		 * same data may succeed, as defined by the memory
+		 * object.
+		 */
+
+#define	KERN_ALREADY_IN_SET		11
+		/* The receive right is already a member of the portset.
+		 */
+
+#define KERN_NOT_IN_SET			12
+		/* The receive right is not a member of a port set.
+		 */
+
+#define KERN_NAME_EXISTS		13
+		/* The name already denotes a right in the task.
+		 */
+
+#define KERN_ABORTED			14
+		/* The operation was aborted.  Ipc code will
+		 * catch this and reflect it as a message error.
+		 */
+
+#define KERN_INVALID_NAME		15
+		/* The name doesn't denote a right in the task.
+		 */
+
+#define	KERN_INVALID_TASK		16
+		/* Target task isn't an active task.
+		 */
+
+#define KERN_INVALID_RIGHT		17
+		/* The name denotes a right, but not an appropriate right.
+		 */
+
+#define KERN_INVALID_VALUE		18
+		/* A blatant range error.
+		 */
+
+#define	KERN_UREFS_OVERFLOW		19
+		/* Operation would overflow limit on user-references.
+		 */
+
+#define	KERN_INVALID_CAPABILITY		20
+		/* The supplied (port) capability is improper.
+		 */
+
+#define KERN_RIGHT_EXISTS		21
+		/* The task already has send or receive rights
+		 * for the port under another name.
+		 */
+
+#define	KERN_INVALID_HOST		22
+		/* Target host isn't actually a host.
+		 */
+
+#define KERN_MEMORY_PRESENT		23
+		/* An attempt was made to supply "precious" data
+		 * for memory that is already present in a
+		 * memory object.
+		 */
+
+#define KERN_MEMORY_DATA_MOVED		24
+		/* A page was requested of a memory manager via
+		 * memory_object_data_request for an object using
+		 * a MEMORY_OBJECT_COPY_CALL strategy, with the
+		 * VM_PROT_WANTS_COPY flag being used to specify
+		 * that the page desired is for a copy of the
+		 * object, and the memory manager has detected
+		 * the page was pushed into a copy of the object
+		 * while the kernel was walking the shadow chain
+		 * from the copy to the object. This error code
+		 * is delivered via memory_object_data_error
+		 * and is handled by the kernel (it forces the
+		 * kernel to restart the fault). It will not be
+		 * seen by users.
+		 */
+
+#define KERN_MEMORY_RESTART_COPY	25
+		/* A strategic copy was attempted of an object
+		 * upon which a quicker copy is now possible.
+		 * The caller should retry the copy using
+		 * vm_object_copy_quickly. This error code
+		 * is seen only by the kernel.
+		 */
+
+#define KERN_INVALID_PROCESSOR_SET	26
+		/* An argument applied to assert processor set privilege
+		 * was not a processor set control port.
+		 */
+
+#define KERN_POLICY_LIMIT		27
+		/* The specified scheduling attributes exceed the thread's
+		 * limits.
+		 */
+
+#define KERN_INVALID_POLICY		28
+		/* The specified scheduling policy is not currently
+		 * enabled for the processor set.
+		 */
+
+#define KERN_INVALID_OBJECT		29
+		/* The external memory manager failed to initialize the
+		 * memory object.
+		 */
+
+#define KERN_ALREADY_WAITING		30
+		/* A thread is attempting to wait for an event for which 
+		 * there is already a waiting thread.
+		 */
+
+#define KERN_DEFAULT_SET		31
+		/* An attempt was made to destroy the default processor
+		 * set.
+		 */
+
+#define KERN_EXCEPTION_PROTECTED	32
+		/* An attempt was made to fetch an exception port that is
+		 * protected, or to abort a thread while processing a
+		 * protected exception.
+		 */
+
+#define KERN_INVALID_LEDGER		33
+		/* A ledger was required but not supplied.
+		 */
+
+#define KERN_INVALID_MEMORY_CONTROL	34
+		/* The port was not a memory cache control port.
+		 */
+
+#define KERN_INVALID_SECURITY		35
+		/* An argument supplied to assert security privilege 	
+		 * was not a host security port.
+		 */
+		
+#define KERN_NOT_DEPRESSED		36
+		/* thread_depress_abort was called on a thread which
+		 * was not currently depressed.
+		 */
+		
+#define KERN_TERMINATED			37
+		/* Object has been terminated and is no longer available
+		 */
+
+#define KERN_LOCK_SET_DESTROYED		38
+		/* Lock set has been destroyed and is no longer available.
+		 */
+
+#define KERN_LOCK_UNSTABLE		39
+		/* The thread holding the lock terminated before releasing
+		 * the lock
+		 */
+
+#define KERN_LOCK_OWNED			40
+		/* The lock is already owned by another thread
+		 */
+
+#define KERN_LOCK_OWNED_SELF		41
+		/* The lock is already owned by the calling thread
+		 */
+
+#define KERN_SEMAPHORE_DESTROYED	42
+		/* Semaphore has been destroyed and is no longer available.
+		 */
+
+#define KERN_RPC_SERVER_TERMINATED	43
+		/* Return from RPC indicating the target server was 
+		 * terminated before it successfully replied 
+		 */
+
+#define KERN_RPC_TERMINATE_ORPHAN	44
+		/* Terminate an orphaned activation.
+		 */
+
+#define KERN_RPC_CONTINUE_ORPHAN	45
+		/* Allow an orphaned activation to continue executing.
+		 */
+
+#define	KERN_NOT_SUPPORTED		46
+		/* Empty thread activation (No thread linked to it)
+		 */
+
+#define	KERN_NODE_DOWN			47
+		/* Remote node down or inaccessible.
+		 */
+
+#define KERN_NOT_WAITING		48
+		/* A signalled thread was not actually waiting. */
+
+#define	KERN_OPERATION_TIMED_OUT        49
+		/* Some thread-oriented operation (semaphore_wait) timed out
+		 */
+
+#define	KERN_RETURN_MAX			0x100
+		/* Maximum return value allowable
+		 */
+
+#endif	/* _MACH_KERN_RETURN_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/kmod.h b/xnu-792.18.15/osfmk/mach/kmod.h
new file mode 100644
index 0000000..3acba53
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/kmod.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef	_MACH_KMOD_H_
+#define	_MACH_KMOD_H_
+
+#include <mach/kern_return.h>
+
+#include <sys/cdefs.h>
+
+#define KMOD_CNTL_START		1	// call kmod's start routine
+#define KMOD_CNTL_STOP		2	// call kmod's stop routine
+#define KMOD_CNTL_RETAIN	3	// increase a kmod's reference count
+#define KMOD_CNTL_RELEASE	4	// decrease a kmod's reference count
+#define KMOD_CNTL_GET_CMD	5	// get kmod load cmd from kernel
+
+#define KMOD_PACK_IDS(from, to)	(((unsigned long)from << 16) | (unsigned long)to)
+#define KMOD_UNPACK_FROM_ID(i)	((unsigned long)i >> 16)
+#define KMOD_UNPACK_TO_ID(i)	((unsigned long)i & 0xffff)
+
+typedef int kmod_t;
+typedef int kmod_control_flavor_t;
+typedef void* kmod_args_t;
+
+#define KMOD_MAX_NAME	64
+
+#pragma pack(4)
+
+/* LP64todo - not 64-bit safe */
+typedef struct kmod_reference {
+	struct kmod_reference	*next;
+	struct kmod_info	*info;
+} kmod_reference_t;
+
+#pragma pack()
+
+/**************************************************************************************/
+/*	 warning any changes to this structure affect the following macros.	      */	
+/**************************************************************************************/
+
+#define KMOD_RETURN_SUCCESS	KERN_SUCCESS
+#define KMOD_RETURN_FAILURE	KERN_FAILURE
+
+typedef kern_return_t kmod_start_func_t(struct kmod_info *ki, void *data);
+typedef kern_return_t kmod_stop_func_t(struct kmod_info *ki, void *data);
+
+#pragma pack(4)
+
+/* LP64todo - not 64-bit safe */
+
+typedef struct kmod_info {
+	struct kmod_info 	*next;
+	int			info_version;		// version of this structure
+	int			id;
+	char			name[KMOD_MAX_NAME];
+	char			version[KMOD_MAX_NAME];
+	int			reference_count;	// # refs to this 
+	kmod_reference_t	*reference_list;	// who this refs
+	vm_address_t		address;		// starting address
+	vm_size_t		size;			// total size
+	vm_size_t		hdr_size;		// unwired hdr size
+        kmod_start_func_t	*start;
+        kmod_stop_func_t	*stop;
+} kmod_info_t;
+
+#pragma pack()
+
+typedef kmod_info_t *kmod_info_array_t;
+
+#define KMOD_INFO_NAME 		kmod_info
+#define KMOD_INFO_VERSION	1
+
+#define KMOD_DECL(name, version)							\
+	static kmod_start_func_t name ## _module_start;					\
+	static kmod_stop_func_t  name ## _module_stop;					\
+	kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1,			\
+				       { #name }, { version }, -1, 0, 0, 0, 0,		\
+			               name ## _module_start,		\
+			               name ## _module_stop };
+
+#define KMOD_EXPLICIT_DECL(name, version, start, stop)					\
+	kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1,			\
+				       { #name }, { version }, -1, 0, 0, 0, 0,		\
+			               start, stop };
+
+// the following is useful for libaries that don't need their own start and stop functions
+#define KMOD_LIB_DECL(name, version)							\
+	kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1,			\
+				       { #name }, { version }, -1, 0, 0, 0, 0,		\
+			               kmod_default_start,				\
+				       kmod_default_stop };
+
+
+// *************************************************************************************
+// kmod kernel to user commands
+// *************************************************************************************
+
+#define KMOD_LOAD_EXTENSION_PACKET		1
+#define KMOD_LOAD_WITH_DEPENDENCIES_PACKET	2
+
+// for generic packets
+#define KMOD_IOKIT_START_RANGE_PACKET		0x1000
+#define KMOD_IOKIT_END_RANGE_PACKET		0x1fff
+
+typedef struct kmod_load_extension_cmd {
+	int	type;
+	char	name[KMOD_MAX_NAME];
+} kmod_load_extension_cmd_t;
+
+typedef struct kmod_load_with_dependencies_cmd {
+	int	type;
+	char	name[KMOD_MAX_NAME];
+	char	dependencies[1][KMOD_MAX_NAME];
+} kmod_load_with_dependencies_cmd_t;
+
+typedef struct kmod_generic_cmd {
+	int	type;
+	char	data[1];
+} kmod_generic_cmd_t;
+
+#ifdef	KERNEL_PRIVATE
+
+extern kmod_info_t *kmod_lookupbyname(const char * name);
+extern kmod_info_t *kmod_lookupbyid(kmod_t id);
+
+extern kmod_info_t *kmod_lookupbyname_locked(const char * name);
+extern kmod_info_t *kmod_lookupbyid_locked(kmod_t id);
+extern kmod_start_func_t kmod_default_start;
+extern kmod_stop_func_t  kmod_default_stop;
+
+__BEGIN_DECLS
+extern void kmod_init(void);
+
+extern kern_return_t kmod_create_fake(const char *name, const char *version);
+extern kern_return_t kmod_create_fake_with_address(const char *name, const char *version, 
+                                                    vm_address_t address, vm_size_t size,
+                                                    int * return_id);
+extern kern_return_t kmod_destroy_fake(kmod_t id);
+
+extern kern_return_t kmod_load_extension(char *name);
+extern kern_return_t kmod_load_extension_with_dependencies(char *name, char **dependencies);
+extern kern_return_t kmod_send_generic(int type, void *data, int size);
+
+extern kern_return_t kmod_initialize_cpp(kmod_info_t *info);
+extern kern_return_t kmod_finalize_cpp(kmod_info_t *info);
+
+extern void kmod_dump(vm_offset_t *addr, unsigned int dump_cnt);
+__END_DECLS
+
+#endif	/* KERNEL_PRIVATE */
+
+#endif	/* _MACH_KMOD_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/ledger.defs b/xnu-792.18.15/osfmk/mach/ledger.defs
new file mode 100644
index 0000000..53b84aa
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/ledger.defs
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       ledger 5000;
+
+#ifdef	KERNEL_USER
+userprefix r_;
+#endif	/* KERNEL_USER */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+/*
+ *	Create a subordinate ledger
+ */
+routine ledger_create(
+		parent_ledger		: ledger_t;
+		ledger_ledger		: ledger_t;
+	out	new_ledger		: ledger_t;
+		transfer		: ledger_item_t);
+
+/*
+ *	Destroy a ledger
+ */
+routine ledger_terminate(
+		ledger			: ledger_t);
+
+/*
+ *	Transfer resources from a parent ledger to a child
+ */
+routine ledger_transfer(
+		parent_ledger		: ledger_t;
+		child_ledger		: ledger_t;
+		transfer		: ledger_item_t);
+
+/*
+ *	Return the ledger limit and balance
+ */
+routine ledger_read(
+		ledger			: ledger_t;
+	out	balance			: ledger_item_t;
+	out	limit			: ledger_item_t);
+
diff --git a/xnu-792.18.15/osfmk/mach/lock_set.defs b/xnu-792.18.15/osfmk/mach/lock_set.defs
new file mode 100644
index 0000000..2edca9f
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/lock_set.defs
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+/*
+ *	File: mach/lock_set.defs
+ *	Author: Joseph CaraDonna
+ *
+ *	Exported kernel calls	
+ *
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	KernelServer
+#endif	/* KERNEL_SERVER */
+			lock_set 617000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+/*
+ * a lock_set_t is created and destroyed through the task object.
+ *      lock_set_create(task,&lock_set_t,...);
+ *      lock_set_destroy(task,lock_set_t);
+ */
+
+routine lock_acquire(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_release(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_try(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_make_stable(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_handoff(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_handoff_accept(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
diff --git a/xnu-792.18.15/osfmk/mach/mach.h b/xnu-792.18.15/osfmk/mach/mach.h
new file mode 100644
index 0000000..df61ab8
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1989 Carnegie-Mellon University
+ * All rights reserved.  The CMU software License Agreement specifies
+ * the terms and conditions for use and redistribution.
+ */
+/* 
+ *  Includes all the types that a normal user
+ *  of Mach programs should need
+ */
+
+#ifndef	_MACH_H_
+#define	_MACH_H_
+
+#include <mach/mach_types.h>
+#include <mach/message.h>
+#include <mach/thread_switch.h>
+#include <mach/mach_interface.h>
+
+#endif	/* _MACH_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_host.defs b/xnu-792.18.15/osfmk/mach/mach_host.defs
new file mode 100644
index 0000000..7f54489
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_host.defs
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ * File:	mach/mach_host.defs
+ *
+ * Abstract:
+ *	Mach host operations support.  Includes processor allocation and
+ *	control.  
+ */
+
+#ifdef	MACH_KERNEL
+#include <mach_prof.h>
+#include <advisory_pageout.h>
+#endif	/* MACH_KERNEL */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       mach_host 200;
+
+/*
+ *	Basic types
+ */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach/clock_types.defs>
+#include <mach_debug/mach_debug_types.defs>
+
+/*
+ * References to host objects are returned by:
+ *	mach_host_self() - trap
+ */
+
+/*
+ *	Return information about this host.
+ */
+routine host_info(
+		host		: host_t;
+		flavor		: host_flavor_t;
+	out	host_info_out	: host_info_t, CountInOut);
+
+/*
+ *	Get string describing current kernel version.
+ */
+routine	host_kernel_version(
+		host		: host_t;
+	out	kernel_version	: kernel_version_t);
+
+/*
+ *      Get host page size
+ */
+routine host_page_size(
+		host		: host_t;
+	out	out_page_size	: vm_size_t);
+
+/*
+ *	Allow pagers to create named entries that point to un-mapped
+ *	abstract memory object.  The named entries are generally mappable
+ *	and can be subsetted through the mach_make_memory_entry call
+ */
+routine mach_memory_object_memory_entry(
+		host		:host_t;
+		internal	:boolean_t;
+		size		:vm_size_t;
+		permission	:vm_prot_t;
+		pager		:memory_object_t;
+	out	entry_handle	:mach_port_move_send_t);
+
+
+/*
+ *      Get processor info for all the processors on this host.
+ *	The returned data is an OOL array of processor info.
+ */
+routine host_processor_info(
+		host			: host_t;
+                flavor          	: processor_flavor_t;
+	out	out_processor_count 	: natural_t;
+        out     out_processor_info  	: processor_info_array_t);
+
+/*
+ * 	Return host IO master access port
+ */
+routine host_get_io_master(
+                host            : host_t;
+        out     io_master       : io_master_t);
+
+/*
+ *	Get service port for a processor set.
+ *	Available to all.
+ */
+routine host_get_clock_service(
+		host		: host_t;
+		clock_id	: clock_id_t;
+	out	clock_serv	: clock_serv_t);
+
+
+routine	kmod_get_info(
+		host		: host_t;
+	out	modules		: kmod_args_t);
+
+/*
+ *	Returns information about the memory allocation zones.
+ *      Supported in all kernels..
+ */
+routine host_zone_info(
+		host		: host_t;
+	out	names		: zone_name_array_t,
+					Dealloc;
+	out	info		: zone_info_array_t,
+					Dealloc);
+
+/*
+ *	Returns information about the global VP table.
+ *      Only supported in MACH_VM_DEBUG kernels,
+ *      otherwise returns KERN_FAILURE.
+ */
+routine host_virtual_physical_table_info(
+		host		: host_t;
+	out	info		: hash_info_bucket_array_t,
+					Dealloc);
+
+/*
+ *	Returns information about the global reverse hash table.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine host_ipc_hash_info(
+		host		: host_t;
+	out	info		: hash_info_bucket_array_t,
+					Dealloc);
+
+/*
+ * JMM - These routines should be on the host_priv port.  We need
+ * to verify the move before putting them there.
+ */
+routine enable_bluebox(
+		host			: host_t;
+	in	taskID			: unsigned;
+	in	TWI_TableStart	: unsigned;
+	in	Desc_TableStart	: unsigned);
+
+routine disable_bluebox(
+		host		: host_t);
+
+/*
+ * JMM - Keep processor_set related items at the end for easy
+ * removal.
+ */
+/*
+ *	Get default processor set for host.
+ */
+routine processor_set_default(
+		host		: host_t;
+	out	default_set	: processor_set_name_t);
+
+/*
+ *	Create new processor set.  Returns real port for manipulations,
+ *	and name port for obtaining information.
+ */
+routine processor_set_create(
+		host		: host_t;
+	out	new_set		: processor_set_t;
+	out	new_name	: processor_set_name_t);
+
+/*
+ * 	Temporary interfaces for conversion to 64 bit data path 
+ */
+
+routine mach_memory_object_memory_entry_64(
+		host		:host_t;
+		internal	:boolean_t;
+		size		:memory_object_size_t;
+		permission	:vm_prot_t;
+		pager		:memory_object_t;
+	out	entry_handle	:mach_port_move_send_t);
+
+/*
+ *	Return statistics from this host.
+ */
+routine host_statistics(
+		host_priv	: host_t;
+		flavor		: host_flavor_t;
+	out	host_info_out	: host_info_t, CountInOut);
+
+routine host_request_notification(
+		host		: host_t;
+		notify_type	: host_flavor_t;
+		notify_port	: mach_port_make_send_once_t);
+
+routine host_lockgroup_info(
+		host		: host_t;
+	out	lockgroup_info	: lockgroup_info_array_t,
+					Dealloc);
+
diff --git a/xnu-792.18.15/osfmk/mach/mach_interface.h b/xnu-792.18.15/osfmk/mach/mach_interface.h
new file mode 100644
index 0000000..161fbff
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_interface.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef	_MACH_INTERFACE_H_
+#define _MACH_INTERFACE_H_
+
+#include <mach/clock.h>
+#include <mach/clock_priv.h>
+#include <mach/clock_reply_server.h>
+#include <mach/exc_server.h>
+#include <mach/host_priv.h>
+#include <mach/host_security.h>
+#include <mach/ledger.h>
+#include <mach/lock_set.h>
+#include <mach/mach_host.h>
+#include <mach/mach_port.h>
+#include <mach/notify_server.h>
+#include <mach/processor.h>
+#include <mach/processor_set.h>
+#include <mach/semaphore.h>
+#include <mach/task.h>
+#include <mach/thread_act.h>
+#include <mach/vm_map.h>
+
+#ifdef XNU_KERNEL_PRIVATE
+/*
+ * Raw EMMI interfaces are private to xnu
+ * and subject to change.
+ */
+#include <mach/memory_object_default_server.h>
+#include <mach/memory_object_control.h>
+#include <mach/memory_object_name.h>
+#include <mach/upl.h>
+#endif
+
+#endif /* _MACH_INTERFACE_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_norma.defs b/xnu-792.18.15/osfmk/mach/mach_norma.defs
new file mode 100644
index 0000000..0bc37cf
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_norma.defs
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:45  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.3.17.2  1994/09/23  02:38:45  ezf
+ * 	change marker to not FREE
+ * 	[1994/09/22  21:40:54  ezf]
+ *
+ * Revision 1.3.17.1  1994/06/13  20:49:36  dlb
+ * 	Merge MK6 and NMK17
+ * 	[1994/06/13  20:47:52  dlb]
+ * 
+ * Revision 1.3.11.1  1994/02/08  11:01:11  bernadat
+ * 	Checked in NMK16_1 changes
+ * 	[94/02/04            bernadat]
+ * 
+ * Revision 1.3.4.2  1993/07/22  13:54:29  bernadat
+ * 	[Joe Barerra: joebar@microsoft.com] Added norma_task_teleport as
+ * 	an alternative migration mechanism.
+ * 	Change from NORMA_MK14.6 [93/03/08            sjs]
+ * 	[93/07/16            bernadat]
+ * 
+ * Revision 1.3.2.2  1993/06/02  23:45:24  jeffc
+ * 	Added to OSF/1 R1.3 from NMK15.0.
+ * 	[1993/06/02  21:16:50  jeffc]
+ * 
+ * Revision 1.3  1992/12/07  21:29:17  robert
+ * 	integrate any changes below for 14.0 (branch from 13.16 base)
+ * 
+ * 	Joseph Barrera (jsb) at Carnegie-Mellon University 03-Jul-92
+ * 	Added norma_task_clone to support task migration.
+ * 	[1992/12/06  20:25:30  robert]
+ * 
+ * Revision 1.2  1992/11/25  01:13:00  robert
+ * 	fix history
+ * 	[1992/11/09  21:25:21  robert]
+ * 
+ * 	integrate changes below for norma_14
+ * 	[1992/11/09  16:42:52  robert]
+ * 
+ * Revision 0.0  92/10/02            dwm
+ * 	Add Comment: norma_port_location_hint requires send rights on 'port'.
+ * 
+ * 	Revision 1.1  1992/11/05  20:59:18  robert
+ * 	Initial revision
+ * 	[92/10/02            dwm]
+ * 
+ * $EndLog$
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.6  91/12/13  13:45:12  jsb
+ * 	Moved non-exported interfaces to norma/norma_internal.defs.
+ * 	Changed name of task_create_remote to norma_task_create.
+ * 	Added comments.
+ * 
+ * Revision 2.5  91/11/14  16:56:43  rpd
+ * 	Picked up mysterious norma changes.
+ * 	[91/11/14            rpd]
+ * 
+ * Revision 2.4  91/08/28  11:15:08  jsb
+ * 	Added KERNEL_USER definitions.
+ * 	Removed norma_set_task_server.
+ * 	Added task_create_remote, norma_copy_create.
+ * 	[91/08/15  13:28:27  jsb]
+ * 
+ * Revision 2.3  91/08/03  18:19:02  jsb
+ * 	Removed norma_get_{host,host_priv,device}_port;
+ * 	Use norma_{get,set}_special_port instead.
+ * 	[91/07/25  07:51:11  jsb]
+ * 
+ * Revision 2.2  91/06/06  17:07:57  jsb
+ * 	First checkin.
+ * 	[91/05/25  10:37:22  jsb]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	KERNEL_USER
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	KERNEL_SERVER
+		       mach_norma 555000;
+#ifdef	KERNEL_USER
+userprefix r_;
+#endif	KERNEL_USER
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+skip;
+
+/*
+ * Specify a node upon which children tasks will be created.
+ * This call exists only to allow testing with unmodified servers.
+ * Server developers should use norma_task_create instead.
+ */
+routine	task_set_child_node(
+		target_task	: task_t;
+		child_node	: int);
+
+/*
+ * THIS CALL WILL BE ELIMINATED.
+ * Use norma_port_location_hint(,mach_task_self(),) instead.
+ */
+routine norma_node_self(
+		host		: host_t;
+	out	node		: int);
+
+skip;
+
+skip;
+
+/*
+ * Create a task on the given node, possibly inheriting memory.
+ * Same inheritance semantics as task_create, including inheritance
+ * of initial ports and emulation library, except for memory:
+ * inheritance attributes are ignored, so that all regions appear
+ * in the child task, shared with the parent, until the parent
+ * is destroyed. (The inheritance of the regions in the child
+ * will, however, be set to match the parent.)
+ *
+ * This call is intended to support process migration, where the
+ * inheritance semantics of norma_task_create would break migrated
+ * programs that depended upon sharing relationships remaining
+ * after migration.
+ *
+ * This call is not a true task migration call, in that it does not
+ * migrate the port space, threads, and other non-address-space
+ * attributes of the task.
+ */
+routine norma_task_clone(
+		target_task	: task_t;
+		inherit_memory	: boolean_t;
+		child_node	: int;
+	out	child_task	: task_t);
+
+/*
+ * Create a task on the given node, possibly inheriting memory.
+ * Same inheritance semantics as task_create, including inheritance
+ * of initial ports and emulation library.
+ * Setting child_node to node_self forces local task creation.
+ */
+routine norma_task_create(
+		target_task	: task_t;
+		inherit_memory	: boolean_t;
+		child_node	: int;
+	out	child_task	: task_t);
+
+/*
+ * Get a given special port for a given node.
+ * Norma special ports are defined in norma_special_ports.h;
+ * examples include the master device port.
+ * There are a limited number of slots available for system servers.
+ */
+routine	norma_get_special_port(
+		host_priv	: host_priv_t;
+		node		: int;
+		which		: int;
+	out	port		: mach_port_t);
+
+/*
+ * Set a given special port for a given node.
+ * See norma_get_special_port.
+ */
+routine	norma_set_special_port(
+		host_priv	: host_priv_t;
+		which		: int;
+		port		: mach_port_t);
+
+/*
+ * Just like norma_task_clone, except target_task is terminated,
+ * allowing useful VM optimizations.
+ */
+routine norma_task_teleport(
+		target_task	: task_t;
+		inherit_memory	: boolean_t;
+		child_node	: int;
+	out	child_task	: task_t);
+
+skip;
+
+skip;
+
+/*
+ * Return best guess of port's current location.
+ * Guaranteed to be a node where the port once was.
+ * Guaranteed to be accurate if port has never moved.
+ * Can be used to determine residence node for hosts, tasks, threads, etc.
+ */
+routine norma_port_location_hint(
+		task		: task_t;
+		port		: mach_port_t;
+	out	node		: int);
diff --git a/xnu-792.18.15/osfmk/mach/mach_notify.defs b/xnu-792.18.15/osfmk/mach/mach_notify.defs
new file mode 100644
index 0000000..0b23826
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_notify.defs
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * The mach/notify.h file is hand-crafted.
+ * It contains additional data that cannot be generated by MIG at this time.
+ * But its existence keeps us from having MIG generate the client-side
+ * routines to send Mach notifications.  This file exists simply to give
+ * those routines a new home (mach/mach_notify.h and mach_notify_user.c)
+ * until the real notify.h becomes "MIG-safe."
+ */
+#include <mach/notify.defs>
diff --git a/xnu-792.18.15/osfmk/mach/mach_param.h b/xnu-792.18.15/osfmk/mach/mach_param.h
new file mode 100644
index 0000000..e4ead67
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_param.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_param.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
+ *	Date:	1986
+ *
+ *	Mach system sizing parameters
+ */
+
+#ifndef	_MACH_MACH_PARAM_H_
+#define _MACH_MACH_PARAM_H_
+
+/* Number of "registered" ports */
+
+#define TASK_PORT_REGISTER_MAX	3
+
+#endif	/* _MACH_MACH_PARAM_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_port.defs b/xnu-792.18.15/osfmk/mach/mach_port.defs
new file mode 100644
index 0000000..b325ba4
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_port.defs
@@ -0,0 +1,456 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_port.defs
+ *	Author:	Rich Draves
+ *
+ *	Exported kernel calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  mach_port 3200;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach_debug/mach_debug_types.defs>
+
+/*
+ *	Returns the set of port and port set names
+ *	to which the target task has access, along with
+ *	the type (set or port) for each name.
+ */
+
+routine mach_port_names(
+		task		: ipc_space_t;
+	out	names		: mach_port_name_array_t;
+	out	types		: mach_port_type_array_t);
+
+/*
+ *	Returns the type (set or port) for the port name
+ *	within the target task.  Also indicates whether
+ *	there is a dead-name request for the name.
+ */
+
+routine mach_port_type(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	ptype		: mach_port_type_t);
+
+/*
+ *	Changes the name by which a port (or port set) is known to
+ *	the target task.  The new name can't be in use.  The
+ *	old name becomes available for recycling.
+ */
+
+routine mach_port_rename(
+		task		: ipc_space_t;
+		old_name	: mach_port_name_t;
+		new_name	: mach_port_name_t);
+
+/*
+ *	Allocates the specified kind of object, with the given name.
+ *	The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *	New port sets are empty.  New ports don't have any
+ *	send/send-once rights or queued messages.  The make-send
+ *	count is zero and their queue limit is MACH_PORT_QLIMIT_DEFAULT.
+ *	New sets, ports, and dead names have one user reference.
+ */
+
+routine mach_port_allocate_name(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+		name		: mach_port_name_t);
+
+/*
+ *	Allocates the specified kind of object.
+ *	The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *	Like port_allocate_name, but the kernel picks a name.
+ *	It can use any name not associated with a right.
+ */
+
+routine mach_port_allocate(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+	out	name		: mach_port_name_t);
+
+/*
+ *	Destroys all rights associated with the name and makes it
+ *	available for recycling immediately.  The name can be a
+ *	port (possibly with multiple user refs), a port set, or
+ *	a dead name (again, with multiple user refs).
+ */
+
+routine mach_port_destroy(
+		task		: ipc_space_t;
+		name		: mach_port_name_t);
+
+/*
+ *	Releases one send/send-once/dead-name user ref.
+ *	Just like mach_port_mod_refs -1, but deduces the
+ *	correct type of right.  This allows a user task
+ *	to release a ref for a port without worrying
+ *	about whether the port has died or not.
+ */
+
+routine mach_port_deallocate(
+		task		: ipc_space_t;
+		name		: mach_port_name_t);
+
+/*
+ *	A port set always has one user ref.
+ *	A send-once right always has one user ref.
+ *	A dead name always has one or more user refs.
+ *	A send right always has one or more user refs.
+ *	A receive right always has one user ref.
+ *	The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *		MACH_PORT_RIGHT_SEND
+ *		MACH_PORT_RIGHT_SEND_ONCE
+ */
+
+routine mach_port_get_refs(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		right		: mach_port_right_t;
+	out	refs		: mach_port_urefs_t);
+
+/*
+ *	The delta is a signed change to the task's
+ *	user ref count for the right.  Only dead names
+ *	and send rights can have a positive delta.
+ *	The resulting user ref count can't be negative.
+ *	If it is zero, the right is deallocated.
+ *	If the name isn't a composite right, it becomes
+ *	available for recycling.  The right must be one of
+ *		MACH_PORT_RIGHT_RECEIVE
+ *		MACH_PORT_RIGHT_PORT_SET
+ *		MACH_PORT_RIGHT_DEAD_NAME
+ *		MACH_PORT_RIGHT_SEND
+ *		MACH_PORT_RIGHT_SEND_ONCE
+ */
+
+routine mach_port_mod_refs(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		right		: mach_port_right_t;
+		delta		: mach_port_delta_t);
+
+skip;
+
+/*
+ *	Only valid for receive rights.
+ *	Sets the make-send count for the port.
+ */
+routine mach_port_set_mscount(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		mscount		: mach_port_mscount_t);
+
+/*
+ *	Only valid for port sets.  Returns a list of
+ *	the members.
+ */
+
+routine mach_port_get_set_status(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	members		: mach_port_name_array_t);
+
+/*
+ *	Puts the member port (the task must have receive rights)
+ *	into the after port set.  (Or removes it from any port set
+ *	if after is MACH_PORT_NULL.)  If the port is already in
+ *	a set, does an atomic move.
+ */
+
+routine mach_port_move_member(
+		task		: ipc_space_t;
+		member		: mach_port_name_t;
+		after		: mach_port_name_t);
+
+/*
+ *	Requests a notification from the kernel.  The request
+ *	must supply the send-once right which is used for
+ *	the notification.  If a send-once right was previously
+ *	registered, it is returned.  The msg_id must be one of
+ *		MACH_NOTIFY_PORT_DESTROYED (receive rights)
+ *		MACH_NOTIFY_DEAD_NAME (send/receive/send-once rights)
+ *		MACH_NOTIFY_NO_SENDERS (receive rights)
+ *
+ *	The sync value specifies whether a notification should
+ *	get sent immediately, if appropriate.  The exact meaning
+ *	depends on the notification:
+ *		MACH_NOTIFY_PORT_DESTROYED: must be zero.
+ *		MACH_NOTIFY_DEAD_NAME: if non-zero, then name can be dead,
+ *			and the notification gets sent immediately.
+ *			If zero, then name can't be dead.
+ *		MACH_NOTIFY_NO_SENDERS: the notification gets sent
+ *			immediately if the current mscount is greater
+ *			than or equal to the sync value and there are no
+ *			extant send rights.
+ */
+
+routine mach_port_request_notification(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		msgid		: mach_msg_id_t;
+		sync		: mach_port_mscount_t;
+		notify		: mach_port_send_once_t;
+	out	previous	: mach_port_move_send_once_t);
+
+/*
+ *	Inserts the specified rights into the target task,
+ *	using the specified name.  If inserting send/receive
+ *	rights and the task already has send/receive rights
+ *	for the port, then the names must agree.  In any case,
+ *	the task gains a user ref for the port.
+ */
+
+routine mach_port_insert_right(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		poly		: mach_port_poly_t);
+
+/*
+ *	Returns the specified right for the named port
+ *	in the target task, extracting that right from
+ *	the target task.  The target task loses a user
+ *	ref and the name may be available for recycling.
+ *	msgt_name must be one of
+ *		MACH_MSG_TYPE_MOVE_RECEIVE
+ *		MACH_MSG_TYPE_COPY_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND
+ *		MACH_MSG_TYPE_MOVE_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND_ONCE
+ *		MACH_MSG_TYPE_MOVE_SEND_ONCE
+ */
+
+routine mach_port_extract_right(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		msgt_name	: mach_msg_type_name_t;
+	out	poly		: mach_port_poly_t);
+
+/*
+ *	Only valid for receive rights.
+ *	Sets the sequence number for the port.
+ */
+
+routine mach_port_set_seqno(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		seqno		: mach_port_seqno_t);
+
+/*
+ *      Returns information about a port.
+ */
+
+routine mach_port_get_attributes(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		flavor		: mach_port_flavor_t;
+	out	port_info_out	: mach_port_info_t, CountInOut);
+
+/*
+ *      Set attributes of a port
+ */
+
+routine mach_port_set_attributes(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		flavor		: mach_port_flavor_t;
+		port_info	: mach_port_info_t);
+
+
+/*
+ *	Allocates the specified kind of object, qos version.
+ *	The right must be
+ *		MACH_PORT_RIGHT_RECEIVE
+ *	Like port_allocate_name, but the kernel picks a name.
+ *	It can use any name not associated with a right.
+ */
+
+routine mach_port_allocate_qos(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+	inout	qos		: mach_port_qos_t;
+	out	name		: mach_port_name_t);
+
+
+/*
+ *	Generic interface to allocation various kinds of ports.
+ *	Should never be called directly by users (at least not
+ *	unless they are exceedingly masochistic).
+ */
+
+routine mach_port_allocate_full(
+		task		: ipc_space_t;
+		right		: mach_port_right_t;
+		proto		: mach_port_t;
+	inout	qos		: mach_port_qos_t;
+	inout	name		: mach_port_name_t);
+
+
+/*
+ *	Pre-expand task port name space.
+ */
+routine task_set_port_space(
+		task		: ipc_space_t;
+		table_entries	: int);
+
+
+/*
+ *	Returns the exact number of extant send rights
+ *	for the given receive right.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine	mach_port_get_srights(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	srights		: mach_port_rights_t);
+
+
+/*
+ *	Returns information about an IPC space.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine mach_port_space_info(
+		task		: ipc_space_t;
+	out	space_info	: ipc_info_space_t;
+	out	table_info	: ipc_info_name_array_t,
+					Dealloc;
+	out	tree_info	: ipc_info_tree_name_array_t,
+					Dealloc);
+
+/*
+ *	Returns information about the dead-name requests
+ *	registered with the named receive right.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine mach_port_dnrequest_info(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	dnr_total	: unsigned;	/* total size of table */
+	out	dnr_used	: unsigned);	/* amount used */
+
+/*
+ *	Return the type and address of the kernel object
+ *	that the given send/receive right represents.
+ *      This call is only valid on MACH_IPC_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine	mach_port_kernel_object(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	object_type	: unsigned;
+	out	object_addr	: vm_offset_t);
+
+
+/*
+ *	Inserts the specified rights into the portset identified
+ *	by the <task, pset> pair.  The results of passing in the
+ *	Poly argument via the supplied disposition must yield a
+ *	receive right.
+ *
+ *	If the <task,pset> pair does not represent a valid portset
+ *	KERN_INVALID_RIGHT is returned.
+ *	
+ *	If the passed in name argument does not represent a receive
+ *	right, KERN_INVALID_CAPABILITY will be returned.
+ *
+ *	If the port represented by the receive right is already in
+ *	the portset, KERN_ALREADY_IN_SET is returned.
+ */
+routine mach_port_insert_member(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		pset		: mach_port_name_t);
+
+/*
+ *	Extracts the specified right from the named portset
+ *	in the target task.  
+ *	the target task.  The target task loses a user
+ *	ref and the name may be available for recycling.
+ *	msgt_name must be one of
+ *		MACH_MSG_TYPE_MOVE_RECEIVE
+ *		MACH_MSG_TYPE_COPY_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND
+ *		MACH_MSG_TYPE_MOVE_SEND
+ *		MACH_MSG_TYPE_MAKE_SEND_ONCE
+ *		MACH_MSG_TYPE_MOVE_SEND_ONCE
+ */
+
+routine mach_port_extract_member(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+		pset		: mach_port_name_t);
+
diff --git a/xnu-792.18.15/osfmk/mach/mach_syscalls.h b/xnu-792.18.15/osfmk/mach/mach_syscalls.h
new file mode 100644
index 0000000..0e04e4f
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_syscalls.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+#ifndef _MACH_MACH_SYSCALLS_H_
+#define	_MACH_MACH_SYSCALLS_H_
+
+#include <mach/mach_traps.h>
+
+#endif	/* _MACH_MACH_SYSCALLS_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_time.h b/xnu-792.18.15/osfmk/mach/mach_time.h
new file mode 100644
index 0000000..de93d51
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_time.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2001-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef	_MACH_MACH_TIME_H_
+#define	_MACH_MACH_TIME_H_
+
+#include <mach/mach_types.h>
+
+#include <sys/cdefs.h>
+
+struct mach_timebase_info {
+	uint32_t	numer;
+	uint32_t	denom;
+};
+
+typedef struct mach_timebase_info	*mach_timebase_info_t;
+typedef struct mach_timebase_info	mach_timebase_info_data_t;
+
+__BEGIN_DECLS
+#ifndef	KERNEL
+
+kern_return_t		mach_timebase_info(
+						mach_timebase_info_t	info);
+
+kern_return_t		mach_wait_until(
+						uint64_t		deadline);
+
+#endif	/* KERNEL */
+
+uint64_t			mach_absolute_time(void);
+__END_DECLS
+
+#endif /* _MACH_MACH_TIME_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_traps.h b/xnu-792.18.15/osfmk/mach/mach_traps.h
new file mode 100644
index 0000000..2438e72
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_traps.h
@@ -0,0 +1,561 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Definitions of general Mach system traps.
+ *
+ *	These are the definitions as seen from user-space.
+ *	The kernel definitions are in <mach/syscall_sw.h>.
+ *	Kernel RPC functions are defined in <mach/mach_interface.h>.
+ */
+
+#ifndef	_MACH_MACH_TRAPS_H_
+#define _MACH_MACH_TRAPS_H_
+
+#include <stdint.h>
+
+#include <mach/std_types.h>
+#include <mach/mach_types.h>
+#include <mach/kern_return.h>
+#include <mach/port.h>
+#include <mach/vm_types.h>
+#include <mach/clock_types.h>
+
+#include <machine/endian.h>
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+#ifndef	KERNEL
+
+#ifdef	PRIVATE
+
+extern mach_port_name_t mach_reply_port(void);
+
+extern mach_port_name_t thread_self_trap(void);
+
+extern mach_port_name_t host_self_trap(void);
+
+extern mach_msg_return_t mach_msg_trap(
+				mach_msg_header_t *msg,
+				mach_msg_option_t option,
+				mach_msg_size_t send_size,
+				mach_msg_size_t rcv_size,
+				mach_port_name_t rcv_name,
+				mach_msg_timeout_t timeout,
+				mach_port_name_t notify);
+
+extern mach_msg_return_t mach_msg_overwrite_trap(
+				mach_msg_header_t *msg,
+				mach_msg_option_t option,
+				mach_msg_size_t send_size,
+				mach_msg_size_t rcv_size,
+				mach_port_name_t rcv_name,
+				mach_msg_timeout_t timeout,
+				mach_port_name_t notify,
+				mach_msg_header_t *rcv_msg,
+				mach_msg_size_t rcv_limit);
+
+extern kern_return_t semaphore_signal_trap(
+				mach_port_name_t signal_name);
+					      
+extern kern_return_t semaphore_signal_all_trap(
+				mach_port_name_t signal_name);
+
+extern kern_return_t semaphore_signal_thread_trap(
+				mach_port_name_t signal_name,
+				mach_port_name_t thread_name);
+
+extern kern_return_t semaphore_wait_trap(
+				mach_port_name_t wait_name);
+
+extern kern_return_t semaphore_wait_signal_trap(
+				mach_port_name_t wait_name,
+				mach_port_name_t signal_name);
+
+extern kern_return_t semaphore_timedwait_trap(
+				mach_port_name_t wait_name,
+				unsigned int sec,
+				clock_res_t nsec);
+
+extern kern_return_t semaphore_timedwait_signal_trap(
+				mach_port_name_t wait_name,
+				mach_port_name_t signal_name,
+				unsigned int sec,
+				clock_res_t nsec);
+
+#if		!defined(__LP64__)
+/* these should go away altogether - so no 64 legacy please */
+
+extern kern_return_t init_process(void);
+
+#endif	/* !defined(__LP64__) */
+
+#if		!defined(__LP64__)
+
+/* more that should go away so no 64-bit legacy please */
+extern kern_return_t macx_swapon(
+				char *filename,
+				int flags,
+				int size,
+				int priority);
+
+extern kern_return_t macx_swapoff(
+				char *filename,
+				int flags);
+
+extern kern_return_t macx_triggers(
+				int hi_water,
+				int low_water,
+				int flags,
+				mach_port_t alert_port);
+
+extern kern_return_t macx_backing_store_suspend(
+				boolean_t suspend);
+
+extern kern_return_t macx_backing_store_recovery(
+				int pid);
+
+#endif	/* !defined(__LP64__) */
+     
+extern kern_return_t clock_sleep_trap(
+				mach_port_name_t clock_name,
+				sleep_type_t sleep_type,
+				int sleep_sec,
+				int sleep_nsec,
+				mach_timespec_t	*wakeup_time);
+
+#endif	/* PRIVATE */
+
+extern boolean_t swtch_pri(int pri);
+
+extern boolean_t swtch(void);
+
+extern kern_return_t thread_switch(
+				mach_port_name_t thread_name,
+				int option,
+				mach_msg_timeout_t option_time);
+
+extern mach_port_name_t task_self_trap(void);
+
+/*
+ *	Obsolete interfaces.
+ */
+
+extern kern_return_t task_for_pid(
+				mach_port_name_t target_tport,
+				int pid,
+				mach_port_name_t *t);
+
+extern kern_return_t task_name_for_pid(
+				mach_port_name_t target_tport,
+				int pid,
+				mach_port_name_t *tn);
+
+extern kern_return_t pid_for_task(
+				mach_port_name_t t,
+				int *x);
+
+#if		!defined(__LP64__)
+/* these should go away altogether - so no 64 legacy please */
+
+extern kern_return_t map_fd(
+				int fd,
+				vm_offset_t offset,
+				vm_offset_t *va,
+				boolean_t findspace,
+				vm_size_t size);
+
+#endif	/* !defined(__LP64__) */
+
+#else	/* KERNEL */
+
+#ifdef	XNU_KERNEL_PRIVATE
+
+/* Syscall data translations routines */
+#define	PAD_(t)	(sizeof(uint64_t) <= sizeof(t) \
+ 		? 0 : sizeof(uint64_t) - sizeof(t))
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define	PADL_(t)	0
+#define	PADR_(t)	PAD_(t)
+#else
+#define	PADL_(t)	PAD_(t)
+#define	PADR_(t)	0
+#endif
+
+#define PAD_ARG_(arg_type, arg_name) \
+  char arg_name##_l_[PADL_(arg_type)]; arg_type arg_name; char arg_name##_r_[PADR_(arg_type)];
+
+#ifndef __MUNGE_ONCE
+#define __MUNGE_ONCE
+#ifdef __ppc__
+void munge_w(const void *, void *);  
+void munge_ww(const void *, void *);  
+void munge_www(const void *, void *);  
+void munge_wwww(const void *, void *);  
+void munge_wwwww(const void *, void *);  
+void munge_wwwwww(const void *, void *);  
+void munge_wwwwwww(const void *, void *);  
+void munge_wwwwwwww(const void *, void *);  
+void munge_d(const void *, void *);  
+void munge_dd(const void *, void *);  
+void munge_ddd(const void *, void *);  
+void munge_dddd(const void *, void *);  
+void munge_ddddd(const void *, void *);  
+void munge_dddddd(const void *, void *);  
+void munge_ddddddd(const void *, void *);  
+void munge_dddddddd(const void *, void *);
+void munge_l(const void *, void *);
+void munge_wl(const void *, void *);  
+void munge_wlw(const void *, void *);  
+void munge_wwwl(const void *, void *);  
+void munge_wwwwl(const void *, void *);  
+void munge_wwwwwl(const void *, void *);  
+#else 
+#define munge_w  NULL 
+#define munge_ww  NULL 
+#define munge_www  NULL 
+#define munge_wwww  NULL 
+#define munge_wwwww  NULL 
+#define munge_wwwwww  NULL 
+#define munge_wwwwwww  NULL 
+#define munge_wwwwwwww  NULL 
+#define munge_d  NULL 
+#define munge_dd  NULL 
+#define munge_ddd  NULL 
+#define munge_dddd  NULL 
+#define munge_ddddd  NULL 
+#define munge_dddddd  NULL 
+#define munge_ddddddd  NULL 
+#define munge_dddddddd  NULL 
+#define munge_l NULL
+#define munge_wl  NULL 
+#define munge_wlw  NULL 
+#define munge_wwwl  NULL 
+#define munge_wwwwl  NULL 
+#define munge_wwwwwl  NULL 
+#endif /* __ppc__ */
+#endif /* !__MUNGE_ONCE */
+
+struct kern_invalid_args {
+	register_t dummy;
+};
+extern kern_return_t kern_invalid(
+				struct kern_invalid_args *args);
+
+struct mach_reply_port_args {
+	register_t dummy;
+};
+extern mach_port_name_t mach_reply_port(
+				struct mach_reply_port_args *args);
+
+struct thread_self_trap_args {
+	register_t dummy;
+};
+extern mach_port_name_t thread_self_trap(
+				struct thread_self_trap_args *args);
+
+struct task_self_trap_args {
+	register_t dummy;
+};
+extern mach_port_name_t task_self_trap(
+				struct task_self_trap_args *args);
+
+struct host_self_trap_args {
+	register_t dummy;
+};
+extern mach_port_name_t host_self_trap(
+				struct host_self_trap_args *args);
+
+struct mach_msg_overwrite_trap_args {
+	PAD_ARG_(mach_vm_address_t, msg);
+	PAD_ARG_(mach_msg_option_t, option);
+	PAD_ARG_(mach_msg_size_t, send_size);
+	PAD_ARG_(mach_msg_size_t, rcv_size);
+	PAD_ARG_(mach_port_name_t, rcv_name);
+	PAD_ARG_(mach_msg_timeout_t, timeout);
+	PAD_ARG_(mach_port_name_t, notify);
+	PAD_ARG_(mach_vm_address_t, rcv_msg);  /* Unused on mach_msg_trap */
+};
+extern mach_msg_return_t mach_msg_trap(
+				struct mach_msg_overwrite_trap_args *args);
+extern mach_msg_return_t mach_msg_overwrite_trap(
+				struct mach_msg_overwrite_trap_args *args);
+
+struct semaphore_signal_trap_args {
+	PAD_ARG_(mach_port_name_t, signal_name);
+};
+extern kern_return_t semaphore_signal_trap(
+				struct semaphore_signal_trap_args *args);
+					      
+struct semaphore_signal_all_trap_args {
+	PAD_ARG_(mach_port_name_t, signal_name);
+};
+extern kern_return_t semaphore_signal_all_trap(
+				struct semaphore_signal_all_trap_args *args);
+
+struct semaphore_signal_thread_trap_args {
+	PAD_ARG_(mach_port_name_t, signal_name);
+	PAD_ARG_(mach_port_name_t, thread_name);
+};
+extern kern_return_t semaphore_signal_thread_trap(
+				struct semaphore_signal_thread_trap_args *args);
+
+struct semaphore_wait_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+};
+extern kern_return_t semaphore_wait_trap(
+				struct semaphore_wait_trap_args *args);
+
+struct semaphore_wait_signal_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+	PAD_ARG_(mach_port_name_t, signal_name);
+};
+extern kern_return_t semaphore_wait_signal_trap(
+				struct semaphore_wait_signal_trap_args *args);
+
+struct semaphore_timedwait_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+	PAD_ARG_(unsigned int, sec);
+	PAD_ARG_(clock_res_t, nsec);
+};
+extern kern_return_t semaphore_timedwait_trap(
+				struct semaphore_timedwait_trap_args *args);
+
+struct semaphore_timedwait_signal_trap_args {
+	PAD_ARG_(mach_port_name_t, wait_name);
+	PAD_ARG_(mach_port_name_t, signal_name);
+	PAD_ARG_(unsigned int, sec);
+	PAD_ARG_(clock_res_t, nsec);
+};
+extern kern_return_t semaphore_timedwait_signal_trap(
+				struct semaphore_timedwait_signal_trap_args *args);
+
+/* not published to LP64 clients */
+struct init_process_args {
+    register_t dummy;
+};
+extern kern_return_t init_process(
+				struct init_process_args *args);
+
+struct map_fd_args {
+	PAD_ARG_(int, fd);
+	PAD_ARG_(vm_offset_t, offset);
+	PAD_ARG_(vm_offset_t *, va);
+	PAD_ARG_(boolean_t, findspace);
+	PAD_ARG_(vm_size_t, size);
+};
+extern kern_return_t map_fd(
+				struct map_fd_args *args);
+
+struct task_for_pid_args {
+	PAD_ARG_(mach_port_name_t, target_tport);
+	PAD_ARG_(int, pid);
+	PAD_ARG_(user_addr_t, t);
+};
+extern kern_return_t task_for_pid(
+				struct task_for_pid_args *args);
+
+struct task_name_for_pid_args {
+	PAD_ARG_(mach_port_name_t, target_tport);
+	PAD_ARG_(int, pid);
+	PAD_ARG_(user_addr_t, t);
+};
+extern kern_return_t task_name_for_pid(
+				struct task_name_for_pid_args *args);
+
+struct pid_for_task_args {
+	PAD_ARG_(mach_port_name_t, t);
+	PAD_ARG_(user_addr_t, pid);
+};
+extern kern_return_t pid_for_task(
+				struct pid_for_task_args *args);
+
+/* not published to LP64 clients*/
+struct macx_swapon_args {
+	PAD_ARG_(char *, filename);
+	PAD_ARG_(int, flags);
+	PAD_ARG_(int, size);
+	PAD_ARG_(int, priority);
+};
+extern kern_return_t macx_swapon(
+				struct macx_swapon_args *args);
+
+struct macx_swapoff_args {
+    PAD_ARG_(char *, filename);
+    PAD_ARG_(int, flags);
+};
+extern kern_return_t macx_swapoff(
+				struct macx_swapoff_args *args);
+
+struct macx_triggers_args {
+	PAD_ARG_(int, hi_water);
+	PAD_ARG_(int, low_water);
+	PAD_ARG_(int, flags);
+	PAD_ARG_(mach_port_t, alert_port);
+};
+extern kern_return_t macx_triggers(
+				struct macx_triggers_args *args);
+
+struct macx_backing_store_suspend_args {
+	PAD_ARG_(boolean_t, suspend);
+};
+extern kern_return_t macx_backing_store_suspend(
+				struct macx_backing_store_suspend_args *args);
+
+struct macx_backing_store_recovery_args {
+	PAD_ARG_(int, pid);
+};
+extern kern_return_t macx_backing_store_recovery(
+				struct macx_backing_store_recovery_args *args);
+
+struct swtch_pri_args {
+	PAD_ARG_(int, pri);
+};
+extern boolean_t swtch_pri(
+				struct swtch_pri_args *args);
+
+struct swtch_args {
+    register_t dummy;
+};
+extern boolean_t swtch(
+				struct swtch_args *args);
+
+struct clock_sleep_trap_args{
+	PAD_ARG_(mach_port_name_t, clock_name);
+	PAD_ARG_(sleep_type_t, sleep_type);
+	PAD_ARG_(int, sleep_sec);
+	PAD_ARG_(int, sleep_nsec);
+	PAD_ARG_(mach_vm_address_t, wakeup_time);
+};
+extern kern_return_t clock_sleep_trap(
+				struct clock_sleep_trap_args *args);
+
+struct thread_switch_args {
+	PAD_ARG_(mach_port_name_t, thread_name);
+	PAD_ARG_(int, option);
+	PAD_ARG_(mach_msg_timeout_t, option_time);
+};
+extern kern_return_t thread_switch(
+				struct thread_switch_args *args);
+
+struct mach_timebase_info_trap_args {
+	PAD_ARG_(mach_vm_address_t, info);
+};
+extern kern_return_t mach_timebase_info_trap(
+				struct mach_timebase_info_trap_args *args);
+
+struct mach_wait_until_trap_args {
+	PAD_ARG_(uint64_t, deadline);
+};
+extern kern_return_t mach_wait_until_trap(
+				struct mach_wait_until_trap_args *args);
+
+struct mk_timer_create_trap_args {
+    register_t dummy;
+};
+extern mach_port_name_t mk_timer_create_trap(
+				struct mk_timer_create_trap_args *args);
+
+struct mk_timer_destroy_trap_args {
+	PAD_ARG_(mach_port_name_t, name);
+};
+extern kern_return_t mk_timer_destroy_trap(
+				struct mk_timer_destroy_trap_args *args);
+
+struct mk_timer_arm_trap_args {
+	PAD_ARG_(mach_port_name_t, name);
+	PAD_ARG_(uint64_t, expire_time);
+};
+extern kern_return_t mk_timer_arm_trap(
+				struct mk_timer_arm_trap_args *args);
+
+struct mk_timer_cancel_trap_args {
+    PAD_ARG_(mach_port_name_t, name);
+    PAD_ARG_(mach_vm_address_t, result_time);
+};
+extern kern_return_t mk_timer_cancel_trap(
+				struct mk_timer_cancel_trap_args *args);
+
+/* not published to LP64 clients yet */
+struct iokit_user_client_trap_args {
+	PAD_ARG_(void *, userClientRef);
+	PAD_ARG_(uint32_t, index);
+	PAD_ARG_(void *, p1);
+	PAD_ARG_(void *, p2);
+	PAD_ARG_(void *, p3);
+	PAD_ARG_(void *, p4);
+	PAD_ARG_(void *, p5);
+	PAD_ARG_(void *, p6);
+};
+kern_return_t iokit_user_client_trap(
+				struct iokit_user_client_trap_args *args);
+
+#undef PAD_
+#undef PADL_
+#undef PADR_
+#undef PAD_ARG_
+
+#endif	/* XNU_KERNEL_PRIVATE */
+
+#endif	/* KERNEL */
+
+__END_DECLS
+
+#endif	/* _MACH_MACH_TRAPS_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_types.defs b/xnu-792.18.15/osfmk/mach/mach_types.defs
new file mode 100644
index 0000000..174c6b9
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_types.defs
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Mach kernel interface type declarations
+ */
+
+#ifndef	_MACH_MACH_TYPES_DEFS_
+#define _MACH_MACH_TYPES_DEFS_
+
+
+#include <mach/std_types.defs>
+
+type memory_object_offset_t 	= uint64_t;
+type memory_object_size_t 	= uint64_t;
+type memory_object_cluster_size_t = uint32_t;
+
+#ifdef KERNEL_PRIVATE
+
+/* Universal Page Lists - restricted to (in-kernel) pagers for now */
+type upl_size_t			= uint32_t;
+type upl_offset_t			= uint32_t;
+type upl_page_info_t		= struct[2] of integer_t;
+type upl_page_info_array_t	= array[*:256] of upl_page_info_t;
+
+type upl_t = mach_port_t
+		intran: upl_t convert_port_to_upl(mach_port_t)
+		outtran: mach_port_t convert_upl_to_port(upl_t)
+		destructor: upl_deallocate(upl_t)
+		;
+
+#endif /* KERNEL_PRIVATE */
+
+type mach_port_status_t = struct[10] of integer_t;	/* obsolete */
+
+		/* mach_port_info_t: can hold either a
+		 * mach_port_status_t (9 ints) or a
+		 * mach_port_limits_t (1 int). If new flavors of
+		 * mach_port_{get,set}_attributes are added, the size of
+		 * this array may have to be increased. (See mach/port.h)
+		 */
+type mach_port_flavor_t 	= int;
+type mach_port_info_t		= array[*:10] of integer_t;
+
+type task_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: task_t convert_port_to_task(mach_port_t)
+		outtran: mach_port_t convert_task_to_port(task_t)
+		destructor: task_deallocate(task_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type task_name_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: task_name_t convert_port_to_task_name(mach_port_t)
+		outtran: mach_port_t convert_task_name_to_port(task_name_t)
+		destructor: task_name_deallocate(task_name_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type thread_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: thread_t convert_port_to_thread(mach_port_t)
+		outtran: mach_port_t convert_thread_to_port(thread_t)
+		destructor: thread_deallocate(thread_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type thread_act_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: thread_act_t convert_port_to_thread(mach_port_t)
+		outtran: mach_port_t convert_thread_to_port(thread_act_t)
+		destructor: thread_deallocate(thread_act_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type thread_act_consume_ref_t = mach_port_move_send_t
+		cusertype: thread_act_t
+#if	KERNEL_SERVER
+		intran: thread_act_t convert_port_to_thread(mach_port_t)
+		destructor: thread_deallocate(thread_act_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+		/* thread_state_t: This inline array can hold
+		 * a machine-dependent amount of data, defined in
+		 * mach/machine/???? (currently THREAD_STATE_MAX,
+		 * in mach/thread_state.h)
+		 */
+#include <mach/machine/thread_state.h>
+type thread_state_flavor_t	= int;
+type thread_state_t		= array[*:THREAD_STATE_MAX] of natural_t;
+
+type task_array_t = ^array[] of task_t;
+type thread_array_t = ^array[] of thread_t;
+type thread_act_array_t = ^array[] of thread_act_t;
+type act_params_t = array[6] of int;
+
+type vm_map_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: vm_map_t convert_port_to_map(mach_port_t)
+		destructor: vm_map_deallocate(vm_map_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type vm_task_entry_t = mach_port_t
+		cusertype: vm_map_t
+#if	KERNEL_SERVER
+		intran: vm_map_t convert_port_entry_to_map(mach_port_t)
+		destructor: vm_map_deallocate(vm_map_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type ipc_space_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: ipc_space_t convert_port_to_space(mach_port_t)
+		destructor: space_deallocate(ipc_space_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type vm_prot_t = int;
+type vm_inherit_t = int;
+type vm_purgable_t = int;
+type xxx_vm_statistics_data_t = struct[13] of integer_t;
+type vm_behavior_t = int;
+type vm_statistics_data_t = struct[14] of integer_t;
+type vm_machine_attribute_t = int;
+type vm_machine_attribute_val_t = int;
+type vm_sync_t = int;
+
+		/* thread_info_t: this inline array can hold any of:
+		 * thread_basic_info_t (10 ints)
+		 * policy_timeshare_info_t (5 ints)
+		 * policy_fifo_info_t (4 ints)
+		 * policy_rr_info_t (5 ints)
+		 * if other thread_info flavors are added, this
+		 * definition may need to be changed. (See
+		 * mach/thread_info.h and mach/policy.h) */
+type thread_flavor_t		= int;
+type thread_info_t		= array[*:12] of integer_t;
+
+type thread_policy_flavor_t	= natural_t;
+type thread_policy_t		= array[*:16] of integer_t;
+
+		/* task_info_t: this inline array can hold any of:
+		 * task_basic_info_32_t (8 ints)
+		 * task_basic_info_64_t (10 ints)
+		 * task_events_info_t (8 ints)
+		 * task_thread_times_info_t (4 ints)
+		 * policy_timeshare_info_t (5 ints)
+		 * policy_fifo_info_t (4 ints)
+		 * policy_rr_info_t (5 ints)
+		 * task security token (2 ints)
+		 * task audit token (8 ints)
+		 * If other task_info flavors are added, this
+		 * definition may need to be changed. (See
+		 * mach/task_info.h and mach/policy.h) */
+type task_flavor_t		= int;
+type task_info_t		= array[*:10] of integer_t;
+
+type task_policy_flavor_t	= natural_t;
+type task_policy_t		= array[*:16] of integer_t;
+
+type mem_entry_name_port_t = mach_port_t
+#if     KERNEL_SERVER
+		intran: mem_entry_name_port_t null_conversion(mach_port_t)
+		outtran: mach_port_t null_conversion(mem_entry_name_port_t)
+#endif  /* KERNEL_SERVER */
+		;
+
+type mem_entry_name_port_move_send_t = mach_port_move_send_t
+	cusertype: mem_entry_name_port_t
+#if     KERNEL_SERVER
+		intran: mem_entry_name_port_t null_conversion(mach_port_t)
+		outtran: mach_port_t null_conversion(mem_entry_name_port_t)
+#endif  /* KERNEL_SERVER */
+		;
+
+type memory_object_default_t = mach_port_t
+#if	KERNEL_PRIVATE
+		intran: memory_object_default_t null_conversion(mach_port_t)
+		outtran: mach_port_t null_conversion(memory_object_default_t)
+#endif	/* KERNEL_PRIVATE */
+		;
+ 
+type memory_object_t = mach_port_t
+#if	KERNEL_PRIVATE
+		intran: memory_object_t convert_port_to_memory_object(mach_port_t)
+		outtran: mach_port_t convert_memory_object_to_port(memory_object_t)
+#endif	/* KERNEL_PRIVATE */
+		;
+
+
+type memory_object_control_t = mach_port_t
+#if	KERNEL_PRIVATE
+		intran: memory_object_control_t convert_port_to_mo_control(mach_port_t)
+		outtran: mach_port_t convert_mo_control_to_port(memory_object_control_t)
+		destructor: memory_object_control_deallocate(memory_object_control_t)
+#endif	/* KERNEL_PRIVATE */
+		;
+
+type memory_object_name_t = mach_port_t
+		ctype: mach_port_t
+		;
+
+
+type memory_object_copy_strategy_t = int;
+type memory_object_return_t = int;
+
+type machine_info_data_t = struct[5] of integer_t;
+type machine_slot_data_t = struct[8] of integer_t;
+
+type host_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: host_t convert_port_to_host(mach_port_t)
+		outtran: mach_port_t convert_host_to_port(host_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type host_priv_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: host_priv_t convert_port_to_host_priv(mach_port_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type host_security_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: host_security_t convert_port_to_host_security(mach_port_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+		/* host_info_t: variable-sized inline array that can contain:
+		 * host_basic_info_old_t (5 ints)
+		 * host_basic_info_t (12 ints)
+		 * host_sched_info_t (2 ints)
+		 * kernel_resource_sizes_t (5 ints)
+		 * host_load_info_t (6 ints)
+		 * vm_statistics_t (14 ints)
+		 * If other host_info flavors are added, this definition may
+		 * need to be changed. (See mach/{host_info,vm_statistics}.h)
+		 */
+type host_flavor_t		= int;
+type host_info_t 		= array[*:14] of integer_t;
+
+type processor_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: processor_t convert_port_to_processor(mach_port_t)
+		outtran: mach_port_t convert_processor_to_port(processor_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type processor_array_t 	= ^array[] of processor_t;
+
+		/* processor_info_t: variable-sized inline array that can
+		 * contain:
+		 * processor_basic_info_t:   (5 ints)
+		 * processor_cpu_load_info_t:(4 ints)
+		 * processor_machine_info_t :(12 ints)
+		 * If other processor_info flavors are added, this definition
+		 * may need to be changed. (See mach/processor_info.h) */
+type processor_flavor_t		= int;
+type processor_info_t		= array[*:12] of integer_t;
+type processor_info_array_t	= ^array[] of integer_t;
+
+type processor_set_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: processor_set_t convert_port_to_pset(mach_port_t)
+		outtran: mach_port_t convert_pset_to_port(processor_set_t)
+		destructor: pset_deallocate(processor_set_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type processor_set_array_t = ^array[] of processor_set_t;
+
+type processor_set_name_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: processor_set_name_t convert_port_to_pset_name(mach_port_t)
+		outtran: mach_port_t convert_pset_name_to_port(processor_set_name_t)
+		destructor: pset_deallocate(processor_set_name_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type processor_set_name_array_t = ^array[] of processor_set_name_t;
+
+		/* processor_set_info_t: variable-size inline array
+		 * that can hold:
+		 * processor_set_basic_info (5 ints)
+		 * processor_set_load_info (4 ints)
+		 * policy_timeshare_base_t (1 int)
+		 * policy_fifo_base_t (1 int)
+		 * policy_rr_base_t (1 int)
+		 * policy_timeshare_base_t (1 int)
+		 * policy_fifo_base_t (1 int)
+		 * policy_rr_base_t (1 int)
+		 * policy_t (1 int)
+		 * If other flavors are added, this definition may
+		 * need to be changed. (see mach/processor.h) */
+type processor_set_flavor_t	= int;
+type processor_set_info_t	= array[*:5] of integer_t;	
+
+type bootstrap_t = mach_port_t;
+
+type kernel_version_t           = c_string[*:512];
+type kernel_boot_info_t         = c_string[*:4096];
+
+type time_value_t = struct[2] of integer_t;
+
+type mach_port_qos_t = struct[2] of integer_t;
+
+type emulation_vector_t		= ^array[] of vm_offset_t;
+
+type inline_existence_map_t	= array[*:512] of char;
+
+type policy_t			= int;
+		/* policy_info_t: variable-size inline array. Can hold:
+		 * policy_timeshare_info_t (5 ints)
+		 * policy_fifo_info_t (4 ints)
+		 * policy_rr_info_t (5 ints) */
+type policy_base_t		= array[*:5] of integer_t;
+type policy_info_t		= array[*:2] of integer_t;
+type policy_limit_t		= array[*:1] of integer_t;
+
+type ledger_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: ledger_t convert_port_to_ledger(mach_port_t)
+		outtran: mach_port_t convert_ledger_to_port(ledger_t)
+#endif	/* KERNEL_SERVER */
+                ;
+
+type ledger_array_t	 	= ^array[] of ledger_t;
+type ledger_item_t		= integer_t;
+
+type security_token_t		= struct[2] of uint32_t;
+type audit_token_t		= struct[8] of uint32_t;
+
+		/* memory_object_info_t: variable-size inline array:
+		 * memory_object_attr_info_t (5 ints)
+		 * XXX actually it's 6 ints temporarily (object_ready!)
+		 * memory_object_behave_info_t (4 ints)
+		 * memory_object_perf_info_t (2 ints)
+		 * old_memory_object_attr_info_t (3 ints)
+		 * memory_object_norma_info_t (5 ints)
+		 * If other flavors are added, this definition may
+		 * need to be changed. (see mach/memory_object.h) */
+type memory_object_flavor_t	= int;
+type memory_object_info_t	= array[*:6] of int;
+
+		/* vm_region_info_t: variable-size inline array that can hold:
+		 * vm_region_basic_info_t (8 ints)
+		 * If other flavors are added, this definition may
+		 * need to be changed. (see mach/vm_region.h) */
+type vm_region_flavor_t		= int;
+type vm_region_info_t		= array[*:10] of int;
+type vm_region_recurse_info_t	= array[*:19] of int;
+
+type mach_vm_read_entry_t = array[512] of mach_vm_offset_t;
+type vm_read_entry_t = array[512] of vm_offset_t;
+
+type exception_mask_t		= int;
+type exception_behavior_t	= int;
+
+type    exception_handler_t = mach_port_t;
+
+type	exception_handler_array_t	=
+			array[*:32] of exception_handler_t;
+
+type	exception_behavior_array_t	=
+			array[*:32] of exception_behavior_t;
+
+type	exception_flavor_array_t	=
+			array[*:32] of thread_state_flavor_t;
+
+type	exception_mask_array_t	=
+			array[*:32] of exception_mask_t;
+
+type semaphore_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
+		outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
+		destructor: semaphore_dereference(semaphore_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type semaphore_consume_ref_t = mach_port_move_send_t
+		cusertype: semaphore_t
+#if	KERNEL_SERVER
+		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
+		outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
+		destructor: semaphore_dereference(semaphore_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type lock_set_t = mach_port_t
+#if	KERNEL_SERVER
+		intran: lock_set_t convert_port_to_lock_set(mach_port_t)
+		outtran: mach_port_t convert_lock_set_to_port(lock_set_t)
+		destructor: lock_set_dereference(lock_set_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+/* kernel module loader */
+type kmod_t = int;
+type kmod_control_flavor_t = int;
+
+type kmod_args_t = ^array[] of MACH_MSG_TYPE_BYTE
+	ctype: kmod_args_t;
+
+type io_master_t = mach_port_t;
+type UNDServerRef = mach_port_t;
+
+#if KERNEL_SERVER
+#ifdef	MACH_KERNEL_PRIVATE
+simport <kern/ipc_kobject.h>;	/* for null conversion */
+simport <kern/ipc_tt.h>;	/* for task/thread conversion */
+simport <kern/ipc_host.h>;	/* for host/processor/pset conversions */
+simport <kern/ipc_sync.h>;      /* for lock_set and semaphore conversions */
+simport <kern/ledger.h>;	/* for ledger conversions */
+simport <kern/processor.h>;	/* for processor conversions */
+simport <kern/sync_lock.h>;	/* for lock-set conversions */
+simport <kern/sync_sema.h>;	/* for semaphore conversions */
+simport <vm/memory_object.h>;	/* for memory object type conversions */
+simport <vm/vm_map.h>;		/* for vm_map conversions */
+#endif	/* MACH_KERNEL_PRIVATE */
+
+simport <kern/ipc_mig.h>;	/* pick up kernel-specific MIG things */
+
+#endif /* KERNEL_SERVER */
+
+import <mach/mig.h>;
+import <mach/mach_types.h>;
+
+#endif	/* _MACH_MACH_TYPES_DEFS_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_types.h b/xnu-792.18.15/osfmk/mach/mach_types.h
new file mode 100644
index 0000000..76e6f8a
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_types.h
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_types.h
+ *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
+ *	Date:	1986
+ *
+ *	Mach external interface definitions.
+ *
+ */
+
+#ifndef	_MACH_MACH_TYPES_H_
+#define _MACH_MACH_TYPES_H_
+
+#include <stdint.h>
+
+#include <sys/cdefs.h>
+
+#include <mach/host_info.h>
+#include <mach/host_notify.h>
+#include <mach/host_special_ports.h>
+#include <mach/machine.h>
+#include <mach/machine/vm_types.h>
+#include <mach/memory_object_types.h>
+#include <mach/message.h>
+#include <mach/exception_types.h>
+#include <mach/port.h>
+#include <mach/processor_info.h>
+#include <mach/task_info.h>
+#include <mach/task_policy.h>
+#include <mach/task_special_ports.h>
+#include <mach/thread_info.h>
+#include <mach/thread_policy.h>
+#include <mach/thread_special_ports.h>
+#include <mach/thread_status.h>
+#include <mach/time_value.h>
+#include <mach/clock_types.h>
+#include <mach/vm_attributes.h>
+#include <mach/vm_inherit.h>
+#include <mach/vm_purgable.h>
+#include <mach/vm_behavior.h>
+#include <mach/vm_prot.h>
+#include <mach/vm_statistics.h>
+#include <mach/vm_sync.h>
+#include <mach/vm_types.h>
+#include <mach/vm_region.h>
+#include <mach/kmod.h>
+
+#ifdef	KERNEL
+
+#include <mach/vm_param.h>
+
+/*
+ * If we are in the kernel, then pick up the kernel definitions for
+ * the basic mach types.
+ */
+typedef struct task			*task_t, *task_name_t;
+typedef struct thread		*thread_t, *thread_act_t;
+typedef struct ipc_space		*ipc_space_t;
+typedef struct host			*host_t;
+typedef struct host			*host_priv_t;
+typedef struct host			*host_security_t;
+typedef struct processor		*processor_t;
+typedef struct processor_set		*processor_set_t;
+typedef struct processor_set		*processor_set_control_t;
+typedef struct semaphore 		*semaphore_t;
+typedef struct lock_set 		*lock_set_t;
+typedef struct ledger 			*ledger_t;
+typedef	struct alarm			*alarm_t;
+typedef	struct clock			*clock_serv_t;
+typedef	struct clock			*clock_ctrl_t;
+
+#ifndef	MACH_KERNEL_PRIVATE
+
+__BEGIN_DECLS
+
+struct task ;
+struct thread ;
+struct host ;
+struct processor ;
+struct processor_set ;
+struct semaphore ;
+struct lock_set ;
+struct ledger ;
+struct alarm ;
+struct clock ;
+
+__END_DECLS
+
+#endif	/* MACH_KERNEL_PRIVATE */
+
+#else	/* KERNEL */
+
+/*
+ * If we are not in the kernel, then these will all be represented by
+ * ports at user-space.
+ */
+typedef mach_port_t		task_t;
+typedef mach_port_t		task_name_t;
+typedef mach_port_t		thread_t;
+typedef	mach_port_t		thread_act_t;
+typedef mach_port_t		ipc_space_t;
+typedef mach_port_t		host_t;
+typedef mach_port_t		host_priv_t;
+typedef mach_port_t		host_security_t;
+typedef mach_port_t		processor_t;
+typedef mach_port_t		processor_set_t;
+typedef mach_port_t		processor_set_control_t;
+typedef mach_port_t		semaphore_t;
+typedef mach_port_t		lock_set_t;
+typedef mach_port_t		ledger_t;
+typedef mach_port_t		alarm_t;
+typedef mach_port_t		clock_serv_t;
+typedef mach_port_t		clock_ctrl_t;
+
+#endif	/* KERNEL */
+
+/*
+ * These aren't really unique types.  They are just called
+ * out as unique types at one point in history.  So we list
+ * them here for compatibility.
+ */
+typedef processor_set_t		processor_set_name_t;
+
+/*
+ * These types are just hard-coded as ports
+ */
+typedef mach_port_t		clock_reply_t;
+typedef mach_port_t		bootstrap_t;
+typedef	mach_port_t		mem_entry_name_port_t;
+typedef mach_port_t		exception_handler_t;
+typedef exception_handler_t	*exception_handler_array_t;
+typedef mach_port_t		vm_task_entry_t;
+typedef mach_port_t		io_master_t;
+typedef mach_port_t		UNDServerRef;
+
+/*
+ * Mig doesn't translate the components of an array.
+ * For example, Mig won't use the thread_t translations
+ * to translate a thread_array_t argument.  So, these definitions
+ * are not completely accurate at the moment for other kernel
+ * components.
+ */
+typedef task_t			*task_array_t;
+typedef thread_t		*thread_array_t;
+typedef processor_set_t		*processor_set_array_t;
+typedef processor_set_t		*processor_set_name_array_t;
+typedef processor_t		*processor_array_t;
+typedef	thread_act_t		*thread_act_array_t;
+typedef ledger_t		*ledger_array_t;
+
+/*
+ * However the real mach_types got declared, we also have to declare
+ * types with "port" in the name for compatability with the way OSF
+ * had declared the user interfaces at one point.  Someday these should
+ * go away.
+ */
+typedef task_t			task_port_t;
+typedef	task_array_t		task_port_array_t;
+typedef thread_t		thread_port_t;
+typedef	thread_array_t		thread_port_array_t;
+typedef ipc_space_t		ipc_space_port_t;
+typedef host_t			host_name_t;
+typedef host_t			host_name_port_t;
+typedef processor_set_t		processor_set_port_t;
+typedef processor_set_t		processor_set_name_port_t;
+typedef processor_set_array_t	processor_set_name_port_array_t;
+typedef processor_set_t		processor_set_control_port_t;
+typedef processor_t		processor_port_t;
+typedef processor_array_t	processor_port_array_t;
+typedef thread_act_t		thread_act_port_t;
+typedef	thread_act_array_t	thread_act_port_array_t;
+typedef semaphore_t		semaphore_port_t;
+typedef lock_set_t		lock_set_port_t;
+typedef ledger_t		ledger_port_t;
+typedef ledger_array_t		ledger_port_array_t;
+typedef alarm_t			alarm_port_t;
+typedef clock_serv_t		clock_serv_port_t;
+typedef clock_ctrl_t		clock_ctrl_port_t;
+typedef exception_handler_t	exception_port_t;
+typedef exception_handler_array_t exception_port_arrary_t;
+
+
+#define TASK_NULL		((task_t) 0)
+#define TASK_NAME_NULL		((task_name_t) 0)
+#define THREAD_NULL		((thread_t) 0)
+#define THR_ACT_NULL 		((thread_act_t) 0)
+#define IPC_SPACE_NULL		((ipc_space_t) 0)
+#define HOST_NULL		((host_t) 0)
+#define HOST_PRIV_NULL		((host_priv_t)0)
+#define HOST_SECURITY_NULL	((host_security_t)0)
+#define PROCESSOR_SET_NULL	((processor_set_t) 0)
+#define PROCESSOR_NULL		((processor_t) 0)
+#define SEMAPHORE_NULL		((semaphore_t) 0)
+#define LOCK_SET_NULL		((lock_set_t) 0)
+#define LEDGER_NULL 		((ledger_t) 0)
+#define ALARM_NULL		((alarm_t) 0)
+#define CLOCK_NULL		((clock_t) 0)
+#define UND_SERVER_NULL		((UNDServerRef) 0)
+
+typedef natural_t 		ledger_item_t;
+#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
+
+typedef mach_vm_offset_t	*emulation_vector_t;
+typedef char			*user_subsystem_t;
+
+/*
+ *	Backwards compatibility, for those programs written
+ *	before mach/{std,mach}_types.{defs,h} were set up.
+ */
+#include <mach/std_types.h>
+
+#endif	/* _MACH_MACH_TYPES_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mach_vm.defs b/xnu-792.18.15/osfmk/mach/mach_vm.defs
new file mode 100644
index 0000000..9267f7e
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mach_vm.defs
@@ -0,0 +1,447 @@
+/*
+ * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_vm.defs
+ *
+ *	Exported kernel VM calls (for any task on the platform).
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+	  mach_vm
+#else
+	  vm_map_lp64_local
+#endif
+	  4800;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach_debug/mach_debug_types.defs>
+
+/*
+ *	Allocate zero-filled memory in the address space
+ *	of the target task, either at the specified address,
+ *	or wherever space can be found (controlled by flags),
+ *	of the specified size.  The address at which the
+ *	allocation actually took place is returned.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_allocate(
+#else
+routine vm_allocate(
+#endif
+		target		: vm_task_entry_t;
+	inout	address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		flags		: int);
+
+/*
+ *	Deallocate the specified range from the virtual
+ *	address space of the target virtual memory map.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_deallocate(
+#else
+routine vm_deallocate(
+#endif
+		target		: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t);
+
+/*
+ *	Set the current or maximum protection attribute
+ *	for the specified range of the virtual address
+ *	space of the target virtual memory map.  The current
+ *	protection limits the memory access rights of threads
+ *	within the map; the maximum protection limits the accesses
+ *	that may be given in the current protection.
+ *	Protections are specified as a set of {read, write, execute}
+ *	*permissions*.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_protect(
+#else
+routine vm_protect(
+#endif
+		target_task	: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		set_maximum	: boolean_t;
+		new_protection	: vm_prot_t);
+
+/*
+ *	Set the inheritance attribute for the specified range
+ *	of the virtual address space of the target address space.
+ *	The inheritance value is one of {none, copy, share}, and
+ *	specifies how the child address space should acquire
+ *	this memory at the time of a task_create call.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_inherit(
+#else
+routine vm_inherit(
+#endif
+		target_task	: vm_task_entry_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		new_inheritance	: vm_inherit_t);
+
+/*
+ *	Returns the contents of the specified range of the
+ *	virtual address space of the target task.  [The
+ *	range must be aligned on a virtual page boundary,
+ *	and must be a multiple of pages in extent.  The
+ *	protection on the specified range must permit reading.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_read(
+#else
+routine vm_read(
+#endif
+		target_task	: vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+	out	data		: pointer_t);
+
+/* 
+ * List corrollary to vm_read, returns mapped contents of specified
+ * ranges within target address space.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_read_list(
+#else
+routine vm_read_list(
+#endif
+		target_task 	: vm_map_t;
+	inout	data_list   	: mach_vm_read_entry_t;
+		count		: natural_t);
+
+/*
+ *	Writes the contents of the specified range of the
+ *	virtual address space of the target task.  [The
+ *	range must be aligned on a virtual page boundary,
+ *	and must be a multiple of pages in extent.  The
+ *	protection on the specified range must permit writing.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_write(
+#else
+routine vm_write(
+#endif
+		target_task	: vm_map_t;
+		address		: mach_vm_address_t;
+		data		: pointer_t);
+
+/*
+ *	Copy the contents of the source range of the virtual
+ *	address space of the target task to the destination
+ *	range in that same address space.  [Both of the
+ *	ranges must be aligned on a virtual page boundary,
+ *	and must be multiples of pages in extent.  The
+ *	protection on the source range must permit reading,
+ *	and the protection on the destination range must
+ *	permit writing.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_copy(
+#else
+routine vm_copy(
+#endif
+		target_task	: vm_map_t;
+		source_address	: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		dest_address	: mach_vm_address_t);
+
+/*
+ *	Returns the contents of the specified range of the
+ *	virtual address space of the target task.  [There
+ *	are no alignment restrictions, and the results will
+ *      overwrite the area pointed to by data - which must
+ *      already exist. The protection on the specified range
+ *	must permit reading.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_read_overwrite(
+#else
+routine vm_read_overwrite(
+#endif
+		target_task	: vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		data		: mach_vm_address_t;
+	out	outsize		: mach_vm_size_t);
+
+
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_msync(
+#else
+routine vm_msync(
+#endif
+		target_task	: vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		sync_flags	: vm_sync_t );
+
+/*
+ *	Set the paging behavior attribute for the specified range
+ *	of the virtual address space of the target task.
+ *	The behavior value is one of {default, random, forward 
+ *	sequential, reverse sequential} and indicates the expected
+ *	page reference pattern for the specified range.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_behavior_set(
+#else
+routine vm_behavior_set(
+#endif
+		target_task	: vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		new_behavior	: vm_behavior_t);
+
+
+/*
+ *	Map a user-supplie memory object into the virtual address
+ *	space of the target task.  If desired (anywhere is TRUE),
+ *	the kernel will find a suitable address range of the
+ *	specified size; else, the specific address will be allocated.
+ *
+ *	The beginning address of the range will be aligned on a virtual
+ *	page boundary, be at or beyond the address specified, and
+ *	meet the mask requirements (bits turned on in the mask must not
+ *	be turned on in the result); the size of the range, in bytes,
+ *	will be rounded	up to an integral number of virtual pages.
+ *
+ *	The memory in the resulting range will be associated with the
+ *	specified memory object, with the beginning of the memory range
+ *	referring to the specified offset into the memory object.
+ *
+ *	The mapping will take the current and maximum protections and
+ *	the inheritance attributes specified; see the vm_protect and
+ *	vm_inherit calls for a description of these attributes.
+ *
+ *	If desired (copy is TRUE), the memory range will be filled
+ *	with a copy of the data from the memory object; this copy will
+ *	be private to this mapping in this target task.  Otherwise,
+ *	the memory in this mapping will be shared with other mappings
+ *	of the same memory object at the same offset (in this task or
+ *	in other tasks).  [The Mach kernel only enforces shared memory
+ *	consistency among mappings on one host with similar page alignments.
+ *	The user-defined memory manager for this object is responsible
+ *	for further consistency.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_map(
+#else
+routine vm_map(
+#endif
+		target_task	: vm_task_entry_t;
+	inout	address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		mask		: mach_vm_offset_t;
+		flags		: int;
+		object		: mem_entry_name_port_t;
+		offset		: memory_object_offset_t;
+		copy		: boolean_t;
+		cur_protection	: vm_prot_t;
+		max_protection	: vm_prot_t;
+		inheritance	: vm_inherit_t);
+
+/*
+ *	Set/Get special properties of memory associated
+ *	to some virtual address range, such as cachability, 
+ *	migrability, replicability.  Machine-dependent.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_machine_attribute(
+#else
+routine vm_machine_attribute(
+#endif
+		target_task	: vm_map_t;
+		address		: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		attribute	: vm_machine_attribute_t;
+	inout	value		: vm_machine_attribute_val_t);
+
+/*
+ *      Map portion of a task's address space.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_remap(
+#else
+routine vm_remap(
+#endif
+		target_task	: vm_map_t;
+	inout	target_address	: mach_vm_address_t;
+		size		: mach_vm_size_t;
+		mask		: mach_vm_offset_t;
+		anywhere	: boolean_t;
+		src_task	: vm_map_t;
+		src_address	: mach_vm_address_t;
+		copy		: boolean_t;
+	out	cur_protection	: vm_prot_t;
+	out	max_protection	: vm_prot_t;
+		inheritance	: vm_inherit_t);
+
+/*
+ *      Give the caller information on the given location in a virtual
+ *      address space.  If a page is mapped return ref and dirty info.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_page_query(
+#else
+routine vm_map_page_query(
+#endif
+                target_map      :vm_map_t;
+                offset          :mach_vm_offset_t;
+        out     disposition     :integer_t;
+        out     ref_count       :integer_t);
+
+
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_region_recurse(
+#else
+routine vm_region_recurse_64(
+#endif
+                target_task     : vm_map_t;
+	inout	address		: mach_vm_address_t;
+        out     size            : mach_vm_size_t;
+	inout	nesting_depth	: natural_t;
+	out	info		: vm_region_recurse_info_t,CountInOut);
+
+/*
+ *      Returns information about the contents of the virtual
+ *      address space of the target task at the specified
+ *      address.  The returned protection, inheritance, sharing
+ *      and memory object values apply to the entire range described
+ *      by the address range returned; the memory object offset
+ *      corresponds to the beginning of the address range.
+ *      [If the specified address is not allocated, the next
+ *      highest address range is described.  If no addresses beyond
+ *      the one specified are allocated, the call returns KERN_NO_SPACE.]
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_region(
+#else
+routine vm_region_64(
+#endif
+                target_task     : vm_map_t;
+	inout	address		: mach_vm_address_t;
+        out     size            : mach_vm_size_t;
+		flavor		: vm_region_flavor_t;
+	out	info		: vm_region_info_t, CountInOut;
+        out     object_name     : memory_object_name_t =
+                                        MACH_MSG_TYPE_MOVE_SEND
+                                        ctype: mach_port_t);
+
+/*
+ *	Allow application level processes to create named entries which
+ *	correspond to mapped portions of their address space.  These named
+ *	entries can then be manipulated, shared with other processes in
+ *	other address spaces and ultimately mapped in ohter address spaces
+ *
+ *	THIS INTERFACE IS STILL EVOLVING.
+ */
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine _mach_make_memory_entry(
+#else
+routine mach_make_memory_entry_64(
+#endif
+		target_task	:vm_map_t;
+	inout	size		:memory_object_size_t;
+		offset		:memory_object_offset_t;
+		permission	:vm_prot_t;
+	out	object_handle	:mem_entry_name_port_move_send_t;
+		parent_handle	:mem_entry_name_port_t);
+
+
+/****************************** Legacy section ***************************/
+/*  The following definitions are exist to provide compatibility with    */
+/*  the legacy APIs.  They are no different.  We just need to produce    */
+/*  the user-level stub interface for them.                              */
+/****************************** Legacy section ***************************/
+
+
+/*
+ * These interfaces just aren't supported in the new (wide) model:
+ *
+ *	mach_vm_region_info() -
+ *	vm_map_pages_info() -
+ *		no user-level replacement for these MACH_DEBUG interfaces
+ *	vm_map_get_upl() -
+ *		no user-level replacement at the moment
+ *	vm_region_info() -
+ *		use mach_vm_region_info() or vm_region_info_64()
+ *	vm_region_recurse() -
+ *		use mach_vm_region_recurse() or vm_region_recurse_64()
+ */
+
+/*
+ * The following legacy interfaces are provides as macro wrappers to the new
+ * interfaces.  You should strive to use the new ones instead:
+ *
+ *	vm_map() -
+ *		use mach_vm_map() or vm_map_64()
+ *	vm_region() -
+ *		use mach_vm_region() or vm_region_64()
+ *	mach_make_memory_entry() -
+ *		use mach_vm_make_memory_entry() or mach_make_memory_entry_64()
+ */
diff --git a/xnu-792.18.15/osfmk/mach/machine.h b/xnu-792.18.15/osfmk/mach/machine.h
new file mode 100644
index 0000000..e6d82b0
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/machine.h
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*	File:	machine.h
+ *	Author:	Avadis Tevanian, Jr.
+ *	Date:	1986
+ *
+ *	Machine independent machine abstraction.
+ */
+
+#ifndef	_MACH_MACHINE_H_
+#define _MACH_MACHINE_H_
+
+#include <stdint.h>
+#include <mach/machine/vm_types.h>
+#include <mach/boolean.h>
+
+typedef integer_t	cpu_type_t;
+typedef integer_t	cpu_subtype_t;
+typedef integer_t	cpu_threadtype_t;
+
+#define CPU_STATE_MAX		4
+
+#define CPU_STATE_USER		0
+#define CPU_STATE_SYSTEM	1
+#define CPU_STATE_IDLE		2
+#define CPU_STATE_NICE		3
+
+#ifdef	KERNEL_PRIVATE
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+cpu_type_t			cpu_type(void);
+
+cpu_subtype_t		cpu_subtype(void);
+
+cpu_threadtype_t	cpu_threadtype(void);
+__END_DECLS
+
+#ifdef	MACH_KERNEL_PRIVATE
+
+struct machine_info {
+	integer_t	major_version;		/* kernel major version id */
+	integer_t	minor_version;		/* kernel minor version id */
+	integer_t	max_cpus;			/* max number of CPUs possible */
+	integer_t	avail_cpus;			/* number of CPUs now available */
+	uint32_t	memory_size;		/* size of memory in bytes, capped at 2 GB */
+	uint64_t	max_mem;			/* actual size of physical memory */
+	integer_t	physical_cpu;		/* number of physical CPUs now available */
+	integer_t	physical_cpu_max;	/* max number of physical CPUs possible */
+	integer_t	logical_cpu;		/* number of logical cpu now available */
+	integer_t	logical_cpu_max;	/* max number of physical CPUs possible */
+};
+
+typedef struct machine_info	*machine_info_t;
+typedef struct machine_info	machine_info_data_t;
+
+extern struct machine_info	machine_info;
+
+__BEGIN_DECLS
+cpu_type_t			slot_type(
+						int		slot_num);
+
+cpu_subtype_t		slot_subtype(
+						int		slot_num);
+
+cpu_threadtype_t	slot_threadtype(
+						int		slot_num);
+__END_DECLS
+
+#endif	/* MACH_KERNEL_PRIVATE */
+#endif	/* KERNEL_PRIVATE */
+
+
+/*
+ * Capability bits used in the definition of cpu_type.
+ */
+#define	CPU_ARCH_MASK	0xff000000		/* mask for architecture bits */
+#define CPU_ARCH_ABI64	0x01000000		/* 64 bit ABI */
+
+/*
+ *	Machine types known by all.
+ */
+ 
+#define CPU_TYPE_ANY		((cpu_type_t) -1)
+
+#define CPU_TYPE_VAX		((cpu_type_t) 1)
+/* skip				((cpu_type_t) 2)	*/
+/* skip				((cpu_type_t) 3)	*/
+/* skip				((cpu_type_t) 4)	*/
+/* skip				((cpu_type_t) 5)	*/
+#define	CPU_TYPE_MC680x0	((cpu_type_t) 6)
+#define CPU_TYPE_X86		((cpu_type_t) 7)
+#define CPU_TYPE_I386		CPU_TYPE_X86		/* compatibility */
+#define	CPU_TYPE_X86_64		(CPU_TYPE_X86 | CPU_ARCH_ABI64)
+
+/* skip CPU_TYPE_MIPS		((cpu_type_t) 8)	*/
+/* skip 			((cpu_type_t) 9)	*/
+#define CPU_TYPE_MC98000	((cpu_type_t) 10)
+#define CPU_TYPE_HPPA           ((cpu_type_t) 11)
+/* skip CPU_TYPE_ARM		((cpu_type_t) 12)	*/
+#define CPU_TYPE_MC88000	((cpu_type_t) 13)
+#define CPU_TYPE_SPARC		((cpu_type_t) 14)
+#define CPU_TYPE_I860		((cpu_type_t) 15)
+/* skip	CPU_TYPE_ALPHA		((cpu_type_t) 16)	*/
+/* skip				((cpu_type_t) 17)	*/
+#define CPU_TYPE_POWERPC		((cpu_type_t) 18)
+#define CPU_TYPE_POWERPC64		(CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
+
+/*
+ *	Machine subtypes (these are defined here, instead of in a machine
+ *	dependent directory, so that any program can get all definitions
+ *	regardless of where is it compiled).
+ */
+
+/*
+ *	Object files that are hand-crafted to run on any
+ *	implementation of an architecture are tagged with
+ *	CPU_SUBTYPE_MULTIPLE.  This functions essentially the same as
+ *	the "ALL" subtype of an architecture except that it allows us
+ *	to easily find object files that may need to be modified
+ *	whenever a new implementation of an architecture comes out.
+ *
+ *	It is the responsibility of the implementor to make sure the
+ *	software handles unsupported implementations elegantly.
+ */
+#define	CPU_SUBTYPE_MULTIPLE		((cpu_subtype_t) -1)
+#define CPU_SUBTYPE_LITTLE_ENDIAN	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_BIG_ENDIAN		((cpu_subtype_t) 1)
+
+/*
+ *     Machine threadtypes.
+ *     This is none - not defined - for most machine types/subtypes.
+ */
+#define CPU_THREADTYPE_NONE		((cpu_threadtype_t) 0)
+
+/*
+ *	VAX subtypes (these do *not* necessary conform to the actual cpu
+ *	ID assigned by DEC available via the SID register).
+ */
+
+#define	CPU_SUBTYPE_VAX_ALL	((cpu_subtype_t) 0) 
+#define CPU_SUBTYPE_VAX780	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_VAX785	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_VAX750	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_VAX730	((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_UVAXI	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_UVAXII	((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_VAX8200	((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_VAX8500	((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_VAX8600	((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_VAX8650	((cpu_subtype_t) 10)
+#define CPU_SUBTYPE_VAX8800	((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_UVAXIII	((cpu_subtype_t) 12)
+
+/*
+ * 	680x0 subtypes
+ *
+ * The subtype definitions here are unusual for historical reasons.
+ * NeXT used to consider 68030 code as generic 68000 code.  For
+ * backwards compatability:
+ * 
+ *	CPU_SUBTYPE_MC68030 symbol has been preserved for source code
+ *	compatability.
+ *
+ *	CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
+ *	subtype as CPU_SUBTYPE_MC68030 for binary comatability.
+ *
+ *	CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
+ *	files to be tagged as containing 68030-specific instructions.
+ */
+
+#define	CPU_SUBTYPE_MC680x0_ALL		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MC68030		((cpu_subtype_t) 1) /* compat */
+#define CPU_SUBTYPE_MC68040		((cpu_subtype_t) 2) 
+#define	CPU_SUBTYPE_MC68030_ONLY	((cpu_subtype_t) 3)
+
+/*
+ *	I386 subtypes
+ */
+
+#define CPU_SUBTYPE_INTEL(f, m)	((cpu_subtype_t) (f) + ((m) << 4))
+
+#define	CPU_SUBTYPE_I386_ALL			CPU_SUBTYPE_INTEL(3, 0)
+#define CPU_SUBTYPE_386					CPU_SUBTYPE_INTEL(3, 0)
+#define CPU_SUBTYPE_486					CPU_SUBTYPE_INTEL(4, 0)
+#define CPU_SUBTYPE_486SX				CPU_SUBTYPE_INTEL(4, 8)	// 8 << 4 = 128
+#define CPU_SUBTYPE_586					CPU_SUBTYPE_INTEL(5, 0)
+#define CPU_SUBTYPE_PENT	CPU_SUBTYPE_INTEL(5, 0)
+#define CPU_SUBTYPE_PENTPRO	CPU_SUBTYPE_INTEL(6, 1)
+#define CPU_SUBTYPE_PENTII_M3	CPU_SUBTYPE_INTEL(6, 3)
+#define CPU_SUBTYPE_PENTII_M5	CPU_SUBTYPE_INTEL(6, 5)
+#define CPU_SUBTYPE_CELERON				CPU_SUBTYPE_INTEL(7, 6)
+#define CPU_SUBTYPE_CELERON_MOBILE		CPU_SUBTYPE_INTEL(7, 7)
+#define CPU_SUBTYPE_PENTIUM_3			CPU_SUBTYPE_INTEL(8, 0)
+#define CPU_SUBTYPE_PENTIUM_3_M			CPU_SUBTYPE_INTEL(8, 1)
+#define CPU_SUBTYPE_PENTIUM_3_XEON		CPU_SUBTYPE_INTEL(8, 2)
+#define CPU_SUBTYPE_PENTIUM_M			CPU_SUBTYPE_INTEL(9, 0)
+#define CPU_SUBTYPE_PENTIUM_4			CPU_SUBTYPE_INTEL(10, 0)
+#define CPU_SUBTYPE_PENTIUM_4_M			CPU_SUBTYPE_INTEL(10, 1)
+#define CPU_SUBTYPE_ITANIUM				CPU_SUBTYPE_INTEL(11, 0)
+#define CPU_SUBTYPE_ITANIUM_2			CPU_SUBTYPE_INTEL(11, 1)
+#define CPU_SUBTYPE_XEON				CPU_SUBTYPE_INTEL(12, 0)
+#define CPU_SUBTYPE_XEON_MP				CPU_SUBTYPE_INTEL(12, 1)
+
+#define CPU_SUBTYPE_INTEL_FAMILY(x)	((x) & 15)
+#define CPU_SUBTYPE_INTEL_FAMILY_MAX	15
+
+#define CPU_SUBTYPE_INTEL_MODEL(x)	((x) >> 4)
+#define CPU_SUBTYPE_INTEL_MODEL_ALL	0
+
+/*
+ *	X86 subtypes.
+ */
+
+#define CPU_SUBTYPE_X86_ALL		((cpu_subtype_t)3)
+#define CPU_SUBTYPE_X86_64_ALL		((cpu_subtype_t)3)
+#define CPU_SUBTYPE_X86_ARCH1		((cpu_subtype_t)4)
+
+
+#define CPU_THREADTYPE_INTEL_HTT	((cpu_threadtype_t) 1)
+
+/*
+ *	Mips subtypes.
+ */
+
+#define	CPU_SUBTYPE_MIPS_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MIPS_R2300	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MIPS_R2600	((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_MIPS_R2800	((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_MIPS_R2000a	((cpu_subtype_t) 4)	/* pmax */
+#define CPU_SUBTYPE_MIPS_R2000	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_MIPS_R3000a	((cpu_subtype_t) 6)	/* 3max */
+#define CPU_SUBTYPE_MIPS_R3000	((cpu_subtype_t) 7)
+
+/*
+ *	MC98000 (PowerPC) subtypes
+ */
+#define	CPU_SUBTYPE_MC98000_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MC98601	((cpu_subtype_t) 1)
+
+/*
+ *	HPPA subtypes for Hewlett-Packard HP-PA family of
+ *	risc processors. Port by NeXT to 700 series. 
+ */
+
+#define	CPU_SUBTYPE_HPPA_ALL		((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_HPPA_7100		((cpu_subtype_t) 0) /* compat */
+#define CPU_SUBTYPE_HPPA_7100LC		((cpu_subtype_t) 1)
+
+/*
+ *	MC88000 subtypes.
+ */
+#define	CPU_SUBTYPE_MC88000_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_MC88100	((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_MC88110	((cpu_subtype_t) 2)
+
+/*
+ *	SPARC subtypes
+ */
+#define	CPU_SUBTYPE_SPARC_ALL		((cpu_subtype_t) 0)
+
+/*
+ *	I860 subtypes
+ */
+#define CPU_SUBTYPE_I860_ALL	((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_I860_860	((cpu_subtype_t) 1)
+
+/*
+ *	PowerPC subtypes
+ */
+#define CPU_SUBTYPE_POWERPC_ALL		((cpu_subtype_t) 0)
+#define CPU_SUBTYPE_POWERPC_601		((cpu_subtype_t) 1)
+#define CPU_SUBTYPE_POWERPC_602		((cpu_subtype_t) 2)
+#define CPU_SUBTYPE_POWERPC_603		((cpu_subtype_t) 3)
+#define CPU_SUBTYPE_POWERPC_603e	((cpu_subtype_t) 4)
+#define CPU_SUBTYPE_POWERPC_603ev	((cpu_subtype_t) 5)
+#define CPU_SUBTYPE_POWERPC_604		((cpu_subtype_t) 6)
+#define CPU_SUBTYPE_POWERPC_604e	((cpu_subtype_t) 7)
+#define CPU_SUBTYPE_POWERPC_620		((cpu_subtype_t) 8)
+#define CPU_SUBTYPE_POWERPC_750		((cpu_subtype_t) 9)
+#define CPU_SUBTYPE_POWERPC_7400	((cpu_subtype_t) 10)
+#define CPU_SUBTYPE_POWERPC_7450	((cpu_subtype_t) 11)
+#define CPU_SUBTYPE_POWERPC_970		((cpu_subtype_t) 100)
+
+/*
+ *      CPU families (sysctl hw.cpufamily)
+ *
+ * NB: the encodings of the CPU families are intentionally arbitrary.
+ * There is no ordering, and you should never try to deduce whether
+ * or not some feature is available based on the family.
+ * Use feature flags (eg, hw.optional.altivec) to test for optional
+ * functionality.
+ */
+#define CPUFAMILY_UNKNOWN    0
+#define CPUFAMILY_POWERPC_G3 0xcee41549
+#define CPUFAMILY_POWERPC_G4 0x77c184ae
+#define CPUFAMILY_POWERPC_G5 0xed76d8aa
+#define CPUFAMILY_INTEL_6_14 0x73d67300  /* Intel Core Solo and Intel Core Duo (32-bit Pentium-M with SSE3) */
+#define CPUFAMILY_INTEL_6_15 0x426f69ef  /* Intel Core 2 */
+
+#endif	/* _MACH_MACHINE_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/memory_object.defs b/xnu-792.18.15/osfmk/mach/memory_object.defs
new file mode 100644
index 0000000..6cf4f89
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/memory_object.defs
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * File:	mach/memory_object.defs
+ *
+ * Abstract:
+ *	Basic Mach external memory management interface declaration.
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		     memory_object 2200;
+
+#ifdef	MACH_KERNEL
+#include <advisory_pageout.h>
+#endif	/* MACH_KERNEL */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+#if	KERNEL_SERVER
+serverprefix dp_;
+#endif
+
+/*
+ *	Initialize the specified memory object, providing
+ *	a memory object control reference on which to make
+ *   cache control calls.
+ *	[To allow the mapping of this object to be used, the
+ *	memory manager must call memory_object_set_attributes,
+ *	specifying the "ready" parameter as TRUE.  To reject
+ *	all mappings of this object, the memory manager may
+ *	use memory_object_destroy.]
+ */
+routine	memory_object_init(
+		memory_object		: memory_object_t;
+		memory_control	: memory_object_control_t;
+		memory_object_page_size	: memory_object_cluster_size_t);
+
+
+/*
+ *	Indicates that the specified memory object is no longer
+ *	mapped (or cached -- see memory_object_set_attributes),
+ *	and that further mappings will cause another memory_object_init
+ *	call to be made.  
+ *
+ *	[The kernel will release its reference on the memory object
+ *	after this call returns.  The memory object control associated
+ *	with the memory object is no longer usable - the pager should
+ *	drop the control reference granted to it by memory_object_init.]
+ */
+routine	memory_object_terminate(
+		memory_object		: memory_object_t);
+
+/*
+ *	Request data from this memory object.  At least
+ *	the specified data should be returned with at
+ *	least the specified access permitted.
+ *
+ *	[Response should be upl commit over the specified range.]
+ */
+routine	memory_object_data_request(
+		memory_object		: memory_object_t;
+		offset			: memory_object_offset_t;
+		length			: memory_object_cluster_size_t;
+		desired_access		: vm_prot_t);
+
+/*
+ *	Return data to manager.  This call is used in place of data_write
+ *	for objects initialized by object_ready instead of set_attributes.
+ *	This call indicates whether the returned data is dirty and whether
+ *	the kernel kept a copy.  Precious data remains precious if the
+ *	kernel keeps a copy.  The indication that the kernel kept a copy
+ *	is only a hint if the data is not precious; the cleaned copy may
+ *	be discarded without further notifying the manager.
+ *
+ *	[response should be a upl_commit over the range specified]
+ */
+routine   memory_object_data_return(
+		memory_object		: memory_object_t;
+		offset		 	: memory_object_offset_t;
+		size			: memory_object_cluster_size_t;
+	out	resid_offset	 	: memory_object_offset_t;
+	out	io_error		: int;
+		dirty			: boolean_t;
+		kernel_copy		: boolean_t;
+		upl_flags		: int);
+
+/*
+ *	Provide initial data contents for this region of
+ *	the memory object.  If data has already been written
+ *	to the object, this value must be discarded; otherwise,
+ *	this call acts identically to memory_object_data_return.
+ *
+ *	[response should be UPL commit over the specified range.]
+ */
+routine	memory_object_data_initialize(
+		memory_object		: memory_object_t;
+		offset			: memory_object_offset_t;
+		size			: memory_object_cluster_size_t);
+
+/*
+ *	Request that the specified portion of this
+ *	memory object be unlocked to allow the specified
+ *	forms of access; the kernel already has the data.
+ *
+ *	[Response should be memory_object_lock_request when
+ *	the operation is fully complete.]
+ */
+routine	memory_object_data_unlock(
+		memory_object		: memory_object_t;
+		offset			: memory_object_offset_t;
+		size			: memory_object_cluster_size_t;
+		desired_access		: vm_prot_t);
+
+
+/*
+ *	Request that the specified portion of this
+ *	memory object be synchronized with its backing
+ *	store according to the supplied flags.
+ *
+ *	[Response should be memory_object_synchronize_completed when
+ *	the operation is fully complete.]
+ */
+routine memory_object_synchronize(
+		memory_object           : memory_object_t;
+		offset          	: memory_object_offset_t;
+		size	          	: memory_object_cluster_size_t;
+		sync_flags 	     	: vm_sync_t );
+
+/*
+ *	Notify the pager that the specified memory object
+ *	has no other (mapped) references besides the named
+ *	reference held by the pager itself.
+ *
+ *	[Response should be a release of the named reference when
+ *	the pager deems that appropriate.]
+ */
+routine memory_object_unmap(
+		memory_object           : memory_object_t);
+
+
diff --git a/xnu-792.18.15/osfmk/mach/memory_object.h b/xnu-792.18.15/osfmk/mach/memory_object.h
new file mode 100644
index 0000000..68223b8
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/memory_object.h
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	memory_object.h
+ *	Author:	Michael Wayne Young
+ *
+ *	External memory management interface definition.
+ */
+
+#ifndef	_MACH_MEMORY_OBJECT_H_
+#define _MACH_MEMORY_OBJECT_H_
+
+/*
+ *	User-visible types used in the external memory
+ *	management interface:
+ */
+
+#include <mach/port.h>
+#include <mach/message.h>
+#include <mach/machine/vm_types.h>
+
+typedef	mach_port_t	memory_object_t;
+					/* A memory object ... */
+					/*  Used by the kernel to retrieve */
+					/*  or store data */
+
+typedef	mach_port_t	memory_object_control_t;
+					/* Provided to a memory manager; ... */
+					/*  used to control a memory object */
+
+typedef	mach_port_t	memory_object_name_t;
+					/* Used to describe the memory ... */
+					/*  object in vm_regions() calls */
+
+typedef mach_port_t     memory_object_rep_t;
+					/* Per-client handle for mem object */
+					/*  Used by user programs to specify */
+					/*  the object to map */
+
+typedef	int		memory_object_copy_strategy_t;
+					/* How memory manager handles copy: */
+#define		MEMORY_OBJECT_COPY_NONE		0
+					/* ... No special support */
+#define		MEMORY_OBJECT_COPY_CALL		1
+					/* ... Make call on memory manager */
+#define		MEMORY_OBJECT_COPY_DELAY 	2
+					/* ... Memory manager doesn't
+					 *     change data externally.
+					 */
+#define		MEMORY_OBJECT_COPY_TEMPORARY 	3
+					/* ... Memory manager doesn't
+					 *     change data externally, and
+					 *     doesn't need to see changes.
+					 */
+#define		MEMORY_OBJECT_COPY_SYMMETRIC 	4
+					/* ... Memory manager doesn't
+					 *     change data externally,
+					 *     doesn't need to see changes,
+					 *     and object will not be
+					 *     multiply mapped.
+					 *
+					 *     XXX
+					 *     Not yet safe for non-kernel use.
+					 */
+
+#define		MEMORY_OBJECT_COPY_INVALID	5
+					/* ...	An invalid copy strategy,
+					 *	for external objects which
+					 *	have not been initialized.
+					 *	Allows copy_strategy to be
+					 *	examined without also
+					 *	examining pager_ready and
+					 *	internal.
+					 */
+
+typedef	int		memory_object_return_t;
+					/* Which pages to return to manager
+					   this time (lock_request) */
+#define		MEMORY_OBJECT_RETURN_NONE	0
+					/* ... don't return any. */
+#define		MEMORY_OBJECT_RETURN_DIRTY	1
+					/* ... only dirty pages. */
+#define		MEMORY_OBJECT_RETURN_ALL	2
+					/* ... dirty and precious pages. */
+#define		MEMORY_OBJECT_RETURN_ANYTHING	3
+					/* ... any resident page. */
+
+#define		MEMORY_OBJECT_NULL	MACH_PORT_NULL
+
+
+/*
+ *	Types for the memory object flavor interfaces
+ */
+
+#define MEMORY_OBJECT_INFO_MAX      (1024) 
+typedef int     *memory_object_info_t;      
+typedef int	 memory_object_flavor_t;
+typedef int      memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];
+
+
+#define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 	10	
+#define MEMORY_OBJECT_PERFORMANCE_INFO	11
+#define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO	12
+#define MEMORY_OBJECT_ATTRIBUTE_INFO	14
+#define MEMORY_OBJECT_BEHAVIOR_INFO 	15	
+
+
+struct old_memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+};
+
+struct memory_object_perf_info {
+	memory_object_cluster_size_t	cluster_size;
+	boolean_t						may_cache;
+};
+
+struct old_memory_object_attr_info {			/* old attr list */
+        boolean_t       		object_ready;
+        boolean_t       		may_cache;
+        memory_object_copy_strategy_t 	copy_strategy;
+};
+
+struct memory_object_attr_info {
+	memory_object_copy_strategy_t	copy_strategy;
+	memory_object_cluster_size_t	cluster_size;
+	boolean_t			may_cache_object;
+	boolean_t			temporary;
+};
+
+struct memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+	boolean_t			silent_overwrite;
+	boolean_t			advisory_pageout;
+};
+
+typedef struct old_memory_object_behave_info *old_memory_object_behave_info_t;
+typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t;
+
+typedef struct memory_object_behave_info *memory_object_behave_info_t;
+typedef struct memory_object_behave_info memory_object_behave_info_data_t;
+
+typedef struct memory_object_perf_info 	*memory_object_perf_info_t;
+typedef struct memory_object_perf_info	memory_object_perf_info_data_t;
+
+typedef struct old_memory_object_attr_info *old_memory_object_attr_info_t;
+typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t;
+
+typedef struct memory_object_attr_info	*memory_object_attr_info_t;
+typedef struct memory_object_attr_info	memory_object_attr_info_data_t;
+
+#define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT   	((mach_msg_type_number_t) \
+                (sizeof(old_memory_object_behave_info_data_t)/sizeof(int)))
+#define MEMORY_OBJECT_BEHAVE_INFO_COUNT   	((mach_msg_type_number_t) \
+                (sizeof(memory_object_behave_info_data_t)/sizeof(int)))
+#define MEMORY_OBJECT_PERF_INFO_COUNT		((mach_msg_type_number_t) \
+		(sizeof(memory_object_perf_info_data_t)/sizeof(int)))
+#define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(old_memory_object_attr_info_data_t)/sizeof(int)))
+#define MEMORY_OBJECT_ATTR_INFO_COUNT		((mach_msg_type_number_t) \
+		(sizeof(memory_object_attr_info_data_t)/sizeof(int)))
+
+#define invalid_memory_object_flavor(f)					\
+	(f != MEMORY_OBJECT_ATTRIBUTE_INFO && 				\
+	 f != MEMORY_OBJECT_PERFORMANCE_INFO && 			\
+	 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO &&			\
+	 f != MEMORY_OBJECT_BEHAVIOR_INFO &&				\
+	 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
+
+#endif	/* _MACH_MEMORY_OBJECT_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/memory_object_control.defs b/xnu-792.18.15/osfmk/mach/memory_object_control.defs
new file mode 100644
index 0000000..f537dcc
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/memory_object_control.defs
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * File:	mach/memory_object_control.defs
+ *
+ * Abstract:
+ *	Basic Mach external memory management interface declaration.
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		     memory_object_control 2000;
+
+#ifdef	MACH_KERNEL
+#include <advisory_pageout.h>
+#endif	/* MACH_KERNEL */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+/*
+ *      Retrieves the attributes currently associated with
+ *      a memory object.
+ */
+routine memory_object_get_attributes(
+                memory_control	: memory_object_control_t;
+		flavor		: memory_object_flavor_t;
+	out	attributes	: memory_object_info_t, CountInOut);
+
+
+routine memory_object_change_attributes(
+                memory_control	: memory_object_control_t;
+                flavor          : memory_object_flavor_t;
+        	attributes      : memory_object_info_t
+		);
+
+routine memory_object_synchronize_completed (
+		memory_control	: memory_object_control_t;
+		offset		: memory_object_offset_t;
+		length		: vm_offset_t);
+
+/*
+ *	Control use of the data associated with the given
+ *	memory object.  For each page in the given range,
+ *	perform the following operations, in order:
+ *		1)  restrict access to the page (disallow
+ *		    forms specified by "prot");
+ *		2)  write back modifications (if "should_return"
+ *		    is RETURN_DIRTY and the page is dirty, or
+ *		    "should_return" is RETURN_ALL and the page
+ * 		    is either dirty or precious); and,
+ *		3)  flush the cached copy (if "should_flush"
+ *		    is asserted).
+ *	The set of pages is defined by a starting offset
+ *	("offset") and size ("size").  Only pages with the
+ *	same page alignment as the starting offset are
+ *	considered.
+ */
+routine memory_object_lock_request(
+		memory_control	: memory_object_control_t;
+		offset		: memory_object_offset_t;
+		size		: memory_object_size_t;
+	out	resid_offset	: memory_object_offset_t;
+	out	io_errno	: integer_t;
+		should_return	: memory_object_return_t;
+		flags		: integer_t;
+		lock_value	: vm_prot_t
+		);
+
+
+/*
+ */
+routine memory_object_destroy(
+		memory_control	: memory_object_control_t;
+		reason		: kern_return_t);
+
+/*
+ *	The pager gets memory_object_data_request and memory_object_data_return
+ *	calls to inform it that data within the memory object needs to be
+ *	manipulated.  Those requests simply identify the range in the memory
+ *	object that needs servicing, but not the data itself.  The pager
+ *	turns around and requests one (or several) Universal Page Lists (UPLs)
+ *	from the VM cache object associated with the memory object via one
+ *	of the following calls.  These UPLs are then committed (or aborted)
+ *	in whole (or in ranges) as the processing completes.
+ */
+
+routine memory_object_upl_request(
+		memory_control	: memory_object_control_t;
+	in	offset		: memory_object_offset_t;
+	in	size		: vm_size_t;
+	out	upl		: upl_t;
+	out	page_list	: upl_page_info_array_t, CountInOut;
+	in	cntrl_flags	: integer_t);
+
+routine memory_object_super_upl_request(
+		memory_control		: memory_object_control_t;
+	in	offset		: memory_object_offset_t;
+	in	size		: vm_size_t;
+	in	super_size	: vm_size_t;
+	out	upl		: upl_t;
+	out	page_list	: upl_page_info_array_t, CountInOut;
+	in	cntrl_flags	: integer_t);
+
+/*
+ * This functions allows a single page to be manipulated with less overhead
+ * than creating a UPL.
+ */
+routine memory_object_page_op(
+		memory_control	: memory_object_control_t;
+	in	offset		: memory_object_offset_t;
+	in	ops		: integer_t;
+	out	phys_entry	: uint32_t;
+	out	flags		: integer_t);
+
+routine memory_object_recover_named(
+		memory_control	: memory_object_control_t;
+	in	wait_on_terminating : boolean_t);
+
+routine memory_object_release_name(
+		memory_control	: memory_object_control_t;
+		flags		: integer_t);
+
+routine memory_object_range_op(
+		memory_control	: memory_object_control_t;
+	in	offset_beg	: memory_object_offset_t;
+	in	offset_end	: memory_object_offset_t;
+	in      ops             : integer_t;
+	out     range		: integer_t);
+
+
diff --git a/xnu-792.18.15/osfmk/mach/memory_object_default.defs b/xnu-792.18.15/osfmk/mach/memory_object_default.defs
new file mode 100644
index 0000000..79ef448
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/memory_object_default.defs
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * File:	mach/memory_object_default.defs
+ *
+ * Abstract:
+ *	Mach external memory management interface declaration; subset
+ *	that is applicable to managers of kernel-created memory objects.
+ */
+
+subsystem
+#if	KERNEL_USER
+	KernelUser
+#endif	/* KERNEL_USER */
+#if	KERNEL_SERVER
+	KernelServer
+#endif	/* KERNEL_SERVER */
+		     memory_object_default 2250;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+#if KERNEL_SERVER
+serverprefix default_pager_;
+#endif
+
+/*
+ *	Pass on responsibility for the new kernel-created memory
+ *	object.  The port on which this request is that port
+ *	(possibly a memory object itself) registered as the "default
+ *	pager".  Other arguments are as described for memory_object_init.
+ *	[No reply required.]
+ */
+routine	memory_object_create(
+		default_memory_manager	: memory_object_default_t;
+		new_memory_object_size	: vm_size_t;
+	out	new_memory_object	: memory_object_t);
+
diff --git a/xnu-792.18.15/osfmk/mach/memory_object_name.defs b/xnu-792.18.15/osfmk/mach/memory_object_name.defs
new file mode 100644
index 0000000..d039aa7
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/memory_object_name.defs
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_port.defs
+ *	Author:	Rich Draves
+ *
+ *	Exported kernel calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  memory_object_name 2600;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+/*
+ * References to memory_object_name objects are returned by:
+ *	vm_region(vm_map_t,...)
+ *
+ * These are used simply to compare one mapping againsts another
+ * and have no methods.
+ */
diff --git a/xnu-792.18.15/osfmk/mach/memory_object_types.h b/xnu-792.18.15/osfmk/mach/memory_object_types.h
new file mode 100644
index 0000000..5f55f85
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/memory_object_types.h
@@ -0,0 +1,627 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	memory_object.h
+ *	Author:	Michael Wayne Young
+ *
+ *	External memory management interface definition.
+ */
+
+#ifndef	_MACH_MEMORY_OBJECT_TYPES_H_
+#define _MACH_MEMORY_OBJECT_TYPES_H_
+
+/*
+ *	User-visible types used in the external memory
+ *	management interface:
+ */
+
+#include <mach/port.h>
+#include <mach/message.h>
+#include <mach/vm_prot.h>
+#include <mach/vm_sync.h>
+#include <mach/vm_types.h>
+#include <mach/machine/vm_types.h>
+
+#include <sys/cdefs.h>
+
+#define VM_64_BIT_DATA_OBJECTS
+
+typedef unsigned long long	memory_object_offset_t;
+typedef unsigned long long	memory_object_size_t;
+typedef natural_t		memory_object_cluster_size_t;
+
+
+/*
+ * Temporary until real EMMI version gets re-implemented
+ */
+
+#ifdef	KERNEL_PRIVATE
+
+struct memory_object_pager_ops;	/* forward declaration */
+
+typedef struct 		memory_object {
+	const struct memory_object_pager_ops	*mo_pager_ops;
+} *memory_object_t;
+
+typedef struct		memory_object_control {
+	struct vm_object *moc_object;
+	unsigned int	moc_ikot; /* XXX fake ip_kotype */
+} *memory_object_control_t;
+
+typedef const struct memory_object_pager_ops {
+	void (*memory_object_reference)(
+		memory_object_t mem_obj);
+	void (*memory_object_deallocate)(
+		memory_object_t mem_obj);
+	kern_return_t (*memory_object_init)(
+		memory_object_t mem_obj,
+		memory_object_control_t mem_control,
+		memory_object_cluster_size_t size);
+	kern_return_t (*memory_object_terminate)(
+		memory_object_t mem_obj);
+	kern_return_t (*memory_object_data_request)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		memory_object_cluster_size_t length,
+		vm_prot_t desired_access);
+	kern_return_t (*memory_object_data_return)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		vm_size_t size,
+		memory_object_offset_t *resid_offset,
+		int *io_error,
+		boolean_t dirty,
+		boolean_t kernel_copy,
+		int upl_flags);
+	kern_return_t (*memory_object_data_initialize)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		vm_size_t size);
+	kern_return_t (*memory_object_data_unlock)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		vm_size_t size,
+		vm_prot_t desired_access);
+	kern_return_t (*memory_object_synchronize)(
+		memory_object_t mem_obj,
+		memory_object_offset_t offset,
+		vm_size_t size,
+		vm_sync_t sync_flags);
+	kern_return_t (*memory_object_unmap)(
+		memory_object_t mem_obj);
+	const char *memory_object_pager_name;
+} * memory_object_pager_ops_t;
+
+#else	/* KERNEL_PRIVATE */
+
+typedef mach_port_t	memory_object_t;
+typedef mach_port_t	memory_object_control_t;
+
+#endif	/* KERNEL_PRIVATE */
+
+typedef memory_object_t *memory_object_array_t;
+					/* A memory object ... */
+					/*  Used by the kernel to retrieve */
+					/*  or store data */
+
+typedef	mach_port_t	memory_object_name_t;
+					/* Used to describe the memory ... */
+					/*  object in vm_regions() calls */
+
+typedef mach_port_t	memory_object_default_t;
+					/* Registered with the host ... */
+					/*  for creating new internal objects */
+
+#define MEMORY_OBJECT_NULL		((memory_object_t) 0)
+#define MEMORY_OBJECT_CONTROL_NULL	((memory_object_control_t) 0)
+#define MEMORY_OBJECT_NAME_NULL		((memory_object_name_t) 0)
+#define MEMORY_OBJECT_DEFAULT_NULL	((memory_object_default_t) 0)
+
+
+typedef	int		memory_object_copy_strategy_t;
+					/* How memory manager handles copy: */
+#define		MEMORY_OBJECT_COPY_NONE		0
+					/* ... No special support */
+#define		MEMORY_OBJECT_COPY_CALL		1
+					/* ... Make call on memory manager */
+#define		MEMORY_OBJECT_COPY_DELAY 	2
+					/* ... Memory manager doesn't
+					 *     change data externally.
+					 */
+#define		MEMORY_OBJECT_COPY_TEMPORARY 	3
+					/* ... Memory manager doesn't
+					 *     change data externally, and
+					 *     doesn't need to see changes.
+					 */
+#define		MEMORY_OBJECT_COPY_SYMMETRIC 	4
+					/* ... Memory manager doesn't
+					 *     change data externally,
+					 *     doesn't need to see changes,
+					 *     and object will not be
+					 *     multiply mapped.
+					 *
+					 *     XXX
+					 *     Not yet safe for non-kernel use.
+					 */
+
+#define		MEMORY_OBJECT_COPY_INVALID	5
+					/* ...	An invalid copy strategy,
+					 *	for external objects which
+					 *	have not been initialized.
+					 *	Allows copy_strategy to be
+					 *	examined without also
+					 *	examining pager_ready and
+					 *	internal.
+					 */
+
+typedef	int		memory_object_return_t;
+					/* Which pages to return to manager
+					   this time (lock_request) */
+#define		MEMORY_OBJECT_RETURN_NONE	0
+					/* ... don't return any. */
+#define		MEMORY_OBJECT_RETURN_DIRTY	1
+					/* ... only dirty pages. */
+#define		MEMORY_OBJECT_RETURN_ALL	2
+					/* ... dirty and precious pages. */
+#define		MEMORY_OBJECT_RETURN_ANYTHING	3
+					/* ... any resident page. */
+
+/* 
+ *	Data lock request flags
+ */
+
+#define		MEMORY_OBJECT_DATA_FLUSH 	0x1
+#define		MEMORY_OBJECT_DATA_NO_CHANGE	0x2
+#define		MEMORY_OBJECT_DATA_PURGE	0x4
+#define		MEMORY_OBJECT_COPY_SYNC		0x8
+#define		MEMORY_OBJECT_DATA_SYNC		0x10
+#define         MEMORY_OBJECT_IO_SYNC           0x20
+
+/*
+ *	Types for the memory object flavor interfaces
+ */
+
+#define MEMORY_OBJECT_INFO_MAX      (1024) 
+typedef int     *memory_object_info_t;      
+typedef int	 memory_object_flavor_t;
+typedef int      memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];
+
+
+#define MEMORY_OBJECT_PERFORMANCE_INFO	11
+#define MEMORY_OBJECT_ATTRIBUTE_INFO	14
+#define MEMORY_OBJECT_BEHAVIOR_INFO 	15	
+
+#ifdef	PRIVATE
+
+#define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 	10	
+#define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO	12
+
+struct old_memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+};
+
+struct old_memory_object_attr_info {			/* old attr list */
+        boolean_t       		object_ready;
+        boolean_t       		may_cache;
+        memory_object_copy_strategy_t 	copy_strategy;
+};
+
+typedef struct old_memory_object_behave_info *old_memory_object_behave_info_t;
+typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t;
+typedef struct old_memory_object_attr_info *old_memory_object_attr_info_t;
+typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t;
+
+#define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT   	((mach_msg_type_number_t) \
+                (sizeof(old_memory_object_behave_info_data_t)/sizeof(int)))
+#define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(old_memory_object_attr_info_data_t)/sizeof(int)))
+
+#ifdef KERNEL
+
+__BEGIN_DECLS
+extern void memory_object_reference(memory_object_t object);
+extern void memory_object_deallocate(memory_object_t object);
+
+extern void memory_object_default_reference(memory_object_default_t);
+extern void memory_object_default_deallocate(memory_object_default_t);
+
+extern void memory_object_control_reference(memory_object_control_t control);
+extern void memory_object_control_deallocate(memory_object_control_t control);
+extern int  memory_object_control_uiomove(memory_object_control_t, memory_object_offset_t, void *, int, int, int);
+__END_DECLS
+
+#endif  /* KERNEL */
+
+#endif	/* PRIVATE */
+
+struct memory_object_perf_info {
+	memory_object_cluster_size_t	cluster_size;
+	boolean_t			may_cache;
+};
+
+struct memory_object_attr_info {
+	memory_object_copy_strategy_t	copy_strategy;
+	memory_object_cluster_size_t	cluster_size;
+	boolean_t			may_cache_object;
+	boolean_t			temporary;
+};
+
+struct memory_object_behave_info {
+	memory_object_copy_strategy_t	copy_strategy;	
+	boolean_t			temporary;
+	boolean_t			invalidate;
+	boolean_t			silent_overwrite;
+	boolean_t			advisory_pageout;
+};
+
+
+typedef struct memory_object_behave_info *memory_object_behave_info_t;
+typedef struct memory_object_behave_info memory_object_behave_info_data_t;
+
+typedef struct memory_object_perf_info 	*memory_object_perf_info_t;
+typedef struct memory_object_perf_info	memory_object_perf_info_data_t;
+
+typedef struct memory_object_attr_info	*memory_object_attr_info_t;
+typedef struct memory_object_attr_info	memory_object_attr_info_data_t;
+
+#define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t)	\
+                (sizeof(memory_object_behave_info_data_t)/sizeof(int)))
+#define MEMORY_OBJECT_PERF_INFO_COUNT	((mach_msg_type_number_t)	\
+		(sizeof(memory_object_perf_info_data_t)/sizeof(int)))
+#define MEMORY_OBJECT_ATTR_INFO_COUNT	((mach_msg_type_number_t)	\
+		(sizeof(memory_object_attr_info_data_t)/sizeof(int)))
+
+#define invalid_memory_object_flavor(f)					\
+	(f != MEMORY_OBJECT_ATTRIBUTE_INFO && 				\
+	 f != MEMORY_OBJECT_PERFORMANCE_INFO && 			\
+	 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO &&			\
+	 f != MEMORY_OBJECT_BEHAVIOR_INFO &&				\
+	 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
+
+
+/*
+ * Used to support options on memory_object_release_name call
+ */
+#define MEMORY_OBJECT_TERMINATE_IDLE	0x1
+#define MEMORY_OBJECT_RESPECT_CACHE	0x2
+#define MEMORY_OBJECT_RELEASE_NO_OP	0x4
+
+
+/* named entry processor mapping options */
+/* enumerated */
+#define MAP_MEM_NOOP		0
+#define MAP_MEM_COPYBACK	1
+#define MAP_MEM_IO		2
+#define MAP_MEM_WTHRU		3
+#define MAP_MEM_WCOMB		4	/* Write combining mode */
+					/* aka store gather     */
+
+#define GET_MAP_MEM(flags)	\
+	((((unsigned int)(flags)) >> 24) & 0xFF)
+
+#define SET_MAP_MEM(caching, flags)	\
+	((flags) = ((((unsigned int)(caching)) << 24) \
+			& 0xFF000000) | ((flags) & 0xFFFFFF));
+
+/* leave room for vm_prot bits */
+#define MAP_MEM_ONLY		0x10000	/* change processor caching  */
+#define MAP_MEM_NAMED_CREATE	0x20000 /* create extant object      */
+#define MAP_MEM_PURGABLE	0x40000	/* create a purgable VM object */
+#define MAP_MEM_NAMED_REUSE	0x80000	/* reuse provided entry if identical */
+
+#ifdef KERNEL
+
+/*
+ *  Universal Page List data structures
+ *
+ *  A UPL describes a bounded set of physical pages
+ *  associated with some range of an object or map
+ *  and a snapshot of the attributes associated with
+ *  each of those pages.
+ */
+#ifdef PRIVATE
+#define MAX_UPL_TRANSFER 256
+
+struct upl_page_info {
+	ppnum_t		phys_addr;	/* physical page index number */
+        unsigned int
+#ifdef  XNU_KERNEL_PRIVATE
+                        pageout:1,      /* page is to be removed on commit */
+                        absent:1,       /* No valid data in this page */
+                        dirty:1,        /* Page must be cleaned (O) */
+			precious:1,     /* must be cleaned, we have only copy */
+			device:1,	/* no page data, mapped dev memory */
+                        :0;		/* force to long boundary */
+#else
+			opaque;		/* use upl_page_xxx() accessor funcs */
+#endif /* XNU_KERNEL_PRIVATE */
+};
+
+#else
+
+struct upl_page_info {
+	unsigned int	opaque[2];	/* use upl_page_xxx() accessor funcs */
+};
+
+#endif /* PRIVATE */
+
+typedef struct upl_page_info	upl_page_info_t;
+typedef upl_page_info_t		*upl_page_info_array_t;
+typedef upl_page_info_array_t	upl_page_list_ptr_t;
+
+typedef uint32_t	upl_offset_t;	/* page-aligned byte offset */
+typedef uint32_t	upl_size_t;	/* page-aligned byte size */
+
+/* upl invocation flags */
+/* top nibble is used by super upl */
+
+#define UPL_FLAGS_NONE		0x00000000
+#define UPL_COPYOUT_FROM	0x00000001
+#define UPL_PRECIOUS		0x00000002
+#define UPL_NO_SYNC		0x00000004
+#define UPL_CLEAN_IN_PLACE	0x00000008
+#define UPL_NOBLOCK		0x00000010
+#define UPL_RET_ONLY_DIRTY	0x00000020
+#define UPL_SET_INTERNAL	0x00000040
+#define UPL_QUERY_OBJECT_TYPE	0x00000080
+#define UPL_RET_ONLY_ABSENT	0x00000100 /* used only for COPY_FROM = FALSE */
+#define UPL_FILE_IO             0x00000200
+#define UPL_SET_LITE		0x00000400
+#define UPL_SET_INTERRUPTIBLE	0x00000800
+#define UPL_SET_IO_WIRE		0x00001000
+#define UPL_FOR_PAGEOUT		0x00002000
+#define UPL_WILL_BE_DUMPED      0x00004000
+#define UPL_FORCE_DATA_SYNC	0x00008000
+/* continued after the ticket bits... */
+
+#define UPL_PAGE_TICKET_MASK	0x000F0000
+#define UPL_PAGE_TICKET_SHIFT   16
+
+/* ... flags resume here */
+#define UPL_BLOCK_ACCESS	0x00100000
+#define UPL_ENCRYPT		0x00200000
+#define UPL_NOZEROFILL		0x00400000
+#define UPL_WILL_MODIFY		0x00800000 /* caller will modify the pages */
+
+#define UPL_NEED_32BIT_ADDR	0x01000000
+
+/* UPL flags known by this kernel */
+#define UPL_VALID_FLAGS		0x01FFFFFF
+
+
+/* upl abort error flags */
+#define UPL_ABORT_RESTART	0x1
+#define UPL_ABORT_UNAVAILABLE	0x2
+#define UPL_ABORT_ERROR		0x4
+#define UPL_ABORT_FREE_ON_EMPTY	0x8  /* only implemented in wrappers */
+#define UPL_ABORT_DUMP_PAGES	0x10
+#define UPL_ABORT_NOTIFY_EMPTY	0x20
+#define UPL_ABORT_ALLOW_ACCESS	0x40
+
+/* upl pages check flags */
+#define UPL_CHECK_DIRTY         0x1
+
+
+/*
+ *  upl pagein/pageout  flags
+ *
+ * 
+ * when I/O is issued from this UPL it should be done synchronously
+ */
+#define UPL_IOSYNC	0x1
+
+/*
+ * the passed in UPL should not have either a commit or abort 
+ * applied to it by the underlying layers... the site that
+ * created the UPL is responsible for cleaning it up.
+ */
+#define UPL_NOCOMMIT	0x2
+
+/*
+ * turn off any speculative read-ahead applied at the I/O layer
+ */
+#define UPL_NORDAHEAD	0x4
+
+/*
+ * pageout request is targeting a real file
+ * as opposed to a swap file.
+ */
+
+#define UPL_VNODE_PAGER	0x8
+/*
+ * this pageout is being originated as part of an explicit
+ * memory synchronization operation... no speculative clustering
+ * should be applied, only the range specified should be pushed.
+ */
+#define UPL_MSYNC		0x10
+
+/*
+ *
+ */
+#ifdef MACH_KERNEL_PRIVATE
+#define UPL_PAGING_ENCRYPTED	0x20
+#endif /* MACH_KERNEL_PRIVATE */
+
+/*
+ * this pageout is being originated as part of an explicit
+ * memory synchronization operation that is checking for I/O
+ * errors and taking it's own action... if an error occurs,
+ * just abort the pages back into the cache unchanged
+ */
+#define UPL_KEEPCACHED		0x40
+
+
+
+/* upl commit flags */
+#define UPL_COMMIT_FREE_ON_EMPTY	0x1 /* only implemented in wrappers */
+#define UPL_COMMIT_CLEAR_DIRTY		0x2
+#define UPL_COMMIT_SET_DIRTY		0x4
+#define UPL_COMMIT_INACTIVATE		0x8
+#define UPL_COMMIT_NOTIFY_EMPTY		0x10
+#define UPL_COMMIT_ALLOW_ACCESS		0x20
+
+/* flags for return of state from vm_map_get_upl,  vm_upl address space */
+/* based call */
+#define UPL_DEV_MEMORY			0x1
+#define UPL_PHYS_CONTIG			0x2
+
+
+/* 
+ * Flags for the UPL page ops routine.  This routine is not exported
+ * out of the kernel at the moment and so the defs live here.
+ */
+#define UPL_POP_DIRTY		0x1
+#define UPL_POP_PAGEOUT		0x2
+#define UPL_POP_PRECIOUS		0x4
+#define UPL_POP_ABSENT		0x8
+#define UPL_POP_BUSY			0x10
+
+#define UPL_POP_PHYSICAL	0x10000000
+#define UPL_POP_DUMP		0x20000000
+#define UPL_POP_SET		0x40000000
+#define UPL_POP_CLR		0x80000000
+
+/* 
+ * Flags for the UPL range op routine.  This routine is not exported 
+ * out of the kernel at the moemet and so the defs live here.
+ */
+/*
+ * UPL_ROP_ABSENT: Returns the extent of the range presented which
+ * is absent, starting with the start address presented    
+ */
+#define UPL_ROP_ABSENT		0x01
+/*
+ * UPL_ROP_PRESENT: Returns the extent of the range presented which
+ * is present (i.e. resident), starting with the start address presented
+ */
+#define UPL_ROP_PRESENT		0x02
+/*
+ * UPL_ROP_DUMP: Dump the pages which are found in the target object
+ * for the target range.
+ */
+#define UPL_ROP_DUMP			0x04
+
+#ifdef	PRIVATE
+
+/* access macros for upl_t */
+
+#define UPL_DEVICE_PAGE(upl) \
+	(((upl)[(index)].phys_addr != 0) ? (!((upl)[0].device)) : FALSE)
+
+#define UPL_PAGE_PRESENT(upl, index) \
+	((upl)[(index)].phys_addr != 0)
+
+#define UPL_PHYS_PAGE(upl, index) \
+	((upl)[(index)].phys_addr)
+
+#define UPL_DIRTY_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? ((upl)[(index)].dirty) : FALSE)
+
+#define UPL_PRECIOUS_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? ((upl)[(index)].precious) : FALSE)
+
+#define UPL_VALID_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? (!((upl)[(index)].absent)) : FALSE)
+
+#define UPL_PAGEOUT_PAGE(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ? ((upl)[(index)].pageout) : FALSE)
+
+#define UPL_SET_PAGE_FREE_ON_COMMIT(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ?	      \
+	 ((upl)[(index)].pageout = TRUE) : FALSE)
+
+#define UPL_CLR_PAGE_FREE_ON_COMMIT(upl, index) \
+	(((upl)[(index)].phys_addr != 0) ?       \
+	 ((upl)[(index)].pageout = FALSE) : FALSE)
+
+/* The call prototyped below is used strictly by UPL_GET_INTERNAL_PAGE_LIST */
+
+extern vm_size_t	upl_offset_to_pagelist;
+extern vm_size_t 	upl_get_internal_pagelist_offset(void);
+
+/* UPL_GET_INTERNAL_PAGE_LIST is only valid on internal objects where the */
+/* list request was made with the UPL_INTERNAL flag */
+
+#define UPL_GET_INTERNAL_PAGE_LIST(upl) \
+	((upl_page_info_t *)((upl_offset_to_pagelist == 0) ?  \
+	(unsigned int)upl + (unsigned int)(upl_offset_to_pagelist = upl_get_internal_pagelist_offset()): \
+	(unsigned int)upl + (unsigned int)upl_offset_to_pagelist))
+
+__BEGIN_DECLS
+
+extern ppnum_t	upl_phys_page(upl_page_info_t *upl, int index);
+extern void	upl_clear_dirty(upl_t upl, boolean_t value);
+
+__END_DECLS
+
+#endif /* PRIVATE */
+
+__BEGIN_DECLS
+
+extern boolean_t	upl_page_present(upl_page_info_t *upl, int index);
+extern boolean_t	upl_dirty_page(upl_page_info_t *upl, int index);
+extern boolean_t	upl_valid_page(upl_page_info_t *upl, int index);
+extern void		upl_deallocate(upl_t upl);
+
+__END_DECLS
+
+#endif  /* KERNEL */
+
+#endif	/* _MACH_MEMORY_OBJECT_TYPES_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/message.h b/xnu-792.18.15/osfmk/mach/message.h
new file mode 100644
index 0000000..a07ad5a
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/message.h
@@ -0,0 +1,711 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/message.h
+ *
+ *	Mach IPC message and primitive function definitions.
+ */
+
+#ifndef	_MACH_MESSAGE_H_
+#define _MACH_MESSAGE_H_
+
+#include <stdint.h>
+#include <mach/port.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/machine/vm_types.h>
+
+#include <sys/cdefs.h>
+
+/*
+ *  The timeout mechanism uses mach_msg_timeout_t values,
+ *  passed by value.  The timeout units are milliseconds.
+ *  It is controlled with the MACH_SEND_TIMEOUT
+ *  and MACH_RCV_TIMEOUT options.
+ */
+
+typedef natural_t mach_msg_timeout_t;
+
+/*
+ *  The value to be used when there is no timeout.
+ *  (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
+ */
+
+#define MACH_MSG_TIMEOUT_NONE		((mach_msg_timeout_t) 0)
+
+/*
+ *  The kernel uses MACH_MSGH_BITS_COMPLEX as a hint.  It it isn't on, it
+ *  assumes the body of the message doesn't contain port rights or OOL
+ *  data.  The field is set in received messages.  A user task must
+ *  use caution in interpreting the body of a message if the bit isn't
+ *  on, because the mach_msg_type's in the body might "lie" about the
+ *  contents.  If the bit isn't on, but the mach_msg_types
+ *  in the body specify rights or OOL data, the behavior is undefined.
+ *  (Ie, an error may or may not be produced.)
+ *
+ *  The value of MACH_MSGH_BITS_REMOTE determines the interpretation
+ *  of the msgh_remote_port field.  It is handled like a msgt_name.
+ *
+ *  The value of MACH_MSGH_BITS_LOCAL determines the interpretation
+ *  of the msgh_local_port field.  It is handled like a msgt_name.
+ *
+ *  MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
+ *  and local fields, into a single value suitable for msgh_bits.
+ *
+ *  MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
+ *
+ *  The unused bits should be zero and are reserved for the kernel
+ *  or for future interface expansion.
+ */
+
+#define MACH_MSGH_BITS_ZERO		0x00000000
+#define MACH_MSGH_BITS_REMOTE_MASK	0x000000ff
+#define MACH_MSGH_BITS_LOCAL_MASK	0x0000ff00
+#define MACH_MSGH_BITS_COMPLEX		0x80000000U
+#define MACH_MSGH_BITS_USER             0x8000ffffU
+
+#define	MACH_MSGH_BITS_CIRCULAR		0x40000000	/* internal use only */
+#define	MACH_MSGH_BITS_USED		0xc000ffffU
+
+#define	MACH_MSGH_BITS_PORTS_MASK				\
+		(MACH_MSGH_BITS_REMOTE_MASK|MACH_MSGH_BITS_LOCAL_MASK)
+
+#define MACH_MSGH_BITS(remote, local)				\
+		((remote) | ((local) << 8))
+#define	MACH_MSGH_BITS_REMOTE(bits)				\
+		((bits) & MACH_MSGH_BITS_REMOTE_MASK)
+#define	MACH_MSGH_BITS_LOCAL(bits)				\
+		(((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
+#define	MACH_MSGH_BITS_PORTS(bits)				\
+		((bits) & MACH_MSGH_BITS_PORTS_MASK)
+#define	MACH_MSGH_BITS_OTHER(bits)				\
+		((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
+
+/*
+ *  Every message starts with a message header.
+ *  Following the message header are zero or more pairs of
+ *  type descriptors (mach_msg_type_t/mach_msg_type_long_t) and
+ *  data values.  The size of the message must be specified in bytes,
+ *  and includes the message header, type descriptors, inline
+ *  data, and inline pointer for out-of-line data.
+ *
+ *  The msgh_remote_port field specifies the destination of the message.
+ *  It must specify a valid send or send-once right for a port.
+ *
+ *  The msgh_local_port field specifies a "reply port".  Normally,
+ *  This field carries a send-once right that the receiver will use
+ *  to reply to the message.  It may carry the values MACH_PORT_NULL,
+ *  MACH_PORT_DEAD, a send-once right, or a send right.
+ *
+ *  The msgh_seqno field carries a sequence number associated with the
+ *  received-from port.  A port's sequence number is incremented every
+ *  time a message is received from it.  In sent messages, the field's
+ *  value is ignored.
+ *
+ *  The msgh_id field is uninterpreted by the message primitives.
+ *  It normally carries information specifying the format
+ *  or meaning of the message.
+ */
+
+typedef unsigned int mach_msg_bits_t;
+typedef	natural_t mach_msg_size_t;
+typedef integer_t mach_msg_id_t;
+
+
+#define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
+
+typedef unsigned int mach_msg_type_name_t;
+
+#define MACH_MSG_TYPE_MOVE_RECEIVE	16	/* Must hold receive rights */
+#define MACH_MSG_TYPE_MOVE_SEND		17	/* Must hold send rights */
+#define MACH_MSG_TYPE_MOVE_SEND_ONCE	18	/* Must hold sendonce rights */
+#define MACH_MSG_TYPE_COPY_SEND		19	/* Must hold send rights */
+#define MACH_MSG_TYPE_MAKE_SEND		20	/* Must hold receive rights */
+#define MACH_MSG_TYPE_MAKE_SEND_ONCE	21	/* Must hold receive rights */
+#define MACH_MSG_TYPE_COPY_RECEIVE	22	/* Must hold receive rights */
+
+typedef unsigned int mach_msg_copy_options_t;
+
+#define MACH_MSG_PHYSICAL_COPY		0
+#define MACH_MSG_VIRTUAL_COPY   	1
+#define MACH_MSG_ALLOCATE		2
+#define MACH_MSG_OVERWRITE		3
+#ifdef  MACH_KERNEL
+#define MACH_MSG_KALLOC_COPY_T		4
+#endif  /* MACH_KERNEL */
+
+typedef unsigned int mach_msg_descriptor_type_t;
+
+#define MACH_MSG_PORT_DESCRIPTOR 		0
+#define MACH_MSG_OOL_DESCRIPTOR  		1
+#define MACH_MSG_OOL_PORTS_DESCRIPTOR 		2
+#define MACH_MSG_OOL_VOLATILE_DESCRIPTOR  	3
+
+#pragma pack(4)
+
+typedef struct
+{
+  natural_t			pad1;
+  mach_msg_size_t		pad2;
+  unsigned int			pad3 : 24;
+  mach_msg_descriptor_type_t	type : 8;
+} mach_msg_type_descriptor_t;
+
+typedef struct
+{
+  mach_port_t			name;
+  mach_msg_size_t		pad1;
+  unsigned int			pad2 : 16;
+  mach_msg_type_name_t		disposition : 8;
+  mach_msg_descriptor_type_t	type : 8;
+} mach_msg_port_descriptor_t;
+
+typedef struct
+{
+  uint32_t			address;
+  mach_msg_size_t       	size;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  unsigned int     		pad1: 8;
+  mach_msg_descriptor_type_t    type: 8;
+} mach_msg_ool_descriptor32_t;
+
+typedef struct
+{
+  uint64_t			address;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  unsigned int     		pad1: 8;
+  mach_msg_descriptor_type_t    type: 8;
+  mach_msg_size_t       	size;
+} mach_msg_ool_descriptor64_t;
+
+typedef struct
+{
+  void*				address;
+#if !defined(__LP64__)
+  mach_msg_size_t       	size;
+#endif
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  unsigned int     		pad1: 8;
+  mach_msg_descriptor_type_t    type: 8;
+#if defined(__LP64__)
+  mach_msg_size_t       	size;
+#endif
+} mach_msg_ool_descriptor_t;
+
+typedef struct
+{
+  uint32_t			address;
+  mach_msg_size_t		count;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  mach_msg_type_name_t		disposition : 8;
+  mach_msg_descriptor_type_t	type : 8;
+} mach_msg_ool_ports_descriptor32_t;
+
+typedef struct
+{
+  uint64_t			address;
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  mach_msg_type_name_t		disposition : 8;
+  mach_msg_descriptor_type_t	type : 8;
+  mach_msg_size_t		count;
+} mach_msg_ool_ports_descriptor64_t;
+
+typedef struct
+{
+  void*				address;
+#if !defined(__LP64__)
+  mach_msg_size_t		count;
+#endif
+  boolean_t     		deallocate: 8;
+  mach_msg_copy_options_t       copy: 8;
+  mach_msg_type_name_t		disposition : 8;
+  mach_msg_descriptor_type_t	type : 8;
+#if defined(__LP64__)
+  mach_msg_size_t		count;
+#endif
+} mach_msg_ool_ports_descriptor_t;
+
+/*
+ * LP64support - This union definition is not really
+ * appropriate in LP64 mode because not all descriptors
+ * are of the same size in that environment.
+ */
+typedef union
+{
+  mach_msg_port_descriptor_t		port;
+  mach_msg_ool_descriptor_t		out_of_line;
+  mach_msg_ool_ports_descriptor_t	ool_ports;
+  mach_msg_type_descriptor_t		type;
+} mach_msg_descriptor_t;
+
+typedef struct
+{
+        mach_msg_size_t msgh_descriptor_count;
+} mach_msg_body_t;
+
+#define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
+#define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
+
+typedef	struct 
+{
+  mach_msg_bits_t	msgh_bits;
+  mach_msg_size_t	msgh_size;
+  mach_port_t		msgh_remote_port;
+  mach_port_t		msgh_local_port;
+  mach_msg_size_t 	msgh_reserved;
+  mach_msg_id_t		msgh_id;
+} mach_msg_header_t;
+
+#define MACH_MSG_NULL (mach_msg_header_t *) 0
+
+typedef struct
+{
+        mach_msg_header_t       header;
+        mach_msg_body_t         body;
+} mach_msg_base_t;
+
+typedef	unsigned int mach_msg_trailer_type_t;
+
+#define	MACH_MSG_TRAILER_FORMAT_0	0
+
+typedef	unsigned int mach_msg_trailer_size_t;
+
+typedef struct 
+{
+  mach_msg_trailer_type_t	msgh_trailer_type;
+  mach_msg_trailer_size_t	msgh_trailer_size;
+} mach_msg_trailer_t;
+
+typedef struct
+{
+  mach_msg_trailer_type_t       msgh_trailer_type;
+  mach_msg_trailer_size_t       msgh_trailer_size;
+  mach_port_seqno_t             msgh_seqno;
+} mach_msg_seqno_trailer_t;
+
+typedef struct
+{
+  unsigned int			val[2];
+} security_token_t;
+
+typedef struct 
+{
+  mach_msg_trailer_type_t	msgh_trailer_type;
+  mach_msg_trailer_size_t	msgh_trailer_size;
+  mach_port_seqno_t		msgh_seqno;
+  security_token_t		msgh_sender;
+} mach_msg_security_trailer_t;
+
+/*
+ * The audit token is an opaque token which identifies
+ * Mach tasks and senders of Mach messages as subjects
+ * to the BSM audit system.  Only the appropriate BSM
+ * library routines should be used to interpret the
+ * contents of the audit token as the representation
+ * of the subject identity within the token may change
+ * over time.
+ */
+typedef struct
+{
+  unsigned int			val[8];
+} audit_token_t;
+
+typedef struct 
+{
+  mach_msg_trailer_type_t	msgh_trailer_type;
+  mach_msg_trailer_size_t	msgh_trailer_size;
+  mach_port_seqno_t		msgh_seqno;
+  security_token_t		msgh_sender;
+  audit_token_t			msgh_audit;
+} mach_msg_audit_trailer_t;
+
+#define MACH_MSG_TRAILER_MINIMUM_SIZE  sizeof(mach_msg_trailer_t)
+
+/*
+ * These values can change from release to release - but clearly
+ * code cannot request additional trailer elements one was not
+ * compiled to understand.  Therefore, it is safe to use this
+ * constant when the same module specified the receive options.
+ * Otherwise, you run the risk that the options requested by
+ * another module may exceed the local modules notion of
+ * MAX_TRAILER_SIZE.
+ */
+typedef mach_msg_audit_trailer_t mach_msg_max_trailer_t;
+#define MAX_TRAILER_SIZE sizeof(mach_msg_max_trailer_t)
+
+/*
+ * Legacy requirements keep us from ever updating these defines (even
+ * when the format_0 trailers gain new option data fields in the future).
+ * Therefore, they shouldn't be used going forward.  Instead, the sizes
+ * should be compared against the specific element size requested using
+ * REQUESTED_TRAILER_SIZE.
+ */
+typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t;
+#define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
+
+#define   KERNEL_SECURITY_TOKEN_VALUE  { {0, 1} }
+extern security_token_t KERNEL_SECURITY_TOKEN;
+
+#define   KERNEL_AUDIT_TOKEN_VALUE  { {0, 0, 0, 0, 0, 0, 0, 0} }
+extern audit_token_t KERNEL_AUDIT_TOKEN;
+
+typedef	integer_t mach_msg_options_t;
+
+typedef struct
+{
+  mach_msg_header_t	header;
+} mach_msg_empty_send_t;
+
+typedef struct
+{
+  mach_msg_header_t	header;
+  mach_msg_trailer_t	trailer;
+} mach_msg_empty_rcv_t;
+
+typedef union
+{
+  mach_msg_empty_send_t	send;
+  mach_msg_empty_rcv_t	rcv;
+} mach_msg_empty_t;
+
+#pragma pack()
+
+/* utility to round the message size - will become machine dependent */
+#define round_msg(x)	(((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
+				~(sizeof (natural_t) - 1))
+
+/*
+ *  There is no fixed upper bound to the size of Mach messages.
+ */
+
+#define	MACH_MSG_SIZE_MAX	((mach_msg_size_t) ~0)
+
+/*
+ *  Compatibility definitions, for code written
+ *  when there was a msgh_kind instead of msgh_seqno.
+ */
+#define MACH_MSGH_KIND_NORMAL		0x00000000
+#define MACH_MSGH_KIND_NOTIFICATION	0x00000001
+#define	msgh_kind			msgh_seqno
+#define mach_msg_kind_t			mach_port_seqno_t
+
+/*
+ *  The msgt_number field specifies the number of data elements.
+ *  The msgt_size field specifies the size of each data element, in bits.
+ *  The msgt_name field specifies the type of each data element.
+ *  If msgt_inline is TRUE, the data follows the type descriptor
+ *  in the body of the message.  If msgt_inline is FALSE, then a pointer
+ *  to the data should follow the type descriptor, and the data is
+ *  sent out-of-line.  In this case, if msgt_deallocate is TRUE,
+ *  then the out-of-line data is moved (instead of copied) into the message.
+ *  If msgt_longform is TRUE, then the type descriptor is actually
+ *  a mach_msg_type_long_t.
+ *
+ *  The actual amount of inline data following the descriptor must
+ *  a multiple of the word size.  For out-of-line data, this is a
+ *  pointer.  For inline data, the supplied data size (calculated
+ *  from msgt_number/msgt_size) is rounded up.  This guarantees
+ *  that type descriptors always fall on word boundaries.
+ *
+ *  For port rights, msgt_size must be 8*sizeof(mach_port_t).
+ *  If the data is inline, msgt_deallocate should be FALSE.
+ *  The msgt_unused bit should be zero.
+ *  The msgt_name, msgt_size, msgt_number fields in
+ *  a mach_msg_type_long_t should be zero.
+ */
+
+typedef natural_t mach_msg_type_size_t;
+typedef natural_t mach_msg_type_number_t;
+
+/*
+ *  Values received/carried in messages.  Tells the receiver what
+ *  sort of port right he now has.
+ *
+ *  MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
+ *  which should remain uninterpreted by the kernel.  (Port rights
+ *  are not transferred, just the port name.)
+ */
+
+#define MACH_MSG_TYPE_PORT_NONE		0
+
+#define MACH_MSG_TYPE_PORT_NAME		15
+#define MACH_MSG_TYPE_PORT_RECEIVE	MACH_MSG_TYPE_MOVE_RECEIVE
+#define MACH_MSG_TYPE_PORT_SEND		MACH_MSG_TYPE_MOVE_SEND
+#define MACH_MSG_TYPE_PORT_SEND_ONCE	MACH_MSG_TYPE_MOVE_SEND_ONCE
+
+#define MACH_MSG_TYPE_LAST		22		/* Last assigned */
+
+/*
+ *  A dummy value.  Mostly used to indicate that the actual value
+ *  will be filled in later, dynamically.
+ */
+
+#define MACH_MSG_TYPE_POLYMORPHIC	((mach_msg_type_name_t) -1)
+
+/*
+ *	Is a given item a port type?
+ */
+
+#define MACH_MSG_TYPE_PORT_ANY(x)			\
+	(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) &&		\
+	 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
+
+#define	MACH_MSG_TYPE_PORT_ANY_SEND(x)			\
+	(((x) >= MACH_MSG_TYPE_MOVE_SEND) &&		\
+	 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
+
+#define	MACH_MSG_TYPE_PORT_ANY_RIGHT(x)			\
+	(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) &&		\
+	 ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
+
+typedef integer_t mach_msg_option_t;
+
+#define MACH_MSG_OPTION_NONE	0x00000000
+
+#define	MACH_SEND_MSG		0x00000001
+#define	MACH_RCV_MSG		0x00000002
+#define MACH_RCV_LARGE		0x00000004
+
+#define MACH_SEND_TIMEOUT	0x00000010
+#define MACH_SEND_INTERRUPT	0x00000040	/* libmach implements */
+#define MACH_SEND_CANCEL	0x00000080
+#define MACH_SEND_ALWAYS	0x00010000	/* internal use only */
+#define MACH_SEND_TRAILER	0x00020000	
+
+#define MACH_RCV_TIMEOUT	0x00000100
+#define MACH_RCV_NOTIFY		0x00000200
+#define MACH_RCV_INTERRUPT	0x00000400	/* libmach implements */
+#define MACH_RCV_OVERWRITE	0x00001000
+
+/* 
+ * NOTE: a 0x00------ RCV mask implies to ask for
+ * a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements, 
+ * which is equivalent to a mach_msg_trailer_t.
+ */
+#define MACH_RCV_TRAILER_NULL   0
+#define MACH_RCV_TRAILER_SEQNO  1
+#define MACH_RCV_TRAILER_SENDER 2
+#define MACH_RCV_TRAILER_AUDIT  3
+
+#define MACH_RCV_TRAILER_TYPE(x)     (((x) & 0xf) << 28) 
+#define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)  
+#define MACH_RCV_TRAILER_MASK 	     ((0xff << 24))
+
+#define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
+#define REQUESTED_TRAILER_SIZE(y) 				\
+	((mach_msg_trailer_size_t)				\
+	 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ?	\
+	  sizeof(mach_msg_trailer_t) :				\
+	  ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ?	\
+	   sizeof(mach_msg_seqno_trailer_t) :			\
+	  ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ?	\
+	   sizeof(mach_msg_security_trailer_t) :		\
+	   sizeof(mach_msg_audit_trailer_t)))))
+/*
+ *  Much code assumes that mach_msg_return_t == kern_return_t.
+ *  This definition is useful for descriptive purposes.
+ *
+ *  See <mach/error.h> for the format of error codes.
+ *  IPC errors are system 4.  Send errors are subsystem 0;
+ *  receive errors are subsystem 1.  The code field is always non-zero.
+ *  The high bits of the code field communicate extra information
+ *  for some error codes.  MACH_MSG_MASK masks off these special bits.
+ */
+
+typedef kern_return_t mach_msg_return_t;
+
+#define MACH_MSG_SUCCESS		0x00000000
+
+
+#define	MACH_MSG_MASK			0x00003e00
+		/* All special error code bits defined below. */
+#define	MACH_MSG_IPC_SPACE		0x00002000
+		/* No room in IPC name space for another capability name. */
+#define	MACH_MSG_VM_SPACE		0x00001000
+		/* No room in VM address space for out-of-line memory. */
+#define	MACH_MSG_IPC_KERNEL		0x00000800
+		/* Kernel resource shortage handling an IPC capability. */
+#define	MACH_MSG_VM_KERNEL		0x00000400
+		/* Kernel resource shortage handling out-of-line memory. */
+
+#define MACH_SEND_IN_PROGRESS		0x10000001
+		/* Thread is waiting to send.  (Internal use only.) */
+#define MACH_SEND_INVALID_DATA		0x10000002
+		/* Bogus in-line data. */
+#define MACH_SEND_INVALID_DEST		0x10000003
+		/* Bogus destination port. */
+#define MACH_SEND_TIMED_OUT		0x10000004
+		/* Message not sent before timeout expired. */
+#define MACH_SEND_INTERRUPTED		0x10000007
+		/* Software interrupt. */
+#define MACH_SEND_MSG_TOO_SMALL		0x10000008
+		/* Data doesn't contain a complete message. */
+#define MACH_SEND_INVALID_REPLY		0x10000009
+		/* Bogus reply port. */
+#define MACH_SEND_INVALID_RIGHT		0x1000000a
+		/* Bogus port rights in the message body. */
+#define MACH_SEND_INVALID_NOTIFY	0x1000000b
+		/* Bogus notify port argument. */
+#define MACH_SEND_INVALID_MEMORY	0x1000000c
+		/* Invalid out-of-line memory pointer. */
+#define MACH_SEND_NO_BUFFER		0x1000000d
+		/* No message buffer is available. */
+#define MACH_SEND_TOO_LARGE		0x1000000e
+		/* Send is too large for port */
+#define MACH_SEND_INVALID_TYPE		0x1000000f
+		/* Invalid msg-type specification. */
+#define MACH_SEND_INVALID_HEADER	0x10000010
+		/* A field in the header had a bad value. */
+#define MACH_SEND_INVALID_TRAILER	0x10000011
+		/* The trailer to be sent does not match kernel format. */
+#define MACH_SEND_INVALID_RT_OOL_SIZE	0x10000015
+		/* compatibility: no longer a returned error */
+
+#define MACH_RCV_IN_PROGRESS		0x10004001
+		/* Thread is waiting for receive.  (Internal use only.) */
+#define MACH_RCV_INVALID_NAME		0x10004002
+		/* Bogus name for receive port/port-set. */
+#define MACH_RCV_TIMED_OUT		0x10004003
+		/* Didn't get a message within the timeout value. */
+#define MACH_RCV_TOO_LARGE		0x10004004
+		/* Message buffer is not large enough for inline data. */
+#define MACH_RCV_INTERRUPTED		0x10004005
+		/* Software interrupt. */
+#define MACH_RCV_PORT_CHANGED		0x10004006
+		/* compatibility: no longer a returned error */
+#define MACH_RCV_INVALID_NOTIFY		0x10004007
+		/* Bogus notify port argument. */
+#define MACH_RCV_INVALID_DATA		0x10004008
+		/* Bogus message buffer for inline data. */
+#define MACH_RCV_PORT_DIED		0x10004009
+		/* Port/set was sent away/died during receive. */
+#define	MACH_RCV_IN_SET			0x1000400a
+		/* compatibility: no longer a returned error */
+#define	MACH_RCV_HEADER_ERROR		0x1000400b
+		/* Error receiving message header.  See special bits. */
+#define	MACH_RCV_BODY_ERROR		0x1000400c
+		/* Error receiving message body.  See special bits. */
+#define	MACH_RCV_INVALID_TYPE		0x1000400d
+		/* Invalid msg-type specification in scatter list. */
+#define	MACH_RCV_SCATTER_SMALL		0x1000400e
+		/* Out-of-line overwrite region is not large enough */
+#define MACH_RCV_INVALID_TRAILER	0x1000400f
+		/* trailer type or number of trailer elements not supported */
+#define MACH_RCV_IN_PROGRESS_TIMED      0x10004011
+                /* Waiting for receive with timeout. (Internal use only.) */
+
+
+__BEGIN_DECLS
+
+/*
+ *	Routine:	mach_msg_overwrite
+ *	Purpose:
+ *		Send and/or receive a message.  If the message operation
+ *		is interrupted, and the user did not request an indication
+ *		of that fact, then restart the appropriate parts of the
+ *		operation silently (trap version does not restart).
+ *
+ *		Distinct send and receive buffers may be specified.  If
+ *		no separate receive buffer is specified, the msg parameter
+ *		will be used for both send and receive operations.
+ *
+ *		In addition to a distinct receive buffer, that buffer may
+ *		already contain scatter control information to direct the
+ *		receiving of the message.
+ */
+
+extern mach_msg_return_t	mach_msg_overwrite(
+					mach_msg_header_t *msg,
+					mach_msg_option_t option,
+					mach_msg_size_t send_size,
+					mach_msg_size_t rcv_size,
+					mach_port_name_t rcv_name,
+					mach_msg_timeout_t timeout,
+					mach_port_name_t notify,
+					mach_msg_header_t *rcv_msg,
+					mach_msg_size_t rcv_limit);
+
+#ifndef	KERNEL
+
+/*
+ *	Routine:	mach_msg
+ *	Purpose:
+ *		Send and/or receive a message.  If the message operation
+ *		is interrupted, and the user did not request an indication
+ *		of that fact, then restart the appropriate parts of the
+ *		operation silently (trap version does not restart).
+ */
+extern mach_msg_return_t	mach_msg(
+					mach_msg_header_t *msg,
+					mach_msg_option_t option,
+					mach_msg_size_t send_size,
+					mach_msg_size_t rcv_size,
+					mach_port_name_t rcv_name,
+					mach_msg_timeout_t timeout,
+					mach_port_name_t notify);
+
+#endif	/* KERNEL */
+
+__END_DECLS
+
+#endif	/* _MACH_MESSAGE_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mig.h b/xnu-792.18.15/osfmk/mach/mig.h
new file mode 100644
index 0000000..72ca0dc
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mig.h
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+/*
+ * Mach MIG Subsystem Interfaces
+ */
+
+#ifndef	_MACH_MIG_H_
+#define _MACH_MIG_H_
+
+#include <stdint.h>
+#include <mach/port.h>
+#include <mach/message.h>
+#include <mach/vm_types.h>
+
+#include <sys/cdefs.h>
+
+#if defined(MACH_KERNEL)
+
+/* Turn MIG type checking on by default for kernel */
+#define __MigTypeCheck 1
+#define __MigKernelSpecificCode 1
+#define _MIG_KERNEL_SPECIFIC_CODE_ 1
+
+/* Otherwise check legacy setting (temporary) */
+#elif defined(TypeCheck)  
+
+#define __MigTypeCheck TypeCheck
+ 
+#endif /* defined(TypeCheck) */
+
+/*
+ * Pack MIG message structs.
+ * This is an indicator of the need to view shared structs in a
+ * binary-compatible format - and MIG message structs are no different.
+ */
+#define __MigPackStructs 1
+
+/*
+ * Definition for MIG-generated server stub routines.  These routines
+ * unpack the request message, call the server procedure, and pack the
+ * reply message.
+ */
+typedef void	(*mig_stub_routine_t) (mach_msg_header_t *InHeadP,
+				       mach_msg_header_t *OutHeadP);
+
+typedef mig_stub_routine_t mig_routine_t;
+
+/*
+ * Definition for MIG-generated server routine.  This routine takes a
+ * message, and returns the appropriate stub function for handling that
+ * message.
+ */
+typedef mig_routine_t (*mig_server_routine_t) (mach_msg_header_t *InHeadP);
+
+/*
+ * Generic definition for implementation routines.  These routines do
+ * the real work associated with this request.  This generic type is
+ * used for keeping the pointers in the subsystem array.
+ */
+typedef kern_return_t   (*mig_impl_routine_t)(void);
+
+typedef mach_msg_type_descriptor_t routine_arg_descriptor;
+typedef mach_msg_type_descriptor_t *routine_arg_descriptor_t;
+typedef mach_msg_type_descriptor_t *mig_routine_arg_descriptor_t;
+
+#define MIG_ROUTINE_ARG_DESCRIPTOR_NULL ((mig_routine_arg_descriptor_t)0)
+
+struct routine_descriptor {
+	mig_impl_routine_t	impl_routine;	/* Server work func pointer   */
+	mig_stub_routine_t	stub_routine;	/* Unmarshalling func pointer */
+	unsigned int		argc;			/* Number of argument words   */
+	unsigned int		descr_count;	/* Number complex descriptors */
+	routine_arg_descriptor_t
+						arg_descr;		/* pointer to descriptor array*/
+	unsigned int		max_reply_msg;	/* Max size for reply msg     */
+};
+typedef struct routine_descriptor *routine_descriptor_t;
+
+typedef struct routine_descriptor mig_routine_descriptor;
+typedef mig_routine_descriptor *mig_routine_descriptor_t;
+
+#define MIG_ROUTINE_DESCRIPTOR_NULL ((mig_routine_descriptor_t)0)
+
+typedef struct mig_subsystem {
+	mig_server_routine_t server;		/* pointer to demux routine	*/
+	mach_msg_id_t		 start;			/* Min routine number	    */
+	mach_msg_id_t		 end;			/* Max routine number + 1   */
+	mach_msg_size_t		 maxsize;		/* Max reply message size   */
+	vm_address_t		 reserved;		/* reserved for MIG use	    */
+	mig_routine_descriptor
+						 routine[1];	/* Routine descriptor array */
+} *mig_subsystem_t;
+
+#define MIG_SUBSYSTEM_NULL		((mig_subsystem_t)0)
+
+typedef struct mig_symtab {
+	char				*ms_routine_name;
+	int					ms_routine_number;
+	void    			(*ms_routine)(void);	/* Since the functions in the
+					 							 * symbol table have unknown
+												 * signatures, this is the best
+					 							 * we can do...
+					 							 */
+} mig_symtab_t;
+
+#ifdef	PRIVATE
+
+/* MIG object runtime - not ready for public consumption */
+
+#ifdef  KERNEL_PRIVATE
+
+/*
+ * MIG object runtime definitions
+ *
+ * Conforming MIG subsystems may enable this support to get
+ * significant assistance from the base mig_object_t implementation.
+ *
+ * Support includes:
+ *	- Transparency from port manipulation.
+ *	- Dymanic port allocation on first "remoting" of an object.
+ *	- Reference conversions from object to port and vice versa.
+ *	- Automatic port deallocation on no-more-senders.
+ *	- Support for multiple server implementations in a single space.
+ *	- Messaging bypass for local servers.
+ *	- Automatic hookup to base dispatch mechanism.
+ *	- General notification support
+ * Coming soon:
+ *	- User-level support
+ */
+typedef unsigned int 			mig_notify_type_t;
+
+typedef struct MIGIID {
+	unsigned long				data1;
+	unsigned short				data2;
+	unsigned short				data3;
+	unsigned char				data4[8];
+} MIGIID;
+
+typedef struct IMIGObjectVtbl			IMIGObjectVtbl;
+typedef struct IMIGNotifyObjectVtbl		IMIGNotifyObjectVtbl;
+
+typedef struct IMIGObject {
+	const IMIGObjectVtbl			*pVtbl;
+} IMIGObject;
+
+typedef struct IMIGNotifyObject {
+	const IMIGNotifyObjectVtbl		*pVtbl;
+} IMIGNotifyObject;
+
+struct IMIGObjectVtbl {
+	kern_return_t (*QueryInterface)(
+			IMIGObject		*object,
+			const MIGIID		*iid,
+			void			**ppv);
+
+	unsigned long (*AddRef)(
+			IMIGObject		*object);
+
+	unsigned long (*Release)(	
+			IMIGObject		*object);
+
+	unsigned long (*GetServer)(
+			IMIGObject		*object,
+			mig_server_routine_t 	*server);
+	    
+	boolean_t (*RaiseNotification)(
+			IMIGObject 		*object,
+			mig_notify_type_t	notify_type);
+
+	boolean_t (*RequestNotification)(
+			IMIGObject		*object,
+			IMIGNotifyObject	*notify,
+			mig_notify_type_t	notify_type);
+};		
+
+/*
+ * IMIGNotifyObject
+ *
+ * A variant of the IMIGObject interface that is a sink for
+ * MIG notifications.
+ *
+ * A reference is held on both the subject MIGObject and the target
+ * MIGNotifyObject. Because of this, care must be exercised to avoid
+ * reference cycles.  Once a notification is raised, the object
+ * reference is returned and the request must be re-requested (if
+ * desired).
+ *
+ * One interesting note:  because this interface is itself a MIG
+ * object, one may request notification about state changes in
+ * the MIGNotifyObject itself.
+ */
+struct IMIGNotifyObjectVtbl {
+	kern_return_t (*QueryInterface)(
+			IMIGNotifyObject	*notify,
+			const MIGIID		*iid,
+			void			**ppv);
+
+	unsigned long (*AddRef)(	
+			IMIGNotifyObject	*notify);
+
+	unsigned long (*Release)(	
+			IMIGNotifyObject	*notify);
+
+	unsigned long (*GetServer)(
+			IMIGNotifyObject	*notify,
+			mig_server_routine_t	*server);
+
+	boolean_t (*RaiseNotification)(
+			IMIGNotifyObject	*notify,
+			mig_notify_type_t	notify_type);
+
+	boolean_t (*RequestNotification)(
+			IMIGNotifyObject	*notify,
+			IMIGNotifyObject	*notify_notify,
+			mig_notify_type_t	notify_type);
+
+	void (*HandleNotification)(
+			IMIGNotifyObject	*notify,
+			IMIGObject		*object,
+			mig_notify_type_t	notify_type);
+};
+
+#endif	/* KERNEL_PRIVATE */
+#endif  /* PRIVATE */
+
+__BEGIN_DECLS
+
+/* Client side reply port allocate */
+extern mach_port_t mig_get_reply_port(void);
+
+/* Client side reply port deallocate */
+extern void mig_dealloc_reply_port(mach_port_t reply_port);
+
+/* Client side reply port "deallocation" */
+extern void mig_put_reply_port(mach_port_t reply_port);
+
+/* Bounded string copy */
+extern int mig_strncpy(char	*dest, const char *src,	int	len);
+
+#ifdef KERNEL_PRIVATE
+
+/* Allocate memory for out-of-stack mig structures */
+extern char *mig_user_allocate(vm_size_t size);
+
+/* Deallocate memory used for out-of-stack mig structures */
+extern void mig_user_deallocate(char *data, vm_size_t size);
+
+#else
+
+/* Allocate memory for out-of-line mig structures */
+extern void mig_allocate(vm_address_t *, vm_size_t);
+
+/* Deallocate memory used for out-of-line mig structures */
+extern void mig_deallocate(vm_address_t, vm_size_t);
+
+#endif /* KERNEL_PRIVATE */
+
+__END_DECLS
+
+#endif	/* _MACH_MIG_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mig_errors.h b/xnu-792.18.15/osfmk/mach/mig_errors.h
new file mode 100644
index 0000000..34c03cb
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mig_errors.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * Mach Interface Generator errors
+ *
+ */
+
+#ifndef	_MACH_MIG_ERRORS_H_
+#define _MACH_MIG_ERRORS_H_
+
+#include <mach/mig.h>
+#include <mach/ndr.h>
+#include <mach/message.h>
+#include <mach/kern_return.h>
+
+#include <sys/cdefs.h>
+
+/*
+ *	These error codes should be specified as system 4, subsytem 2.
+ *	But alas backwards compatibility makes that impossible.
+ *	The problem is old clients of new servers (eg, the kernel)
+ *	which get strange large error codes when there is a Mig problem
+ *	in the server.  Unfortunately, the IPC system doesn't have
+ *	the knowledge to convert the codes in this situation.
+ */
+
+#define MIG_TYPE_ERROR		-300	/* client type check failure */
+#define MIG_REPLY_MISMATCH	-301	/* wrong reply message ID */
+#define MIG_REMOTE_ERROR	-302	/* server detected error */
+#define MIG_BAD_ID		-303	/* bad request message ID */
+#define MIG_BAD_ARGUMENTS	-304	/* server type check failure */
+#define MIG_NO_REPLY		-305	/* no reply should be send */
+#define MIG_EXCEPTION		-306	/* server raised exception */
+#define MIG_ARRAY_TOO_LARGE	-307	/* array not large enough */
+#define MIG_SERVER_DIED		-308	/* server died */
+#define MIG_TRAILER_ERROR       -309    /* trailer has an unknown format */
+
+/*
+ *	Whenever MIG detects an error, it sends back a generic
+ *	mig_reply_error_t format message.  Clients must accept
+ *	these in addition to the expected reply message format.
+ */
+#pragma pack(4)
+typedef struct {
+	mach_msg_header_t	Head;
+	NDR_record_t		NDR;
+	kern_return_t		RetCode;
+} mig_reply_error_t;
+#pragma pack()
+
+
+__BEGIN_DECLS
+
+#define __NDR_convert__mig_reply_error_t__defined
+#if mig_internal
+mig_internal
+#else
+static
+#endif
+__inline__ void
+__NDR_convert__mig_reply_error_t(mig_reply_error_t *x)
+{
+#if defined(__NDR_convert__int_rep__kern_return_t__defined)
+	if (x->NDR.int_rep != NDR_record.int_rep)
+		__NDR_convert__int_rep__kern_return_t(&x->RetCode, x->NDR.int_rep);
+#endif /* __NDR_convert__int_rep__kern_return_t__defined */
+}
+
+__END_DECLS
+
+#endif	/* _MACH_MIG_ERRORS_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mig_log.h b/xnu-792.18.15/osfmk/mach/mig_log.h
new file mode 100644
index 0000000..44ce000
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mig_log.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+#ifndef _mig_log_
+#define _mig_log_
+
+#include <sys/appleapiopts.h>
+
+#ifdef __APPLE_API_OBSOLETE
+
+typedef enum {
+	MACH_MSG_LOG_USER,
+	MACH_MSG_LOG_SERVER
+} mig_who_t;
+
+typedef enum {
+	MACH_MSG_REQUEST_BEING_SENT,
+	MACH_MSG_REQUEST_BEING_RCVD,
+	MACH_MSG_REPLY_BEING_SENT,
+	MACH_MSG_REPLY_BEING_RCVD
+} mig_which_event_t;
+
+typedef enum {
+	MACH_MSG_ERROR_WHILE_PARSING,
+	MACH_MSG_ERROR_UNKNOWN_ID
+} mig_which_error_t;
+
+extern void MigEventTracer
+#if     defined(__STDC__)
+(
+	mig_who_t who,	
+	mig_which_event_t what,
+	mach_msg_id_t msgh_id,
+	unsigned int size,
+	unsigned int kpd,
+	unsigned int retcode,
+	unsigned int ports,
+	unsigned int oolports,
+	unsigned int ool,
+	char *file,
+	unsigned int line
+);
+#else  	/* !defined(__STDC__) */
+();
+#endif  /* !defined(__STDC__) */
+
+extern void MigEventErrors
+#if     defined(__STDC__)
+(
+	mig_who_t who,	
+	mig_which_error_t what,
+	void *par,
+	char *file,
+	unsigned int line
+);
+#else  	/* !defined(__STDC__) */
+();
+#endif  /* !defined(__STDC__) */
+
+extern int mig_errors;
+extern int mig_tracing;
+
+#define LOG_ERRORS      if (mig_errors)  MigEventErrors
+#define LOG_TRACE       if (mig_tracing) MigEventTracer
+
+#endif  /* __APPLE_API_OBSOLETE */
+
+#endif  /* _mach_log_ */
+
diff --git a/xnu-792.18.15/osfmk/mach/mk_timer.h b/xnu-792.18.15/osfmk/mach/mk_timer.h
new file mode 100644
index 0000000..396c1a1
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mk_timer.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (c) 2000 Apple Computer, Inc.  All rights reserved.
+ *
+ * HISTORY
+ *
+ * 31 August 2000 (debo)
+ *  Created.
+ */
+
+#ifndef	_MACH_MK_TIMER_H_
+#define	_MACH_MK_TIMER_H_
+
+#include <mach/mach_time.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+mach_port_name_t	mk_timer_create(void);
+
+kern_return_t	mk_timer_destroy(
+					mach_port_name_t	name);
+
+kern_return_t	mk_timer_arm(
+					mach_port_name_t	name,
+					uint64_t			expire_time);
+
+kern_return_t	mk_timer_cancel(
+					mach_port_name_t	name,
+					uint64_t			*result_time);
+
+__END_DECLS
+
+#pragma pack(4)
+struct mk_timer_expire_msg {
+	mach_msg_header_t	header;
+	uint64_t			unused[3];
+};
+#pragma pack()
+
+typedef struct mk_timer_expire_msg		mk_timer_expire_msg_t;
+
+#endif /* _MACH_MK_TIMER_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/mk_traps.h b/xnu-792.18.15/osfmk/mach/mk_traps.h
new file mode 100644
index 0000000..68e71fa
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/mk_traps.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (c) 2000 Apple Computer, Inc.  All rights reserved.
+ *
+ * HISTORY
+ *
+ * 20 October 2000 (debo)
+ *  Created.
+ */
+
+#ifndef	_MACH_MK_TRAPS_H_
+#define	_MACH_MK_TRAPS_H_
+
+#endif /* _MACH_MK_TRAPS_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/msg_type.h b/xnu-792.18.15/osfmk/mach/msg_type.h
new file mode 100644
index 0000000..fb28033
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/msg_type.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:46  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.2.6.1  1994/09/23  02:40:41  ezf
+ * 	change marker to not FREE
+ * 	[1994/09/22  21:41:56  ezf]
+ *
+ * Revision 1.2.2.2  1993/06/09  02:42:32  gm
+ * 	Added to OSF/1 R1.3 from NMK15.0.
+ * 	[1993/06/02  21:17:31  jeffc]
+ * 
+ * Revision 1.2  1993/04/19  16:37:56  devrcs
+ * 	ansi C conformance changes
+ * 	[1993/02/02  18:53:54  david]
+ * 
+ * Revision 1.1  1992/09/30  02:31:51  robert
+ * 	Initial revision
+ * 
+ * $EndLog$
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.3  91/05/14  16:58:02  mrt
+ * 	Correcting copyright
+ * 
+ * Revision 2.2  91/02/05  17:35:10  mrt
+ * 	Changed to new Mach copyright
+ * 	[91/02/01  17:17:32  mrt]
+ * 
+ * Revision 2.1  89/08/03  16:03:38  rwd
+ * Created.
+ * 
+ * Revision 2.3  89/02/25  18:39:26  gm0w
+ * 	Changes for cleanup.
+ * 
+ *  4-Mar-87  Michael Young (mwyoung) at Carnegie-Mellon University
+ *	Added MSG_TYPE_RPC.
+ *
+ *  22-Dec-86 Mary Thompson
+ *	defined MSG_TYPE_CAMELOT, and MSG_TYPE_ENCRYPTED
+ *
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *    This file defines user msg types that may be ored into
+ *    the msg_type field in a msg header. Values 0-5 are reserved
+ *    for use by the kernel and are defined in message.h. 
+ *
+ */
+
+#ifndef	MSG_TYPE_H_
+#define	MSG_TYPE_H_
+
+#define MSG_TYPE_CAMELOT	(1 << 6)
+#define MSG_TYPE_ENCRYPTED	(1 << 7)
+#define	MSG_TYPE_RPC		(1 << 8)	/* Reply expected */
+
+#include <mach/message.h>
+
+#endif	/* MSG_TYPE_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/ndr.h b/xnu-792.18.15/osfmk/mach/ndr.h
new file mode 100644
index 0000000..5c6aa27
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/ndr.h
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+#ifndef _MACH_NDR_H_
+#define _MACH_NDR_H_
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+
+typedef struct {
+    unsigned char       mig_vers;
+    unsigned char       if_vers;
+    unsigned char       reserved1;
+    unsigned char       mig_encoding;
+    unsigned char       int_rep;
+    unsigned char       char_rep;
+    unsigned char       float_rep;
+    unsigned char       reserved2;
+} NDR_record_t;
+
+/*
+ * MIG supported protocols for Network Data Representation
+ */
+#define  NDR_PROTOCOL_2_0      0
+
+/*
+ * NDR 2.0 format flag type definition and values.
+ */
+#define  NDR_INT_BIG_ENDIAN    0
+#define  NDR_INT_LITTLE_ENDIAN 1
+#define  NDR_FLOAT_IEEE        0
+#define  NDR_FLOAT_VAX         1
+#define  NDR_FLOAT_CRAY        2
+#define  NDR_FLOAT_IBM         3
+#define  NDR_CHAR_ASCII        0
+#define  NDR_CHAR_EBCDIC       1
+
+extern NDR_record_t NDR_record;
+
+#ifndef __NDR_convert__
+#define __NDR_convert__ 1
+#endif /* __NDR_convert__ */
+
+#ifndef __NDR_convert__int_rep__
+#define __NDR_convert__int_rep__ 1
+#endif /* __NDR_convert__int_rep__ */
+
+#ifndef __NDR_convert__char_rep__
+#define __NDR_convert__char_rep__ 0
+#endif /* __NDR_convert__char_rep__ */
+
+#ifndef __NDR_convert__float_rep__
+#define __NDR_convert__float_rep__ 0
+#endif /* __NDR_convert__float_rep__ */
+
+#if __NDR_convert__
+
+#define __NDR_convert__NOOP		do ; while (0)
+#define __NDR_convert__UNKNOWN(s)	__NDR_convert__NOOP
+#define __NDR_convert__SINGLE(a, f, r)	do { r((a), (f)); } while (0)
+#define __NDR_convert__ARRAY(a, f, c, r) \
+	do { int __i__, __C__ = (c); \
+	for (__i__ = 0; __i__ < __C__; __i__++) \
+	r(&(a)[__i__], f); } while (0)
+#define __NDR_convert__2DARRAY(a, f, s, c, r) \
+	do { int __i__, __C__ = (c), __S__ = (s); \
+	for (__i__ = 0; __i__ < __C__; __i__++) \
+	r(&(a)[__i__ * __S__], f, __S__); } while (0)
+
+#if __NDR_convert__int_rep__
+
+#include <libkern/OSByteOrder.h>
+
+#define __NDR_READSWAP_assign(a, rs)	do { *(a) = rs(a); } while (0)
+
+#define __NDR_READSWAP__uint16_t(a) 	OSReadSwapInt16((void *)a, 0)
+#define __NDR_READSWAP__int16_t(a)	(int16_t)OSReadSwapInt16((void *)a, 0)
+#define __NDR_READSWAP__uint32_t(a) 	OSReadSwapInt32((void *)a, 0)
+#define __NDR_READSWAP__int32_t(a)	(int32_t)OSReadSwapInt32((void *)a, 0)
+#define __NDR_READSWAP__uint64_t(a)	OSReadSwapInt64((void *)a, 0)
+#define __NDR_READSWAP__int64_t(a)	(int64_t)OSReadSwapInt64((void *)a, 0)
+
+__BEGIN_DECLS
+
+static __inline__ float __NDR_READSWAP__float(float *argp) {
+	union {
+		float sv;
+		uint32_t ull;
+	} result;
+	result.ull = __NDR_READSWAP__uint32_t((uint32_t *)argp);
+	return result.sv;
+}
+
+static __inline__ double __NDR_READSWAP__double(double *argp) {
+	union {
+		double sv;
+		uint64_t ull;
+	} result;
+	result.ull = __NDR_READSWAP__uint64_t((uint64_t *)argp);
+	return result.sv;
+}
+
+__END_DECLS
+
+#define __NDR_convert__int_rep__int16_t__defined
+#define __NDR_convert__int_rep__int16_t(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__int16_t)
+
+#define __NDR_convert__int_rep__uint16_t__defined
+#define __NDR_convert__int_rep__uint16_t(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__uint16_t)
+
+#define __NDR_convert__int_rep__int32_t__defined
+#define __NDR_convert__int_rep__int32_t(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__int32_t)
+
+#define __NDR_convert__int_rep__uint32_t__defined
+#define __NDR_convert__int_rep__uint32_t(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__uint32_t)
+
+#define __NDR_convert__int_rep__int64_t__defined
+#define __NDR_convert__int_rep__int64_t(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__int64_t)
+
+#define __NDR_convert__int_rep__uint64_t__defined
+#define __NDR_convert__int_rep__uint64_t(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__uint64_t)
+
+#define __NDR_convert__int_rep__float__defined
+#define __NDR_convert__int_rep__float(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__float)
+
+#define __NDR_convert__int_rep__double__defined
+#define __NDR_convert__int_rep__double(v,f)		\
+	__NDR_READSWAP_assign(v, __NDR_READSWAP__double)
+
+#define __NDR_convert__int_rep__boolean_t__defined
+#define __NDR_convert__int_rep__boolean_t(v, f)		\
+	__NDR_convert__int_rep__int32_t(v,f)
+
+#define __NDR_convert__int_rep__kern_return_t__defined
+#define __NDR_convert__int_rep__kern_return_t(v,f)	\
+	__NDR_convert__int_rep__int32_t(v,f)
+
+#define __NDR_convert__int_rep__mach_port_name_t__defined
+#define __NDR_convert__int_rep__mach_port_name_t(v,f)	\
+	__NDR_convert__int_rep__uint32_t(v,f)
+
+#define __NDR_convert__int_rep__mach_msg_type_number_t__defined
+#define __NDR_convert__int_rep__mach_msg_type_number_t(v,f) \
+	__NDR_convert__int_rep__uint32_t(v,f)
+
+#endif /* __NDR_convert__int_rep__ */
+
+#if __NDR_convert__char_rep__
+
+#warning  NDR character representation conversions not implemented yet!
+#define __NDR_convert__char_rep__char(v,f)	__NDR_convert__NOOP
+#define __NDR_convert__char_rep__string(v,f,l)	__NDR_convert__NOOP
+
+#endif /* __NDR_convert__char_rep__ */
+
+#if __NDR_convert__float_rep__
+
+#warning  NDR floating point representation conversions not implemented yet!
+#define __NDR_convert__float_rep__float(v,f)	__NDR_convert__NOOP
+#define __NDR_convert__float_rep__double(v,f)	__NDR_convert__NOOP
+
+#endif /* __NDR_convert__float_rep__ */
+
+#endif /* __NDR_convert__ */
+
+#endif /* _MACH_NDR_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/norma_special_ports.h b/xnu-792.18.15/osfmk/mach/norma_special_ports.h
new file mode 100644
index 0000000..e4da723
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/norma_special_ports.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/norma_special_ports.h
+ *
+ *	Defines codes for remote access to special ports.
+ */
+
+#ifndef	_MACH_NORMA_SPECIAL_PORTS_H_
+#define _MACH_NORMA_SPECIAL_PORTS_H_
+
+#include <mach/host_special_ports.h>
+
+#define norma_get_host_port(host, node, port)	\
+	(host_get_special_port((host), (node), \
+	HOST_PORT, (port)))
+
+#define norma_get_host_priv_port(host, node, port)	\
+	(host_get_special_port((host), (node), \
+	HOST_PRIV_PORT, (port)))
+
+#define norma_get_io_master_port(host, node, port)	\
+	(host_get_special_port((host), (node), \
+	HOST_IO_MASTER_PORT, (port)))
+
+#define norma_get_dynamic_pager_port(host, port) \
+	(host_get_special_port((host), 0, \
+	HOST_DYNAMIC_PAGER_PORT, (port)))
+
+#define norma_get_audit_control_port(host, node, port)	\
+	(host_get_special_port((host), (node), \
+	HOST_AUDIT_CONTROL_PORT, (port)))
+
+#define norma_get_user_notification_port(host, node, port) \
+	(host_get_special_port((host), (node), \
+	HOST_USER_NOTIFICATION_PORT, (port)))
+
+#endif	/* _MACH_NORMA_SPECIAL_PORTS_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/notify.defs b/xnu-792.18.15/osfmk/mach/notify.defs
new file mode 100644
index 0000000..07af66f
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/notify.defs
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+subsystem 
+#if	KERNEL_USER
+	KernelUser
+#endif
+	notify 64;
+
+#include <mach/std_types.defs>
+
+#if	SEQNOS
+serverprefix do_seqnos_;
+serverdemux seqnos_notify_server;
+#else	/* !SEQNOS */
+serverprefix do_;
+serverdemux notify_server;
+#endif	/* SEQNOS */
+
+/* MACH_NOTIFY_FIRST: 0100 */
+skip;
+
+/* MACH_NOTIFY_PORT_DELETED: 0101 */
+simpleroutine mach_notify_port_deleted(
+		notify	: mach_port_move_send_once_t;
+#if	SEQNOS
+	msgseqno seqno	: mach_port_seqno_t;
+#endif	/* SEQNOS */
+		name	: mach_port_name_t);
+
+skip;	/* was MACH_NOTIFY_MSG_ACCEPTED: 0102 */
+
+skip;	/* was NOTIFY_OWNERSHIP_RIGHTS: 0103 */
+
+skip;	/* was NOTIFY_RECEIVE_RIGHTS: 0104 */
+
+/* MACH_NOTIFY_PORT_DESTROYED: 0105 */
+simpleroutine mach_notify_port_destroyed(
+		notify	: mach_port_move_send_once_t;
+#if	SEQNOS
+	msgseqno seqno	: mach_port_seqno_t;
+#endif	/* SEQNOS */
+		rights	: mach_port_move_receive_t);
+
+/* MACH_NOTIFY_NO_SENDERS: 0106 */
+simpleroutine mach_notify_no_senders(
+		notify	: mach_port_move_send_once_t;
+#if	SEQNOS
+	msgseqno seqno	: mach_port_seqno_t;
+#endif	/* SEQNOS */
+		mscount	: mach_port_mscount_t);
+
+/* MACH_NOTIFY_SEND_ONCE: 0107 */
+simpleroutine mach_notify_send_once(
+		notify	: mach_port_move_send_once_t
+#if	SEQNOS
+;	msgseqno seqno	: mach_port_seqno_t
+#endif	/* SEQNOS */
+		);
+
+/* MACH_NOTIFY_DEAD_NAME: 0110 */
+simpleroutine mach_notify_dead_name(
+		notify	: mach_port_move_send_once_t;
+#if	SEQNOS
+	msgseqno seqno	: mach_port_seqno_t;
+#endif	/* SEQNOS */
+		name	: mach_port_name_t);
diff --git a/xnu-792.18.15/osfmk/mach/notify.h b/xnu-792.18.15/osfmk/mach/notify.h
new file mode 100644
index 0000000..768a865
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/notify.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/notify.h
+ *
+ *	Kernel notification message definitions.
+ */
+
+#ifndef	_MACH_NOTIFY_H_
+#define _MACH_NOTIFY_H_
+
+#include <mach/port.h>
+#include <mach/message.h>
+#include <mach/ndr.h>
+
+/*
+ *  An alternative specification of the notification interface
+ *  may be found in mach/notify.defs.
+ */
+
+#define MACH_NOTIFY_FIRST		0100
+#define MACH_NOTIFY_PORT_DELETED	(MACH_NOTIFY_FIRST + 001 )
+			/* A send or send-once right was deleted. */
+#define MACH_NOTIFY_PORT_DESTROYED	(MACH_NOTIFY_FIRST + 005)
+			/* A receive right was (would have been) deallocated */
+#define MACH_NOTIFY_NO_SENDERS		(MACH_NOTIFY_FIRST + 006)
+			/* Receive right has no extant send rights */
+#define MACH_NOTIFY_SEND_ONCE		(MACH_NOTIFY_FIRST + 007)
+			/* An extant send-once right died */
+#define MACH_NOTIFY_DEAD_NAME		(MACH_NOTIFY_FIRST + 010)
+			/* Send or send-once right died, leaving a dead-name */
+#define MACH_NOTIFY_LAST		(MACH_NOTIFY_FIRST + 015)
+
+typedef mach_port_t notify_port_t;
+
+/*
+ * Hard-coded message structures for receiving Mach port notification
+ * messages.  However, they are not actual large enough to receive 
+ * the largest trailers current exported by Mach IPC (so they cannot
+ * be used for space allocations in situations using these new larger
+ * trailers).  Instead, the MIG-generated server routines (and
+ * related prototypes should be used).
+ */
+typedef struct {
+    mach_msg_header_t	not_header;
+    NDR_record_t	NDR;
+    mach_port_name_t not_port;/* MACH_MSG_TYPE_PORT_NAME */
+    mach_msg_format_0_trailer_t trailer;
+} mach_port_deleted_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    mach_msg_body_t	not_body;
+    mach_msg_port_descriptor_t not_port;/* MACH_MSG_TYPE_PORT_RECEIVE */
+    mach_msg_format_0_trailer_t trailer;
+} mach_port_destroyed_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    NDR_record_t	NDR;
+    mach_msg_type_number_t not_count;
+    mach_msg_format_0_trailer_t trailer;
+} mach_no_senders_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    mach_msg_format_0_trailer_t trailer;
+} mach_send_once_notification_t;
+
+typedef struct {
+    mach_msg_header_t	not_header;
+    NDR_record_t	NDR;
+    mach_port_name_t not_port;/* MACH_MSG_TYPE_PORT_NAME */
+    mach_msg_format_0_trailer_t trailer;
+} mach_dead_name_notification_t;
+
+#endif	/* _MACH_NOTIFY_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/policy.h b/xnu-792.18.15/osfmk/mach/policy.h
new file mode 100644
index 0000000..b6ec795
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/policy.h
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_POLICY_H_
+#define _MACH_POLICY_H_
+
+/*
+ *	mach/policy.h
+ *
+ *	Definitions for scheduing policy.
+ */
+
+/*
+ *  All interfaces defined here are obsolete.
+ */
+
+#include <mach/boolean.h>
+#include <mach/message.h>
+#include <mach/vm_types.h>
+
+/*
+ *	Old scheduling control interface
+ */
+typedef int 				policy_t;
+typedef integer_t			*policy_info_t;
+typedef integer_t			*policy_base_t;
+typedef integer_t			*policy_limit_t;
+
+/*
+ *	Policy definitions.  Policies should be powers of 2,
+ *	but cannot be or'd together other than to test for a
+ *	policy 'class'.
+ */
+#define	POLICY_NULL		0	/* none			*/
+#define	POLICY_TIMESHARE	1	/* timesharing		*/
+#define	POLICY_RR		2	/* fixed round robin	*/
+#define POLICY_FIFO		4	/* fixed fifo		*/
+
+#define __NEW_SCHEDULING_FRAMEWORK__
+
+/*
+ *	Check if policy is of 'class' fixed-priority.
+ */
+#define	POLICYCLASS_FIXEDPRI	(POLICY_RR | POLICY_FIFO)
+
+/*
+ *	Check if policy is valid.
+ */
+#define invalid_policy(policy)			\
+	((policy) != POLICY_TIMESHARE &&	\
+	 (policy) != POLICY_RR &&		\
+	 (policy) != POLICY_FIFO)
+
+
+/*
+ * 	Types for TIMESHARE policy
+ */
+struct policy_timeshare_base {			
+	integer_t		base_priority;
+};
+struct policy_timeshare_limit {
+	integer_t		max_priority;
+};
+struct policy_timeshare_info {
+	integer_t		max_priority;
+	integer_t		base_priority;
+	integer_t		cur_priority;
+	boolean_t		depressed;
+	integer_t		depress_priority;
+};
+
+typedef struct policy_timeshare_base	*policy_timeshare_base_t; 
+typedef struct policy_timeshare_limit	*policy_timeshare_limit_t;
+typedef struct policy_timeshare_info	*policy_timeshare_info_t;
+
+typedef struct policy_timeshare_base	policy_timeshare_base_data_t; 
+typedef struct policy_timeshare_limit	policy_timeshare_limit_data_t;
+typedef struct policy_timeshare_info	policy_timeshare_info_data_t;
+
+
+#define POLICY_TIMESHARE_BASE_COUNT	((mach_msg_type_number_t) \
+	(sizeof(struct policy_timeshare_base)/sizeof(integer_t)))
+#define POLICY_TIMESHARE_LIMIT_COUNT	((mach_msg_type_number_t) \
+	(sizeof(struct policy_timeshare_limit)/sizeof(integer_t)))
+#define POLICY_TIMESHARE_INFO_COUNT	((mach_msg_type_number_t) \
+	(sizeof(struct policy_timeshare_info)/sizeof(integer_t)))
+
+
+/*
+ *	Types for the ROUND ROBIN (RR) policy
+ */
+struct policy_rr_base {				
+	integer_t		base_priority;
+	integer_t		quantum;
+};
+struct policy_rr_limit {
+	integer_t		max_priority;
+};
+struct policy_rr_info {
+	integer_t		max_priority;
+	integer_t		base_priority;
+	integer_t		quantum;
+	boolean_t		depressed;
+	integer_t		depress_priority;
+};
+
+typedef struct policy_rr_base		*policy_rr_base_t;
+typedef struct policy_rr_limit		*policy_rr_limit_t;
+typedef struct policy_rr_info		*policy_rr_info_t;
+
+typedef struct policy_rr_base		policy_rr_base_data_t;
+typedef struct policy_rr_limit		policy_rr_limit_data_t;
+typedef struct policy_rr_info		policy_rr_info_data_t;
+
+#define POLICY_RR_BASE_COUNT	((mach_msg_type_number_t)	\
+	(sizeof(struct policy_rr_base)/sizeof(integer_t)))
+#define POLICY_RR_LIMIT_COUNT	((mach_msg_type_number_t)	\
+	(sizeof(struct policy_rr_limit)/sizeof(integer_t)))
+#define POLICY_RR_INFO_COUNT	((mach_msg_type_number_t)	\
+	(sizeof(struct policy_rr_info)/sizeof(integer_t)))
+
+
+/*
+ * 	Types for the FIRST-IN-FIRST-OUT (FIFO) policy
+ */
+struct policy_fifo_base {		
+	integer_t		base_priority;
+};
+struct policy_fifo_limit {
+	integer_t		max_priority;
+};
+struct policy_fifo_info {
+	integer_t		max_priority;
+	integer_t		base_priority;
+	boolean_t		depressed;
+	integer_t		depress_priority;
+};
+
+typedef struct policy_fifo_base		*policy_fifo_base_t;
+typedef struct policy_fifo_limit	*policy_fifo_limit_t;
+typedef struct policy_fifo_info		*policy_fifo_info_t;
+
+typedef struct policy_fifo_base		policy_fifo_base_data_t;
+typedef struct policy_fifo_limit	policy_fifo_limit_data_t;
+typedef struct policy_fifo_info		policy_fifo_info_data_t;
+
+#define POLICY_FIFO_BASE_COUNT	((mach_msg_type_number_t)	\
+	(sizeof(struct policy_fifo_base)/sizeof(integer_t)))
+#define POLICY_FIFO_LIMIT_COUNT	((mach_msg_type_number_t)	\
+	(sizeof(struct policy_fifo_limit)/sizeof(integer_t)))
+#define POLICY_FIFO_INFO_COUNT	((mach_msg_type_number_t)	\
+	(sizeof(struct policy_fifo_info)/sizeof(integer_t)))
+
+/*
+ * 	Aggregate policy types
+ */
+
+struct policy_bases {
+	policy_timeshare_base_data_t	ts;
+	policy_rr_base_data_t		rr;
+	policy_fifo_base_data_t		fifo;
+};
+
+struct policy_limits {
+	policy_timeshare_limit_data_t	ts;
+	policy_rr_limit_data_t		rr;
+	policy_fifo_limit_data_t	fifo;
+};
+
+struct policy_infos {
+	policy_timeshare_info_data_t	ts;
+	policy_rr_info_data_t		rr;
+	policy_fifo_info_data_t		fifo;
+};
+
+typedef struct policy_bases		policy_base_data_t;
+typedef struct policy_limits		policy_limit_data_t;
+typedef struct policy_infos		policy_info_data_t;
+
+#endif	/* _MACH_POLICY_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/port.h b/xnu-792.18.15/osfmk/mach/port.h
new file mode 100644
index 0000000..db22349
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/port.h
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/port.h
+ *
+ *	Definition of a Mach port
+ *
+ *	Mach ports are the endpoints to Mach-implemented communications
+ *	channels (usually uni-directional message queues, but other types
+ *	also exist).
+ *
+ *	Unique collections of these endpoints are maintained for each
+ *	Mach task.  Each Mach port in the task's collection is given a 
+ *	[task-local] name to identify it - and the the various "rights"
+ *	held by the task for that specific endpoint.
+ *
+ *	This header defines the types used to identify these Mach ports
+ *	and the various rights associated with them.  For more info see:
+ *
+ *	<mach/mach_port.h> - manipulation of port rights in a given space
+ *	<mach/message.h> - message queue [and port right passing] mechanism
+ *
+ */
+
+#ifndef	_MACH_PORT_H_
+#define _MACH_PORT_H_
+
+#include <stdint.h>
+#include <mach/boolean.h>
+#include <mach/machine/vm_types.h>
+
+/*
+ *	mach_port_name_t - the local identity for a Mach port
+ *
+ *	The name is Mach port namespace specific.  It is used to
+ *	identify the rights held for that port by the task whose
+ *	namespace is implied [or specifically provided].
+ *
+ *	Use of this type usually implies just a name - no rights.
+ *	See mach_port_t for a type that implies a "named right."
+ *
+ */
+ 
+typedef natural_t mach_port_name_t;
+typedef mach_port_name_t *mach_port_name_array_t;
+
+#ifdef	KERNEL
+
+/* 
+ *	mach_port_t - a named port right
+ *
+ *	In the kernel, "rights" are represented [named] by pointers to
+ *	the ipc port object in question. There is no port namespace for the
+ *	rights to be collected.
+ *
+ *	Actually, there is namespace for the kernel task.  But most kernel
+ *	code - including, but not limited to, Mach IPC code - lives in the
+ *	limbo between the current user-level task and the "next" task. Very
+ *	little of the kernel code runs in full kernel task context.  So very
+ *	little of it gets to use the kernel task's port name space.  
+ *
+ *	Because of this implementation approach, all in-kernel rights for
+ *	a given port coalesce [have the same name/pointer].  The actual
+ *	references are counted in the port itself.  It is up to the kernel
+ *	code in question to "just remember" how many [and what type of]
+ *	rights it holds and handle them appropriately.
+ *
+ */
+
+#ifndef	MACH_KERNEL_PRIVATE
+/*
+ *	For kernel code that resides outside of Mach proper, we opaque the
+ *	port structure definition.
+ */
+struct ipc_port ;
+
+#endif	/* MACH_KERNEL_PRIVATE */
+
+typedef struct ipc_port	        *ipc_port_t;
+
+#define IPC_PORT_NULL		((ipc_port_t) 0)
+#define IPC_PORT_DEAD		((ipc_port_t)~0)
+#define IPC_PORT_VALID(port) \
+	((port) != IPC_PORT_NULL && (port) != IPC_PORT_DEAD)
+
+typedef ipc_port_t 		mach_port_t;
+
+#else	/* KERNEL */
+
+/* 
+ *	mach_port_t - a named port right
+ *
+ *	In user-space, "rights" are represented by the name of the
+ *	right in the Mach port namespace.  Even so, this type is
+ *	presented as a unique one to more clearly denote the presence
+ *	of a right coming along with the name. 
+ *
+ *	Often, various rights for a port held in a single name space
+ *	will coalesce and are, therefore, be identified by a single name
+ *	[this is the case for send and receive rights].  But not
+ *	always [send-once rights currently get a unique name for
+ *	each right].      
+ *
+ */
+
+#ifndef _MACH_PORT_T
+#define _MACH_PORT_T
+typedef mach_port_name_t 		mach_port_t;
+#endif
+
+#endif	/* KERNEL */
+
+typedef mach_port_t			*mach_port_array_t;
+
+/*
+ *  MACH_PORT_NULL is a legal value that can be carried in messages.
+ *  It indicates the absence of any port or port rights.  (A port
+ *  argument keeps the message from being "simple", even if the
+ *  value is MACH_PORT_NULL.)  The value MACH_PORT_DEAD is also a legal
+ *  value that can be carried in messages.  It indicates
+ *  that a port right was present, but it died.
+ */
+
+#define MACH_PORT_NULL		0  /* intentional loose typing */
+#define MACH_PORT_DEAD		((mach_port_name_t) ~0)
+#define MACH_PORT_VALID(name)				\
+		(((name) != MACH_PORT_NULL) && 		\
+		 ((name) != MACH_PORT_DEAD))
+
+
+/*
+ *	For kernel-selected [assigned] port names, the name is
+ *	comprised of two parts: a generation number and an index.
+ *	This approach keeps the exact same name from being generated
+ *	and reused too quickly [to catch right/reference counting bugs].
+ *	The dividing line between the constituent parts is exposed so
+ *	that efficient "mach_port_name_t to data structure pointer"
+ *	conversion implementation can be made.  But it is possible
+ *	for user-level code to assign their own names to Mach ports.
+ *	These are not required to participate in this algorithm.  So
+ *	care should be taken before "assuming" this model.
+ *
+ */
+
+#ifndef	NO_PORT_GEN
+
+#define	MACH_PORT_INDEX(name)		((name) >> 8)
+#define	MACH_PORT_GEN(name)		(((name) & 0xff) << 24)
+#define	MACH_PORT_MAKE(index, gen)	\
+		(((index) << 8) | (gen) >> 24)
+
+#else	/* NO_PORT_GEN */
+
+#define	MACH_PORT_INDEX(name)		(name)
+#define	MACH_PORT_GEN(name)		(0)
+#define	MACH_PORT_MAKE(index, gen)	(index)
+
+#endif	/* NO_PORT_GEN */
+
+
+/*
+ *  These are the different rights a task may have for a port.
+ *  The MACH_PORT_RIGHT_* definitions are used as arguments
+ *  to mach_port_allocate, mach_port_get_refs, etc, to specify
+ *  a particular right to act upon.  The mach_port_names and
+ *  mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
+ *  definitions.  This is because a single name may denote
+ *  multiple rights.
+ */
+
+typedef natural_t mach_port_right_t;
+
+#define MACH_PORT_RIGHT_SEND		((mach_port_right_t) 0)
+#define MACH_PORT_RIGHT_RECEIVE		((mach_port_right_t) 1)
+#define MACH_PORT_RIGHT_SEND_ONCE	((mach_port_right_t) 2)
+#define MACH_PORT_RIGHT_PORT_SET	((mach_port_right_t) 3)
+#define MACH_PORT_RIGHT_DEAD_NAME	((mach_port_right_t) 4)
+#define MACH_PORT_RIGHT_NUMBER		((mach_port_right_t) 5)
+
+typedef natural_t mach_port_type_t;
+typedef mach_port_type_t *mach_port_type_array_t;
+
+#define MACH_PORT_TYPE(right)						\
+		((mach_port_type_t)(((mach_port_type_t) 1)  		\
+		<< ((right) + ((mach_port_right_t) 16))))	
+#define MACH_PORT_TYPE_NONE	    ((mach_port_type_t) 0L)
+#define MACH_PORT_TYPE_SEND	    MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
+#define MACH_PORT_TYPE_RECEIVE	    MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
+#define MACH_PORT_TYPE_SEND_ONCE    MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
+#define MACH_PORT_TYPE_PORT_SET	    MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
+#define MACH_PORT_TYPE_DEAD_NAME    MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
+
+/* Convenient combinations. */
+
+#define MACH_PORT_TYPE_SEND_RECEIVE					\
+		(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
+#define	MACH_PORT_TYPE_SEND_RIGHTS					\
+		(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
+#define	MACH_PORT_TYPE_PORT_RIGHTS					\
+		(MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
+#define	MACH_PORT_TYPE_PORT_OR_DEAD					\
+		(MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
+#define MACH_PORT_TYPE_ALL_RIGHTS					\
+		(MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
+
+/* Dummy type bits that mach_port_type/mach_port_names can return. */
+
+#define MACH_PORT_TYPE_DNREQUEST	0x80000000
+
+/* User-references for capabilities. */
+
+typedef natural_t mach_port_urefs_t;
+typedef integer_t mach_port_delta_t;			/* change in urefs */
+
+/* Attributes of ports.  (See mach_port_get_receive_status.) */
+
+typedef natural_t mach_port_seqno_t;		/* sequence number */
+typedef natural_t mach_port_mscount_t;		/* make-send count */
+typedef natural_t mach_port_msgcount_t;		/* number of msgs */
+typedef natural_t mach_port_rights_t;		/* number of rights */
+
+/*
+ *	Are there outstanding send rights for a given port?
+ */
+#define	MACH_PORT_SRIGHTS_NONE		0		/* no srights */
+#define	MACH_PORT_SRIGHTS_PRESENT	1		/* srights */
+typedef unsigned int mach_port_srights_t;	/* status of send rights */
+
+typedef struct mach_port_status {
+	mach_port_name_t	mps_pset;	/* containing port set */
+	mach_port_seqno_t	mps_seqno;	/* sequence number */
+	mach_port_mscount_t	mps_mscount;	/* make-send count */
+	mach_port_msgcount_t	mps_qlimit;	/* queue limit */
+	mach_port_msgcount_t	mps_msgcount;	/* number in the queue */
+	mach_port_rights_t	mps_sorights;	/* how many send-once rights */
+	boolean_t		mps_srights;	/* do send rights exist? */
+	boolean_t		mps_pdrequest;	/* port-deleted requested? */
+	boolean_t		mps_nsrequest;	/* no-senders requested? */
+	natural_t		mps_flags;		/* port flags */
+} mach_port_status_t;
+
+#define MACH_PORT_QLIMIT_DEFAULT	((mach_port_msgcount_t) 5)
+#define MACH_PORT_QLIMIT_MAX	((mach_port_msgcount_t) 16)
+
+typedef struct mach_port_limits {
+	mach_port_msgcount_t	mpl_qlimit;	/* number of msgs */
+} mach_port_limits_t;
+
+typedef integer_t *mach_port_info_t;		/* varying array of natural_t */
+
+/* Flavors for mach_port_get/set_attributes() */
+typedef int	mach_port_flavor_t;
+#define MACH_PORT_LIMITS_INFO		1	/* uses mach_port_status_t */
+#define MACH_PORT_RECEIVE_STATUS	2	/* uses mach_port_limits_t */
+#define MACH_PORT_DNREQUESTS_SIZE	3	/* info is int */
+
+#define MACH_PORT_LIMITS_INFO_COUNT	((natural_t) \
+	(sizeof(mach_port_limits_t)/sizeof(natural_t)))
+#define MACH_PORT_RECEIVE_STATUS_COUNT	((natural_t) \
+	(sizeof(mach_port_status_t)/sizeof(natural_t)))
+#define MACH_PORT_DNREQUESTS_SIZE_COUNT 1
+
+/*
+ * Structure used to pass information about port allocation requests.
+ * Must be padded to 64-bits total length.
+ */
+typedef struct mach_port_qos {
+	boolean_t		name:1;		/* name given */
+	boolean_t		prealloc:1;	/* prealloced message */
+	boolean_t		pad1:30;
+	natural_t		len;
+} mach_port_qos_t;
+
+#if	!defined(_POSIX_C_SOURCE) && !defined(_NO_PORT_T_FROM_MACH)
+/*
+ *  Mach 3.0 renamed everything to have mach_ in front of it.
+ *  These types and macros are provided for backward compatibility
+ *	but are deprecated.
+ */
+typedef mach_port_t		port_t;
+typedef mach_port_name_t	port_name_t;
+typedef mach_port_name_t	*port_name_array_t;
+
+#define PORT_NULL		((port_t) 0)
+#define PORT_DEAD		((port_t) ~0)
+#define PORT_VALID(name) \
+		((port_t)(name) != PORT_NULL && (port_t)(name) != PORT_DEAD)
+
+#endif	/* !_POSIX_C_SOURCE && !_NO_PORT_T_FROM_MACH */
+
+#endif	/* _MACH_PORT_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/processor.defs b/xnu-792.18.15/osfmk/mach/processor.defs
new file mode 100644
index 0000000..ad84af8
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/processor.defs
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_port.defs
+ *	Author:	Rich Draves
+ *
+ *	Exported kernel calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  processor 3000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+/*
+ * References to processor objects are returned by:
+ *	host_processors(host_priv_t,...);
+ *
+/*
+ *	Start processor.
+ */
+routine	processor_start(
+		processor	: processor_t);
+
+/*
+ *	Exit processor -- may not be restartable.
+ */
+
+routine	processor_exit(
+		processor	: processor_t);
+
+/*
+ *	Return information about this processor.
+ */
+routine processor_info(
+		processor	: processor_t;
+		flavor		: processor_flavor_t;
+	out	host		: host_t;
+	out	processor_info_out: processor_info_t, CountInOut);
+
+
+/*
+ *	Do something machine-dependent to processor.
+ */
+routine processor_control(
+		processor	: processor_t;
+		processor_cmd	: processor_info_t);
+
+/*
+ * JMM - Keep processor_set related stuff at the end because
+ * they likely will be removed.
+ */
+
+/*
+ *	Assign processor to processor set.
+ */
+routine processor_assign(
+		processor	: processor_t;
+		new_set		: processor_set_t;
+		wait		: boolean_t);
+
+/*
+ *	Get current assignment for processor.
+ */
+routine processor_get_assignment(
+		processor	: processor_t;
+	out	assigned_set	: processor_set_name_t);
diff --git a/xnu-792.18.15/osfmk/mach/processor_info.h b/xnu-792.18.15/osfmk/mach/processor_info.h
new file mode 100644
index 0000000..db40394
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/processor_info.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+/*
+ *	File:	mach/processor_info.h
+ *	Author:	David L. Black
+ *	Date:	1988
+ *
+ *	Data structure definitions for processor_info, processor_set_info
+ */
+
+#ifndef	_MACH_PROCESSOR_INFO_H_
+#define _MACH_PROCESSOR_INFO_H_
+
+#include <mach/message.h>
+#include <mach/machine.h>
+#include <mach/machine/processor_info.h>
+
+/*
+ *	Generic information structure to allow for expansion.
+ */
+typedef integer_t	*processor_info_t;	/* varying array of int. */
+typedef integer_t	*processor_info_array_t;  /* varying array of int */
+
+#define PROCESSOR_INFO_MAX	(1024)	/* max array size */
+typedef integer_t	processor_info_data_t[PROCESSOR_INFO_MAX];
+
+
+typedef integer_t	*processor_set_info_t;	/* varying array of int. */
+
+#define PROCESSOR_SET_INFO_MAX	(1024)	/* max array size */
+typedef integer_t	processor_set_info_data_t[PROCESSOR_SET_INFO_MAX];
+
+/*
+ *	Currently defined information.
+ */
+typedef int	processor_flavor_t;
+#define	PROCESSOR_BASIC_INFO	1		/* basic information */
+#define	PROCESSOR_CPU_LOAD_INFO	2	/* cpu load information */
+#define	PROCESSOR_PM_REGS_INFO	0x10000001	/* performance monitor register info */
+#define	PROCESSOR_TEMPERATURE	0x10000002	/* Processor core temperature */
+
+struct processor_basic_info {
+	cpu_type_t	cpu_type;	/* type of cpu */
+	cpu_subtype_t	cpu_subtype;	/* subtype of cpu */
+	boolean_t	running;	/* is processor running */
+	int		slot_num;	/* slot number */
+	boolean_t	is_master;	/* is this the master processor */
+};
+
+typedef	struct processor_basic_info	processor_basic_info_data_t;
+typedef struct processor_basic_info	*processor_basic_info_t;
+#define PROCESSOR_BASIC_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(processor_basic_info_data_t)/sizeof(natural_t)))
+
+struct processor_cpu_load_info {             /* number of ticks while running... */
+        unsigned long   cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
+}; 
+
+typedef	struct processor_cpu_load_info	processor_cpu_load_info_data_t;
+typedef struct processor_cpu_load_info	*processor_cpu_load_info_t;
+#define PROCESSOR_CPU_LOAD_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(processor_cpu_load_info_data_t)/sizeof(natural_t)))
+
+/*
+ *	Scaling factor for load_average, mach_factor.
+ */
+#define	LOAD_SCALE	1000		
+
+typedef	int	processor_set_flavor_t;
+#define	PROCESSOR_SET_BASIC_INFO	5	/* basic information */
+
+struct processor_set_basic_info {
+	int		processor_count;	/* How many processors */
+	int		default_policy;		/* When others not enabled */
+};
+
+typedef	struct processor_set_basic_info	processor_set_basic_info_data_t;
+typedef struct processor_set_basic_info	*processor_set_basic_info_t;
+#define PROCESSOR_SET_BASIC_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(processor_set_basic_info_data_t)/sizeof(natural_t)))
+
+#define PROCESSOR_SET_LOAD_INFO		4	/* scheduling statistics */
+
+struct processor_set_load_info {
+        int             task_count;             /* How many tasks */
+        int             thread_count;           /* How many threads */
+        integer_t       load_average;           /* Scaled */
+        integer_t       mach_factor;            /* Scaled */
+};
+
+typedef struct processor_set_load_info processor_set_load_info_data_t;
+typedef struct processor_set_load_info *processor_set_load_info_t;
+#define PROCESSOR_SET_LOAD_INFO_COUNT	((mach_msg_type_number_t) \
+                (sizeof(processor_set_load_info_data_t)/sizeof(natural_t)))
+
+#ifdef	PRIVATE
+
+#define PROCESSOR_SET_ENABLED_POLICIES                   3
+#define PROCESSOR_SET_ENABLED_POLICIES_COUNT ((mach_msg_type_number_t) \
+		(sizeof(policy_t)/sizeof(natural_t)))
+
+#define PROCESSOR_SET_TIMESHARE_DEFAULT                 10
+#define PROCESSOR_SET_TIMESHARE_LIMITS                  11
+
+#define PROCESSOR_SET_RR_DEFAULT                        20
+#define PROCESSOR_SET_RR_LIMITS                         21
+
+#define PROCESSOR_SET_FIFO_DEFAULT                      30
+#define PROCESSOR_SET_FIFO_LIMITS                       31
+
+#endif	/* PRIVATE */
+
+#endif	/* _MACH_PROCESSOR_INFO_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/processor_set.defs b/xnu-792.18.15/osfmk/mach/processor_set.defs
new file mode 100644
index 0000000..aa2e956
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/processor_set.defs
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_port.defs
+ *	Author:	Rich Draves
+ *
+ *	Exported kernel calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  processor_set 4000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+/*
+ *      Return scheduling statistics for a processor set.
+ */
+routine processor_set_statistics(
+        	pset                    : processor_set_name_t;
+        	flavor                  : processor_set_flavor_t;
+	out     info_out        	: processor_set_info_t, CountInOut);
+
+
+/*
+ *	Destroy processor set.
+ */
+routine processor_set_destroy(
+		set		: processor_set_t);
+
+
+/*
+ *	Set max priority for processor_set.
+ */
+routine processor_set_max_priority(
+		processor_set	: processor_set_t;
+		max_priority	: int;
+		change_threads	: boolean_t);
+
+/*
+ *	Enable policy for processor set
+ */
+routine processor_set_policy_enable(
+		processor_set	: processor_set_t;
+		policy		: int);
+
+/*
+ *	Disable policy for processor set
+ */
+routine processor_set_policy_disable(
+		processor_set	: processor_set_t;
+		policy		: int;
+		change_threads	: boolean_t);
+
+/*
+ *	List all tasks in processor set.
+ */
+routine processor_set_tasks(
+		processor_set	: processor_set_t;
+	out	task_list	: task_array_t);
+
+/*
+ *	List all threads in processor set.
+ */
+routine processor_set_threads(
+		processor_set	: processor_set_t;
+	out	thread_list	: thread_act_array_t);
+
+/*
+ *      Controls the scheduling attributes governing the processor set.
+ *      Allows control of enabled policies, and per-policy base and limit
+ *      priorities.
+ */
+routine processor_set_policy_control(
+	pset			: processor_set_t;
+	flavor			: processor_set_flavor_t;
+	policy_info		: processor_set_info_t;
+	change			: boolean_t);
+
+
+/*
+ *	Debug Info
+ *      This call is only valid on MACH_DEBUG kernels.
+ *      Otherwise, KERN_FAILURE is returned.
+ */
+routine processor_set_stack_usage(
+		pset		: processor_set_t;
+	out	total		: unsigned;
+	out	space		: vm_size_t;
+	out	resident	: vm_size_t;
+	out	maxusage	: vm_size_t;
+	out	maxstack	: vm_offset_t);
+
+/*
+ *      Get information about processor set.
+ */
+routine processor_set_info(
+                set_name        : processor_set_name_t;
+                flavor          : int;
+        out     host            : host_t;
+        out     info_out        : processor_set_info_t, CountInOut);
+
diff --git a/xnu-792.18.15/osfmk/mach/prof.defs b/xnu-792.18.15/osfmk/mach/prof.defs
new file mode 100644
index 0000000..c5a1749
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/prof.defs
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:46  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.2.12.3  1996/01/09  19:22:20  devrcs
+ * 	Change  notices: msgoption options from int to mach_msg_options_t.
+ * 	[1995/12/01  19:49:49  jfraser]
+ *
+ * 	Merged '64-bit safe' changes from DEC alpha port.
+ * 	[1995/11/21  18:09:30  jfraser]
+ *
+ * Revision 1.2.12.2  1995/01/06  19:51:41  devrcs
+ * 	mk6 CR668 - 1.3b26 merge
+ * 	* Revision 1.2.2.4  1994/03/24  21:23:54  hidden
+ * 	added send_notices to support DCI profile/event tracing
+ * 	* End1.3merge
+ * 	[1994/11/02  18:32:19  dwm]
+ * 
+ * Revision 1.2.12.1  1994/09/23  02:41:58  ezf
+ * 	change marker to not FREE
+ * 	[1994/09/22  21:42:31  ezf]
+ * 
+ * Revision 1.2.2.2  1993/06/09  02:43:11  gm
+ * 	Added to OSF/1 R1.3 from NMK15.0.
+ * 	[1993/06/02  21:18:01  jeffc]
+ * 
+ * Revision 1.2  1993/04/19  16:38:55  devrcs
+ * 	[0014] Change subsystem number as current shared with exc.defs reply messages.
+ * 	[1992/12/23  13:11:20  david]
+ * 
+ * Revision 1.1  1992/09/30  02:23:01  robert
+ * 	Initial revision
+ * 
+ * $EndLog$
+ */
+/* CMU_HIST */
+/*
+ * Revision 2.1.2.1  92/09/15  17:25:42  jeffreyh
+ * 	Created
+ * 	[92/07/17            bernadat]
+ * 
+ */
+/* CMU_ENDHIST */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ * Abstract:
+ *	MiG definitions file for Mach Profiling interface.
+ *	receive_samples();
+ */
+
+subsystem
+#if	KERNEL_USER
+	  KernelUser
+#endif	KERNEL_USER
+		prof 2450;		/* exc.defs from 2400 - 2449 */
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+
+ServerPrefix	receive_;
+UserPrefix	send_;
+
+type sample_array_t = array[*:1024] of unsigned;
+
+simpleroutine		samples(
+			reply_port	: mach_port_t;
+			samples		: sample_array_t);
+
+simpleroutine		notices(
+			reply_port	: mach_port_t;
+			samples		: sample_array_t;
+	msgoption	options		: mach_msg_options_t);
+
+
+
+
diff --git a/xnu-792.18.15/osfmk/mach/prof_types.h b/xnu-792.18.15/osfmk/mach/prof_types.h
new file mode 100644
index 0000000..a410372
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/prof_types.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/*
+ * HISTORY
+ * 
+ * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
+ * Import of Mac OS X kernel (~semeria)
+ *
+ * Revision 1.1.1.1  1998/03/07 02:25:46  wsanchez
+ * Import of OSF Mach kernel (~mburg)
+ *
+ * Revision 1.2.7.2  1995/01/26  22:15:46  ezf
+ * 	corrected CR
+ * 	[1995/01/26  21:16:02  ezf]
+ *
+ * Revision 1.2.3.2  1993/06/09  02:43:16  gm
+ * 	Added to OSF/1 R1.3 from NMK15.0.
+ * 	[1993/06/02  21:18:04  jeffc]
+ * 
+ * Revision 1.2  1993/04/19  16:39:03  devrcs
+ * 	ansi C conformance changes
+ * 	[1993/02/02  18:54:26  david]
+ * 
+ * Revision 1.1  1992/09/30  02:32:04  robert
+ * 	Initial revision
+ * 
+ * $EndLog$
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+
+#ifndef	_MACH_PROF_TYPES_H
+#define	_MACH_PROF_TYPES_H
+
+#define	SAMPLE_MAX	256	/* Max array size */
+typedef unsigned	sample_array_t[SAMPLE_MAX];
+
+#endif	/* _MACH_PROF_TYPES_H */
diff --git a/xnu-792.18.15/osfmk/mach/rpc.h b/xnu-792.18.15/osfmk/mach/rpc.h
new file mode 100644
index 0000000..565d7ac
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/rpc.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+/*
+ * Mach RPC Subsystem Interfaces
+ */
+
+#ifndef	_MACH_RPC_H_
+#define _MACH_RPC_H_
+
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/port.h>
+#include <mach/vm_types.h>
+
+#include <mach/mig.h>
+#include <mach/mig_errors.h>
+#include <mach/machine/rpc.h>
+#include <mach/thread_status.h>
+
+/*
+ * These are the types for RPC-specific variants of the MIG routine
+ * descriptor and subsystem data types.
+ *
+ * THIS IS ONLY FOR COMPATIBILITY.  WE WILL NOT BE IMPLEMENTING THIS.
+ */
+
+/*
+ * Basic mach rpc types.
+ */
+typedef unsigned int    routine_arg_type;
+typedef unsigned int	routine_arg_offset;
+typedef unsigned int	routine_arg_size;
+
+/*
+ * Definitions for a signature's argument and routine descriptor's.
+ */
+struct rpc_routine_arg_descriptor {
+	routine_arg_type	type;	   /* Port, Array, etc. */
+        routine_arg_size        size;      /* element size in bytes */
+        routine_arg_size        count;     /* number of elements */
+	routine_arg_offset	offset;	   /* Offset in list of routine args */
+};
+typedef struct rpc_routine_arg_descriptor *rpc_routine_arg_descriptor_t;
+
+struct rpc_routine_descriptor {
+	mig_impl_routine_t	impl_routine;	/* Server work func pointer   */
+	mig_stub_routine_t	stub_routine;	/* Unmarshalling func pointer */
+	unsigned int		argc;		/* Number of argument words   */
+	unsigned int		descr_count;	/* Number of complex argument */
+					        /* descriptors                */
+	rpc_routine_arg_descriptor_t
+				arg_descr;	/* Pointer to beginning of    */
+						/* the arg_descr array        */
+	unsigned int		max_reply_msg;	/* Max size for reply msg     */
+};
+typedef struct rpc_routine_descriptor *rpc_routine_descriptor_t;
+
+#define RPC_DESCR_SIZE(x) ((x)->descr_count * \
+				sizeof(struct rpc_routine_arg_descriptor))
+
+struct rpc_signature {
+    struct rpc_routine_descriptor rd;
+    struct rpc_routine_arg_descriptor rad[1];
+};
+
+#define RPC_SIGBUF_SIZE 8
+
+/*
+ *	A subsystem describes a set of server routines that can be invoked by
+ *	mach_rpc() on the ports that are registered with the subsystem.  For
+ *	each routine, the routine number is given, along with the
+ *	address of the implementation function in the server and a
+ *	description of the arguments of the routine (it's "signature").
+ *
+ *	This structure definition is only a template for what is really a
+ *	variable-length structure (generated by MIG for each subsystem).
+ *	The actual structures do not always have one entry in the routine
+ *	array, and also have a varying number of entries in the arg_descr
+ *	array.  Each routine has an array of zero or more arg descriptors
+ *	one for each complex arg.  These arrays are all catenated together
+ *	to form the arg_descr field of the subsystem struct.  The
+ *	arg_descr field of each routine entry points to a unique sub-sequence
+ *	within this catenated array.  The goal is to keep everything
+ *	contiguous.
+ */
+struct rpc_subsystem {
+	void		*reserved;	/* Reserved for system use */
+
+	mach_msg_id_t	start;		/* Min routine number */
+	mach_msg_id_t	end;		/* Max routine number + 1 */
+	unsigned int	maxsize;	/* Max mach_msg size */
+	vm_address_t	base_addr;	/* Address of this struct in user */
+
+	struct rpc_routine_descriptor	/* Array of routine descriptors */
+			routine[1       /* Actually, (start-end+1) */
+				 ];
+
+	struct rpc_routine_arg_descriptor
+			arg_descriptor[1   /* Actually, the sum of the descr_ */
+					]; /* count fields for all routines   */
+};
+typedef struct rpc_subsystem  *rpc_subsystem_t;
+
+#define RPC_SUBSYSTEM_NULL	((rpc_subsystem_t) 0)
+
+#endif	/* _MACH_RPC_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/semaphore.defs b/xnu-792.18.15/osfmk/mach/semaphore.defs
new file mode 100644
index 0000000..07d8b3e
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/semaphore.defs
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+/*
+ *	File: mach/semaphore.defs
+ *	Author: Joseph CaraDonna
+ *
+ *	Exported kernel calls	
+ *
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	KernelServer
+#endif	/* KERNEL_SERVER */
+			semaphore 617200;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach/clock_types.defs>
+
+/*
+ * a semaphore_t is created and destroyed through the task object.
+ *      semaphore_create(task_t,&semaphore_t,...);
+ *      semaphore_destroy(task_t,semaphore_t);
+ */
+
+routine semaphore_signal(
+		semaphore	: semaphore_t);
+
+routine semaphore_signal_all(
+		semaphore	: semaphore_t);
+
+routine semaphore_wait(
+		semaphore	: semaphore_t);
+
+
+routine semaphore_signal_thread(
+		semaphore	: semaphore_t;
+		thread		: thread_act_t);
+
+routine semaphore_timedwait(
+		semaphore	: semaphore_t;
+		wait_time	: mach_timespec_t);
+
+routine semaphore_wait_signal(
+		wait_semaphore	: semaphore_t;
+		signal_semaphore: semaphore_t);
+
+routine semaphore_timedwait_signal(
+		wait_semaphore	: semaphore_t;
+		signal_semaphore: semaphore_t;
+		wait_time	: mach_timespec_t);
diff --git a/xnu-792.18.15/osfmk/mach/semaphore.h b/xnu-792.18.15/osfmk/mach/semaphore.h
new file mode 100644
index 0000000..f90bbcd
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/semaphore.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef _MACH_SEMAPHORE_H_
+#define _MACH_SEMAPHORE_H_
+
+#include <mach/port.h>
+#include <mach/mach_types.h>
+#include <mach/kern_return.h>
+#include <mach/sync_policy.h>
+
+/*
+ *	Forward Declarations
+ *
+ *	The semaphore creation and deallocation routines are
+ *	defined with the Mach task APIs in <mach/task.h>.
+ *
+ *      kern_return_t	semaphore_create(task_t task,
+ *                                       semaphore_t *new_semaphore,
+ *					 sync_policy_t policy,
+ *					 int value);
+ *
+ *	kern_return_t	semaphore_destroy(task_t task,
+ *					  semaphore_t semaphore);
+ */
+
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+
+extern	kern_return_t	semaphore_signal     	(semaphore_t semaphore);
+extern	kern_return_t	semaphore_signal_all 	(semaphore_t semaphore);
+extern	kern_return_t	semaphore_signal_thread	(semaphore_t semaphore,
+                                                 thread_t thread);
+
+extern	kern_return_t	semaphore_wait       	(semaphore_t semaphore);
+extern	kern_return_t	semaphore_timedwait    	(semaphore_t semaphore, 
+						 mach_timespec_t wait_time);
+
+extern  kern_return_t   semaphore_wait_signal   (semaphore_t wait_semaphore,
+                                                 semaphore_t signal_semaphore);
+
+extern  kern_return_t semaphore_timedwait_signal(semaphore_t wait_semaphore,
+                                                 semaphore_t signal_semaphore,
+                                                 mach_timespec_t wait_time);
+__END_DECLS
+
+#ifdef	PRIVATE
+
+#define SEMAPHORE_OPTION_NONE		0x00000000
+
+#define SEMAPHORE_SIGNAL		0x00000001
+#define SEMAPHORE_WAIT			0x00000002
+#define SEMAPHORE_WAIT_ON_SIGNAL	0x00000008
+
+#define SEMAPHORE_SIGNAL_TIMEOUT	0x00000010
+#define SEMAPHORE_SIGNAL_ALL		0x00000020
+#define SEMAPHORE_SIGNAL_INTERRUPT	0x00000040	/* libmach implements */
+#define SEMAPHORE_SIGNAL_PREPOST	0x00000080
+
+#define SEMAPHORE_WAIT_TIMEOUT		0x00000100
+#define SEMAPHORE_WAIT_INTERRUPT	0x00000400	/* libmach implements */
+
+#define SEMAPHORE_TIMEOUT_NOBLOCK	0x00100000
+#define SEMAPHORE_TIMEOUT_RELATIVE	0x00200000
+
+#define SEMAPHORE_USE_SAVED_RESULT	0x01000000	/* internal use only */
+#define SEMAPHORE_SIGNAL_RELEASE	0x02000000	/* internal use only */
+
+#endif	/* PRIVATE */
+
+#endif	/* _MACH_SEMAPHORE_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/shared_memory_server.h b/xnu-792.18.15/osfmk/mach/shared_memory_server.h
new file mode 100644
index 0000000..7d2f103
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/shared_memory_server.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ *
+ *	File: mach/shared_memory_server.h
+ *
+ * 	protos and struct definitions for shared library
+ *	server and interface
+ */
+#ifndef _MACH_SHARED_MEMORY_SERVER_H_
+#define _MACH_SHARED_MEMORY_SERVER_H_
+
+#include <sys/cdefs.h>
+#include <mach/vm_prot.h>
+#include <mach/vm_types.h>
+#include <mach/mach_types.h>
+
+#define VM_PROT_COW  0x8  /* must not interfere with normal prot assignments */
+#define VM_PROT_ZF  0x10  /* must not interfere with normal prot assignments */
+
+
+#if !defined(__LP64__)
+
+#define	SHARED_LIBRARY_SERVER_SUPPORTED
+#define GLOBAL_SHARED_TEXT_SEGMENT	0x90000000
+#define GLOBAL_SHARED_DATA_SEGMENT	0xA0000000
+#define GLOBAL_SHARED_SEGMENT_MASK	0xF0000000
+
+#define	SHARED_TEXT_REGION_SIZE		0x10000000
+#define	SHARED_DATA_REGION_SIZE		0x10000000
+#define	SHARED_ALTERNATE_LOAD_BASE	0x09000000
+
+/* 
+ *  Note: the two masks below are useful because the assumption is 
+ *  made that these shared regions will always be mapped on natural boundaries 
+ *  i.e. if the size is 0x10000000 the object can be mapped at 
+ *  0x20000000, or 0x30000000, but not 0x1000000
+ */
+#define	SHARED_TEXT_REGION_MASK		0x0FFFFFFF
+#define	SHARED_DATA_REGION_MASK		0x0FFFFFFF
+
+#define SHARED_LIB_ALIAS  0x10
+
+
+/* flags field aliases for copyin_shared_file and load_shared_file */
+
+/* IN */
+#define ALTERNATE_LOAD_SITE 0x1
+#define NEW_LOCAL_SHARED_REGIONS 0x2
+#define	QUERY_IS_SYSTEM_REGION 0x4
+
+/* OUT */
+#define SF_PREV_LOADED    0x1
+#define SYSTEM_REGION_BACKED 0x2
+
+
+struct sf_mapping {
+	vm_offset_t	mapping_offset;
+	vm_size_t	size;
+	vm_offset_t	file_offset;
+	vm_prot_t	protection;  /* read/write/execute/COW/ZF */
+	vm_offset_t	cksum;
+};
+typedef struct sf_mapping sf_mapping_t;
+
+#ifndef KERNEL
+/* load_shared_file and friends is deprecated */
+__BEGIN_DECLS
+int	load_shared_file(char *, caddr_t, u_long,
+		caddr_t *, int, sf_mapping_t *, int *);
+int	reset_shared_file(caddr_t *, int, sf_mapping_t *);
+int	new_system_shared_regions(void);
+__END_DECLS
+#endif /* !KERNEL */
+
+#endif  /* !defined(__LP64__) */
+
+/* 
+ * All shared_region_* declarations are a private interface
+ * between dyld and the kernel.
+ *
+ */
+struct shared_file_mapping_np {
+	mach_vm_address_t	sfm_address;
+	mach_vm_size_t		sfm_size;
+	mach_vm_offset_t	sfm_file_offset;
+	vm_prot_t		sfm_max_prot;
+	vm_prot_t		sfm_init_prot;
+};
+
+struct shared_region_range_np {
+	mach_vm_address_t	srr_address;
+	mach_vm_size_t		srr_size;
+};
+
+#ifndef KERNEL
+
+__BEGIN_DECLS
+int	shared_region_map_file_np(int fd,
+				  uint32_t mappingCount,
+				  const struct shared_file_mapping_np *mappings,
+				  int64_t *slide_p);
+int	shared_region_make_private_np(uint32_t rangeCount,
+				      const struct shared_region_range_np *ranges);
+__END_DECLS
+
+#endif /* !KERNEL */
+
+#endif /* _MACH_SHARED_MEMORY_SERVER_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/std_types.defs b/xnu-792.18.15/osfmk/mach/std_types.defs
new file mode 100644
index 0000000..49fe417
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/std_types.defs
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Mach kernel standard interface type declarations
+ */
+
+#ifndef	_MACH_STD_TYPES_DEFS_
+#define _MACH_STD_TYPES_DEFS_
+
+/* from ISO/IEC 988:1999 spec */
+/* 7.18.1.1 Exact-width integer types */
+
+type int8_t = MACH_MSG_TYPE_INTEGER_8;
+type uint8_t = MACH_MSG_TYPE_INTEGER_8;
+type int16_t = MACH_MSG_TYPE_INTEGER_16;
+type uint16_t = MACH_MSG_TYPE_INTEGER_16;
+type int32_t = MACH_MSG_TYPE_INTEGER_32;
+type uint32_t = MACH_MSG_TYPE_INTEGER_32;
+type int64_t = MACH_MSG_TYPE_INTEGER_64;
+type uint64_t = MACH_MSG_TYPE_INTEGER_64;
+
+/*
+ * Legacy fixed-length Mach types which should
+ * be replaced with the Standard types from above.
+ */
+type int32 = int32_t;
+type unsigned32 = uint32_t;
+type int64 = int64_t;
+type unsigned64 = uint64_t;
+
+/*
+ * Other fixed length Mach types.
+ */
+type char = MACH_MSG_TYPE_CHAR;
+type boolean_t = MACH_MSG_TYPE_BOOLEAN;
+
+#include <mach/machine/machine_types.defs>
+
+type kern_return_t = int;
+
+type pointer_t = ^array[] of MACH_MSG_TYPE_BYTE
+	ctype: vm_offset_t;
+
+
+type mach_port_t = MACH_MSG_TYPE_COPY_SEND;
+type mach_port_array_t = array[] of mach_port_t;
+
+type mach_port_name_t = MACH_MSG_TYPE_PORT_NAME;
+type mach_port_name_array_t = array[] of mach_port_name_t;
+
+type mach_port_right_t = natural_t;
+
+type mach_port_type_t = natural_t;
+type mach_port_type_array_t = array[] of mach_port_type_t;
+
+type mach_port_urefs_t = natural_t;
+type mach_port_delta_t = integer_t;
+type mach_port_seqno_t = natural_t;
+type mach_port_mscount_t = unsigned;
+type mach_port_msgcount_t = unsigned;
+type mach_port_rights_t = unsigned;
+type mach_msg_id_t = integer_t;
+type mach_msg_size_t = natural_t;
+type mach_msg_type_name_t = unsigned;
+type mach_msg_options_t = integer_t;
+
+type mach_port_move_receive_t =		MACH_MSG_TYPE_MOVE_RECEIVE
+	ctype: mach_port_t;
+type mach_port_copy_send_t =		MACH_MSG_TYPE_COPY_SEND
+	ctype: mach_port_t;
+type mach_port_make_send_t =		MACH_MSG_TYPE_MAKE_SEND
+	ctype: mach_port_t;
+type mach_port_move_send_t =		MACH_MSG_TYPE_MOVE_SEND
+	ctype: mach_port_t;
+type mach_port_make_send_once_t =	MACH_MSG_TYPE_MAKE_SEND_ONCE
+	ctype: mach_port_t;
+type mach_port_move_send_once_t =	MACH_MSG_TYPE_MOVE_SEND_ONCE
+	ctype: mach_port_t;
+
+type mach_port_receive_t =		MACH_MSG_TYPE_PORT_RECEIVE
+	ctype: mach_port_t;
+type mach_port_send_t =			MACH_MSG_TYPE_PORT_SEND
+	ctype: mach_port_t;
+type mach_port_send_once_t =		MACH_MSG_TYPE_PORT_SEND_ONCE
+	ctype: mach_port_t;
+
+type mach_port_poly_t = polymorphic
+	ctype: mach_port_t;
+
+import <mach/std_types.h>;
+import <mach/mig.h>;
+
+#endif	/* _MACH_STD_TYPES_DEFS_ */
diff --git a/xnu-792.18.15/osfmk/mach/std_types.h b/xnu-792.18.15/osfmk/mach/std_types.h
new file mode 100644
index 0000000..f5b838a
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/std_types.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Mach standard external interface type definitions.
+ *
+ */
+
+#ifndef	_MACH_STD_TYPES_H_
+#define	_MACH_STD_TYPES_H_
+
+#include <stdint.h>
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/port.h>
+#include <mach/vm_types.h>
+
+#endif	/* _MACH_STD_TYPES_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/sync.defs b/xnu-792.18.15/osfmk/mach/sync.defs
new file mode 100644
index 0000000..e6f8c28
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/sync.defs
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ * 
+ */
+/*
+ *	File: mach/sync.defs
+ *	Author: Joseph CaraDonna
+ *
+ *	Exported kernel calls	
+ *
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	KernelServer
+#endif	/* KERNEL_SERVER */
+			sync 617000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach/clock_types.defs>
+
+#if	KERNEL_SERVER
+import <kern/sync_lock.h>;
+import <kern/sync_sema.h>;
+import <kern/ipc_sync.h>;
+#endif	/* KERNEL_SERVER */
+
+
+type semaphore_t = mach_port_t
+		ctype: mach_port_t
+#if	KERNEL_SERVER
+		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
+		outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
+		destructor: semaphore_dereference(semaphore_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type semaphore_consume_ref_t = mach_port_move_send_t
+		ctype: mach_port_t
+#if	KERNEL_SERVER
+		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
+		destructor: semaphore_dereference(semaphore_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+type lock_set_t = mach_port_t
+		ctype: mach_port_t
+#if	KERNEL_SERVER
+		intran: lock_set_t convert_port_to_lock_set(mach_port_t)
+		outtran: mach_port_t convert_lock_set_to_port(lock_set_t)
+		destructor: lock_set_dereference(lock_set_t)
+#endif	/* KERNEL_SERVER */
+		;
+
+
+routine semaphore_create(
+		task		: task_t;
+	out	semaphore	: semaphore_t;
+		policy		: int;
+		value		: int);
+
+routine semaphore_destroy(
+		task		: task_t;
+		semaphore	: semaphore_consume_ref_t);
+
+routine semaphore_signal(
+		semaphore	: semaphore_t);
+
+routine semaphore_signal_all(
+		semaphore	: semaphore_t);
+
+routine semaphore_wait(
+		semaphore	: semaphore_t);
+
+routine lock_set_create(
+		task		: task_t;
+	out	new_lock_set	: lock_set_t;
+		n_ulocks	: int;
+		policy		: int);
+
+routine lock_set_destroy(
+		task		: task_t;
+		lock_set	: lock_set_t);
+
+routine lock_acquire(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_release(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_try(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_make_stable(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_handoff(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine lock_handoff_accept(
+		lock_set	: lock_set_t;
+		lock_id		: int);
+
+routine semaphore_signal_thread(
+		semaphore	: semaphore_t;
+		thread		: thread_act_t);
+
+routine semaphore_timedwait(
+		semaphore	: semaphore_t;
+		wait_time	: mach_timespec_t);
diff --git a/xnu-792.18.15/osfmk/mach/sync_policy.h b/xnu-792.18.15/osfmk/mach/sync_policy.h
new file mode 100644
index 0000000..50e0b21
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/sync_policy.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+
+#ifndef	_MACH_SYNC_POLICY_H_
+#define _MACH_SYNC_POLICY_H_
+
+typedef int sync_policy_t;
+
+/*
+ *	These options define the wait ordering of the synchronizers
+ */
+#define SYNC_POLICY_FIFO		0x0
+#define SYNC_POLICY_FIXED_PRIORITY	0x1
+#define SYNC_POLICY_REVERSED		0x2
+#define SYNC_POLICY_ORDER_MASK		0x3
+#define SYNC_POLICY_LIFO		(SYNC_POLICY_FIFO|SYNC_POLICY_REVERSED)
+
+#ifdef	KERNEL_PRIVATE
+
+/*
+ *	These options provide addition (kernel-private) behaviors
+ */
+
+#define SYNC_POLICY_PREPOST		0x4
+
+#endif	/* KERNEL_PRIVATE */
+
+#define SYNC_POLICY_MAX			0x7
+
+#endif 	/* _MACH_SYNC_POLICY_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/syscall_sw.h b/xnu-792.18.15/osfmk/mach/syscall_sw.h
new file mode 100644
index 0000000..410d590
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/syscall_sw.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+#ifdef	PRIVATE
+
+#ifndef	_MACH_SYSCALL_SW_H_
+#define _MACH_SYSCALL_SW_H_
+
+/*
+ *	The machine-dependent "syscall_sw.h" file should
+ *	define a macro for
+ *		kernel_trap(trap_name, trap_number, arg_count)
+ *	which will expand into assembly code for the
+ *	trap.
+ *
+ *	N.B.: When adding calls, do not put spaces in the macros.
+ */
+
+#include <mach/machine/syscall_sw.h>
+
+/*
+ *	These trap numbers should be taken from the
+ *	table in <kern/syscall_sw.c>.
+ */
+
+kernel_trap(mach_reply_port,-26,0)
+kernel_trap(thread_self_trap,-27,0)
+kernel_trap(task_self_trap,-28,0)
+kernel_trap(host_self_trap,-29,0)
+
+kernel_trap(mach_msg_trap,-31,7)
+kernel_trap(mach_msg_overwrite_trap,-32,9)
+kernel_trap(semaphore_signal_trap, -33, 1)
+kernel_trap(semaphore_signal_all_trap, -34, 1)
+kernel_trap(semaphore_signal_thread_trap, -35, 2)
+kernel_trap(semaphore_wait_trap,-36,1)
+kernel_trap(semaphore_wait_signal_trap,-37,2)
+kernel_trap(semaphore_timedwait_trap,-38,3)
+kernel_trap(semaphore_timedwait_signal_trap,-39,4)
+
+#if		!defined(__LP64__)
+kernel_trap(init_process,-41,0)
+kernel_trap(map_fd,-43,5)
+#endif	/* __LP64__ */
+
+kernel_trap(task_name_for_pid,-44,3)
+kernel_trap(task_for_pid,-45,3)
+kernel_trap(pid_for_task,-46,2)
+
+#if		!defined(__LP64__)
+kernel_trap(macx_swapon,-48, 4)
+kernel_trap(macx_swapoff,-49, 2)
+kernel_trap(macx_triggers,-51, 4)
+kernel_trap(macx_backing_store_suspend,-52, 1)
+kernel_trap(macx_backing_store_recovery,-53, 1)
+#endif	/* __LP64__ */
+
+/* These are currently used by pthreads even on LP64 */
+/* But as soon as that is fixed - they will go away there */
+kernel_trap(swtch_pri,-59,1)
+kernel_trap(swtch,-60,0)
+
+kernel_trap(syscall_thread_switch,-61,3)
+kernel_trap(clock_sleep_trap,-62,5)
+
+kernel_trap(mach_timebase_info,-89,1)
+
+#if		defined(__LP64__)
+/* unit64_t arguments passed in one register in LP64 */
+kernel_trap(mach_wait_until,-90,1)
+#else	/* __LP64__ */
+kernel_trap(mach_wait_until,-90,2)
+#endif	/* __LP64__ */
+
+kernel_trap(mk_timer_create,-91,0)
+kernel_trap(mk_timer_destroy,-92,1)
+
+#if		defined(__LP64__)
+/* unit64_t arguments passed in one register in LP64 */
+kernel_trap(mk_timer_arm,-93,2)
+#else	/* __LP64__ */
+kernel_trap(mk_timer_arm,-93,3)
+#endif	/* __LP64__ */
+
+kernel_trap(mk_timer_cancel,-94,2)
+
+#if		!defined(__LP64__)
+kernel_trap(MKGetTimeBaseInfo,-95,5)
+#endif	/* __LP64__ */
+
+#endif	/* _MACH_SYSCALL_SW_H_ */
+
+#endif	/* PRIVATE */
diff --git a/xnu-792.18.15/osfmk/mach/task.defs b/xnu-792.18.15/osfmk/mach/task.defs
new file mode 100644
index 0000000..ae8e6f1
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/task.defs
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_FREE_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	File:	mach/mach_port.defs
+ *	Author:	Rich Draves
+ *
+ *	Exported kernel calls.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+	  task 3400;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+/*
+ *	Create a new task with an empty set of IPC rights,
+ *	and having an address space constructed from the
+ *	target task (or empty, if inherit_memory is FALSE).
+ */
+routine task_create(
+		target_task	: task_t;
+		ledgers		: ledger_array_t;
+		inherit_memory	: boolean_t;
+	out	child_task	: task_t);
+
+/*
+ *	Destroy the target task, causing all of its threads
+ *	to be destroyed, all of its IPC rights to be deallocated,
+ *	and all of its address space to be deallocated.
+ */
+routine task_terminate(
+		target_task	: task_t);
+
+/*
+ *	Returns the set of threads belonging to the target task.
+ */
+routine task_threads(
+		target_task	: task_t;
+	out	act_list	: thread_act_array_t);
+
+/*
+ *	Stash a handful of ports for the target task; child
+ *	tasks inherit this stash at task_create time.
+ */
+routine	mach_ports_register(
+		target_task	: task_t;
+		init_port_set	: mach_port_array_t =
+					^array[] of mach_port_t);
+
+/*
+ *	Retrieve the stashed ports for the target task.
+ */
+routine	mach_ports_lookup(
+		target_task	: task_t;
+	out	init_port_set	: mach_port_array_t =
+					^array[] of mach_port_t);
+
+/*
+ *      Returns information about the target task.
+ */
+routine task_info(
+                target_task     : task_name_t;
+                flavor          : task_flavor_t;
+        out     task_info_out   : task_info_t, CountInOut);
+
+/*
+ * Set task information.
+ */
+routine	task_set_info(
+		target_task	: task_t;
+		flavor		: task_flavor_t;
+		task_info_in	: task_info_t);
+
+/*
+ *	Increment the suspend count for the target task.
+ *	No threads within a task may run when the suspend
+ *	count for that task is non-zero.
+ */
+routine	task_suspend(
+		target_task	: task_t);
+
+
+/*
+ *	Decrement the suspend count for the target task,
+ *	if the count is currently non-zero.  If the resulting
+ *	suspend	count is zero, then threads within the task
+ *	that also have non-zero suspend counts may execute.
+ */
+routine	task_resume(
+		target_task	: task_t);
+
+/*
+ *	Returns the current value of the selected special port
+ *	associated with the target task.
+ */
+routine task_get_special_port(
+		task		: task_t;
+		which_port	: int;
+	out	special_port	: mach_port_t);
+
+/*
+ *	Set one of the special ports associated with the
+ *	target task.
+ */
+routine task_set_special_port(
+		task		: task_t;
+		which_port	: int;
+		special_port	: mach_port_t);
+
+/*
+ *	Create a new thread within the target task, returning
+ *	the port representing the first thr_act in that new thread.  The
+ *	initial execution state of the thread is undefined.
+ */
+routine thread_create(
+		parent_task	: task_t;
+	out	child_act	: thread_act_t);
+
+/*
+ *      Create a new thread within the target task, returning
+ *      the port representing that new thread.  The new thread 
+ *	is not suspended; its initial execution state is given
+ *	by flavor and new_state. Returns the port representing 
+ *	the new thread.
+ */
+routine thread_create_running(
+                parent_task     : task_t;
+                flavor          : thread_state_flavor_t;
+                new_state       : thread_state_t;
+        out     child_act       : thread_act_t);
+
+/*
+ * Set an exception handler for a task on one or more exception types.
+ * These handlers are invoked for all threads in the task if there are
+ * no thread-specific exception handlers or those handlers returned an
+ * error.
+ */
+routine	task_set_exception_ports(
+		task		: task_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t);
+
+
+/*
+ * Lookup some of the old exception handlers for a task
+ */
+routine	task_get_exception_ports(
+		task		: task_t;
+		exception_mask	: exception_mask_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlers	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+
+/*
+ * Set an exception handler for a thread on one or more exception types.
+ * At the same time, return the previously defined exception handlers for
+ * those types.
+ */
+routine	task_swap_exception_ports(
+		task		: task_t;
+		exception_mask	: exception_mask_t;
+		new_port	: mach_port_t;
+		behavior	: exception_behavior_t;
+		new_flavor	: thread_state_flavor_t;
+	  out	masks		: exception_mask_array_t;
+	  out	old_handlerss	: exception_handler_array_t, SameCount;
+	  out	old_behaviors	: exception_behavior_array_t, SameCount;
+	  out	old_flavors	: exception_flavor_array_t, SameCount);
+
+/*
+ * Create and destroy lock_set and semaphore synchronizers on a
+ * per-task basis (i.e. the task owns them).
+ */
+routine lock_set_create(
+		task		: task_t;
+	out	new_lock_set	: lock_set_t;
+		n_ulocks	: int;
+		policy		: int);
+
+routine lock_set_destroy(
+		task		: task_t;
+		lock_set	: lock_set_t);
+
+routine semaphore_create(
+		task		: task_t;
+	out	semaphore	: semaphore_t;
+		policy		: int;
+		value		: int);
+
+routine semaphore_destroy(
+		task		: task_t;
+		semaphore	: semaphore_consume_ref_t);
+
+/*
+ * Set/get policy information for a task.
+ * (Approved Mac OS X microkernel interface)
+ */
+
+routine task_policy_set(
+	task			: task_t;
+	flavor			: task_policy_flavor_t;
+	policy_info		: task_policy_t);
+
+routine task_policy_get(
+	task			: task_t;
+	flavor			: task_policy_flavor_t;
+out	policy_info		: task_policy_t, CountInOut;
+inout	get_default		: boolean_t);
+
+/*
+ * Task profiling.
+ */
+routine task_sample(
+		task		: task_t;
+		reply		: mach_port_make_send_t);
+
+/*
+ * JMM - Everything from here down is likely to go away soon
+ */
+/*
+ * OBSOLETE interface.
+ */
+routine task_policy(
+	task			: task_t;
+	policy			: policy_t;
+	base			: policy_base_t;
+	set_limit		: boolean_t;
+	change			: boolean_t);
+
+
+/*
+ *	Establish a user-level handler for the specified
+ *	system call.
+ */
+routine task_set_emulation(
+		target_port	: task_t;
+		routine_entry_pt: vm_address_t;
+		routine_number  : int);	
+
+/*
+ *	Get user-level handler entry points for all
+ *	emulated system calls.
+ */
+routine task_get_emulation_vector(
+		task		: task_t;
+	out	vector_start	: int;
+	out	emulation_vector: emulation_vector_t);
+
+/*
+ *	Establish user-level handlers for the specified
+ *	system calls. Non-emulated system calls are specified
+ *	with emulation_vector[i] == EML_ROUTINE_NULL.
+ */
+routine task_set_emulation_vector(
+		task		: task_t;
+		vector_start	: int;
+		emulation_vector: emulation_vector_t);
+
+
+/*
+ *      Establish restart pc for interrupted atomic sequences.
+ */
+routine task_set_ras_pc(
+		target_task     : task_t;
+		basepc          : vm_address_t;
+		boundspc        : vm_address_t);
+
+
+skip; /* was kernel_task_create() */
+
+/* 
+ * JMM - Want to eliminate processor_set so keep them at the end.
+ */
+
+/*
+ *	Assign task to processor set.
+ */
+routine task_assign(
+		task		: task_t;
+		new_set		: processor_set_t;
+		assign_threads	: boolean_t);
+
+/*
+ *	Assign task to default set.
+ */
+routine task_assign_default(
+		task		: task_t;
+		assign_threads	: boolean_t);
+
+/*
+ *	Get current assignment for task.
+ */
+routine task_get_assignment(
+		task		: task_t;
+	out	assigned_set	: processor_set_name_t);
+
+/*
+ * OBSOLETE interface.
+ */
+routine task_set_policy(
+	task			: task_t;
+	pset			: processor_set_t;
+	policy			: policy_t;
+	base			: policy_base_t;
+	limit			: policy_limit_t;
+	change			: boolean_t);
+
diff --git a/xnu-792.18.15/osfmk/mach/task_info.h b/xnu-792.18.15/osfmk/mach/task_info.h
new file mode 100644
index 0000000..a21ad9e
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/task_info.h
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ */
+/*
+ *	Machine-independent task information structures and definitions.
+ *
+ *	The definitions in this file are exported to the user.  The kernel
+ *	will translate its internal data structures to these structures
+ *	as appropriate.
+ *
+ */
+
+#ifndef	_MACH_TASK_INFO_H_
+#define	_MACH_TASK_INFO_H_
+
+#include <mach/message.h>
+#include <mach/machine/vm_types.h>
+#include <mach/time_value.h>
+#include <mach/policy.h>
+
+#include <sys/cdefs.h>
+
+/*
+ *	Generic information structure to allow for expansion.
+ */
+typedef	natural_t	task_flavor_t;
+typedef	integer_t	*task_info_t;		/* varying array of int */
+
+#define	TASK_INFO_MAX	(1024)		/* maximum array size */
+typedef	integer_t	task_info_data_t[TASK_INFO_MAX];
+
+/*
+ *	Currently defined information structures.
+ */
+
+#pragma pack(4)
+
+#define TASK_BASIC_INFO_32      4       /* basic information */
+
+struct task_basic_info_32 {
+        integer_t       suspend_count;  /* suspend count for task */
+        natural_t       virtual_size;   /* virtual memory size (bytes) */
+        natural_t       resident_size;  /* resident memory size (bytes) */
+        time_value_t    user_time;      /* total user run time for
+                                           terminated threads */
+        time_value_t    system_time;    /* total system run time for
+                                           terminated threads */
+	policy_t	policy;		/* default policy for new threads */
+};
+typedef struct task_basic_info_32       task_basic_info_32_data_t;
+typedef struct task_basic_info_32       *task_basic_info_32_t;
+#define TASK_BASIC_INFO_32_COUNT   \
+                (sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
+
+
+#define TASK_BASIC_INFO_64      5       /* 64-bit capable basic info */
+
+struct task_basic_info_64 {
+        integer_t       suspend_count;  /* suspend count for task */
+        mach_vm_size_t  virtual_size;   /* virtual memory size (bytes) */
+        mach_vm_size_t  resident_size;  /* resident memory size (bytes) */
+        time_value_t    user_time;      /* total user run time for
+                                           terminated threads */
+        time_value_t    system_time;    /* total system run time for
+                                           terminated threads */
+	policy_t	policy;		/* default policy for new threads */
+};
+typedef struct task_basic_info_64       task_basic_info_64_data_t;
+typedef struct task_basic_info_64       *task_basic_info_64_t;
+#define TASK_BASIC_INFO_64_COUNT   \
+                (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
+
+
+/* localized structure - cannot be safely passed between tasks of differing sizes */
+
+struct task_basic_info {
+        integer_t       suspend_count;  /* suspend count for task */
+        vm_size_t       virtual_size;   /* virtual memory size (bytes) */
+        vm_size_t       resident_size;  /* resident memory size (bytes) */
+        time_value_t    user_time;      /* total user run time for
+                                           terminated threads */
+        time_value_t    system_time;    /* total system run time for
+                                           terminated threads */
+	policy_t	policy;		/* default policy for new threads */
+};
+
+typedef struct task_basic_info          task_basic_info_data_t;
+typedef struct task_basic_info          *task_basic_info_t;
+#define TASK_BASIC_INFO_COUNT   \
+                (sizeof(task_basic_info_data_t) / sizeof(natural_t))
+#if !defined(__LP64__)
+#define TASK_BASIC_INFO TASK_BASIC_INFO_32
+#else
+#define TASK_BASIC_INFO TASK_BASIC_INFO_64
+#endif
+
+
+
+#define	TASK_EVENTS_INFO	2	/* various event counts */
+
+struct task_events_info {
+	integer_t	faults;		/* number of page faults */
+	integer_t 	pageins;	/* number of actual pageins */
+	integer_t 	cow_faults;	/* number of copy-on-write faults */
+	integer_t 	messages_sent;	/* number of messages sent */
+	integer_t 	messages_received; /* number of messages received */
+        integer_t 	syscalls_mach;  /* number of mach system calls */
+	integer_t 	syscalls_unix;  /* number of unix system calls */
+	integer_t 	csw;            /* number of context switches */
+};
+typedef struct task_events_info		task_events_info_data_t;
+typedef struct task_events_info		*task_events_info_t;
+#define	TASK_EVENTS_INFO_COUNT		((mach_msg_type_number_t) \
+		(sizeof(task_events_info_data_t) / sizeof(natural_t)))
+
+#define	TASK_THREAD_TIMES_INFO	3	/* total times for live threads -
+					   only accurate if suspended */
+
+struct task_thread_times_info {
+	time_value_t	user_time;	/* total user run time for
+					   live threads */
+	time_value_t	system_time;	/* total system run time for
+					   live threads */
+};
+
+typedef struct task_thread_times_info	task_thread_times_info_data_t;
+typedef struct task_thread_times_info	*task_thread_times_info_t;
+#define	TASK_THREAD_TIMES_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
+
+#define TASK_ABSOLUTETIME_INFO	1
+
+struct task_absolutetime_info {
+	uint64_t		total_user;		/* total time */
+	uint64_t		total_system;
+	uint64_t		threads_user;	/* existing threads only */
+	uint64_t		threads_system;
+};
+
+typedef struct task_absolutetime_info	task_absolutetime_info_data_t;
+typedef struct task_absolutetime_info	*task_absolutetime_info_t;
+#define TASK_ABSOLUTETIME_INFO_COUNT	((mach_msg_type_number_t) \
+		(sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
+
+#define TASK_SECURITY_TOKEN		13
+#define TASK_SECURITY_TOKEN_COUNT	((mach_msg_type_number_t) \
+		(sizeof(security_token_t) / sizeof(natural_t)))
+
+#define TASK_AUDIT_TOKEN		15
+#define TASK_AUDIT_TOKEN_COUNT	\
+		(sizeof(audit_token_t) / sizeof(natural_t))
+
+#pragma pack()
+
+
+/*
+ * Obsolete interfaces.
+ */
+
+#define TASK_SCHED_TIMESHARE_INFO	10
+#define TASK_SCHED_RR_INFO		11
+#define TASK_SCHED_FIFO_INFO		12
+
+#define TASK_SCHED_INFO			14
+
+#endif	/* _MACH_TASK_INFO_H_ */
diff --git a/xnu-792.18.15/osfmk/mach/task_ledger.h b/xnu-792.18.15/osfmk/mach/task_ledger.h
new file mode 100644
index 0000000..5d4bc25
--- /dev/null
+++ b/xnu-792.18.15/osfmk/mach/task_ledger.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this