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