|
|
1.1.1.2 root 1: /*
1.1 root 2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
4: * All Rights Reserved.
1.1.1.2 root 5: *
1.1 root 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.
1.1.1.2 root 11: *
1.1 root 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.
1.1.1.2 root 15: *
1.1 root 16: * Carnegie Mellon requests users of this software to return to
1.1.1.2 root 17: *
1.1 root 18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
1.1.1.2 root 22: *
1.1 root 23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26: /*
27: * File: mach/memory_object.defs
28: *
29: * Abstract:
30: * Basic Mach external memory management interface declaration.
31: */
32:
33: subsystem
34: #if KERNEL_USER
35: KernelUser
1.1.1.2 root 36: #endif /* KERNEL_USER */
1.1 root 37: #if KERNEL_SERVER
38: KernelServer
1.1.1.2 root 39: #endif /* KERNEL_SERVER */
1.1 root 40: memory_object 2200;
41:
42: #include <mach/std_types.defs>
43: #include <mach/mach_types.defs>
44:
1.1.1.4 root 45: #ifdef MEMORY_OBJECT_IMPORTS
46: MEMORY_OBJECT_IMPORTS
47: #endif
48:
1.1 root 49: #if SEQNOS
50: serverprefix seqnos_;
51: serverdemux seqnos_memory_object_server;
1.1.1.2 root 52: #endif /* SEQNOS */
1.1 root 53:
54: /*
55: * Initialize the specified memory object, providing
56: * a reqeust port on which control calls can be made, and
57: * a name port that identifies this object to callers of
58: * vm_regions.
59: * [To allow the mapping of this object to be used, the
1.1.1.5 ! root 60: * memory manager must call memory_object_ready or
! 61: * memory_object_change_attributes. To reject all mappings of
! 62: * this object, the memory manager may use
! 63: * memory_object_destroy.]
1.1 root 64: */
65: simpleroutine memory_object_init(
66: memory_object : memory_object_t;
67: #if SEQNOS
68: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 69: #endif /* SEQNOS */
1.1 root 70: memory_control : memory_object_control_t =
71: MACH_MSG_TYPE_MAKE_SEND
72: ctype: mach_port_t;
73: memory_object_name : memory_object_name_t =
74: MACH_MSG_TYPE_MAKE_SEND
75: ctype: mach_port_t;
76: memory_object_page_size : vm_size_t);
77:
78: /*
1.1.1.5 ! root 79: * Indicates that the specified memory object is no longer mapped
! 80: * (or cached -- see memory_object_ready or
! 81: * memory_object_change_attributes), and that further mappings
! 82: * will cause another memory_object_init call to be made. No
! 83: * further calls will be made on the memory object by this
! 84: * kernel.
1.1 root 85: *
86: * [All rights to the control and name ports are included
87: * in this call. The memory manager should use port_deallocate
88: * to release them once they are no longer needed.]
89: */
90: simpleroutine memory_object_terminate(
91: memory_object : memory_object_t =
92: MACH_MSG_TYPE_MOVE_SEND
1.1.1.4 root 93: ctype: mach_port_t
94: #ifdef MEMORY_OBJECT_INTRAN
95: intran: MEMORY_OBJECT_INTRAN
96: #endif
97: #ifdef MEMORY_OBJECT_INTRAN_PAYLOAD
98: intranpayload:
99: MEMORY_OBJECT_INTRAN_PAYLOAD
100: #endif
101: #ifdef MEMORY_OBJECT_DESTRUCTOR
102: destructor: MEMORY_OBJECT_DESTRUCTOR
103: #endif
104: ;
1.1 root 105: #if SEQNOS
106: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 107: #endif /* SEQNOS */
1.1 root 108: memory_control : memory_object_control_t =
109: MACH_MSG_TYPE_MOVE_RECEIVE
110: ctype: mach_port_t
111: #if KERNEL_USER
112: /* for compatibility with Mach 2.5 kernels */
113: , dealloc
1.1.1.2 root 114: #endif /* KERNEL_USER */
1.1 root 115: ;
116: memory_object_name : memory_object_name_t =
117: MACH_MSG_TYPE_MOVE_RECEIVE
118: ctype: mach_port_t
119: #if KERNEL_USER
120: /* for compatibility with Mach 2.5 kernels */
121: , dealloc
1.1.1.2 root 122: #endif /* KERNEL_USER */
1.1 root 123: );
124:
125: /*
126: * Indicates that a copy has been made of the specified range of
127: * the given original memory object. The kernel will use the new
128: * memory object, control and name ports to refer to the new copy
129: * (once the memory manager has asserted its "ready" attribute).
130: *
131: * Cached pages from the original memory object at the time of
132: * the copy operation are handled as follows:
133: * Readable pages may be silently copied to the new
134: * memory object (with all access permissions).
135: * Pages not copied are locked to prevent write access.
136: *
137: * This call includes only the new memory object itself; a
138: * memory_object_init call will be made on the new memory
139: * object after the actions above are completed.
140: *
141: * The new memory object is *temporary*, meaning that the
142: * memory manager should not change its contents or allow
143: * the memory object to be mapped in another client. The
144: * memory manager may use the memory_object_data_unavailable
145: * call to indicate that the appropriate page of the original
146: * memory object may be used to fulfill a data request.
147: *
1.1.1.5 ! root 148: * [Reply should be memory_object_ready or
! 149: * memory_object_change_attributes on the new memory object control
! 150: * port to indicate readiness.]
1.1 root 151: */
152: simpleroutine memory_object_copy(
153: old_memory_object : memory_object_t;
154: #if SEQNOS
155: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 156: #endif /* SEQNOS */
1.1 root 157: old_memory_control : memory_object_control_t =
158: MACH_MSG_TYPE_MAKE_SEND
159: ctype: mach_port_t;
160: offset : vm_offset_t;
161: length : vm_size_t;
162: new_memory_object : memory_object_t =
163: MACH_MSG_TYPE_MOVE_RECEIVE
164: ctype: mach_port_t
165: #if KERNEL_USER
166: /* for compatibility with Mach 2.5 kernels */
167: , dealloc
1.1.1.2 root 168: #endif /* KERNEL_USER */
1.1 root 169: );
170:
171: /*
172: * Request data from this memory object. At least
173: * the specified data should be returned with at
174: * least the specified access permitted.
175: *
1.1.1.5 ! root 176: * [Reply should be memory_object_data_supply.]
1.1 root 177: */
178: simpleroutine memory_object_data_request(
179: memory_object : memory_object_t;
180: #if SEQNOS
181: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 182: #endif /* SEQNOS */
1.1 root 183: memory_control : memory_object_control_t =
184: MACH_MSG_TYPE_MAKE_SEND
185: ctype: mach_port_t;
186: offset : vm_offset_t;
187: length : vm_size_t;
188: desired_access : vm_prot_t);
189:
190: /*
191: * Request that the specified portion of this
192: * memory object be unlocked to allow the specified
193: * forms of access; the kernel already has the data.
194: *
195: * [Reply should be memory_object_lock_request.]
196: */
197: simpleroutine memory_object_data_unlock(
198: memory_object : memory_object_t;
199: #if SEQNOS
200: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 201: #endif /* SEQNOS */
1.1 root 202: memory_control : memory_object_control_t =
203: MACH_MSG_TYPE_MAKE_SEND
204: ctype: mach_port_t;
205: offset : vm_offset_t;
206: length : vm_size_t;
207: desired_access : vm_prot_t);
208:
1.1.1.5 ! root 209: skip; /* was: memory_object_data_write */
1.1 root 210:
211: /*
212: * Indicate that a previous memory_object_lock_reqeust has been
213: * completed. Note that this call is made on whatever
214: * port is specified in the memory_object_lock_request; that port
215: * need not be the memory object port itself.
216: *
217: * [No reply expected.]
218: */
219: simpleroutine memory_object_lock_completed(
220: memory_object : memory_object_t =
221: polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
1.1.1.4 root 222: ctype: mach_port_t
223: #ifdef MEMORY_OBJECT_INTRAN
224: intran: MEMORY_OBJECT_INTRAN
225: #endif
226: #ifdef MEMORY_OBJECT_INTRAN_PAYLOAD
227: intranpayload: MEMORY_OBJECT_INTRAN_PAYLOAD
228: #endif
229: #ifdef MEMORY_OBJECT_DESTRUCTOR
230: destructor: MEMORY_OBJECT_DESTRUCTOR
231: #endif
232: ;
1.1 root 233: #if SEQNOS
234: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 235: #endif /* SEQNOS */
1.1 root 236: memory_control : memory_object_control_t =
237: MACH_MSG_TYPE_MAKE_SEND
238: ctype: mach_port_t;
239: offset : vm_offset_t;
240: length : vm_size_t);
241:
242: /*
243: * Indicate that a previous memory_object_data_supply has been
244: * completed. Note that this call is made on whatever
245: * port is specified in the memory_object_data_supply; that port
246: * need not be the memory object port itself.
247: *
248: * The result parameter indicates what happened during the supply.
249: * If it is not KERN_SUCCESS, then error_offset identifies the
250: * first offset at which a problem occurred. The pagein operation
251: * stopped at this point. Note that the only failures reported
252: * by this mechanism are KERN_MEMORY_PRESENT. All other failures
253: * (invalid argument, error on pagein of supplied data in manager's
254: * address space) cause the entire operation to fail.
255: *
256: * XXX Check what actually happens in latter case!
257: *
258: * [No reply expected.]
259: */
260: simpleroutine memory_object_supply_completed(
261: memory_object : memory_object_t =
262: polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
1.1.1.4 root 263: ctype: mach_port_t
264: #ifdef MEMORY_OBJECT_INTRAN
265: intran: MEMORY_OBJECT_INTRAN
266: #endif
267: #ifdef MEMORY_OBJECT_INTRAN_PAYLOAD
268: intranpayload: MEMORY_OBJECT_INTRAN_PAYLOAD
269: #endif
270: #ifdef MEMORY_OBJECT_DESTRUCTOR
271: destructor: MEMORY_OBJECT_DESTRUCTOR
272: #endif
273: ;
1.1 root 274: #if SEQNOS
275: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 276: #endif /* SEQNOS */
1.1 root 277: memory_control : memory_object_control_t =
278: MACH_MSG_TYPE_MAKE_SEND
279: ctype: mach_port_t;
280: offset : vm_offset_t;
281: length : vm_size_t;
282: result : kern_return_t;
283: error_offset : vm_offset_t);
284:
285: /*
1.1.1.5 ! root 286: * Return data to manager. This call indicates whether the
! 287: * returned data is dirty and whether the kernel kept a copy.
! 288: * Precious data remains precious if the kernel keeps a copy.
! 289: * The indication that the kernel kept a copy is only a hint if
! 290: * the data is not precious; the cleaned copy may be discarded
! 291: * without further notifying the manager.
1.1 root 292: *
293: * [Reply should be vm_deallocate to release the data.]
294: */
295: simpleroutine memory_object_data_return(
296: memory_object : memory_object_t;
297: #if SEQNOS
298: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 299: #endif /* SEQNOS */
1.1 root 300: memory_control : memory_object_control_t =
301: MACH_MSG_TYPE_MAKE_SEND
302: ctype: mach_port_t;
303: offset : vm_offset_t;
304: data : pointer_t;
305: dirty : boolean_t;
306: kernel_copy : boolean_t);
307:
308: /*
309: * XXX Warning: This routine does NOT contain a memory_object_control_t
310: * XXX because the memory_object_change_attributes call may cause
311: * XXX memory object termination (by uncaching the object). This would
312: * XXX yield an invalid port.
313: */
314:
315: simpleroutine memory_object_change_completed(
316: memory_object : memory_object_t =
317: polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
1.1.1.4 root 318: ctype: mach_port_t
319: #ifdef MEMORY_OBJECT_INTRAN
320: intran: MEMORY_OBJECT_INTRAN
321: #endif
322: #ifdef MEMORY_OBJECT_INTRAN_PAYLOAD
323: intranpayload: MEMORY_OBJECT_INTRAN_PAYLOAD
324: #endif
325: #ifdef MEMORY_OBJECT_DESTRUCTOR
326: destructor: MEMORY_OBJECT_DESTRUCTOR
327: #endif
328: ;
1.1 root 329: #if SEQNOS
330: msgseqno seqno : mach_port_seqno_t;
1.1.1.2 root 331: #endif /* SEQNOS */
1.1 root 332: may_cache : boolean_t;
333: copy_strategy : memory_object_copy_strategy_t);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.