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