]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/memory_object.h
xnu-1699.22.73.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 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
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. 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.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
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.
41 *
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.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58/*
59 * File: memory_object.h
60 * Author: Michael Wayne Young
61 *
62 * External memory management interface definition.
63 */
64
65#ifndef _MACH_MEMORY_OBJECT_H_
66#define _MACH_MEMORY_OBJECT_H_
67
68/*
69 * User-visible types used in the external memory
70 * management interface:
71 */
72
73#include <mach/port.h>
91447636 74#include <mach/message.h>
1c79356b
A
75#include <mach/machine/vm_types.h>
76
77typedef mach_port_t memory_object_t;
78 /* A memory object ... */
79 /* Used by the kernel to retrieve */
80 /* or store data */
81
82typedef mach_port_t memory_object_control_t;
83 /* Provided to a memory manager; ... */
84 /* used to control a memory object */
85
86typedef mach_port_t memory_object_name_t;
87 /* Used to describe the memory ... */
88 /* object in vm_regions() calls */
89
90typedef 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 */
94
95typedef 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.
104 */
105#define MEMORY_OBJECT_COPY_TEMPORARY 3
106 /* ... Memory manager doesn't
107 * change data externally, and
108 * doesn't need to see changes.
109 */
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
115 * multiply mapped.
116 *
117 * XXX
118 * Not yet safe for non-kernel use.
119 */
120
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
128 * internal.
129 */
130
131typedef 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. */
142
143#define MEMORY_OBJECT_NULL MACH_PORT_NULL
144
145
146/*
147 * Types for the memory object flavor interfaces
148 */
149
150#define MEMORY_OBJECT_INFO_MAX (1024)
151typedef int *memory_object_info_t;
152typedef int memory_object_flavor_t;
153typedef int memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];
154
155
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
161
162
163struct old_memory_object_behave_info {
164 memory_object_copy_strategy_t copy_strategy;
165 boolean_t temporary;
166 boolean_t invalidate;
167};
168
169struct memory_object_perf_info {
91447636
A
170 memory_object_cluster_size_t cluster_size;
171 boolean_t may_cache;
1c79356b
A
172};
173
174struct old_memory_object_attr_info { /* old attr list */
175 boolean_t object_ready;
176 boolean_t may_cache;
177 memory_object_copy_strategy_t copy_strategy;
178};
179
180struct memory_object_attr_info {
181 memory_object_copy_strategy_t copy_strategy;
91447636 182 memory_object_cluster_size_t cluster_size;
1c79356b
A
183 boolean_t may_cache_object;
184 boolean_t temporary;
185};
186
187struct memory_object_behave_info {
188 memory_object_copy_strategy_t copy_strategy;
189 boolean_t temporary;
190 boolean_t invalidate;
191 boolean_t silent_overwrite;
192 boolean_t advisory_pageout;
193};
194
195typedef struct old_memory_object_behave_info *old_memory_object_behave_info_t;
196typedef struct old_memory_object_behave_info old_memory_object_behave_info_data_t;
197
198typedef struct memory_object_behave_info *memory_object_behave_info_t;
199typedef struct memory_object_behave_info memory_object_behave_info_data_t;
200
201typedef struct memory_object_perf_info *memory_object_perf_info_t;
202typedef struct memory_object_perf_info memory_object_perf_info_data_t;
203
204typedef struct old_memory_object_attr_info *old_memory_object_attr_info_t;
205typedef struct old_memory_object_attr_info old_memory_object_attr_info_data_t;
206
207typedef struct memory_object_attr_info *memory_object_attr_info_t;
208typedef struct memory_object_attr_info memory_object_attr_info_data_t;
209
91447636
A
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)))
1c79356b
A
220
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)
227
228#endif /* _MACH_MEMORY_OBJECT_H_ */