*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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. 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 OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * 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_LICENSE_HEADER_END@
*/
#include <mach_rt.h>
#include <platforms.h>
-#include <kern/ast.h>
+#include <mach/mig.h>
#include <mach/port.h>
#include <mach/kern_return.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/notify.h>
+
#include <kern/etap_macros.h>
#include <kern/ipc_mig.h>
#include <kern/ipc_kobject.h>
#include <kern/misc_protos.h>
#include <kern/mk_timer.h>
-#include <ipc/ipc_object.h>
#include <ipc/ipc_kmsg.h>
#include <ipc/ipc_port.h>
#include <kern/counters.h>
-void
- def_pager_hash_insert(
- ipc_port_t name_port);
-void pager_mux_hash_insert(
- ipc_port_t port,
- rpc_subsystem_t rec);
-void pager_mux_hash_delete(
- ipc_port_t port);
-rpc_subsystem_t pager_mux_hash_lookup(
- ipc_port_t port);
-
-
/*
* Routine: ipc_kobject_notify
* Purpose:
#endif /* XK_PROXY */
-rpc_subsystem_t mig_e[] = {
- (rpc_subsystem_t)&mach_port_subsystem,
- (rpc_subsystem_t)&mach_host_subsystem,
- (rpc_subsystem_t)&host_priv_subsystem,
- (rpc_subsystem_t)&host_security_subsystem,
- (rpc_subsystem_t)&clock_subsystem,
- (rpc_subsystem_t)&clock_priv_subsystem,
- (rpc_subsystem_t)&processor_subsystem,
- (rpc_subsystem_t)&processor_set_subsystem,
- (rpc_subsystem_t)&is_iokit_subsystem,
- (rpc_subsystem_t)&dp_memory_object_subsystem,
- (rpc_subsystem_t)&dp_memory_object_default_subsystem,
- (rpc_subsystem_t)&memory_object_name_subsystem,
- (rpc_subsystem_t)&default_pager_object_subsystem,
- (rpc_subsystem_t)&lock_set_subsystem,
- (rpc_subsystem_t)&ledger_subsystem,
- (rpc_subsystem_t)&semaphore_subsystem,
- (rpc_subsystem_t)&task_subsystem,
- (rpc_subsystem_t)&thread_act_subsystem,
- (rpc_subsystem_t)&vm_map_subsystem,
- (rpc_subsystem_t)&UNDReply_subsystem,
+mig_subsystem_t mig_e[] = {
+ (mig_subsystem_t)&mach_port_subsystem,
+ (mig_subsystem_t)&mach_host_subsystem,
+ (mig_subsystem_t)&host_priv_subsystem,
+ (mig_subsystem_t)&host_security_subsystem,
+ (mig_subsystem_t)&clock_subsystem,
+ (mig_subsystem_t)&clock_priv_subsystem,
+ (mig_subsystem_t)&processor_subsystem,
+ (mig_subsystem_t)&processor_set_subsystem,
+ (mig_subsystem_t)&is_iokit_subsystem,
+ (mig_subsystem_t)&memory_object_name_subsystem,
+ (mig_subsystem_t)&lock_set_subsystem,
+ (mig_subsystem_t)&ledger_subsystem,
+ (mig_subsystem_t)&semaphore_subsystem,
+ (mig_subsystem_t)&task_subsystem,
+ (mig_subsystem_t)&thread_act_subsystem,
+ (mig_subsystem_t)&vm_map_subsystem,
+ (mig_subsystem_t)&UNDReply_subsystem,
#if XK_PROXY
- (rpc_subsystem_t)&do_uproxy_xk_uproxy_subsystem,
+ (mig_subsystem_t)&do_uproxy_xk_uproxy_subsystem,
#endif /* XK_PROXY */
#if MACH_MACHINE_ROUTINES
- (rpc_subsystem_t)&MACHINE_SUBSYSTEM,
+ (mig_subsystem_t)&MACHINE_SUBSYSTEM,
#endif /* MACH_MACHINE_ROUTINES */
#if MCMSG && iPSC860
- (rpc_subsystem_t)&mcmsg_info_subsystem,
+ (mig_subsystem_t)&mcmsg_info_subsystem,
#endif /* MCMSG && iPSC860 */
};
void
mig_init(void)
{
- register unsigned int i, n = sizeof(mig_e)/sizeof(rpc_subsystem_t);
+ register unsigned int i, n = sizeof(mig_e)/sizeof(mig_subsystem_t);
register unsigned int howmany;
register mach_msg_id_t j, pos, nentry, range;
}
}
}
-}
-
-
-#define PAGER_MUX_HASH_COUNT 127
-
-
-struct pager_mux_entry {
- queue_chain_t links;
- ipc_port_t name;
- rpc_subsystem_t pager_object;
-};
-typedef struct pager_mux_entry *pager_mux_entry_t;
-
-queue_head_t pager_mux_hashtable[PAGER_MUX_HASH_COUNT];
-zone_t pager_mux_hash_zone;
-
-decl_mutex_data(,pager_mux_hash_lock)
-
-#define pager_mux_hash(name_port) \
- (((natural_t)(name_port) & 0xffffff) % PAGER_MUX_HASH_COUNT)
-
-
-rpc_subsystem_t
-pager_mux_hash_lookup(
- ipc_port_t name_port)
-{
- register queue_t bucket;
- register pager_mux_entry_t entry;
- register rpc_subsystem_t pager_object;
-
- bucket = &pager_mux_hashtable[pager_mux_hash(name_port)];
-
- mutex_lock(&pager_mux_hash_lock);
- for (entry = (pager_mux_entry_t)queue_first(bucket);
- !queue_end(bucket, &entry->links);
- entry = (pager_mux_entry_t)queue_next(&entry->links)) {
- if (entry->name == name_port) {
- pager_object = entry->pager_object;
- /* don't need to reference the object, it can't disappear */
- /* pager_mux_reference(pager_object); */
- mutex_unlock(&pager_mux_hash_lock);
- return (pager_object);
- }
- }
- mutex_unlock(&pager_mux_hash_lock);
- return (rpc_subsystem_t)0;
-}
-
-
-void
-pager_mux_hash_init(void)
-{
- register int i;
- register vm_size_t size;
-
- size = sizeof(struct pager_mux_entry);
- pager_mux_hash_zone = zinit(
- size,
- size * 2000,
- PAGE_SIZE,
- "pager mux port hash");
- for (i = 0; i < PAGER_MUX_HASH_COUNT; i++)
- queue_init(&pager_mux_hashtable[i]);
- mutex_init(&pager_mux_hash_lock, ETAP_IO_DEV_PAGEH);
-}
-
-
-void
-pager_mux_hash_insert(
- ipc_port_t name_port,
- rpc_subsystem_t pager_object)
-{
- register pager_mux_entry_t new_entry;
-
- new_entry = (pager_mux_entry_t) zalloc(pager_mux_hash_zone);
- new_entry->links.prev = (queue_entry_t) 0;
- new_entry->links.next = (queue_entry_t) 0;
- new_entry->name = name_port;
- new_entry->pager_object = pager_object;
-
- mutex_lock(&pager_mux_hash_lock);
- queue_enter((&pager_mux_hashtable[pager_mux_hash(name_port)]),
- new_entry, pager_mux_entry_t, links);
- mutex_unlock(&pager_mux_hash_lock);
-}
-
-void
-pager_mux_hash_delete(
- ipc_port_t name_port)
-{
- register queue_t bucket;
- register pager_mux_entry_t entry;
-
- bucket = &pager_mux_hashtable[pager_mux_hash(name_port)];
-
- mutex_lock(&pager_mux_hash_lock);
- for (entry = (pager_mux_entry_t)queue_first(bucket);
- !queue_end(bucket, &entry->links);
- entry = (pager_mux_entry_t)queue_next(&entry->links)) {
- if (entry->name == name_port) {
- queue_remove(bucket, entry, pager_mux_entry_t, links);
- zfree(pager_mux_hash_zone, (vm_offset_t)entry);
- break;
- }
- }
- mutex_unlock(&pager_mux_hash_lock);
+ printf("mig_table_max_displ = %d\n", mig_table_max_displ);
}
break;
default:
- panic("ipc_object_destroy: strange destination rights");
+ panic("ipc_kobject_server: strange destination rights");
}
*destp = IP_NULL;
mach_destroy_memory_entry(port);
break;
- case IKOT_UPL:
- mach_destroy_upl(port);
- break;
-
default: /* XXX (bogon) */
- vm_object_destroy(port);
break;
}
}
mach_msg_header_t *reply_header)
{
ipc_port_t port = (ipc_port_t) request_header->msgh_remote_port;
- rpc_subsystem_t paging_subsystem_object;
+ mig_subsystem_t paging_subsystem_object;
mach_port_seqno_t seqno;
((mig_reply_error_t *) reply_header)->RetCode = MIG_NO_REPLY;
ipc_port_destroy(port); /* releases lock */
return TRUE;
}
- paging_subsystem_object = pager_mux_hash_lookup(
- (ipc_port_t)request_header->msgh_remote_port);
- if(paging_subsystem_object == (rpc_subsystem_t)
- &dp_memory_object_subsystem) {
- default_pager_no_senders(
- (ipc_port_t)request_header->msgh_remote_port,
- seqno,
- (mach_port_mscount_t)
- ((mach_no_senders_notification_t *)
- request_header)->not_count);
- (ipc_port_t)reply_header->msgh_remote_port
- = MACH_PORT_NULL;
- return TRUE;
- }
- if(paging_subsystem_object == (rpc_subsystem_t)
- &vnode_pager_workaround) {
- vnode_pager_no_senders(
- (ipc_port_t)request_header->msgh_remote_port,
- (mach_port_mscount_t)
- ((mach_no_senders_notification_t *)
- request_header)->not_count);
- (ipc_port_t)reply_header->msgh_remote_port
- = MACH_PORT_NULL;
- return TRUE;
+ if (ip_kotype(port) == IKOT_UPL) {
+ upl_no_senders(
+ (ipc_port_t)request_header->msgh_remote_port,
+ (mach_port_mscount_t)
+ ((mach_no_senders_notification_t *)
+ request_header)->not_count);
+ (ipc_port_t)reply_header->msgh_remote_port
+ = MACH_PORT_NULL;
+ return TRUE;
}
+
break;
+
case MACH_NOTIFY_PORT_DELETED:
case MACH_NOTIFY_PORT_DESTROYED:
case MACH_NOTIFY_SEND_ONCE:
void
kobjserver_stats(void)
{
- register unsigned int i, n = sizeof(mig_e)/sizeof(rpc_subsystem_t);
+ register unsigned int i, n = sizeof(mig_e)/sizeof(mig_subsystem_t);
register unsigned int howmany;
register mach_msg_id_t j, pos, nentry, range;