1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989,1988,1987 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: memory_object.defs,v $
29 * Revision 2.9 91/08/28 11:15:19 jsb
30 * Added conditionalized sequence number support.
31 * [91/08/13 rpd]
32 * Fixed memory_object_supply_completed and memory_object_data_return
33 * to use mach_port_t as the C type name for port arguments.
34 * [91/08/02 rpd]
35 * Update types in new memory object routines. Add
36 * memory_object_change_completed.
37 * [91/07/03 14:05:39 dlb]
38 *
39 * Revision 2.8 91/07/01 08:25:16 jsb
40 * From David Black at OSF: added memory_object_supply_completed
41 * and memory_object_data_return.
42 * [91/06/29 14:54:47 jsb]
43 *
44 * Revision 2.7 91/06/25 10:30:30 rpd
45 * Changed the port-based type declarations
46 * to use mach_port_t as the C type name.
47 * [91/05/23 rpd]
48 *
49 * Revision 2.6 91/06/17 15:47:26 jsb
50 * If KERNEL and NORMA_VM, then use a userprefix (to allow interposition).
51 * [91/06/17 10:55:06 jsb]
52 *
53 * Revision 2.5 91/05/14 16:55:36 mrt
54 * Correcting copyright
55 *
56 * Revision 2.4 91/02/05 17:33:53 mrt
57 * Changed to new Mach copyright
58 * [91/02/01 17:19:02 mrt]
59 *
60 * Revision 2.3 90/08/06 17:06:11 rpd
61 * For compatibility with Mach 2.5, added dealloc to
62 * arguments of memory_object_terminate and memory_object_copy.
63 * [90/08/04 rpd]
64 *
65 * Revision 2.2 90/06/02 14:58:51 rpd
66 * Changed memory_object argument to memory_object_lock_completed
67 * to default to a send-once right but still allow send rights.
68 * [90/05/31 rpd]
69 *
70 * Converted to new IPC.
71 * [90/03/26 22:35:02 rpd]
72 *
73 * Revision 2.1 89/08/03 17:18:02 rwd
74 * Created.
75 *
76 * Revision 2.3 89/02/25 18:38:17 gm0w
77 * Changes for cleanup.
78 *
79 * Revision 2.2 89/01/15 16:31:06 rpd
80 * Moved from kern/ to mach/.
81 * [89/01/15 14:40:04 rpd]
82 *
83 * Revision 2.6 89/01/12 07:58:12 rpd
84 * Fixed includes.
85 * [89/01/12 04:52:21 rpd]
86 *
87 * Revision 2.5 88/12/19 02:46:15 mwyoung
88 * Change argument to memory_object_init to avoid lint in the MiG
89 * output.
90 * [88/12/18 mwyoung]
91 *
92 * Add memory_object_copy.
93 * [88/11/07 mwyoung]
94 *
95 * Revision 2.4 88/08/25 18:16:54 mwyoung
96 * Add memory_object_terminate.
97 * [88/08/11 18:46:46 mwyoung]
98 *
99 * 29-Jun-88 Michael Young (mwyoung) at Carnegie-Mellon University
100 * Use new types.
101 *
102 * 29-Jun-88 Michael Young (mwyoung) at Carnegie-Mellon University
103 * Moved data type declarations to "mach_types.defs".
104 *
105 * 9-Dec-87 Michael Young (mwyoung) at Carnegie-Mellon University
106 * Split that part of the interface applicable only to default
107 * pagers into a separate interface definition.
108 *
109 * Documented the interface.
110 *
111 * Purged history. Contributors so far: jle, mwyoung, bolosky.
112 *
113 */
114 /*
115 * File: mach/memory_object.defs
116 *
117 * Abstract:
118 * Basic Mach external memory management interface declaration.
119 */
120
121 subsystem
122 #if KERNEL_USER
123 KernelUser
124 #endif KERNEL_USER
125 #if KERNEL_SERVER
126 KernelServer
127 #endif KERNEL_SERVER
128 memory_object 2200;
129
130 #ifdef KERNEL
131 #include <norma_vm.h>
132 #if NORMA_VM
133 userprefix k_;
134 #endif NORMA_VM
135 #endif KERNEL
136
137 #include <mach/std_types.defs>
138 #include <mach/mach_types.defs>
139
140 #if SEQNOS
141 serverprefix seqnos_;
142 serverdemux seqnos_memory_object_server;
143 #endif SEQNOS
144
145 /*
146 * Initialize the specified memory object, providing
147 * a reqeust port on which control calls can be made, and
148 * a name port that identifies this object to callers of
149 * vm_regions.
150 * [To allow the mapping of this object to be used, the
151 * memory manager must call memory_object_set_attributes,
152 * specifying the "ready" parameter as TRUE. To reject
153 * all mappings of this object, the memory manager may
154 * use memory_object_destroy.]
155 */
156 simpleroutine memory_object_init(
157 memory_object : memory_object_t;
158 #if SEQNOS
159 msgseqno seqno : mach_port_seqno_t;
160 #endif SEQNOS
161 memory_control : memory_object_control_t =
162 MACH_MSG_TYPE_MAKE_SEND
163 ctype: mach_port_t;
164 memory_object_name : memory_object_name_t =
165 MACH_MSG_TYPE_MAKE_SEND
166 ctype: mach_port_t;
167 memory_object_page_size : vm_size_t);
168
169 /*
170 * Indicates that the specified memory object is no longer
171 * mapped (or cached -- see memory_object_set_attributes),
172 * and that further mappings will cause another memory_object_init
173 * call to be made. No further calls will be made on
174 * the memory object by this kernel.
175 *
176 * [All rights to the control and name ports are included
177 * in this call. The memory manager should use port_deallocate
178 * to release them once they are no longer needed.]
179 */
180 simpleroutine memory_object_terminate(
181 memory_object : memory_object_t =
182 MACH_MSG_TYPE_MOVE_SEND
183 ctype: mach_port_t;
184 #if SEQNOS
185 msgseqno seqno : mach_port_seqno_t;
186 #endif SEQNOS
187 memory_control : memory_object_control_t =
188 MACH_MSG_TYPE_MOVE_RECEIVE
189 ctype: mach_port_t
190 #if KERNEL_USER
191 /* for compatibility with Mach 2.5 kernels */
192 , dealloc
193 #endif KERNEL_USER
194 ;
195 memory_object_name : memory_object_name_t =
196 MACH_MSG_TYPE_MOVE_RECEIVE
197 ctype: mach_port_t
198 #if KERNEL_USER
199 /* for compatibility with Mach 2.5 kernels */
200 , dealloc
201 #endif KERNEL_USER
202 );
203
204 /*
205 * Indicates that a copy has been made of the specified range of
206 * the given original memory object. The kernel will use the new
207 * memory object, control and name ports to refer to the new copy
208 * (once the memory manager has asserted its "ready" attribute).
209 *
210 * Cached pages from the original memory object at the time of
211 * the copy operation are handled as follows:
212 * Readable pages may be silently copied to the new
213 * memory object (with all access permissions).
214 * Pages not copied are locked to prevent write access.
215 *
216 * This call includes only the new memory object itself; a
217 * memory_object_init call will be made on the new memory
218 * object after the actions above are completed.
219 *
220 * The new memory object is *temporary*, meaning that the
221 * memory manager should not change its contents or allow
222 * the memory object to be mapped in another client. The
223 * memory manager may use the memory_object_data_unavailable
224 * call to indicate that the appropriate page of the original
225 * memory object may be used to fulfill a data request.
226 *
227 * [Reply should be memory_object_set_attributes on the
228 * new memory object control port to indicate readiness.]
229 */
230 simpleroutine memory_object_copy(
231 old_memory_object : memory_object_t;
232 #if SEQNOS
233 msgseqno seqno : mach_port_seqno_t;
234 #endif SEQNOS
235 old_memory_control : memory_object_control_t =
236 MACH_MSG_TYPE_MAKE_SEND
237 ctype: mach_port_t;
238 offset : vm_offset_t;
239 length : vm_size_t;
240 new_memory_object : memory_object_t =
241 MACH_MSG_TYPE_MOVE_RECEIVE
242 ctype: mach_port_t
243 #if KERNEL_USER
244 /* for compatibility with Mach 2.5 kernels */
245 , dealloc
246 #endif KERNEL_USER
247 );
248
249 /*
250 * Request data from this memory object. At least
251 * the specified data should be returned with at
252 * least the specified access permitted.
253 *
254 * [Reply should be memory_object_data_provided.]
255 */
256 simpleroutine memory_object_data_request(
257 memory_object : memory_object_t;
258 #if SEQNOS
259 msgseqno seqno : mach_port_seqno_t;
260 #endif SEQNOS
261 memory_control : memory_object_control_t =
262 MACH_MSG_TYPE_MAKE_SEND
263 ctype: mach_port_t;
264 offset : vm_offset_t;
265 length : vm_size_t;
266 desired_access : vm_prot_t);
267
268 /*
269 * Request that the specified portion of this
270 * memory object be unlocked to allow the specified
271 * forms of access; the kernel already has the data.
272 *
273 * [Reply should be memory_object_lock_request.]
274 */
275 simpleroutine memory_object_data_unlock(
276 memory_object : memory_object_t;
277 #if SEQNOS
278 msgseqno seqno : mach_port_seqno_t;
279 #endif SEQNOS
280 memory_control : memory_object_control_t =
281 MACH_MSG_TYPE_MAKE_SEND
282 ctype: mach_port_t;
283 offset : vm_offset_t;
284 length : vm_size_t;
285 desired_access : vm_prot_t);
286
287 /*
288 * Write back modifications made to this portion of
289 * the memory object while in memory.
290 *
291 * Unless explicitly requested by a memory_object_lock_request
292 * (clean, but not flush), the kernel will not retain
293 * the data.
294 *
295 * [Reply should be vm_deallocate to release the data.]
296 */
297 simpleroutine memory_object_data_write(
298 memory_object : memory_object_t;
299 #if SEQNOS
300 msgseqno seqno : mach_port_seqno_t;
301 #endif SEQNOS
302 memory_control : memory_object_control_t =
303 MACH_MSG_TYPE_MAKE_SEND
304 ctype: mach_port_t;
305 offset : vm_offset_t;
306 data : pointer_t);
307
308 /*
309 * Indicate that a previous memory_object_lock_reqeust has been
310 * completed. Note that this call is made on whatever
311 * port is specified in the memory_object_lock_request; that port
312 * need not be the memory object port itself.
313 *
314 * [No reply expected.]
315 */
316 simpleroutine memory_object_lock_completed(
317 memory_object : memory_object_t =
318 polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
319 ctype: mach_port_t;
320 #if SEQNOS
321 msgseqno seqno : mach_port_seqno_t;
322 #endif SEQNOS
323 memory_control : memory_object_control_t =
324 MACH_MSG_TYPE_MAKE_SEND
325 ctype: mach_port_t;
326 offset : vm_offset_t;
327 length : vm_size_t);
328
329 /*
330 * Indicate that a previous memory_object_data_supply has been
331 * completed. Note that this call is made on whatever
332 * port is specified in the memory_object_data_supply; that port
333 * need not be the memory object port itself.
334 *
335 * The result parameter indicates what happened during the supply.
336 * If it is not KERN_SUCCESS, then error_offset identifies the
337 * first offset at which a problem occurred. The pagein operation
338 * stopped at this point. Note that the only failures reported
339 * by this mechanism are KERN_MEMORY_PRESENT. All other failures
340 * (invalid argument, error on pagein of supplied data in manager's
341 * address space) cause the entire operation to fail.
342 *
343 * XXX Check what actually happens in latter case!
344 *
345 * [No reply expected.]
346 */
347 simpleroutine memory_object_supply_completed(
348 memory_object : memory_object_t =
349 polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
350 ctype: mach_port_t;
351 #if SEQNOS
352 msgseqno seqno : mach_port_seqno_t;
353 #endif SEQNOS
354 memory_control : memory_object_control_t =
355 MACH_MSG_TYPE_MAKE_SEND
356 ctype: mach_port_t;
357 offset : vm_offset_t;
358 length : vm_size_t;
359 result : kern_return_t;
360 error_offset : vm_offset_t);
361
362 /*
363 * Return data to manager. This call is used in place of data_write
364 * for objects initialized by object_ready instead of set_attributes.
365 * This call indicates whether the returned data is dirty and whether
366 * the kernel kept a copy. Precious data remains precious if the
367 * kernel keeps a copy. The indication that the kernel kept a copy
368 * is only a hint if the data is not precious; the cleaned copy may
369 * be discarded without further notifying the manager.
370 *
371 * [Reply should be vm_deallocate to release the data.]
372 */
373 simpleroutine memory_object_data_return(
374 memory_object : memory_object_t;
375 #if SEQNOS
376 msgseqno seqno : mach_port_seqno_t;
377 #endif SEQNOS
378 memory_control : memory_object_control_t =
379 MACH_MSG_TYPE_MAKE_SEND
380 ctype: mach_port_t;
381 offset : vm_offset_t;
382 data : pointer_t;
383 dirty : boolean_t;
384 kernel_copy : boolean_t);
385
386 /*
387 * XXX Warning: This routine does NOT contain a memory_object_control_t
388 * XXX because the memory_object_change_attributes call may cause
389 * XXX memory object termination (by uncaching the object). This would
390 * XXX yield an invalid port.
391 */
392
393 simpleroutine memory_object_change_completed(
394 memory_object : memory_object_t =
395 polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
396 ctype: mach_port_t;
397 #if SEQNOS
398 msgseqno seqno : mach_port_seqno_t;
399 #endif SEQNOS
400 may_cache : boolean_t;
401 copy_strategy : memory_object_copy_strategy_t);
Cache object: 3c8995941984259f2cd674b0ad25cd6d
|