-
-/*
- * Routine: dp_memory_object_create
- * Purpose:
- * Handle requests for memory objects from the
- * kernel.
- * Notes:
- * Because we only give out the default memory
- * manager port to the kernel, we don't have to
- * be so paranoid about the contents.
- */
-kern_return_t
-dp_memory_object_create(
- MACH_PORT_FACE dmm,
- MACH_PORT_FACE *new_mem_obj,
- vm_size_t new_size)
-{
- mach_port_seqno_t seqno;
- vstruct_t vs;
- MACH_PORT_FACE pager;
- static char here[] = "memory_object_create";
-
- assert(dmm == default_pager_default_port);
-
- vs = vs_object_create(new_size);
- if (vs == VSTRUCT_NULL)
- return KERN_RESOURCE_SHORTAGE;
-
- pager = *new_mem_obj = ipc_port_alloc_kernel();
- assert (pager != IP_NULL);
- (void) ipc_port_make_send(pager);
-
- {
- struct vstruct_alias *alias_struct;
-
- alias_struct = (struct vstruct_alias *)
- kalloc(sizeof(struct vstruct_alias));
- if(alias_struct != NULL) {
- alias_struct->vs = vs;
- alias_struct->name = ISVS;
- pager->alias = (int) alias_struct;
- }
- else Panic("Out of kernel memory");
-
- /* JMM - Add binding to this pager under components */
- pager_mux_hash_insert(pager, &dp_memory_object_subsystem);
- vs->vs_next_seqno = 0;
- pager->ip_receiver = ipc_space_kernel;
- }
-
- /*
- * Set up associations between this port
- * and this default_pager structure
- */
-
- vs->vs_mem_obj_port = pager;
-
- /*
- * After this, other threads might receive requests
- * for this memory object or find it in the port list.
- */
-
- vstruct_list_insert(vs);
- default_pager_add(vs, TRUE);
-
- return KERN_SUCCESS;
-}