|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * @OSF_COPYRIGHT@
24: */
25: /*
26: * Mach Operating System
27: * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28: * All Rights Reserved.
29: *
30: * Permission to use, copy, modify and distribute this software and its
31: * documentation is hereby granted, provided that both the copyright
32: * notice and this permission notice appear in all copies of the
33: * software, derivative works or modified versions, and any portions
34: * thereof, and that both notices appear in supporting documentation.
35: *
36: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39: *
40: * Carnegie Mellon requests users of this software to return to
41: *
42: * Software Distribution Coordinator or [email protected]
43: * School of Computer Science
44: * Carnegie Mellon University
45: * Pittsburgh PA 15213-3890
46: *
47: * any improvements or extensions that they make and grant Carnegie Mellon
48: * the rights to redistribute these changes.
49: */
50: /*
51: */
52: /*
53: * File: mach/memory_object.defs
54: *
55: * Abstract:
56: * Basic Mach external memory management interface declaration.
57: */
58:
59: subsystem
60: #if KERNEL_USER
61: KernelUser
62: #endif KERNEL_USER
63: #if KERNEL_SERVER
64: KernelServer
65: #endif KERNEL_SERVER
66: memory_object 2200;
67:
68: #ifdef MACH_KERNEL
69: #include <advisory_pageout.h>
70: #endif /* MACH_KERNEL */
71:
72: #include <mach/std_types.defs>
73: #include <mach/mach_types.defs>
74:
75: #if KERNEL_SERVER
76: serverprefix dp_;
77: #else
78: #if SEQNOS
79: serverprefix seqnos_;
80: serverdemux seqnos_memory_object_server;
81: #endif SEQNOS
82: #endif
83:
84: /*
85: * Initialize the specified memory object, providing
86: * a reqeust port on which control calls can be made.
87: * [To allow the mapping of this object to be used, the
88: * memory manager must call memory_object_set_attributes,
89: * specifying the "ready" parameter as TRUE. To reject
90: * all mappings of this object, the memory manager may
91: * use memory_object_destroy.]
92: */
93: simpleroutine memory_object_init(
94: memory_object : memory_object_t;
95: #if SEQNOS
96: msgseqno seqno : mach_port_seqno_t;
97: #endif SEQNOS
98: memory_control : memory_object_control_t =
99: MACH_MSG_TYPE_MAKE_SEND
100: ctype: mach_port_t;
101: memory_object_page_size : vm_size_t);
102:
103:
104: /*
105: * Indicates that the specified memory object is no longer
106: * mapped (or cached -- see memory_object_set_attributes),
107: * and that further mappings will cause another memory_object_init
108: * call to be made. No further calls will be made on
109: * the memory object by this kernel.
110: *
111: * [All rights to the control and name ports are included
112: * in this call. The memory manager should use port_deallocate
113: * to release them once they are no longer needed.]
114: */
115: simpleroutine memory_object_terminate(
116: memory_object : memory_object_t =
117: MACH_MSG_TYPE_MOVE_SEND
118: ctype: mach_port_t;
119: #if SEQNOS
120: msgseqno seqno : mach_port_seqno_t;
121: #endif SEQNOS
122: memory_control : memory_object_control_t =
123: MACH_MSG_TYPE_MOVE_RECEIVE
124: ctype: mach_port_t);
125:
126: /*
127: * Request data from this memory object. At least
128: * the specified data should be returned with at
129: * least the specified access permitted.
130: *
131: * [Reply should be memory_object_data_provided.]
132: */
133: simpleroutine memory_object_data_request(
134: memory_object : memory_object_t;
135: #if SEQNOS
136: msgseqno seqno : mach_port_seqno_t;
137: #endif SEQNOS
138: memory_control : memory_object_control_t =
139: MACH_MSG_TYPE_MAKE_SEND
140: ctype: mach_port_t;
141: offset : vm_offset_t;
142: length : vm_size_t;
143: desired_access : vm_prot_t);
144:
145: /*
146: * Request that the specified portion of this
147: * memory object be unlocked to allow the specified
148: * forms of access; the kernel already has the data.
149: *
150: * [Reply should be memory_object_lock_request.]
151: */
152: simpleroutine memory_object_data_unlock(
153: memory_object : memory_object_t;
154: #if SEQNOS
155: msgseqno seqno : mach_port_seqno_t;
156: #endif SEQNOS
157: 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: desired_access : vm_prot_t);
163:
164: /*
165: * Indicate that a previous memory_object_lock_reqeust has been
166: * completed. Note that this call is made on whatever
167: * port is specified in the memory_object_lock_request; that port
168: * need not be the memory object port itself.
169: *
170: * [No reply expected.]
171: */
172: simpleroutine memory_object_lock_completed(
173: memory_object : memory_object_t =
174: polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
175: ctype: mach_port_t;
176: #if SEQNOS
177: msgseqno seqno : mach_port_seqno_t;
178: #endif SEQNOS
179: memory_control : memory_object_control_t =
180: MACH_MSG_TYPE_MAKE_SEND
181: ctype: mach_port_t;
182: offset : vm_offset_t;
183: length : vm_size_t);
184:
185: /*
186: * Indicate that a previous memory_object_data_supply has been
187: * completed. Note that this call is made on whatever
188: * port is specified in the memory_object_data_supply; that port
189: * need not be the memory object port itself.
190: *
191: * The result parameter indicates what happened during the supply.
192: * If it is not KERN_SUCCESS, then error_offset identifies the
193: * first offset at which a problem occurred. The pagein operation
194: * stopped at this point. Note that the only failures reported
195: * by this mechanism are KERN_MEMORY_PRESENT. All other failures
196: * (invalid argument, error on pagein of supplied data in manager's
197: * address space) cause the entire operation to fail.
198: *
199: * XXX Check what actually happens in latter case!
200: *
201: * [No reply expected.]
202: */
203: simpleroutine memory_object_supply_completed(
204: memory_object : memory_object_t =
205: polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
206: ctype: mach_port_t;
207: #if SEQNOS
208: msgseqno seqno : mach_port_seqno_t;
209: #endif SEQNOS
210: memory_control : memory_object_control_t =
211: MACH_MSG_TYPE_MAKE_SEND
212: ctype: mach_port_t;
213: offset : vm_offset_t;
214: length : vm_size_t;
215: result : kern_return_t;
216: error_offset : vm_offset_t);
217:
218: /*
219: * Return data to manager. This call is used in place of data_write
220: * for objects initialized by object_ready instead of set_attributes.
221: * This call indicates whether the returned data is dirty and whether
222: * the kernel kept a copy. Precious data remains precious if the
223: * kernel keeps a copy. The indication that the kernel kept a copy
224: * is only a hint if the data is not precious; the cleaned copy may
225: * be discarded without further notifying the manager.
226: *
227: * [Reply should be vm_deallocate to release the data.]
228: */
229: simpleroutine memory_object_data_return(
230: memory_object : memory_object_t;
231: #if SEQNOS
232: msgseqno seqno : mach_port_seqno_t;
233: #endif SEQNOS
234: memory_control : memory_object_control_t =
235: MACH_MSG_TYPE_MAKE_SEND
236: ctype: mach_port_t;
237: offset : vm_offset_t;
238: data : pointer_t;
239: dirty : boolean_t;
240: kernel_copy : boolean_t);
241:
242:
243: simpleroutine memory_object_synchronize(
244: memory_object : memory_object_t;
245: #if SEQNOS
246: msgseqno seqno : mach_port_seqno_t;
247: #endif SEQNOS
248: memory_control : memory_object_control_t =
249: MACH_MSG_TYPE_MAKE_SEND
250: ctype: mach_port_t;
251: offset : vm_offset_t;
252: length : vm_offset_t;
253: sync_flags : vm_sync_t );
254:
255:
256: /*
257: * Confirm a successful memory_object_change attributes message.
258: */
259: simpleroutine memory_object_change_completed(
260: memory_object : memory_object_t =
261: polymorphic|MACH_MSG_TYPE_PORT_SEND_ONCE
262: ctype: mach_port_t;
263: #if SEQNOS
264: msgseqno seqno : mach_port_seqno_t;
265: #endif SEQNOS
266: memory_control : memory_object_control_t =
267: MACH_MSG_TYPE_MAKE_SEND
268: ctype: mach_port_t;
269: flavor : memory_object_flavor_t);
270:
271:
272: #if !defined(ADVISORY_PAGEOUT) || ADVISORY_PAGEOUT
273:
274: /*
275: * Advisory pageout
276: * Inform pager that the kernel would like to discard the given
277: * page.
278: * The pager should then clean/flush this page via the lock_request
279: * mechanism.
280: * If the pager does not cooperate, the kernel then uses mandatory
281: * (regular) pageout on this page.
282: *
283: */
284: simpleroutine memory_object_discard_request(
285: memory_object : memory_object_t;
286: #if SEQNOS
287: msgseqno seqno : mach_port_seqno_t;
288: #endif SEQNOS
289: memory_control : memory_object_control_t =
290: MACH_MSG_TYPE_MAKE_SEND
291: ctype: mach_port_t;
292: offset : vm_offset_t;
293: length : vm_size_t);
294:
295: #else /* !defined(ADVISORY_PAGEOUT) || ADVISORY_PAGEOUT */
296: skip;
297: #endif /* !defined(ADVISORY_PAGEOUT) || ADVISORY_PAGEOUT */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.