]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/memory_object_control.defs
xnu-123.5.tar.gz
[apple/xnu.git] / osfmk / mach / memory_object_control.defs
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
25/*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
29 *
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.
35 *
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.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50/*
51 */
52/*
53 * File: mach/memory_object.defs
54 *
55 * Abstract:
56 * Basic Mach external memory management interface declaration.
57 */
58
59subsystem
60#if KERNEL_USER
61 KernelUser
62#endif KERNEL_USER
63#if KERNEL_SERVER
64 KernelServer
65#endif KERNEL_SERVER
66 memory_object_control 2000;
67
68#ifdef MACH_KERNEL
69#include <advisory_pageout.h>
70#endif /* MACH_KERNEL */
71
72#include <mach/std_types.defs>
73#include <mach/mach_types.defs>
74
75/*
76 * JMM - For now we define back-and-forth paging until we get the code
77 * cleaned up.
78 */
79#define _BACK_AND_FORTH_PAGING_
80
81/*
82 * Retrieves the attributes currently associated with
83 * a memory object.
84 */
85routine memory_object_get_attributes(
86 memory_control : vm_object_t;
87 flavor : memory_object_flavor_t;
88 out attributes : memory_object_info_t, CountInOut);
89
90
91simpleroutine memory_object_change_attributes(
92 memory_control : vm_object_t;
93 flavor : memory_object_flavor_t;
94 attributes : memory_object_info_t
95#ifdef _BACK_AND_FORTH_PAGING_
96 ; reply_to : mach_port_t =
97 MACH_MSG_TYPE_MAKE_SEND|polymorphic
98#endif
99 );
100
101simpleroutine memory_object_synchronize_completed (
102 memory_control : vm_object_t;
103 offset : memory_object_offset_t;
104 length : vm_offset_t);
105
106skip;
107
108/*
109 * Control use of the data associated with the given
110 * memory object. For each page in the given range,
111 * perform the following operations, in order:
112 * 1) restrict access to the page (disallow
113 * forms specified by "prot");
114 * 2) write back modifications (if "should_return"
115 * is RETURN_DIRTY and the page is dirty, or
116 * "should_return" is RETURN_ALL and the page
117 * is either dirty or precious); and,
118 * 3) flush the cached copy (if "should_flush"
119 * is asserted).
120 * The set of pages is defined by a starting offset
121 * ("offset") and size ("size"). Only pages with the
122 * same page alignment as the starting offset are
123 * considered.
124 *
125 * A single acknowledgement is sent (to the "reply_to"
126 * port) when these actions are complete.
127 *
128 * There are two versions of this routine because IPC distinguishes
129 * between booleans and integers (a 2-valued integer is NOT a
130 * boolean). The new routine is backwards compatible at the C
131 * language interface.
132 */
133simpleroutine memory_object_lock_request(
134 memory_control : vm_object_t;
135 offset : memory_object_offset_t;
136 size : memory_object_size_t;
137 should_return : memory_object_return_t;
138 flags : integer_t;
139 lock_value : vm_prot_t
140#ifdef _BACK_AND_FORTH_PAGING_
141 ; reply_to : mach_port_t =
142 MACH_MSG_TYPE_MAKE_SEND|polymorphic
143#endif
144 );
145
146
147 skip;
148
149/*
150 */
151simpleroutine memory_object_destroy(
152 memory_control : vm_object_t;
153 reason : kern_return_t);
154
155/*
156 * Provide the data contents of a range of the given memory
157 * object, with the access restriction specified, optional
158 * precious attribute, and reply message. [Only
159 * whole virtual pages of data can be accepted; partial pages
160 * will be discarded. Data should be provided on request, but
161 * may be provided in advance as desired. When data already
162 * held by this kernel is provided again, the new data is ignored.
163 * The access restriction is the subset of {read, write, execute}
164 * which are prohibited. The kernel may not provide any data (or
165 * protection) consistency among pages with different virtual page
166 * alignments within the same object. The precious value controls
167 * how the kernel treats the data. If it is FALSE, the kernel treats
168 * its copy as a temporary and may throw it away if it hasn't been
169 * changed. If the precious value is TRUE, the kernel treats its
170 * copy as a data repository and promises to return it to the manager;
171 * the manager may tell the kernel to throw it away instead by flushing
172 * and not cleaning the data -- see memory_object_lock_request. The
173 * reply_to port is for a compeletion message; it will be
174 * memory_object_supply_completed.]
175 */
176
177 skip;
178
179 skip;
180
181routine vm_object_upl_request(
182 object :vm_object_entry_t;
183 in offset :memory_object_offset_t;
184 in size :vm_size_t;
185 out upl :mach_port_move_send_t;
186 out page_list :upl_page_list_ptr_t, CountInOut;
187 in cntrl_flags :integer_t);
188
189routine vm_pager_upl_request(
190 object :vm_object_entry_t;
191 in offset :memory_object_offset_t;
192 in size :vm_size_t;
193 in super_size :vm_size_t;
194 out upl :mach_port_move_send_t;
195 out page_list :upl_page_list_ptr_t, CountInOut;
196 in cntrl_flags :integer_t);
197
198routine vm_upl_map(
199 map :vm_task_entry_t;
200 in upl :upl_object_t;
201 inout dst_addr :vm_offset_t);
202
203routine vm_upl_unmap(
204 map :vm_task_entry_t;
205 in upl :upl_object_t);
206
207routine vm_upl_abort(
208 upl_object :upl_object_entry_t;
209 in abort_cond :integer_t);
210
211routine vm_upl_commit(
212 upl_object :upl_object_entry_t;
213 in page_list :upl_page_list_ptr_t);
214
215routine vm_upl_commit_range(
216 upl_object :upl_object_entry_t;
217 offset :vm_offset_t;
218 size :vm_size_t;
219 in page_list :upl_page_list_ptr_t);