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