*/
extern lck_grp_t host_notify_lock_grp;
-extern lck_attr_t host_notify_lock_attr;
void
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 */
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;
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);
}
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);
}
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;
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);
}
}
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: