2 * Copyright (c) 2000-2005 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/message.h>
69 #include <mach/machine/vm_types.h>
71 typedef mach_port_t memory_object_t
;
72 /* A memory object ... */
73 /* Used by the kernel to retrieve */
76 typedef mach_port_t memory_object_control_t
;
77 /* Provided to a memory manager; ... */
78 /* used to control a memory object */
80 typedef mach_port_t memory_object_name_t
;
81 /* Used to describe the memory ... */
82 /* object in vm_regions() calls */
84 typedef mach_port_t memory_object_rep_t
;
85 /* Per-client handle for mem object */
86 /* Used by user programs to specify */
87 /* the object to map */
89 typedef int memory_object_copy_strategy_t
;
90 /* How memory manager handles copy: */
91 #define MEMORY_OBJECT_COPY_NONE 0
92 /* ... No special support */
93 #define MEMORY_OBJECT_COPY_CALL 1
94 /* ... Make call on memory manager */
95 #define MEMORY_OBJECT_COPY_DELAY 2
96 /* ... Memory manager doesn't
97 * change data externally.
99 #define MEMORY_OBJECT_COPY_TEMPORARY 3
100 /* ... Memory manager doesn't
101 * change data externally, and
102 * doesn't need to see changes.
104 #define MEMORY_OBJECT_COPY_SYMMETRIC 4
105 /* ... Memory manager doesn't
106 * change data externally,
107 * doesn't need to see changes,
108 * and object will not be
112 * Not yet safe for non-kernel use.
115 #define MEMORY_OBJECT_COPY_INVALID 5
116 /* ... An invalid copy strategy,
117 * for external objects which
118 * have not been initialized.
119 * Allows copy_strategy to be
120 * examined without also
121 * examining pager_ready and
125 typedef int memory_object_return_t
;
126 /* Which pages to return to manager
127 this time (lock_request) */
128 #define MEMORY_OBJECT_RETURN_NONE 0
129 /* ... don't return any. */
130 #define MEMORY_OBJECT_RETURN_DIRTY 1
131 /* ... only dirty pages. */
132 #define MEMORY_OBJECT_RETURN_ALL 2
133 /* ... dirty and precious pages. */
134 #define MEMORY_OBJECT_RETURN_ANYTHING 3
135 /* ... any resident page. */
137 #define MEMORY_OBJECT_NULL MACH_PORT_NULL
141 * Types for the memory object flavor interfaces
144 #define MEMORY_OBJECT_INFO_MAX (1024)
145 typedef int *memory_object_info_t
;
146 typedef int memory_object_flavor_t
;
147 typedef int memory_object_info_data_t
[MEMORY_OBJECT_INFO_MAX
];
150 #define OLD_MEMORY_OBJECT_BEHAVIOR_INFO 10
151 #define MEMORY_OBJECT_PERFORMANCE_INFO 11
152 #define OLD_MEMORY_OBJECT_ATTRIBUTE_INFO 12
153 #define MEMORY_OBJECT_ATTRIBUTE_INFO 14
154 #define MEMORY_OBJECT_BEHAVIOR_INFO 15
157 struct old_memory_object_behave_info
{
158 memory_object_copy_strategy_t copy_strategy
;
160 boolean_t invalidate
;
163 struct memory_object_perf_info
{
164 memory_object_cluster_size_t cluster_size
;
168 struct old_memory_object_attr_info
{ /* old attr list */
169 boolean_t object_ready
;
171 memory_object_copy_strategy_t copy_strategy
;
174 struct memory_object_attr_info
{
175 memory_object_copy_strategy_t copy_strategy
;
176 memory_object_cluster_size_t cluster_size
;
177 boolean_t may_cache_object
;
181 struct memory_object_behave_info
{
182 memory_object_copy_strategy_t copy_strategy
;
184 boolean_t invalidate
;
185 boolean_t silent_overwrite
;
186 boolean_t advisory_pageout
;
189 typedef struct old_memory_object_behave_info
*old_memory_object_behave_info_t
;
190 typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t
;
192 typedef struct memory_object_behave_info
*memory_object_behave_info_t
;
193 typedef struct memory_object_behave_info memory_object_behave_info_data_t
;
195 typedef struct memory_object_perf_info
*memory_object_perf_info_t
;
196 typedef struct memory_object_perf_info memory_object_perf_info_data_t
;
198 typedef struct old_memory_object_attr_info
*old_memory_object_attr_info_t
;
199 typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t
;
201 typedef struct memory_object_attr_info
*memory_object_attr_info_t
;
202 typedef struct memory_object_attr_info memory_object_attr_info_data_t
;
204 #define OLD_MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t) \
205 (sizeof(old_memory_object_behave_info_data_t)/sizeof(int)))
206 #define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t) \
207 (sizeof(memory_object_behave_info_data_t)/sizeof(int)))
208 #define MEMORY_OBJECT_PERF_INFO_COUNT ((mach_msg_type_number_t) \
209 (sizeof(memory_object_perf_info_data_t)/sizeof(int)))
210 #define OLD_MEMORY_OBJECT_ATTR_INFO_COUNT ((mach_msg_type_number_t) \
211 (sizeof(old_memory_object_attr_info_data_t)/sizeof(int)))
212 #define MEMORY_OBJECT_ATTR_INFO_COUNT ((mach_msg_type_number_t) \
213 (sizeof(memory_object_attr_info_data_t)/sizeof(int)))
215 #define invalid_memory_object_flavor(f) \
216 (f != MEMORY_OBJECT_ATTRIBUTE_INFO && \
217 f != MEMORY_OBJECT_PERFORMANCE_INFO && \
218 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO && \
219 f != MEMORY_OBJECT_BEHAVIOR_INFO && \
220 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
222 #endif /* _MACH_MEMORY_OBJECT_H_ */