]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/ipc_host.c
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / osfmk / kern / ipc_host.c
index c3b4a4516077309f558c11a64fc33efe5c8614bf..427bcee120ad880d65b016c0bd702bf1c420c5fe 100644 (file)
@@ -93,7 +93,6 @@ ref_pset_port_locked(
  */
 
 extern lck_grp_t                host_notify_lock_grp;
-extern lck_attr_t               host_notify_lock_attr;
 
 void
 ipc_host_init(void)
@@ -101,37 +100,22 @@ ipc_host_init(void)
        ipc_port_t      port;
        int i;
 
-       lck_mtx_init(&realhost.lock, &host_notify_lock_grp, &host_notify_lock_attr);
+       lck_mtx_init(&realhost.lock, &host_notify_lock_grp, LCK_ATTR_NULL);
 
        /*
         *      Allocate and set up the two host ports.
         */
-       port = ipc_port_alloc_kernel();
-       if (port == IP_NULL) {
-               panic("ipc_host_init");
-       }
-
-       ipc_kobject_set(port, (ipc_kobject_t) &realhost, IKOT_HOST_SECURITY);
-       kernel_set_special_port(&realhost, HOST_SECURITY_PORT,
-           ipc_port_make_send(port));
-
-       port = ipc_port_alloc_kernel();
-       if (port == IP_NULL) {
-               panic("ipc_host_init");
-       }
-
-       ipc_kobject_set(port, (ipc_kobject_t) &realhost, IKOT_HOST);
-       kernel_set_special_port(&realhost, HOST_PORT,
-           ipc_port_make_send(port));
+       port = ipc_kobject_alloc_port((ipc_kobject_t) &realhost, IKOT_HOST_SECURITY,
+           IPC_KOBJECT_ALLOC_MAKE_SEND);
+       kernel_set_special_port(&realhost, HOST_SECURITY_PORT, port);
 
-       port = ipc_port_alloc_kernel();
-       if (port == IP_NULL) {
-               panic("ipc_host_init");
-       }
+       port = ipc_kobject_alloc_port((ipc_kobject_t) &realhost, IKOT_HOST,
+           IPC_KOBJECT_ALLOC_MAKE_SEND);
+       kernel_set_special_port(&realhost, HOST_PORT, port);
 
-       ipc_kobject_set(port, (ipc_kobject_t) &realhost, IKOT_HOST_PRIV);
-       kernel_set_special_port(&realhost, HOST_PRIV_PORT,
-           ipc_port_make_send(port));
+       port = ipc_kobject_alloc_port((ipc_kobject_t) &realhost, IKOT_HOST_PRIV,
+           IPC_KOBJECT_ALLOC_MAKE_SEND);
+       kernel_set_special_port(&realhost, HOST_PRIV_PORT, port);
 
        /* the rest of the special ports will be set up later */
 
@@ -296,8 +280,8 @@ convert_port_to_host(
        if (IP_VALID(port)) {
                if (ip_kotype(port) == IKOT_HOST ||
                    ip_kotype(port) == IKOT_HOST_PRIV) {
-                       host = (host_t) port->ip_kobject;
-                       assert(ip_active(port));
+                       host = (host_t) ip_get_kobject(port);
+                       require_ip_active(port);
                }
        }
        return host;
@@ -322,7 +306,7 @@ convert_port_to_host_priv(
                ip_lock(port);
                if (ip_active(port) &&
                    (ip_kotype(port) == IKOT_HOST_PRIV)) {
-                       host = (host_t) port->ip_kobject;
+                       host = (host_t) ip_get_kobject(port);
                }
                ip_unlock(port);
        }
@@ -350,7 +334,7 @@ convert_port_to_processor(
                ip_lock(port);
                if (ip_active(port) &&
                    (ip_kotype(port) == IKOT_PROCESSOR)) {
-                       processor = (processor_t) port->ip_kobject;
+                       processor = (processor_t) ip_get_kobject(port);
                }
                ip_unlock(port);
        }
@@ -419,7 +403,7 @@ ref_pset_port_locked(ipc_port_t port, boolean_t matchn, processor_set_t *ppset)
        if (ip_active(port) &&
            ((ip_kotype(port) == IKOT_PSET) ||
            (matchn && (ip_kotype(port) == IKOT_PSET_NAME)))) {
-               pset = (processor_set_t) port->ip_kobject;
+               pset = (processor_set_t) ip_get_kobject(port);
        }
 
        *ppset = pset;
@@ -534,7 +518,7 @@ convert_port_to_host_security(
                ip_lock(port);
                if (ip_active(port) &&
                    (ip_kotype(port) == IKOT_HOST_SECURITY)) {
-                       host = (host_t) port->ip_kobject;
+                       host = (host_t) ip_get_kobject(port);
                }
                ip_unlock(port);
        }
@@ -583,7 +567,7 @@ host_set_exception_ports(
        }
 
        if (IP_VALID(new_port)) {
-               switch (new_behavior & ~MACH_EXCEPTION_CODES) {
+               switch (new_behavior & ~MACH_EXCEPTION_MASK) {
                case EXCEPTION_DEFAULT:
                case EXCEPTION_STATE:
                case EXCEPTION_STATE_IDENTITY: