]>
Commit | Line | Data |
---|---|---|
1c79356b A |
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 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: memory_object.h | |
54 | * Author: Michael Wayne Young | |
55 | * | |
56 | * External memory management interface definition. | |
57 | */ | |
58 | ||
59 | #ifndef _MACH_MEMORY_OBJECT_H_ | |
60 | #define _MACH_MEMORY_OBJECT_H_ | |
61 | ||
62 | /* | |
63 | * User-visible types used in the external memory | |
64 | * management interface: | |
65 | */ | |
66 | ||
67 | #include <mach/port.h> | |
68 | #include <mach/machine/vm_types.h> | |
69 | ||
70 | typedef mach_port_t memory_object_t; | |
71 | /* A memory object ... */ | |
72 | /* Used by the kernel to retrieve */ | |
73 | /* or store data */ | |
74 | ||
75 | typedef mach_port_t memory_object_control_t; | |
76 | /* Provided to a memory manager; ... */ | |
77 | /* used to control a memory object */ | |
78 | ||
79 | typedef mach_port_t memory_object_name_t; | |
80 | /* Used to describe the memory ... */ | |
81 | /* object in vm_regions() calls */ | |
82 | ||
83 | typedef mach_port_t memory_object_rep_t; | |
84 | /* Per-client handle for mem object */ | |
85 | /* Used by user programs to specify */ | |
86 | /* the object to map */ | |
87 | ||
88 | typedef int memory_object_copy_strategy_t; | |
89 | /* How memory manager handles copy: */ | |
90 | #define MEMORY_OBJECT_COPY_NONE 0 | |
91 | /* ... No special support */ | |
92 | #define MEMORY_OBJECT_COPY_CALL 1 | |
93 | /* ... Make call on memory manager */ | |
94 | #define MEMORY_OBJECT_COPY_DELAY 2 | |
95 | /* ... Memory manager doesn't | |
96 | * change data externally. | |
97 | */ | |
98 | #define MEMORY_OBJECT_COPY_TEMPORARY 3 | |
99 | /* ... Memory manager doesn't | |
100 | * change data externally, and | |
101 | * doesn't need to see changes. | |
102 | */ | |
103 | #define MEMORY_OBJECT_COPY_SYMMETRIC 4 | |
104 | /* ... Memory manager doesn't | |
105 | * change data externally, | |
106 | * doesn't need to see changes, | |
107 | * and object will not be | |
108 | * multiply mapped. | |
109 | * | |
110 | * XXX | |
111 | * Not yet safe for non-kernel use. | |
112 | */ | |
113 | ||
114 | #define MEMORY_OBJECT_COPY_INVALID 5 | |
115 | /* ... An invalid copy strategy, | |
116 | * for external objects which | |
117 | * have not been initialized. | |
118 | * Allows copy_strategy to be | |
119 | * examined without also | |
120 | * examining pager_ready and | |
121 | * internal. | |
122 | */ | |
123 | ||
124 | typedef int memory_object_return_t; | |
125 | /* Which pages to return to manager | |
126 | this time (lock_request) */ | |
127 | #define MEMORY_OBJECT_RETURN_NONE 0 | |
128 | /* ... don't return any. */ | |
129 | #define MEMORY_OBJECT_RETURN_DIRTY 1 | |
130 | /* ... only dirty pages. */ | |
131 | #define MEMORY_OBJECT_RETURN_ALL 2 | |
132 | /* ... dirty and precious pages. */ | |
133 | #define MEMORY_OBJECT_RETURN_ANYTHING 3 | |
134 | /* ... any resident page. */ | |
135 | ||
136 | #define MEMORY_OBJECT_NULL MACH_PORT_NULL | |
137 | ||
138 | ||
139 | /* | |
140 | * Types for the memory object flavor interfaces | |
141 | */ | |
142 | ||
143 | #define MEMORY_OBJECT_INFO_MAX (1024) | |
144 | typedef int *memory_object_info_t; | |
145 | typedef int memory_object_flavor_t; | |
146 | typedef int memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX]; | |
147 | ||
148 | ||
149 | #define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 10 | |
150 | #define MEMORY_OBJECT_PERFORMANCE_INFO 11 | |
151 | #define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO 12 | |
152 | #define MEMORY_OBJECT_ATTRIBUTE_INFO 14 | |
153 | #define MEMORY_OBJECT_BEHAVIOR_INFO 15 | |
154 | ||
155 | ||
156 | struct old_memory_object_behave_info { | |
157 | memory_object_copy_strategy_t copy_strategy; | |
158 | boolean_t temporary; | |
159 | boolean_t invalidate; | |
160 | }; | |
161 | ||
162 | struct memory_object_perf_info { | |
163 | vm_size_t cluster_size; | |
164 | boolean_t may_cache; | |
165 | }; | |
166 | ||
167 | struct old_memory_object_attr_info { /* old attr list */ | |
168 | boolean_t object_ready; | |
169 | boolean_t may_cache; | |
170 | memory_object_copy_strategy_t copy_strategy; | |
171 | }; | |
172 | ||
173 | struct memory_object_attr_info { | |
174 | memory_object_copy_strategy_t copy_strategy; | |
175 | vm_offset_t cluster_size; | |
176 | boolean_t may_cache_object; | |
177 | boolean_t temporary; | |
178 | }; | |
179 | ||
180 | struct memory_object_behave_info { | |
181 | memory_object_copy_strategy_t copy_strategy; | |
182 | boolean_t temporary; | |
183 | boolean_t invalidate; | |
184 | boolean_t silent_overwrite; | |
185 | boolean_t advisory_pageout; | |
186 | }; | |
187 | ||
188 | typedef struct old_memory_object_behave_info *old_memory_object_behave_info_t; | |
189 | typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t; | |
190 | ||
191 | typedef struct memory_object_behave_info *memory_object_behave_info_t; | |
192 | typedef struct memory_object_behave_info memory_object_behave_info_data_t; | |
193 | ||
194 | typedef struct memory_object_perf_info *memory_object_perf_info_t; | |
195 | typedef struct memory_object_perf_info memory_object_perf_info_data_t; | |
196 | ||
197 | typedef struct old_memory_object_attr_info *old_memory_object_attr_info_t; | |
198 | typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t; | |
199 | ||
200 | typedef struct memory_object_attr_info *memory_object_attr_info_t; | |
201 | typedef struct memory_object_attr_info memory_object_attr_info_data_t; | |
202 | ||
203 | #define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT \ | |
204 | (sizeof(old_memory_object_behave_info_data_t)/sizeof(int)) | |
205 | #define MEMORY_OBJECT_BEHAVE_INFO_COUNT \ | |
206 | (sizeof(memory_object_behave_info_data_t)/sizeof(int)) | |
207 | #define MEMORY_OBJECT_PERF_INFO_COUNT \ | |
208 | (sizeof(memory_object_perf_info_data_t)/sizeof(int)) | |
209 | #define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT \ | |
210 | (sizeof(old_memory_object_attr_info_data_t)/sizeof(int)) | |
211 | #define MEMORY_OBJECT_ATTR_INFO_COUNT \ | |
212 | (sizeof(memory_object_attr_info_data_t)/sizeof(int)) | |
213 | ||
214 | #define invalid_memory_object_flavor(f) \ | |
215 | (f != MEMORY_OBJECT_ATTRIBUTE_INFO && \ | |
216 | f != MEMORY_OBJECT_PERFORMANCE_INFO && \ | |
217 | f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO && \ | |
218 | f != MEMORY_OBJECT_BEHAVIOR_INFO && \ | |
219 | f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO) | |
220 | ||
221 | #endif /* _MACH_MEMORY_OBJECT_H_ */ |