]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/memory_object.defs
xnu-201.19.tar.gz
[apple/xnu.git] / osfmk / mach / memory_object.defs
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 Software.Distribution@CS.CMU.EDU
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 #endif
78
79 /*
80 * Initialize the specified memory object, providing
81 * a memory object control reference on which to make
82 * cache control calls.
83 * [To allow the mapping of this object to be used, the
84 * memory manager must call memory_object_set_attributes,
85 * specifying the "ready" parameter as TRUE. To reject
86 * all mappings of this object, the memory manager may
87 * use memory_object_destroy.]
88 */
89 routine memory_object_init(
90 memory_object : memory_object_t;
91 memory_control : memory_object_control_t;
92 memory_object_page_size : vm_size_t);
93
94
95 /*
96 * Indicates that the specified memory object is no longer
97 * mapped (or cached -- see memory_object_set_attributes),
98 * and that further mappings will cause another memory_object_init
99 * call to be made.
100 *
101 * [The kernel will release its reference on the memory object
102 * after this call returns. The memory object control associated
103 * with the memory object is no longer usable - the pager should
104 * drop the control reference granted to it by memory_object_init.]
105 */
106 routine memory_object_terminate(
107 memory_object : memory_object_t);
108
109 /*
110 * Request data from this memory object. At least
111 * the specified data should be returned with at
112 * least the specified access permitted.
113 *
114 * [Response should be upl commit over the specified range.]
115 */
116 routine memory_object_data_request(
117 memory_object : memory_object_t;
118 offset : memory_object_offset_t;
119 length : vm_size_t;
120 desired_access : vm_prot_t);
121
122 /*
123 * Return data to manager. This call is used in place of data_write
124 * for objects initialized by object_ready instead of set_attributes.
125 * This call indicates whether the returned data is dirty and whether
126 * the kernel kept a copy. Precious data remains precious if the
127 * kernel keeps a copy. The indication that the kernel kept a copy
128 * is only a hint if the data is not precious; the cleaned copy may
129 * be discarded without further notifying the manager.
130 *
131 * [response should be a upl_commit over the range specified]
132 */
133 routine memory_object_data_return(
134 memory_object : memory_object_t;
135 offset : memory_object_offset_t;
136 size : vm_size_t;
137 dirty : boolean_t;
138 kernel_copy : boolean_t);
139
140 /*
141 * Provide initial data contents for this region of
142 * the memory object. If data has already been written
143 * to the object, this value must be discarded; otherwise,
144 * this call acts identically to memory_object_data_return.
145 *
146 * [response should be UPL commit over the specified range.]
147 */
148 routine memory_object_data_initialize(
149 memory_object : memory_object_t;
150 offset : memory_object_offset_t;
151 size : vm_size_t);
152
153 /*
154 * Request that the specified portion of this
155 * memory object be unlocked to allow the specified
156 * forms of access; the kernel already has the data.
157 *
158 * [Response should be memory_object_lock_request when
159 * the operation is fully complete.]
160 */
161 routine memory_object_data_unlock(
162 memory_object : memory_object_t;
163 offset : memory_object_offset_t;
164 size : vm_size_t;
165 desired_access : vm_prot_t);
166
167
168 /*
169 * Request that the specified portion of this
170 * memory object be synchronized with its backing
171 * store according to the supplied flags.
172 *
173 * [Response should be memory_object_synchronize_completed when
174 * the operation is fully complete.]
175 */
176 routine memory_object_synchronize(
177 memory_object : memory_object_t;
178 offset : memory_object_offset_t;
179 size : vm_size_t;
180 sync_flags : vm_sync_t );
181
182 /*
183 * Notify the pager that the specified memory object
184 * has no other (mapped) references besides the named
185 * reference held by the pager itself.
186 *
187 * [Response should be a release of the named reference when
188 * the pager deems that appropriate.]
189 */
190 routine memory_object_unmap(
191 memory_object : memory_object_t);
192
193