]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
d7e50217 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
d7e50217 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
d7e50217 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * @OSF_COPYRIGHT@ | |
27 | */ | |
28 | /* | |
29 | * Mach Operating System | |
30 | * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University | |
31 | * All Rights Reserved. | |
32 | * | |
33 | * Permission to use, copy, modify and distribute this software and its | |
34 | * documentation is hereby granted, provided that both the copyright | |
35 | * notice and this permission notice appear in all copies of the | |
36 | * software, derivative works or modified versions, and any portions | |
37 | * thereof, and that both notices appear in supporting documentation. | |
38 | * | |
39 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
40 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
41 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
42 | * | |
43 | * Carnegie Mellon requests users of this software to return to | |
44 | * | |
45 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
46 | * School of Computer Science | |
47 | * Carnegie Mellon University | |
48 | * Pittsburgh PA 15213-3890 | |
49 | * | |
50 | * any improvements or extensions that they make and grant Carnegie Mellon | |
51 | * the rights to redistribute these changes. | |
52 | */ | |
53 | /* | |
54 | */ | |
55 | /* | |
56 | * File: memory_object.h | |
57 | * Author: Michael Wayne Young | |
58 | * | |
59 | * External memory management interface definition. | |
60 | */ | |
61 | ||
62 | #ifndef _MACH_MEMORY_OBJECT_H_ | |
63 | #define _MACH_MEMORY_OBJECT_H_ | |
64 | ||
65 | /* | |
66 | * User-visible types used in the external memory | |
67 | * management interface: | |
68 | */ | |
69 | ||
70 | #include <mach/port.h> | |
71 | #include <mach/machine/vm_types.h> | |
72 | ||
73 | typedef mach_port_t memory_object_t; | |
74 | /* A memory object ... */ | |
75 | /* Used by the kernel to retrieve */ | |
76 | /* or store data */ | |
77 | ||
78 | typedef mach_port_t memory_object_control_t; | |
79 | /* Provided to a memory manager; ... */ | |
80 | /* used to control a memory object */ | |
81 | ||
82 | typedef mach_port_t memory_object_name_t; | |
83 | /* Used to describe the memory ... */ | |
84 | /* object in vm_regions() calls */ | |
85 | ||
86 | typedef mach_port_t memory_object_rep_t; | |
87 | /* Per-client handle for mem object */ | |
88 | /* Used by user programs to specify */ | |
89 | /* the object to map */ | |
90 | ||
91 | typedef int memory_object_copy_strategy_t; | |
92 | /* How memory manager handles copy: */ | |
93 | #define MEMORY_OBJECT_COPY_NONE 0 | |
94 | /* ... No special support */ | |
95 | #define MEMORY_OBJECT_COPY_CALL 1 | |
96 | /* ... Make call on memory manager */ | |
97 | #define MEMORY_OBJECT_COPY_DELAY 2 | |
98 | /* ... Memory manager doesn't | |
99 | * change data externally. | |
100 | */ | |
101 | #define MEMORY_OBJECT_COPY_TEMPORARY 3 | |
102 | /* ... Memory manager doesn't | |
103 | * change data externally, and | |
104 | * doesn't need to see changes. | |
105 | */ | |
106 | #define MEMORY_OBJECT_COPY_SYMMETRIC 4 | |
107 | /* ... Memory manager doesn't | |
108 | * change data externally, | |
109 | * doesn't need to see changes, | |
110 | * and object will not be | |
111 | * multiply mapped. | |
112 | * | |
113 | * XXX | |
114 | * Not yet safe for non-kernel use. | |
115 | */ | |
116 | ||
117 | #define MEMORY_OBJECT_COPY_INVALID 5 | |
118 | /* ... An invalid copy strategy, | |
119 | * for external objects which | |
120 | * have not been initialized. | |
121 | * Allows copy_strategy to be | |
122 | * examined without also | |
123 | * examining pager_ready and | |
124 | * internal. | |
125 | */ | |
126 | ||
127 | typedef int memory_object_return_t; | |
128 | /* Which pages to return to manager | |
129 | this time (lock_request) */ | |
130 | #define MEMORY_OBJECT_RETURN_NONE 0 | |
131 | /* ... don't return any. */ | |
132 | #define MEMORY_OBJECT_RETURN_DIRTY 1 | |
133 | /* ... only dirty pages. */ | |
134 | #define MEMORY_OBJECT_RETURN_ALL 2 | |
135 | /* ... dirty and precious pages. */ | |
136 | #define MEMORY_OBJECT_RETURN_ANYTHING 3 | |
137 | /* ... any resident page. */ | |
138 | ||
139 | #define MEMORY_OBJECT_NULL MACH_PORT_NULL | |
140 | ||
141 | ||
142 | /* | |
143 | * Types for the memory object flavor interfaces | |
144 | */ | |
145 | ||
146 | #define MEMORY_OBJECT_INFO_MAX (1024) | |
147 | typedef int *memory_object_info_t; | |
148 | typedef int memory_object_flavor_t; | |
149 | typedef int memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX]; | |
150 | ||
151 | ||
152 | #define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 10 | |
153 | #define MEMORY_OBJECT_PERFORMANCE_INFO 11 | |
154 | #define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO 12 | |
155 | #define MEMORY_OBJECT_ATTRIBUTE_INFO 14 | |
156 | #define MEMORY_OBJECT_BEHAVIOR_INFO 15 | |
157 | ||
158 | ||
159 | struct old_memory_object_behave_info { | |
160 | memory_object_copy_strategy_t copy_strategy; | |
161 | boolean_t temporary; | |
162 | boolean_t invalidate; | |
163 | }; | |
164 | ||
165 | struct memory_object_perf_info { | |
166 | vm_size_t cluster_size; | |
167 | boolean_t may_cache; | |
168 | }; | |
169 | ||
170 | struct old_memory_object_attr_info { /* old attr list */ | |
171 | boolean_t object_ready; | |
172 | boolean_t may_cache; | |
173 | memory_object_copy_strategy_t copy_strategy; | |
174 | }; | |
175 | ||
176 | struct memory_object_attr_info { | |
177 | memory_object_copy_strategy_t copy_strategy; | |
178 | vm_offset_t cluster_size; | |
179 | boolean_t may_cache_object; | |
180 | boolean_t temporary; | |
181 | }; | |
182 | ||
183 | struct memory_object_behave_info { | |
184 | memory_object_copy_strategy_t copy_strategy; | |
185 | boolean_t temporary; | |
186 | boolean_t invalidate; | |
187 | boolean_t silent_overwrite; | |
188 | boolean_t advisory_pageout; | |
189 | }; | |
190 | ||
191 | typedef struct old_memory_object_behave_info *old_memory_object_behave_info_t; | |
192 | typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t; | |
193 | ||
194 | typedef struct memory_object_behave_info *memory_object_behave_info_t; | |
195 | typedef struct memory_object_behave_info memory_object_behave_info_data_t; | |
196 | ||
197 | typedef struct memory_object_perf_info *memory_object_perf_info_t; | |
198 | typedef struct memory_object_perf_info memory_object_perf_info_data_t; | |
199 | ||
200 | typedef struct old_memory_object_attr_info *old_memory_object_attr_info_t; | |
201 | typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t; | |
202 | ||
203 | typedef struct memory_object_attr_info *memory_object_attr_info_t; | |
204 | typedef struct memory_object_attr_info memory_object_attr_info_data_t; | |
205 | ||
206 | #define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT \ | |
207 | (sizeof(old_memory_object_behave_info_data_t)/sizeof(int)) | |
208 | #define MEMORY_OBJECT_BEHAVE_INFO_COUNT \ | |
209 | (sizeof(memory_object_behave_info_data_t)/sizeof(int)) | |
210 | #define MEMORY_OBJECT_PERF_INFO_COUNT \ | |
211 | (sizeof(memory_object_perf_info_data_t)/sizeof(int)) | |
212 | #define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT \ | |
213 | (sizeof(old_memory_object_attr_info_data_t)/sizeof(int)) | |
214 | #define MEMORY_OBJECT_ATTR_INFO_COUNT \ | |
215 | (sizeof(memory_object_attr_info_data_t)/sizeof(int)) | |
216 | ||
217 | #define invalid_memory_object_flavor(f) \ | |
218 | (f != MEMORY_OBJECT_ATTRIBUTE_INFO && \ | |
219 | f != MEMORY_OBJECT_PERFORMANCE_INFO && \ | |
220 | f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO && \ | |
221 | f != MEMORY_OBJECT_BEHAVIOR_INFO && \ | |
222 | f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO) | |
223 | ||
224 | #endif /* _MACH_MEMORY_OBJECT_H_ */ |