Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/mach/memory_object_types.h

1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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_TYPES_H_
66#define _MACH_MEMORY_OBJECT_TYPES_H_
67
68/*
69 *User-visible types used in the external memory
70 *management interface:
71 */
72
73#include <mach/port.h>
74#include <mach/message.h>
75#include <mach/vm_prot.h>
76#include <mach/vm_sync.h>
77#include <mach/vm_types.h>
78#include <mach/machine/vm_types.h>
79
80#include <sys/cdefs.h>
81
82#define VM_64_BIT_DATA_OBJECTS
83
84typedef unsigned long longmemory_object_offset_t;
85typedef unsigned long longmemory_object_size_t;
86typedef natural_tmemory_object_cluster_size_t;
87typedef natural_t *memory_object_fault_info_t;
88
89typedef unsigned long long vm_object_id_t;
90
91
92/*
93 * Temporary until real EMMI version gets re-implemented
94 */
95
96
97typedef mach_port_tmemory_object_t;
98typedef mach_port_tmemory_object_control_t;
99
100
101typedef memory_object_t *memory_object_array_t;
102/* A memory object ... */
103/* Used by the kernel to retrieve */
104/* or store data */
105
106typedefmach_port_tmemory_object_name_t;
107/* Used to describe the memory ... */
108/* object in vm_regions() calls */
109
110typedef mach_port_tmemory_object_default_t;
111/* Registered with the host ... */
112/* for creating new internal objects */
113
114#define MEMORY_OBJECT_NULL((memory_object_t) 0)
115#define MEMORY_OBJECT_CONTROL_NULL((memory_object_control_t) 0)
116#define MEMORY_OBJECT_NAME_NULL((memory_object_name_t) 0)
117#define MEMORY_OBJECT_DEFAULT_NULL((memory_object_default_t) 0)
118
119
120typedefintmemory_object_copy_strategy_t;
121/* How memory manager handles copy: */
122#defineMEMORY_OBJECT_COPY_NONE0
123/* ... No special support */
124#defineMEMORY_OBJECT_COPY_CALL1
125/* ... Make call on memory manager */
126#defineMEMORY_OBJECT_COPY_DELAY 2
127/* ... Memory manager doesn't
128 * change data externally.
129 */
130#defineMEMORY_OBJECT_COPY_TEMPORARY 3
131/* ... Memory manager doesn't
132 * change data externally, and
133 * doesn't need to see changes.
134 */
135#defineMEMORY_OBJECT_COPY_SYMMETRIC 4
136/* ... Memory manager doesn't
137 * change data externally,
138 * doesn't need to see changes,
139 * and object will not be
140 * multiply mapped.
141 *
142 * XXX
143 * Not yet safe for non-kernel use.
144 */
145
146#defineMEMORY_OBJECT_COPY_INVALID5
147/* ...An invalid copy strategy,
148 *for external objects which
149 *have not been initialized.
150 *Allows copy_strategy to be
151 *examined without also
152 *examining pager_ready and
153 *internal.
154 */
155
156typedefintmemory_object_return_t;
157/* Which pages to return to manager
158 this time (lock_request) */
159#defineMEMORY_OBJECT_RETURN_NONE0
160/* ... don't return any. */
161#defineMEMORY_OBJECT_RETURN_DIRTY1
162/* ... only dirty pages. */
163#defineMEMORY_OBJECT_RETURN_ALL2
164/* ... dirty and precious pages. */
165#defineMEMORY_OBJECT_RETURN_ANYTHING3
166/* ... any resident page. */
167
168/*
169 *Data lock request flags
170 */
171
172#defineMEMORY_OBJECT_DATA_FLUSH 0x1
173#defineMEMORY_OBJECT_DATA_NO_CHANGE0x2
174#defineMEMORY_OBJECT_DATA_PURGE0x4
175#defineMEMORY_OBJECT_COPY_SYNC0x8
176#defineMEMORY_OBJECT_DATA_SYNC0x10
177#define MEMORY_OBJECT_IO_SYNC 0x20
178#defineMEMORY_OBJECT_DATA_FLUSH_ALL0x40
179
180/*
181 *Types for the memory object flavor interfaces
182 */
183
184#define MEMORY_OBJECT_INFO_MAX (1024)
185typedef int *memory_object_info_t;
186typedef int memory_object_flavor_t;
187typedef int memory_object_info_data_t[MEMORY_OBJECT_INFO_MAX];
188
189
190#define MEMORY_OBJECT_PERFORMANCE_INFO11
191#define MEMORY_OBJECT_ATTRIBUTE_INFO14
192#define MEMORY_OBJECT_BEHAVIOR_INFO 15
193
194
195struct memory_object_perf_info {
196memory_object_cluster_size_tcluster_size;
197boolean_tmay_cache;
198};
199
200struct memory_object_attr_info {
201memory_object_copy_strategy_tcopy_strategy;
202memory_object_cluster_size_tcluster_size;
203boolean_tmay_cache_object;
204boolean_ttemporary;
205};
206
207struct memory_object_behave_info {
208memory_object_copy_strategy_tcopy_strategy;
209boolean_ttemporary;
210boolean_tinvalidate;
211boolean_tsilent_overwrite;
212boolean_tadvisory_pageout;
213};
214
215
216typedef struct memory_object_behave_info *memory_object_behave_info_t;
217typedef struct memory_object_behave_info memory_object_behave_info_data_t;
218
219typedef struct memory_object_perf_info *memory_object_perf_info_t;
220typedef struct memory_object_perf_infomemory_object_perf_info_data_t;
221
222typedef struct memory_object_attr_info*memory_object_attr_info_t;
223typedef struct memory_object_attr_infomemory_object_attr_info_data_t;
224
225#define MEMORY_OBJECT_BEHAVE_INFO_COUNT ((mach_msg_type_number_t)\
226 (sizeof(memory_object_behave_info_data_t)/sizeof(int)))
227#define MEMORY_OBJECT_PERF_INFO_COUNT((mach_msg_type_number_t)\
228(sizeof(memory_object_perf_info_data_t)/sizeof(int)))
229#define MEMORY_OBJECT_ATTR_INFO_COUNT((mach_msg_type_number_t)\
230(sizeof(memory_object_attr_info_data_t)/sizeof(int)))
231
232#define invalid_memory_object_flavor(f)\
233(f != MEMORY_OBJECT_ATTRIBUTE_INFO && \
234 f != MEMORY_OBJECT_PERFORMANCE_INFO && \
235 f != OLD_MEMORY_OBJECT_BEHAVIOR_INFO &&\
236 f != MEMORY_OBJECT_BEHAVIOR_INFO &&\
237 f != OLD_MEMORY_OBJECT_ATTRIBUTE_INFO)
238
239
240/*
241 * Used to support options on memory_object_release_name call
242 */
243#define MEMORY_OBJECT_TERMINATE_IDLE0x1
244#define MEMORY_OBJECT_RESPECT_CACHE0x2
245#define MEMORY_OBJECT_RELEASE_NO_OP0x4
246
247
248/* named entry processor mapping options */
249/* enumerated */
250#define MAP_MEM_NOOP0
251#define MAP_MEM_COPYBACK1
252#define MAP_MEM_IO2
253#define MAP_MEM_WTHRU3
254#define MAP_MEM_WCOMB4/* Write combining mode */
255/* aka store gather */
256
257#define GET_MAP_MEM(flags)\
258((((unsigned int)(flags)) >> 24) & 0xFF)
259
260#define SET_MAP_MEM(caching, flags)\
261((flags) = ((((unsigned int)(caching)) << 24) \
262& 0xFF000000) | ((flags) & 0xFFFFFF));
263
264/* leave room for vm_prot bits */
265#define MAP_MEM_ONLY0x10000/* change processor caching */
266#define MAP_MEM_NAMED_CREATE0x20000 /* create extant object */
267#define MAP_MEM_PURGABLE0x40000/* create a purgable VM object */
268#define MAP_MEM_NAMED_REUSE0x80000/* reuse provided entry if identical */
269
270
271#endif/* _MACH_MEMORY_OBJECT_TYPES_H_ */
272

Archive Download this file

Revision: 1622