2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
36 * All Rights Reserved.
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
61 * File: memory_object.h
62 * Author: Michael Wayne Young
64 * External memory management interface definition.
67 #ifndef _MACH_MEMORY_OBJECT_H_
68 #define _MACH_MEMORY_OBJECT_H_
71 * User-visible types used in the external memory
72 * management interface:
75 #include <mach/port.h>
76 #include <mach/message.h>
77 #include <mach/machine/vm_types.h>
79 typedef mach_port_t memory_object_t
;
80 /* A memory object ... */
81 /* Used by the kernel to retrieve */
84 typedef mach_port_t memory_object_control_t
;
85 /* Provided to a memory manager; ... */
86 /* used to control a memory object */
88 typedef mach_port_t memory_object_name_t
;
89 /* Used to describe the memory ... */
90 /* object in vm_regions() calls */
92 typedef mach_port_t memory_object_rep_t
;
93 /* Per-client handle for mem object */
94 /* Used by user programs to specify */
95 /* the object to map */
97 typedef int memory_object_copy_strategy_t
;
98 /* How memory manager handles copy: */
99 #define MEMORY_OBJECT_COPY_NONE 0
100 /* ... No special support */
101 #define MEMORY_OBJECT_COPY_CALL 1
102 /* ... Make call on memory manager */
103 #define MEMORY_OBJECT_COPY_DELAY 2
104 /* ... Memory manager doesn't
105 * change data externally.
107 #define MEMORY_OBJECT_COPY_TEMPORARY 3
108 /* ... Memory manager doesn't
109 * change data externally, and
110 * doesn't need to see changes.
112 #define MEMORY_OBJECT_COPY_SYMMETRIC 4
113 /* ... Memory manager doesn't
114 * change data externally,
115 * doesn't need to see changes,
116 * and object will not be
120 * Not yet safe for non-kernel use.
123 #define MEMORY_OBJECT_COPY_INVALID 5
124 /* ... An invalid copy strategy,
125 * for external objects which
126 * have not been initialized.
127 * Allows copy_strategy to be
128 * examined without also
129 * examining pager_ready and
133 typedef int memory_object_return_t
;
134 /* Which pages to return to manager
135 this time (lock_request) */
136 #define MEMORY_OBJECT_RETURN_NONE 0
137 /* ... don't return any. */
138 #define MEMORY_OBJECT_RETURN_DIRTY 1
139 /* ... only dirty pages. */
140 #define MEMORY_OBJECT_RETURN_ALL 2
141 /* ... dirty and precious pages. */
142 #define MEMORY_OBJECT_RETURN_ANYTHING 3
143 /* ... any resident page. */
145 #define MEMORY_OBJECT_NULL MACH_PORT_NULL
149 * Types for the memory object flavor interfaces
152 #define MEMORY_OBJECT_INFO_MAX (1024)
153 typedef int *memory_object_info_t
;
154 typedef int memory_object_flavor_t
;
155 typedef int memory_object_info_data_t
[MEMORY_OBJECT_INFO_MAX
];
158 #define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 10
159 #define MEMORY_OBJECT_PERFORMANCE_INFO 11
160 #define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO 12
161 #define MEMORY_OBJECT_ATTRIBUTE_INFO 14
162 #define MEMORY_OBJECT_BEHAVIOR_INFO 15
165 struct old_memory_object_behave_info
{
166 memory_object_copy_strategy_t copy_strategy
;
168 boolean_t invalidate
;
171 struct memory_object_perf_info
{
172 memory_object_cluster_size_t cluster_size
;
176 struct old_memory_object_attr_info
{ /* old attr list */
177 boolean_t object_ready
;
179 memory_object_copy_strategy_t copy_strategy
;
182 struct memory_object_attr_info
{
183 memory_object_copy_strategy_t copy_strategy
;
184 memory_object_cluster_size_t cluster_size
;
185 boolean_t may_cache_object
;
189 struct memory_object_behave_info
{
190 memory_object_copy_strategy_t copy_strategy
;
192 boolean_t invalidate
;
193 boolean_t silent_overwrite
;
194 boolean_t advisory_pageout
;
197 typedef struct old_memory_object_behave_info
*old_memory_object_behave_info_t
;
198 typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t
;
200 typedef struct memory_object_behave_info
*memory_object_behave_info_t
;
201 typedef struct memory_object_behave_info memory_object_behave_info_data_t
;
203 typedef struct memory_object_perf_info
*memory_object_perf_info_t
;
204 typedef struct memory_object_perf_info memory_object_perf_info_data_t
;
206 typedef struct old_memory_object_attr_info
*old_memory_object_attr_info_t
;
207 typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t
;
209 typedef struct memory_object_attr_info
*memory_object_attr_info_t
;
210 typedef struct memory_object_attr_info memory_object_attr_info_data_t
;
212 #define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t) \
213 (sizeof(old_memory_object_behave_info_data_t)/sizeof(int)))
214 #define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t) \
215 (sizeof(memory_object_behave_info_data_t)/sizeof(int)))
216 #define MEMORY_OBJECT_PERF_INFO_COUNT ((mach_msg_type_number_t) \
217 (sizeof(memory_object_perf_info_data_t)/sizeof(int)))
218 #define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT ((mach_msg_type_number_t) \
219 (sizeof(old_memory_object_attr_info_data_t)/sizeof(int)))
220 #define MEMORY_OBJECT_ATTR_INFO_COUNT ((mach_msg_type_number_t) \
221 (sizeof(memory_object_attr_info_data_t)/sizeof(int)))
223 #define invalid_memory_object_flavor(f) \
224 (f != MEMORY_OBJECT_ATTRIBUTE_INFO && \
225 f != MEMORY_OBJECT_PERFORMANCE_INFO && \
226 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO && \
227 f != MEMORY_OBJECT_BEHAVIOR_INFO && \
228 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
230 #endif /* _MACH_MEMORY_OBJECT_H_ */