2 * Copyright (c) 2004 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@
23 #ifdef XNU_KERNEL_PRIVATE
25 #ifndef _VM_VM_PROTOS_H_
26 #define _VM_VM_PROTOS_H_
28 #include <mach/mach_types.h>
29 #include <kern/kern_types.h>
32 * This file contains various type definitions and routine prototypes
33 * that are needed to avoid compilation warnings for VM code (in osfmk,
34 * default_pager and bsd).
35 * Most of these should eventually go into more appropriate header files.
37 * Include it after all other header files since it doesn't include any
38 * type definitions and it works around some conflicts with other header
45 extern kern_return_t
device_data_action(
47 ipc_port_t device_pager
,
49 vm_object_offset_t offset
,
52 extern kern_return_t
device_close(
58 extern int start_def_pager(
64 #ifndef _KERN_IPC_TT_H_ /* XXX FBDP */
65 /* these should be exported cleanly from OSFMK since BSD needs them */
66 extern ipc_port_t
convert_task_to_port(
68 #endif /* _KERN_IPC_TT_H_ */
69 #ifndef _IPC_IPC_PORT_H_
70 extern mach_port_name_t
ipc_port_copyout_send(
73 extern task_t
port_name_to_task(
74 mach_port_name_t name
);
75 #endif /* _IPC_IPC_PORT_H_ */
77 extern ipc_space_t
get_task_ipcspace(
80 /* Some loose-ends VM stuff */
82 extern vm_map_t kalloc_map
;
83 extern vm_size_t msg_ool_size_small
;
84 extern vm_map_t zone_map
;
86 extern void consider_machine_adjust(void);
87 extern pmap_t
get_map_pmap(vm_map_t
);
88 extern vm_map_offset_t
get_map_min(vm_map_t
);
89 extern vm_map_offset_t
get_map_max(vm_map_t
);
90 extern vm_map_size_t
get_vmmap_size(vm_map_t
);
91 extern int get_vmmap_entries(vm_map_t
);
93 extern boolean_t
coredumpok(vm_map_t map
, vm_offset_t va
);
96 * VM routines that used to be published to
97 * user space, and are now restricted to the kernel.
99 * They should eventually go away entirely -
100 * to be replaced with standard vm_map() and
101 * vm_deallocate() calls.
104 extern kern_return_t vm_upl_map
106 vm_map_t target_task
,
108 vm_address_t
*address
111 extern kern_return_t vm_upl_unmap
113 vm_map_t target_task
,
117 extern kern_return_t vm_region_object_create
119 vm_map_t target_task
,
121 ipc_port_t
*object_handle
124 extern mach_vm_offset_t
mach_get_vm_start(vm_map_t
);
125 extern mach_vm_offset_t
mach_get_vm_end(vm_map_t
);
128 * Legacy routines to get the start and end for a vm_map_t. They
129 * return them in the vm_offset_t format. So, they should only be
130 * called on maps that are the same size as the kernel map for
133 extern vm_offset_t
get_vm_start(vm_map_t
);
134 extern vm_offset_t
get_vm_end(vm_map_t
);
138 * LP64todo - map in the commpage cleanly and remove these.
140 extern void vm_map_commpage64( vm_map_t
);
141 extern void vm_map_remove_commpage64( vm_map_t
);
148 extern int is_suser(void);
149 extern int bsd_read_page_cache_file(
154 struct vnode
*app_vp
,
156 vm_offset_t
*bufsize
);
157 extern int bsd_write_page_cache_file(
164 extern int prepare_profile_database(
166 extern void vnode_pager_shutdown(void);
167 extern void *upl_get_internal_page_list(
169 #ifndef _VNODE_PAGER_
170 typedef int pager_return_t
;
171 extern pager_return_t
vnode_pagein(
172 struct vnode
*, upl_t
,
173 vm_offset_t
, vm_object_offset_t
,
174 vm_size_t
, int, int *);
175 extern pager_return_t
vnode_pageout(
176 struct vnode
*, upl_t
,
177 vm_offset_t
, vm_object_offset_t
,
178 vm_size_t
, int, int *);
179 extern memory_object_t
vnode_pager_setup(
180 struct vnode
*, memory_object_t
);
181 extern vm_object_offset_t
vnode_pager_get_filesize(
183 #endif /* _VNODE_PAGER_ */
184 extern void vnode_pager_bootstrap(void);
186 vnode_pager_data_unlock(
187 memory_object_t mem_obj
,
188 memory_object_offset_t offset
,
190 vm_prot_t desired_access
);
191 extern kern_return_t
vnode_pager_init(
193 memory_object_control_t
,
195 extern kern_return_t
vnode_pager_get_object_size(
197 memory_object_offset_t
*);
198 extern kern_return_t
vnode_pager_data_request(
200 memory_object_offset_t
,
203 extern kern_return_t
vnode_pager_data_return(
205 memory_object_offset_t
,
207 memory_object_offset_t
*,
212 extern kern_return_t
vnode_pager_data_initialize(
214 memory_object_offset_t
,
216 extern void vnode_pager_reference(
217 memory_object_t mem_obj
);
218 extern kern_return_t
vnode_pager_synchronize(
219 memory_object_t mem_obj
,
220 memory_object_offset_t offset
,
222 vm_sync_t sync_flags
);
223 extern kern_return_t
vnode_pager_unmap(
224 memory_object_t mem_obj
);
225 extern void vnode_pager_deallocate(
227 extern kern_return_t
vnode_pager_terminate(
229 extern void vnode_pager_vrele(
231 extern void vnode_pager_release_from_cache(
233 extern void ubc_unmap(
236 extern int vnode_pager_workaround
;
237 extern int device_pager_workaround
;
239 extern void dp_memory_object_reference(memory_object_t
);
240 extern void dp_memory_object_deallocate(memory_object_t
);
241 #ifndef _memory_object_server_
242 extern kern_return_t
dp_memory_object_init(memory_object_t
,
243 memory_object_control_t
,
245 extern kern_return_t
dp_memory_object_terminate(memory_object_t
);
246 extern kern_return_t
dp_memory_object_data_request(memory_object_t
,
247 memory_object_offset_t
, vm_size_t
, vm_prot_t
);
248 extern kern_return_t
dp_memory_object_data_return(memory_object_t
,
249 memory_object_offset_t
,
256 extern kern_return_t
dp_memory_object_data_initialize(memory_object_t
,
257 memory_object_offset_t
,
259 extern kern_return_t
dp_memory_object_data_unlock(memory_object_t
,
260 memory_object_offset_t
,
263 extern kern_return_t
dp_memory_object_synchronize(memory_object_t
,
264 memory_object_offset_t
,
267 extern kern_return_t
dp_memory_object_unmap(memory_object_t
);
268 #endif /* _memory_object_server_ */
269 #ifndef _memory_object_default_server_
270 extern kern_return_t
default_pager_memory_object_create(
271 memory_object_default_t
,
274 #endif /* _memory_object_default_server_ */
276 extern void device_pager_reference(memory_object_t
);
277 extern void device_pager_deallocate(memory_object_t
);
278 extern kern_return_t
device_pager_init(memory_object_t
,
279 memory_object_control_t
,
281 extern kern_return_t
device_pager_terminate(memory_object_t
);
282 extern kern_return_t
device_pager_data_request(memory_object_t
,
283 memory_object_offset_t
,
286 extern kern_return_t
device_pager_data_return(memory_object_t
,
287 memory_object_offset_t
,
292 extern kern_return_t
device_pager_data_initialize(memory_object_t
,
293 memory_object_offset_t
,
295 extern kern_return_t
device_pager_data_unlock(memory_object_t
,
296 memory_object_offset_t
,
299 extern kern_return_t
device_pager_synchronize(memory_object_t
,
300 memory_object_offset_t
,
303 extern kern_return_t
device_pager_unmap(memory_object_t
);
304 extern kern_return_t
device_pager_populate_object(
305 memory_object_t device
,
306 memory_object_offset_t offset
,
309 extern memory_object_t
device_pager_setup(
314 extern void device_pager_bootstrap(void);
316 extern kern_return_t
memory_object_create_named(
317 memory_object_t pager
,
318 memory_object_offset_t size
,
319 memory_object_control_t
*control
);
322 extern int macx_swapinfo(
323 memory_object_size_t
*total_p
,
324 memory_object_size_t
*avail_p
,
325 vm_size_t
*pagesize_p
,
326 boolean_t
*encrypted_p
);
328 #endif /* _VM_VM_PROTOS_H_ */
330 #endif /* XNU_KERNEL_PRIVATE */