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