]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ipc/ipc_init.c
xnu-4903.221.2.tar.gz
[apple/xnu.git] / osfmk / ipc / ipc_init.c
index 879748a89e5926307bb3edd1a776543e9ddbb327..d8e0917e756c69903bee2a8fe9944f640a36fe34 100644 (file)
@@ -71,7 +71,6 @@
  */
 
 #include <mach_debug.h>
-#include <mach_rt.h>
 
 #include <mach/port.h>
 #include <mach/message.h>
@@ -79,6 +78,7 @@
 
 #include <kern/kern_types.h>
 #include <kern/kalloc.h>
+#include <kern/simple_lock.h>
 #include <kern/mach_param.h>
 #include <kern/ipc_host.h>
 #include <kern/ipc_mig.h>
@@ -87,6 +87,7 @@
 #include <kern/misc_protos.h>
 #include <kern/sync_lock.h>
 #include <kern/sync_sema.h>
+#include <kern/ux_handler.h>
 #include <vm/vm_map.h>
 #include <vm/vm_kern.h>
 
 #include <ipc/ipc_hash.h>
 #include <ipc/ipc_init.h>
 #include <ipc/ipc_table.h>
+#include <ipc/ipc_voucher.h>
+#include <ipc/ipc_importance.h>
 
 #include <mach/machine/ndr_def.h>   /* NDR_record */
-#include <ipc/ipc_labelh.h>
 
 vm_map_t ipc_kernel_map;
 vm_size_t ipc_kernel_map_size = 1024 * 1024;
@@ -130,8 +132,6 @@ lck_attr_t          ipc_lck_attr;
 
 static lck_grp_attr_t  ipc_lck_grp_attr;
 
-extern void ikm_cache_init(void);
-
 /*
  *     Routine:        ipc_bootstrap
  *     Purpose:
@@ -189,17 +189,7 @@ ipc_bootstrap(void)
                              IKM_SAVED_KMSG_SIZE,
                              "ipc kmsgs");
        zone_change(ipc_kmsg_zone, Z_CALLERACCT, FALSE);
-
-#if CONFIG_MACF_MACH
-       ipc_labelh_zone = 
-               zinit(sizeof(struct ipc_labelh),
-                     ipc_port_max * sizeof(struct ipc_labelh),
-                     sizeof(struct ipc_labelh),
-                     "label handles");
-       /* cant charge callers for label allocations (port refs passed) */
-       zone_change(ipc_labelh_zone, Z_CALLERACCT, FALSE);
-
-#endif
+       zone_change(ipc_kmsg_zone, Z_CACHING_ENABLED, TRUE);
 
        /* create special spaces */
 
@@ -217,6 +207,11 @@ ipc_bootstrap(void)
 #endif
        mig_init();
        ipc_table_init();
+       ipc_voucher_init();
+
+#if IMPORTANCE_INHERITANCE
+       ipc_importance_init();
+#endif
 
        semaphore_init();
        mk_timer_init();
@@ -226,7 +221,7 @@ ipc_bootstrap(void)
 /* 
  * XXX tunable, belongs in mach.message.h 
  */
-#define MSG_OOL_SIZE_SMALL_MAX 4096
+#define MSG_OOL_SIZE_SMALL_MAX (2*PAGE_SIZE)
 vm_size_t msg_ool_size_small;
 
 /*
@@ -242,13 +237,21 @@ ipc_init(void)
        vm_offset_t min;
 
        retval = kmem_suballoc(kernel_map, &min, ipc_kernel_map_size,
-                              TRUE, VM_FLAGS_ANYWHERE, &ipc_kernel_map);
+                              TRUE,
+                              (VM_FLAGS_ANYWHERE),
+                              VM_MAP_KERNEL_FLAGS_NONE,
+                              VM_KERN_MEMORY_IPC,
+                              &ipc_kernel_map);
 
        if (retval != KERN_SUCCESS)
                panic("ipc_init: kmem_suballoc of ipc_kernel_map failed");
 
        retval = kmem_suballoc(kernel_map, &min, ipc_kernel_copy_map_size,
-                              TRUE, VM_FLAGS_ANYWHERE, &ipc_kernel_copy_map);
+                              TRUE,
+                              (VM_FLAGS_ANYWHERE),
+                              VM_MAP_KERNEL_FLAGS_NONE,
+                              VM_KERN_MEMORY_IPC,
+                              &ipc_kernel_copy_map);
 
        if (retval != KERN_SUCCESS)
                panic("ipc_init: kmem_suballoc of ipc_kernel_copy_map failed");
@@ -268,6 +271,26 @@ ipc_init(void)
        else {
                msg_ool_size_small = MSG_OOL_SIZE_SMALL_MAX;
        }
+       /* account for overhead to avoid spilling over a page */
+       msg_ool_size_small -= cpy_kdata_hdr_sz;
 
        ipc_host_init();
+       ux_handler_init();
+
+}
+
+
+/*
+ *     Routine:        ipc_thread_call_init
+ *     Purpose:
+ *             Initialize IPC logic that needs thread call support
+ */
+
+void
+ipc_thread_call_init(void)
+{
+#if IMPORTANCE_INHERITANCE
+       ipc_importance_thread_call_init();
+#endif
 }
+