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