FreeBSD/Linux Kernel Cross Reference
sys/ipc/ipc_init.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: ipc_init.c,v $
29 * Revision 2.14 92/08/03 17:34:17 jfriedl
30 * removed silly prototypes
31 * [92/08/02 jfriedl]
32 *
33 * Revision 2.13 92/05/21 17:10:11 jfriedl
34 * tried prototypes.
35 * [92/05/20 jfriedl]
36 *
37 * Revision 2.12 91/12/10 13:25:41 jsb
38 * Removed reference counting bug workaround.
39 * [91/12/10 11:17:21 jsb]
40 *
41 * Revision 2.11 91/11/19 09:54:12 rvb
42 * Joe's tar.3 changes installed by Jeffrey Heller.
43 * [91/11/19 rvb]
44 *
45 * Revision 2.10 91/08/03 18:18:12 jsb
46 * Removed call to ipc_clport_init.
47 * [91/07/24 22:11:04 jsb]
48 *
49 * Revision 2.9 91/06/17 15:46:00 jsb
50 * Renamed NORMA conditionals.
51 * [91/06/17 10:45:48 jsb]
52 *
53 * Revision 2.8 91/06/06 17:05:46 jsb
54 * Added call to ipc_clport_init.
55 * [91/05/13 17:17:10 jsb]
56 *
57 * Revision 2.7 91/05/14 16:32:33 mrt
58 * Correcting copyright
59 *
60 * Revision 2.6 91/02/05 17:21:37 mrt
61 * Changed to new Mach copyright
62 * [91/02/01 15:45:02 mrt]
63 *
64 * Revision 2.5 91/01/08 15:13:40 rpd
65 * Changed zchange calls to make the IPC zones non-collectable.
66 * [90/12/29 rpd]
67 *
68 * Revision 2.4 90/12/20 16:38:41 jeffreyh
69 * Changes to zchange to account for new collectable field. Made all
70 * ipc zones collectable.
71 * [90/12/11 jeffreyh]
72 *
73 * Revision 2.3 90/09/28 16:54:44 jsb
74 * Added NORMA_IPC support.
75 * [90/09/28 14:02:05 jsb]
76 *
77 * Revision 2.2 90/06/02 14:49:55 rpd
78 * Created for new IPC.
79 * [90/03/26 20:55:13 rpd]
80 *
81 */
82 /*
83 * File: ipc/ipc_init.c
84 * Author: Rich Draves
85 * Date: 1989
86 *
87 * Functions to initialize the IPC system.
88 */
89
90 #include <mach/kern_return.h>
91 #include <kern/mach_param.h>
92 #include <kern/ipc_host.h>
93 #include <vm/vm_map.h>
94 #include <vm/vm_kern.h>
95 #include <ipc/ipc_entry.h>
96 #include <ipc/ipc_space.h>
97 #include <ipc/ipc_object.h>
98 #include <ipc/ipc_port.h>
99 #include <ipc/ipc_pset.h>
100 #include <ipc/ipc_marequest.h>
101 #include <ipc/ipc_notify.h>
102 #include <ipc/ipc_kmsg.h>
103 #include <ipc/ipc_hash.h>
104 #include <ipc/ipc_init.h>
105
106
107
108 vm_map_t ipc_kernel_map;
109 vm_size_t ipc_kernel_map_size = 1024 * 1024;
110
111 int ipc_space_max = SPACE_MAX;
112 int ipc_tree_entry_max = ITE_MAX;
113 int ipc_port_max = PORT_MAX;
114 int ipc_pset_max = SET_MAX;
115
116 /*
117 * Routine: ipc_bootstrap
118 * Purpose:
119 * Initialization needed before the kernel task
120 * can be created.
121 */
122
123 void
124 ipc_bootstrap()
125 {
126 kern_return_t kr;
127
128 ipc_port_multiple_lock_init();
129
130 ipc_port_timestamp_lock_init();
131 ipc_port_timestamp_data = 0;
132
133 /* all IPC zones should be exhaustible */
134
135 ipc_space_zone = zinit(sizeof(struct ipc_space),
136 ipc_space_max * sizeof(struct ipc_space),
137 sizeof(struct ipc_space),
138 FALSE, "ipc spaces");
139 /* make it exhaustible */
140 zchange(ipc_space_zone, FALSE, FALSE, TRUE, FALSE);
141
142 ipc_tree_entry_zone =
143 zinit(sizeof(struct ipc_tree_entry),
144 ipc_tree_entry_max * sizeof(struct ipc_tree_entry),
145 sizeof(struct ipc_tree_entry),
146 FALSE, "ipc tree entries");
147 /* make it exhaustible */
148 zchange(ipc_tree_entry_zone, FALSE, FALSE, TRUE, FALSE);
149
150 ipc_object_zones[IOT_PORT] =
151 zinit(sizeof(struct ipc_port),
152 ipc_port_max * sizeof(struct ipc_port),
153 sizeof(struct ipc_port),
154 FALSE, "ipc ports");
155 /* make it exhaustible */
156 zchange(ipc_object_zones[IOT_PORT], FALSE, FALSE, TRUE, FALSE);
157
158 ipc_object_zones[IOT_PORT_SET] =
159 zinit(sizeof(struct ipc_pset),
160 ipc_pset_max * sizeof(struct ipc_pset),
161 sizeof(struct ipc_pset),
162 FALSE, "ipc port sets");
163 /* make it exhaustible */
164 zchange(ipc_object_zones[IOT_PORT_SET], FALSE, FALSE, TRUE, FALSE);
165
166 /* create special spaces */
167
168 kr = ipc_space_create_special(&ipc_space_kernel);
169 assert(kr == KERN_SUCCESS);
170
171 kr = ipc_space_create_special(&ipc_space_reply);
172 assert(kr == KERN_SUCCESS);
173
174 #if NORMA_IPC
175 kr = ipc_space_create_special(&ipc_space_remote);
176 assert(kr == KERN_SUCCESS);
177 #endif NORMA_IPC
178
179 /* initialize modules with hidden data structures */
180
181 ipc_table_init();
182 ipc_notify_init();
183 ipc_hash_init();
184 ipc_marequest_init();
185 }
186
187 /*
188 * Routine: ipc_init
189 * Purpose:
190 * Final initialization of the IPC system.
191 */
192
193 void
194 ipc_init()
195 {
196 vm_offset_t min, max;
197
198 ipc_kernel_map = kmem_suballoc(kernel_map, &min, &max,
199 ipc_kernel_map_size, TRUE);
200
201 ipc_host_init();
202 }
Cache object: 6ccf561fb2590bf618687d263b41794c
|