2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
28 * All Rights Reserved.
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.
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.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
53 * File: memory_object.h
54 * Author: Michael Wayne Young
56 * External memory management interface definition.
59 #ifndef _MACH_MEMORY_OBJECT_H_
60 #define _MACH_MEMORY_OBJECT_H_
63 * User-visible types used in the external memory
64 * management interface:
67 #include <mach/port.h>
68 #include <mach/machine/vm_types.h>
70 typedef mach_port_t memory_object_t
;
71 /* A memory object ... */
72 /* Used by the kernel to retrieve */
75 typedef mach_port_t memory_object_control_t
;
76 /* Provided to a memory manager; ... */
77 /* used to control a memory object */
79 typedef mach_port_t memory_object_name_t
;
80 /* Used to describe the memory ... */
81 /* object in vm_regions() calls */
83 typedef mach_port_t memory_object_rep_t
;
84 /* Per-client handle for mem object */
85 /* Used by user programs to specify */
86 /* the object to map */
88 typedef int memory_object_copy_strategy_t
;
89 /* How memory manager handles copy: */
90 #define MEMORY_OBJECT_COPY_NONE 0
91 /* ... No special support */
92 #define MEMORY_OBJECT_COPY_CALL 1
93 /* ... Make call on memory manager */
94 #define MEMORY_OBJECT_COPY_DELAY 2
95 /* ... Memory manager doesn't
96 * change data externally.
98 #define MEMORY_OBJECT_COPY_TEMPORARY 3
99 /* ... Memory manager doesn't
100 * change data externally, and
101 * doesn't need to see changes.
103 #define MEMORY_OBJECT_COPY_SYMMETRIC 4
104 /* ... Memory manager doesn't
105 * change data externally,
106 * doesn't need to see changes,
107 * and object will not be
111 * Not yet safe for non-kernel use.
114 #define MEMORY_OBJECT_COPY_INVALID 5
115 /* ... An invalid copy strategy,
116 * for external objects which
117 * have not been initialized.
118 * Allows copy_strategy to be
119 * examined without also
120 * examining pager_ready and
124 typedef int memory_object_return_t
;
125 /* Which pages to return to manager
126 this time (lock_request) */
127 #define MEMORY_OBJECT_RETURN_NONE 0
128 /* ... don't return any. */
129 #define MEMORY_OBJECT_RETURN_DIRTY 1
130 /* ... only dirty pages. */
131 #define MEMORY_OBJECT_RETURN_ALL 2
132 /* ... dirty and precious pages. */
133 #define MEMORY_OBJECT_RETURN_ANYTHING 3
134 /* ... any resident page. */
136 #define MEMORY_OBJECT_NULL MACH_PORT_NULL
140 * Types for the memory object flavor interfaces
143 #define MEMORY_OBJECT_INFO_MAX (1024)
144 typedef int *memory_object_info_t
;
145 typedef int memory_object_flavor_t
;
146 typedef int memory_object_info_data_t
[MEMORY_OBJECT_INFO_MAX
];
149 #define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 10
150 #define MEMORY_OBJECT_PERFORMANCE_INFO 11
151 #define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO 12
152 #define MEMORY_OBJECT_ATTRIBUTE_INFO 14
153 #define MEMORY_OBJECT_BEHAVIOR_INFO 15
156 struct old_memory_object_behave_info
{
157 memory_object_copy_strategy_t copy_strategy
;
159 boolean_t invalidate
;
162 struct memory_object_perf_info
{
163 vm_size_t cluster_size
;
167 struct old_memory_object_attr_info
{ /* old attr list */
168 boolean_t object_ready
;
170 memory_object_copy_strategy_t copy_strategy
;
173 struct memory_object_attr_info
{
174 memory_object_copy_strategy_t copy_strategy
;
175 vm_offset_t cluster_size
;
176 boolean_t may_cache_object
;
180 struct memory_object_behave_info
{
181 memory_object_copy_strategy_t copy_strategy
;
183 boolean_t invalidate
;
184 boolean_t silent_overwrite
;
185 boolean_t advisory_pageout
;
188 typedef struct old_memory_object_behave_info
*old_memory_object_behave_info_t
;
189 typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t
;
191 typedef struct memory_object_behave_info
*memory_object_behave_info_t
;
192 typedef struct memory_object_behave_info memory_object_behave_info_data_t
;
194 typedef struct memory_object_perf_info
*memory_object_perf_info_t
;
195 typedef struct memory_object_perf_info memory_object_perf_info_data_t
;
197 typedef struct old_memory_object_attr_info
*old_memory_object_attr_info_t
;
198 typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t
;
200 typedef struct memory_object_attr_info
*memory_object_attr_info_t
;
201 typedef struct memory_object_attr_info memory_object_attr_info_data_t
;
203 #define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT \
204 (sizeof(old_memory_object_behave_info_data_t)/sizeof(int))
205 #define MEMORY_OBJECT_BEHAVE_INFO_COUNT \
206 (sizeof(memory_object_behave_info_data_t)/sizeof(int))
207 #define MEMORY_OBJECT_PERF_INFO_COUNT \
208 (sizeof(memory_object_perf_info_data_t)/sizeof(int))
209 #define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT \
210 (sizeof(old_memory_object_attr_info_data_t)/sizeof(int))
211 #define MEMORY_OBJECT_ATTR_INFO_COUNT \
212 (sizeof(memory_object_attr_info_data_t)/sizeof(int))
214 #define invalid_memory_object_flavor(f) \
215 (f != MEMORY_OBJECT_ATTRIBUTE_INFO && \
216 f != MEMORY_OBJECT_PERFORMANCE_INFO && \
217 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO && \
218 f != MEMORY_OBJECT_BEHAVIOR_INFO && \
219 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
221 #endif /* _MACH_MEMORY_OBJECT_H_ */