|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Copyright (c) 1995, 1994, 1993, 1992, 1991, 1990
27: * Open Software Foundation, Inc.
28: *
29: * Permission to use, copy, modify, and distribute this software and
30: * its documentation for any purpose and without fee is hereby granted,
31: * provided that the above copyright notice appears in all copies and
32: * that both the copyright notice and this permission notice appear in
33: * supporting documentation, and that the name of ("OSF") or Open Software
34: * Foundation not be used in advertising or publicity pertaining to
35: * distribution of the software without specific, written prior permission.
36: *
37: * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
38: * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
39: * FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL OSF BE LIABLE FOR ANY
40: * SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
41: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
42: * ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING
43: * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE
44: */
45: /*
46: * OSF Research Institute MK6.1 (unencumbered) 1/31/1995
47: */
48: /*
49: * Mach Operating System
50: * Copyright (c) 1991,1990,1989 Carnegie Mellon University
51: * All Rights Reserved.
52: *
53: * Permission to use, copy, modify and distribute this software and its
54: * documentation is hereby granted, provided that both the copyright
55: * notice and this permission notice appear in all copies of the
56: * software, derivative works or modified versions, and any portions
57: * thereof, and that both notices appear in supporting documentation.
58: *
59: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
60: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
61: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
62: *
63: * Carnegie Mellon requests users of this software to return to
64: *
65: * Software Distribution Coordinator or [email protected]
66: * School of Computer Science
67: * Carnegie Mellon University
68: * Pittsburgh PA 15213-3890
69: *
70: * any improvements or extensions that they make and grant Carnegie Mellon
71: * the rights to redistribute these changes.
72: */
73: /*
74: * File: ipc/ipc_init.c
75: * Author: Rich Draves
76: * Date: 1989
77: *
78: * Functions to initialize the IPC system.
79: */
80:
81: #import <mach/features.h>
82:
83: #include <mach/kern_return.h>
84: #include <kern/mach_param.h>
85: #include <kern/ipc_host.h>
86: #include <vm/vm_map.h>
87: #include <vm/vm_kern.h>
88: #include <ipc/ipc_entry.h>
89: #include <ipc/ipc_space.h>
90: #include <ipc/ipc_object.h>
91: #include <ipc/ipc_port.h>
92: #include <ipc/ipc_pset.h>
93: #include <ipc/ipc_marequest.h>
94: #include <ipc/ipc_notify.h>
95: #include <ipc/ipc_kmsg.h>
96: #include <ipc/ipc_hash.h>
97: #include <ipc/ipc_init.h>
98: #include <mach/machine/ndr.h>
99:
100:
101: #if MACH_OLD_VM_COPY
102: task_t ipc_soft_task;
103: vm_map_t ipc_soft_map;
104: #endif
105: vm_map_t ipc_kernel_map;
106: vm_size_t ipc_kernel_map_size = 1024 * 1024;
107:
108: vm_map_t ipc_kernel_copy_map;
109: #define IPC_KERNEL_COPY_MAP_SIZE (8 * 1024 * 1024)
110: vm_size_t ipc_kernel_copy_map_size = IPC_KERNEL_COPY_MAP_SIZE;
111:
112: int ipc_space_max = SPACE_MAX;
113: int ipc_tree_entry_max = ITE_MAX;
114: int ipc_port_max = PORT_MAX;
115: int ipc_pset_max = SET_MAX;
116:
117: extern void mig_init(void);
118:
119: /*
120: * Routine: ipc_bootstrap
121: * Purpose:
122: * Initialization needed before the kernel task
123: * can be created.
124: */
125:
126: void
127: ipc_bootstrap(void)
128: {
129: kern_return_t kr;
130:
131: ipc_port_multiple_lock_init();
132:
133: ipc_port_timestamp_lock_init();
134: ipc_port_timestamp_data = 0;
135:
136: /* all IPC zones should be exhaustible */
137:
138: ipc_space_zone = zinit(sizeof(struct ipc_space),
139: ipc_space_max * sizeof(struct ipc_space),
140: sizeof(struct ipc_space),
141: FALSE, "ipc spaces");
142: /* make it exhaustible */
143: zchange(ipc_space_zone, FALSE, FALSE, TRUE, FALSE);
144:
145: ipc_tree_entry_zone =
146: zinit(sizeof(struct ipc_tree_entry),
147: ipc_tree_entry_max * sizeof(struct ipc_tree_entry),
148: sizeof(struct ipc_tree_entry),
149: FALSE, "ipc tree entries");
150: /* make it exhaustible */
151: zchange(ipc_tree_entry_zone, FALSE, FALSE, TRUE, FALSE);
152:
153: ipc_object_zones[IOT_PORT] =
154: zinit(sizeof(struct ipc_port),
155: ipc_port_max * sizeof(struct ipc_port),
156: sizeof(struct ipc_port),
157: FALSE, "ipc ports");
158: /* make it exhaustible */
159: zchange(ipc_object_zones[IOT_PORT], FALSE, FALSE, TRUE, FALSE);
160:
161: ipc_object_zones[IOT_PORT_SET] =
162: zinit(sizeof(struct ipc_pset),
163: ipc_pset_max * sizeof(struct ipc_pset),
164: sizeof(struct ipc_pset),
165: FALSE, "ipc port sets");
166: /* make it exhaustible */
167: zchange(ipc_object_zones[IOT_PORT_SET], FALSE, FALSE, TRUE, FALSE);
168:
169: /* create special spaces */
170:
171: kr = ipc_space_create_special(&ipc_space_kernel);
172: assert(kr == KERN_SUCCESS);
173:
174: kr = ipc_space_create_special(&ipc_space_reply);
175: assert(kr == KERN_SUCCESS);
176:
177: /* initialize modules with hidden data structures */
178:
179: ipc_table_init();
180: ipc_notify_init();
181: ipc_hash_init();
182: ipc_marequest_init();
183: }
184:
185: /*
186: * Routine: ipc_init
187: * Purpose:
188: * Final initialization of the IPC system.
189: */
190:
191: void
192: ipc_init(void)
193: {
194: vm_offset_t min, max;
195:
196: #if MACH_OLD_VM_COPY
197: if (task_create(TASK_NULL, FALSE, &ipc_soft_task) != KERN_SUCCESS)
198: panic("ipc_init");
199:
200: ipc_soft_map = ipc_soft_task->map;
201: {
202: vm_offset_t x = 0;
203:
204: /*
205: * XXX
206: * Allocate page zero here
207: * so that it can't be used as
208: * the address of a valid copy
209: * region.
210: * XXX
211: */
212: (void) vm_allocate(ipc_soft_map, &x, PAGE_SIZE, FALSE);
213: }
214: #endif /* MACH_OLD_VM_COPY */
215:
216: ipc_kernel_map = kmem_suballoc(kernel_map, &min, &max,
217: ipc_kernel_map_size, TRUE);
218:
219: ipc_kernel_copy_map = kmem_suballoc(kernel_map, &min, &max,
220: ipc_kernel_copy_map_size, TRUE);
221:
222: ipc_host_init();
223: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.