2 * Copyright (c) 2004-2006 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(
60 extern int default_pager_init_flag
;
65 #ifndef _KERN_IPC_TT_H_ /* XXX FBDP */
66 /* these should be exported cleanly from OSFMK since BSD needs them */
67 extern ipc_port_t
convert_task_to_port(
69 extern ipc_port_t
convert_task_name_to_port(
70 task_name_t task_name
);
71 #endif /* _KERN_IPC_TT_H_ */
72 #ifndef _IPC_IPC_PORT_H_
73 extern mach_port_name_t
ipc_port_copyout_send(
76 extern task_t
port_name_to_task(
77 mach_port_name_t name
);
78 #endif /* _IPC_IPC_PORT_H_ */
80 extern ipc_space_t
get_task_ipcspace(
83 /* Some loose-ends VM stuff */
85 extern vm_map_t kalloc_map
;
86 extern vm_size_t msg_ool_size_small
;
87 extern vm_map_t zone_map
;
89 extern void consider_machine_adjust(void);
90 extern pmap_t
get_map_pmap(vm_map_t
);
91 extern vm_map_offset_t
get_map_min(vm_map_t
);
92 extern vm_map_offset_t
get_map_max(vm_map_t
);
93 extern vm_map_size_t
get_vmmap_size(vm_map_t
);
94 extern int get_vmmap_entries(vm_map_t
);
96 extern boolean_t
coredumpok(vm_map_t map
, vm_offset_t va
);
99 * VM routines that used to be published to
100 * user space, and are now restricted to the kernel.
102 * They should eventually go away entirely -
103 * to be replaced with standard vm_map() and
104 * vm_deallocate() calls.
107 extern kern_return_t vm_upl_map
109 vm_map_t target_task
,
111 vm_address_t
*address
114 extern kern_return_t vm_upl_unmap
116 vm_map_t target_task
,
120 extern kern_return_t vm_region_object_create
122 vm_map_t target_task
,
124 ipc_port_t
*object_handle
127 extern mach_vm_offset_t
mach_get_vm_start(vm_map_t
);
128 extern mach_vm_offset_t
mach_get_vm_end(vm_map_t
);
131 * Legacy routines to get the start and end for a vm_map_t. They
132 * return them in the vm_offset_t format. So, they should only be
133 * called on maps that are the same size as the kernel map for
136 extern vm_offset_t
get_vm_start(vm_map_t
);
137 extern vm_offset_t
get_vm_end(vm_map_t
);
140 * LP64todo - map in the commpage cleanly and remove these.
142 extern void vm_map_commpage64( vm_map_t
);
143 extern void vm_map_remove_commpage( vm_map_t
);
145 extern void vm_map_commpage32(vm_map_t
);
146 extern kern_return_t
vm_map_apple_protected(
148 vm_map_offset_t start
,
149 vm_map_offset_t end
);
150 extern void apple_protect_pager_bootstrap(void);
151 extern memory_object_t
apple_protect_pager_setup(vm_object_t backing_object
);
152 extern void apple_protect_pager_map(memory_object_t mem_obj
);
153 #endif /* __i386__ */
160 extern int is_suser(void);
161 extern int bsd_read_page_cache_file(
166 struct vnode
*app_vp
,
168 vm_offset_t
*bufsize
);
169 extern int bsd_write_page_cache_file(
176 extern int prepare_profile_database(
178 extern void vnode_pager_shutdown(void);
179 extern void *upl_get_internal_page_list(
181 #ifndef _VNODE_PAGER_
182 typedef int pager_return_t
;
183 extern pager_return_t
vnode_pagein(
184 struct vnode
*, upl_t
,
185 vm_offset_t
, vm_object_offset_t
,
186 vm_size_t
, int, int *);
187 extern pager_return_t
vnode_pageout(
188 struct vnode
*, upl_t
,
189 vm_offset_t
, vm_object_offset_t
,
190 vm_size_t
, int, int *);
191 extern memory_object_t
vnode_pager_setup(
192 struct vnode
*, memory_object_t
);
193 extern vm_object_offset_t
vnode_pager_get_filesize(
195 extern kern_return_t
vnode_pager_get_pathname(
198 vm_size_t
*length_p
);
199 extern kern_return_t
vnode_pager_get_filename(
203 #endif /* _VNODE_PAGER_ */
204 extern void vnode_pager_bootstrap(void);
206 vnode_pager_data_unlock(
207 memory_object_t mem_obj
,
208 memory_object_offset_t offset
,
210 vm_prot_t desired_access
);
211 extern kern_return_t
vnode_pager_init(
213 memory_object_control_t
,
215 extern kern_return_t
vnode_pager_get_object_size(
217 memory_object_offset_t
*);
218 extern kern_return_t
vnode_pager_get_object_pathname(
219 memory_object_t mem_obj
,
221 vm_size_t
*length_p
);
222 extern kern_return_t
vnode_pager_get_object_filename(
223 memory_object_t mem_obj
,
225 extern kern_return_t
vnode_pager_data_request(
227 memory_object_offset_t
,
230 extern kern_return_t
vnode_pager_data_return(
232 memory_object_offset_t
,
234 memory_object_offset_t
*,
239 extern kern_return_t
vnode_pager_data_initialize(
241 memory_object_offset_t
,
243 extern void vnode_pager_reference(
244 memory_object_t mem_obj
);
245 extern kern_return_t
vnode_pager_synchronize(
246 memory_object_t mem_obj
,
247 memory_object_offset_t offset
,
249 vm_sync_t sync_flags
);
250 extern kern_return_t
vnode_pager_unmap(
251 memory_object_t mem_obj
);
252 extern void vnode_pager_deallocate(
254 extern kern_return_t
vnode_pager_terminate(
256 extern void vnode_pager_vrele(
258 extern void vnode_pager_release_from_cache(
260 extern void ubc_unmap(
263 extern void dp_memory_object_reference(memory_object_t
);
264 extern void dp_memory_object_deallocate(memory_object_t
);
265 #ifndef _memory_object_server_
266 extern kern_return_t
dp_memory_object_init(memory_object_t
,
267 memory_object_control_t
,
269 extern kern_return_t
dp_memory_object_terminate(memory_object_t
);
270 extern kern_return_t
dp_memory_object_data_request(memory_object_t
,
271 memory_object_offset_t
, vm_size_t
, vm_prot_t
);
272 extern kern_return_t
dp_memory_object_data_return(memory_object_t
,
273 memory_object_offset_t
,
280 extern kern_return_t
dp_memory_object_data_initialize(memory_object_t
,
281 memory_object_offset_t
,
283 extern kern_return_t
dp_memory_object_data_unlock(memory_object_t
,
284 memory_object_offset_t
,
287 extern kern_return_t
dp_memory_object_synchronize(memory_object_t
,
288 memory_object_offset_t
,
291 extern kern_return_t
dp_memory_object_unmap(memory_object_t
);
292 #endif /* _memory_object_server_ */
293 #ifndef _memory_object_default_server_
294 extern kern_return_t
default_pager_memory_object_create(
295 memory_object_default_t
,
298 #endif /* _memory_object_default_server_ */
300 extern void device_pager_reference(memory_object_t
);
301 extern void device_pager_deallocate(memory_object_t
);
302 extern kern_return_t
device_pager_init(memory_object_t
,
303 memory_object_control_t
,
305 extern kern_return_t
device_pager_terminate(memory_object_t
);
306 extern kern_return_t
device_pager_data_request(memory_object_t
,
307 memory_object_offset_t
,
310 extern kern_return_t
device_pager_data_return(memory_object_t
,
311 memory_object_offset_t
,
313 memory_object_offset_t
*,
318 extern kern_return_t
device_pager_data_initialize(memory_object_t
,
319 memory_object_offset_t
,
321 extern kern_return_t
device_pager_data_unlock(memory_object_t
,
322 memory_object_offset_t
,
325 extern kern_return_t
device_pager_synchronize(memory_object_t
,
326 memory_object_offset_t
,
329 extern kern_return_t
device_pager_unmap(memory_object_t
);
330 extern kern_return_t
device_pager_populate_object(
331 memory_object_t device
,
332 memory_object_offset_t offset
,
335 extern memory_object_t
device_pager_setup(
340 extern void device_pager_bootstrap(void);
342 extern kern_return_t
memory_object_create_named(
343 memory_object_t pager
,
344 memory_object_offset_t size
,
345 memory_object_control_t
*control
);
348 extern int macx_swapinfo(
349 memory_object_size_t
*total_p
,
350 memory_object_size_t
*avail_p
,
351 vm_size_t
*pagesize_p
,
352 boolean_t
*encrypted_p
);
354 extern void log_nx_failure(addr64_t vaddr
, vm_prot_t prot
);
356 #endif /* _VM_VM_PROTOS_H_ */
358 #endif /* XNU_KERNEL_PRIVATE */