]>
Commit | Line | Data |
---|---|---|
91447636 | 1 | /* |
2d21ac55 | 2 | * Copyright (c) 2004-2007 Apple Inc. All rights reserved. |
91447636 | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
91447636 | 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@ |
91447636 A |
27 | */ |
28 | ||
29 | #ifdef XNU_KERNEL_PRIVATE | |
30 | ||
31 | #ifndef _VM_VM_PROTOS_H_ | |
32 | #define _VM_VM_PROTOS_H_ | |
33 | ||
34 | #include <mach/mach_types.h> | |
35 | #include <kern/kern_types.h> | |
36 | ||
39037602 A |
37 | #ifdef __cplusplus |
38 | extern "C" { | |
39 | #endif | |
40 | ||
91447636 A |
41 | /* |
42 | * This file contains various type definitions and routine prototypes | |
43 | * that are needed to avoid compilation warnings for VM code (in osfmk, | |
44 | * default_pager and bsd). | |
45 | * Most of these should eventually go into more appropriate header files. | |
46 | * | |
47 | * Include it after all other header files since it doesn't include any | |
48 | * type definitions and it works around some conflicts with other header | |
49 | * files. | |
50 | */ | |
51 | ||
52 | /* | |
53 | * iokit | |
54 | */ | |
55 | extern kern_return_t device_data_action( | |
b0d623f7 | 56 | uintptr_t device_handle, |
91447636 A |
57 | ipc_port_t device_pager, |
58 | vm_prot_t protection, | |
59 | vm_object_offset_t offset, | |
60 | vm_size_t size); | |
61 | ||
62 | extern kern_return_t device_close( | |
b0d623f7 | 63 | uintptr_t device_handle); |
91447636 | 64 | |
39037602 | 65 | extern boolean_t vm_swap_files_pinned(void); |
91447636 A |
66 | |
67 | /* | |
68 | * osfmk | |
69 | */ | |
91447636 A |
70 | #ifndef _IPC_IPC_PORT_H_ |
71 | extern mach_port_name_t ipc_port_copyout_send( | |
72 | ipc_port_t sright, | |
73 | ipc_space_t space); | |
74 | extern task_t port_name_to_task( | |
75 | mach_port_name_t name); | |
813fb2f6 A |
76 | extern task_t port_name_to_task_inspect( |
77 | mach_port_name_t name); | |
5ba3f43e A |
78 | extern void ipc_port_release_send( |
79 | ipc_port_t port); | |
91447636 A |
80 | #endif /* _IPC_IPC_PORT_H_ */ |
81 | ||
82 | extern ipc_space_t get_task_ipcspace( | |
83 | task_t t); | |
84 | ||
39037602 | 85 | #if CONFIG_MEMORYSTATUS |
3e170ce0 | 86 | extern int max_task_footprint_mb; /* Per-task limit on physical memory consumption in megabytes */ |
39037602 | 87 | #endif /* CONFIG_MEMORYSTATUS */ |
3e170ce0 | 88 | |
91447636 A |
89 | /* Some loose-ends VM stuff */ |
90 | ||
91 | extern vm_map_t kalloc_map; | |
92 | extern vm_size_t msg_ool_size_small; | |
93 | extern vm_map_t zone_map; | |
94 | ||
95 | extern void consider_machine_adjust(void); | |
91447636 A |
96 | extern vm_map_offset_t get_map_min(vm_map_t); |
97 | extern vm_map_offset_t get_map_max(vm_map_t); | |
98 | extern vm_map_size_t get_vmmap_size(vm_map_t); | |
39037602 | 99 | #if CONFIG_COREDUMP |
91447636 | 100 | extern int get_vmmap_entries(vm_map_t); |
39037602 A |
101 | #endif |
102 | extern int get_map_nentries(vm_map_t); | |
91447636 | 103 | |
3e170ce0 | 104 | extern vm_map_offset_t vm_map_page_mask(vm_map_t); |
39236c6e | 105 | |
5ba3f43e A |
106 | extern kern_return_t vm_map_purgable_control( |
107 | vm_map_t map, | |
108 | vm_map_offset_t address, | |
109 | vm_purgable_t control, | |
110 | int *state); | |
111 | ||
a39ff7e2 A |
112 | extern kern_return_t |
113 | vnode_pager_get_object_vnode( | |
114 | memory_object_t mem_obj, | |
115 | uintptr_t * vnodeaddr, | |
116 | uint32_t * vid); | |
117 | ||
39037602 | 118 | #if CONFIG_COREDUMP |
91447636 | 119 | extern boolean_t coredumpok(vm_map_t map, vm_offset_t va); |
39037602 | 120 | #endif |
91447636 A |
121 | |
122 | /* | |
123 | * VM routines that used to be published to | |
124 | * user space, and are now restricted to the kernel. | |
125 | * | |
126 | * They should eventually go away entirely - | |
127 | * to be replaced with standard vm_map() and | |
128 | * vm_deallocate() calls. | |
129 | */ | |
130 | ||
131 | extern kern_return_t vm_upl_map | |
132 | ( | |
133 | vm_map_t target_task, | |
134 | upl_t upl, | |
135 | vm_address_t *address | |
136 | ); | |
137 | ||
138 | extern kern_return_t vm_upl_unmap | |
139 | ( | |
140 | vm_map_t target_task, | |
141 | upl_t upl | |
142 | ); | |
143 | ||
144 | extern kern_return_t vm_region_object_create | |
145 | ( | |
146 | vm_map_t target_task, | |
147 | vm_size_t size, | |
148 | ipc_port_t *object_handle | |
149 | ); | |
150 | ||
151 | extern mach_vm_offset_t mach_get_vm_start(vm_map_t); | |
152 | extern mach_vm_offset_t mach_get_vm_end(vm_map_t); | |
153 | ||
593a1d5f | 154 | #if CONFIG_CODE_DECRYPTION |
3e170ce0 | 155 | #define VM_MAP_DEBUG_APPLE_PROTECT MACH_ASSERT |
39037602 A |
156 | #if VM_MAP_DEBUG_APPLE_PROTECT |
157 | extern int vm_map_debug_apple_protect; | |
158 | #endif /* VM_MAP_DEBUG_APPLE_PROTECT */ | |
593a1d5f | 159 | struct pager_crypt_info; |
0c530ab8 | 160 | extern kern_return_t vm_map_apple_protected( |
3e170ce0 A |
161 | vm_map_t map, |
162 | vm_map_offset_t start, | |
163 | vm_map_offset_t end, | |
164 | vm_object_offset_t crypto_backing_offset, | |
165 | struct pager_crypt_info *crypt_info); | |
0c530ab8 | 166 | extern void apple_protect_pager_bootstrap(void); |
3e170ce0 A |
167 | extern memory_object_t apple_protect_pager_setup( |
168 | vm_object_t backing_object, | |
169 | vm_object_offset_t backing_offset, | |
170 | vm_object_offset_t crypto_backing_offset, | |
171 | struct pager_crypt_info *crypt_info, | |
172 | vm_object_offset_t crypto_start, | |
173 | vm_object_offset_t crypto_end); | |
593a1d5f | 174 | #endif /* CONFIG_CODE_DECRYPTION */ |
0c530ab8 | 175 | |
d9a64523 A |
176 | struct vm_shared_region_slide_info; |
177 | extern kern_return_t vm_map_shared_region( | |
178 | vm_map_t map, | |
179 | vm_map_offset_t start, | |
180 | vm_map_offset_t end, | |
181 | vm_object_offset_t backing_offset, | |
182 | struct vm_shared_region_slide_info *slide_info); | |
183 | extern void shared_region_pager_bootstrap(void); | |
184 | extern memory_object_t shared_region_pager_setup( | |
185 | vm_object_t backing_object, | |
186 | vm_object_offset_t backing_offset, | |
187 | struct vm_shared_region_slide_info *slide_info); | |
188 | ||
b0d623f7 A |
189 | struct vnode; |
190 | extern void swapfile_pager_bootstrap(void); | |
191 | extern memory_object_t swapfile_pager_setup(struct vnode *vp); | |
192 | extern memory_object_control_t swapfile_pager_control(memory_object_t mem_obj); | |
193 | ||
3e170ce0 A |
194 | #if __arm64__ || ((__ARM_ARCH_7K__ >= 2) && defined(PLATFORM_WatchOS)) |
195 | #define SIXTEENK_PAGE_SIZE 0x4000 | |
196 | #define SIXTEENK_PAGE_MASK 0x3FFF | |
197 | #define SIXTEENK_PAGE_SHIFT 14 | |
198 | #endif /* __arm64__ || ((__ARM_ARCH_7K__ >= 2) && defined(PLATFORM_WatchOS)) */ | |
199 | ||
5ba3f43e A |
200 | #if __arm64__ |
201 | #define FOURK_PAGE_SIZE 0x1000 | |
202 | #define FOURK_PAGE_MASK 0xFFF | |
203 | #define FOURK_PAGE_SHIFT 12 | |
204 | ||
205 | extern unsigned int page_shift_user32; | |
206 | ||
207 | #define VM_MAP_DEBUG_FOURK MACH_ASSERT | |
208 | #if VM_MAP_DEBUG_FOURK | |
209 | extern int vm_map_debug_fourk; | |
210 | #endif /* VM_MAP_DEBUG_FOURK */ | |
211 | extern void fourk_pager_bootstrap(void); | |
212 | extern memory_object_t fourk_pager_create(void); | |
213 | extern vm_object_t fourk_pager_to_vm_object(memory_object_t mem_obj); | |
214 | extern kern_return_t fourk_pager_populate( | |
215 | memory_object_t mem_obj, | |
216 | boolean_t overwrite, | |
217 | int index, | |
218 | vm_object_t new_backing_object, | |
219 | vm_object_offset_t new_backing_offset, | |
220 | vm_object_t *old_backing_object, | |
221 | vm_object_offset_t *old_backing_offset); | |
222 | #endif /* __arm64__ */ | |
91447636 A |
223 | |
224 | /* | |
225 | * bsd | |
226 | */ | |
227 | struct vnode; | |
91447636 A |
228 | extern void *upl_get_internal_page_list( |
229 | upl_t upl); | |
b0d623f7 | 230 | |
fe8ab488 | 231 | extern void vnode_setswapmount(struct vnode *); |
3e170ce0 | 232 | extern int64_t vnode_getswappin_avail(struct vnode *); |
fe8ab488 | 233 | |
d9a64523 A |
234 | extern void vnode_pager_was_dirtied( |
235 | struct vnode *, | |
236 | vm_object_offset_t, | |
237 | vm_object_offset_t); | |
238 | ||
91447636 A |
239 | typedef int pager_return_t; |
240 | extern pager_return_t vnode_pagein( | |
241 | struct vnode *, upl_t, | |
b0d623f7 A |
242 | upl_offset_t, vm_object_offset_t, |
243 | upl_size_t, int, int *); | |
91447636 A |
244 | extern pager_return_t vnode_pageout( |
245 | struct vnode *, upl_t, | |
b0d623f7 A |
246 | upl_offset_t, vm_object_offset_t, |
247 | upl_size_t, int, int *); | |
6d2010ae | 248 | extern uint32_t vnode_trim (struct vnode *, int64_t offset, unsigned long len); |
91447636 A |
249 | extern memory_object_t vnode_pager_setup( |
250 | struct vnode *, memory_object_t); | |
251 | extern vm_object_offset_t vnode_pager_get_filesize( | |
252 | struct vnode *); | |
b0d623f7 A |
253 | extern uint32_t vnode_pager_isinuse( |
254 | struct vnode *); | |
6d2010ae A |
255 | extern boolean_t vnode_pager_isSSD( |
256 | struct vnode *); | |
257 | extern void vnode_pager_throttle( | |
258 | void); | |
39236c6e | 259 | extern uint32_t vnode_pager_return_throttle_io_limit( |
b0d623f7 | 260 | struct vnode *, |
39236c6e | 261 | uint32_t *); |
15129b1c | 262 | extern kern_return_t vnode_pager_get_name( |
0c530ab8 A |
263 | struct vnode *vp, |
264 | char *pathname, | |
15129b1c A |
265 | vm_size_t pathname_len, |
266 | char *filename, | |
267 | vm_size_t filename_len, | |
268 | boolean_t *truncated_path_p); | |
269 | struct timespec; | |
270 | extern kern_return_t vnode_pager_get_mtime( | |
0c530ab8 | 271 | struct vnode *vp, |
15129b1c A |
272 | struct timespec *mtime, |
273 | struct timespec *cs_mtime); | |
2d21ac55 A |
274 | extern kern_return_t vnode_pager_get_cs_blobs( |
275 | struct vnode *vp, | |
276 | void **blobs); | |
6d2010ae | 277 | |
fe8ab488 A |
278 | #if CONFIG_IOSCHED |
279 | void vnode_pager_issue_reprioritize_io( | |
280 | struct vnode *devvp, | |
281 | uint64_t blkno, | |
282 | uint32_t len, | |
283 | int priority); | |
284 | #endif | |
285 | ||
6d2010ae A |
286 | #if CHECK_CS_VALIDATION_BITMAP |
287 | /* used by the vnode_pager_cs_validation_bitmap routine*/ | |
288 | #define CS_BITMAP_SET 1 | |
289 | #define CS_BITMAP_CLEAR 2 | |
290 | #define CS_BITMAP_CHECK 3 | |
291 | ||
292 | #endif /* CHECK_CS_VALIDATION_BITMAP */ | |
b0d623f7 | 293 | |
39236c6e | 294 | extern void vnode_pager_bootstrap(void); |
91447636 A |
295 | extern kern_return_t |
296 | vnode_pager_data_unlock( | |
297 | memory_object_t mem_obj, | |
298 | memory_object_offset_t offset, | |
b0d623f7 | 299 | memory_object_size_t size, |
91447636 A |
300 | vm_prot_t desired_access); |
301 | extern kern_return_t vnode_pager_init( | |
302 | memory_object_t, | |
303 | memory_object_control_t, | |
b0d623f7 | 304 | memory_object_cluster_size_t); |
91447636 A |
305 | extern kern_return_t vnode_pager_get_object_size( |
306 | memory_object_t, | |
307 | memory_object_offset_t *); | |
fe8ab488 A |
308 | |
309 | #if CONFIG_IOSCHED | |
310 | extern kern_return_t vnode_pager_get_object_devvp( | |
311 | memory_object_t, | |
312 | uintptr_t *); | |
313 | #endif | |
314 | ||
d9a64523 A |
315 | extern void vnode_pager_dirtied( |
316 | memory_object_t, | |
317 | vm_object_offset_t, | |
318 | vm_object_offset_t); | |
b0d623f7 A |
319 | extern kern_return_t vnode_pager_get_isinuse( |
320 | memory_object_t, | |
321 | uint32_t *); | |
6d2010ae A |
322 | extern kern_return_t vnode_pager_get_isSSD( |
323 | memory_object_t, | |
324 | boolean_t *); | |
39236c6e | 325 | extern kern_return_t vnode_pager_get_throttle_io_limit( |
b0d623f7 | 326 | memory_object_t, |
39236c6e | 327 | uint32_t *); |
15129b1c | 328 | extern kern_return_t vnode_pager_get_object_name( |
0c530ab8 A |
329 | memory_object_t mem_obj, |
330 | char *pathname, | |
15129b1c A |
331 | vm_size_t pathname_len, |
332 | char *filename, | |
333 | vm_size_t filename_len, | |
334 | boolean_t *truncated_path_p); | |
335 | extern kern_return_t vnode_pager_get_object_mtime( | |
0c530ab8 | 336 | memory_object_t mem_obj, |
15129b1c A |
337 | struct timespec *mtime, |
338 | struct timespec *cs_mtime); | |
6d2010ae A |
339 | |
340 | #if CHECK_CS_VALIDATION_BITMAP | |
341 | extern kern_return_t vnode_pager_cs_check_validation_bitmap( | |
342 | memory_object_t mem_obj, | |
343 | memory_object_offset_t offset, | |
344 | int optype); | |
345 | #endif /*CHECK_CS_VALIDATION_BITMAP*/ | |
346 | ||
347 | extern kern_return_t ubc_cs_check_validation_bitmap ( | |
348 | struct vnode *vp, | |
349 | memory_object_offset_t offset, | |
350 | int optype); | |
351 | ||
91447636 A |
352 | extern kern_return_t vnode_pager_data_request( |
353 | memory_object_t, | |
2d21ac55 | 354 | memory_object_offset_t, |
b0d623f7 | 355 | memory_object_cluster_size_t, |
2d21ac55 A |
356 | vm_prot_t, |
357 | memory_object_fault_info_t); | |
91447636 A |
358 | extern kern_return_t vnode_pager_data_return( |
359 | memory_object_t, | |
360 | memory_object_offset_t, | |
b0d623f7 | 361 | memory_object_cluster_size_t, |
91447636 A |
362 | memory_object_offset_t *, |
363 | int *, | |
364 | boolean_t, | |
365 | boolean_t, | |
366 | int); | |
367 | extern kern_return_t vnode_pager_data_initialize( | |
368 | memory_object_t, | |
369 | memory_object_offset_t, | |
b0d623f7 | 370 | memory_object_cluster_size_t); |
91447636 A |
371 | extern void vnode_pager_reference( |
372 | memory_object_t mem_obj); | |
373 | extern kern_return_t vnode_pager_synchronize( | |
374 | memory_object_t mem_obj, | |
375 | memory_object_offset_t offset, | |
b0d623f7 | 376 | memory_object_size_t length, |
91447636 | 377 | vm_sync_t sync_flags); |
593a1d5f A |
378 | extern kern_return_t vnode_pager_map( |
379 | memory_object_t mem_obj, | |
380 | vm_prot_t prot); | |
381 | extern kern_return_t vnode_pager_last_unmap( | |
91447636 A |
382 | memory_object_t mem_obj); |
383 | extern void vnode_pager_deallocate( | |
384 | memory_object_t); | |
385 | extern kern_return_t vnode_pager_terminate( | |
386 | memory_object_t); | |
387 | extern void vnode_pager_vrele( | |
388 | struct vnode *vp); | |
39037602 A |
389 | extern struct vnode *vnode_pager_lookup_vnode( |
390 | memory_object_t); | |
391 | ||
593a1d5f A |
392 | extern int ubc_map( |
393 | struct vnode *vp, | |
394 | int flags); | |
91447636 A |
395 | extern void ubc_unmap( |
396 | struct vnode *vp); | |
397 | ||
b0d623f7 A |
398 | struct vm_map_entry; |
399 | extern struct vm_object *find_vnode_object(struct vm_map_entry *entry); | |
400 | ||
91447636 A |
401 | extern void device_pager_reference(memory_object_t); |
402 | extern void device_pager_deallocate(memory_object_t); | |
403 | extern kern_return_t device_pager_init(memory_object_t, | |
404 | memory_object_control_t, | |
b0d623f7 | 405 | memory_object_cluster_size_t); |
91447636 A |
406 | extern kern_return_t device_pager_terminate(memory_object_t); |
407 | extern kern_return_t device_pager_data_request(memory_object_t, | |
408 | memory_object_offset_t, | |
b0d623f7 | 409 | memory_object_cluster_size_t, |
2d21ac55 A |
410 | vm_prot_t, |
411 | memory_object_fault_info_t); | |
91447636 A |
412 | extern kern_return_t device_pager_data_return(memory_object_t, |
413 | memory_object_offset_t, | |
b0d623f7 | 414 | memory_object_cluster_size_t, |
0c530ab8 A |
415 | memory_object_offset_t *, |
416 | int *, | |
91447636 A |
417 | boolean_t, |
418 | boolean_t, | |
419 | int); | |
420 | extern kern_return_t device_pager_data_initialize(memory_object_t, | |
421 | memory_object_offset_t, | |
b0d623f7 | 422 | memory_object_cluster_size_t); |
91447636 A |
423 | extern kern_return_t device_pager_data_unlock(memory_object_t, |
424 | memory_object_offset_t, | |
b0d623f7 | 425 | memory_object_size_t, |
91447636 A |
426 | vm_prot_t); |
427 | extern kern_return_t device_pager_synchronize(memory_object_t, | |
428 | memory_object_offset_t, | |
b0d623f7 | 429 | memory_object_size_t, |
91447636 | 430 | vm_sync_t); |
593a1d5f A |
431 | extern kern_return_t device_pager_map(memory_object_t, vm_prot_t); |
432 | extern kern_return_t device_pager_last_unmap(memory_object_t); | |
91447636 A |
433 | extern kern_return_t device_pager_populate_object( |
434 | memory_object_t device, | |
435 | memory_object_offset_t offset, | |
436 | ppnum_t page_num, | |
437 | vm_size_t size); | |
438 | extern memory_object_t device_pager_setup( | |
439 | memory_object_t, | |
b0d623f7 | 440 | uintptr_t, |
91447636 A |
441 | vm_size_t, |
442 | int); | |
39236c6e | 443 | extern void device_pager_bootstrap(void); |
39037602 | 444 | extern boolean_t is_device_pager_ops(const struct memory_object_pager_ops *pager_ops); |
39236c6e A |
445 | |
446 | extern kern_return_t pager_map_to_phys_contiguous( | |
447 | memory_object_control_t object, | |
448 | memory_object_offset_t offset, | |
449 | addr64_t base_vaddr, | |
450 | vm_size_t size); | |
91447636 A |
451 | |
452 | extern kern_return_t memory_object_create_named( | |
453 | memory_object_t pager, | |
454 | memory_object_offset_t size, | |
455 | memory_object_control_t *control); | |
456 | ||
b0d623f7 A |
457 | struct macx_triggers_args; |
458 | extern int mach_macx_triggers( | |
459 | struct macx_triggers_args *args); | |
91447636 A |
460 | |
461 | extern int macx_swapinfo( | |
462 | memory_object_size_t *total_p, | |
463 | memory_object_size_t *avail_p, | |
464 | vm_size_t *pagesize_p, | |
465 | boolean_t *encrypted_p); | |
466 | ||
2d21ac55 | 467 | extern void log_stack_execution_failure(addr64_t vaddr, vm_prot_t prot); |
39037602 A |
468 | extern void log_unnest_badness( |
469 | vm_map_t map, | |
470 | vm_map_offset_t start_unnest, | |
471 | vm_map_offset_t end_unnest, | |
472 | boolean_t is_nested_map, | |
473 | vm_map_offset_t lowest_unnestable_addr); | |
b0d623f7 | 474 | |
39236c6e | 475 | struct proc; |
b0d623f7 | 476 | extern int cs_allow_invalid(struct proc *p); |
39037602 | 477 | extern int cs_invalid_page(addr64_t vaddr, boolean_t *cs_killed); |
c18c124e A |
478 | |
479 | #define CS_VALIDATE_TAINTED 0x00000001 | |
480 | #define CS_VALIDATE_NX 0x00000002 | |
39037602 A |
481 | extern boolean_t cs_validate_range(struct vnode *vp, |
482 | memory_object_t pager, | |
483 | memory_object_offset_t offset, | |
484 | const void *data, | |
485 | vm_size_t size, | |
486 | unsigned *result); | |
d9a64523 A |
487 | #if PMAP_CS |
488 | extern kern_return_t cs_associate_blob_with_mapping( | |
489 | void *pmap, | |
490 | vm_map_offset_t start, | |
491 | vm_map_size_t size, | |
492 | vm_object_offset_t offset, | |
493 | void *blobs_p); | |
494 | #endif /* PMAP_CS */ | |
2d21ac55 | 495 | |
5ba3f43e A |
496 | extern kern_return_t memory_entry_purgeable_control_internal( |
497 | ipc_port_t entry_port, | |
498 | vm_purgable_t control, | |
499 | int *state); | |
500 | ||
d9a64523 A |
501 | extern kern_return_t memory_entry_access_tracking_internal( |
502 | ipc_port_t entry_port, | |
503 | int *access_tracking, | |
504 | uint32_t *access_tracking_reads, | |
505 | uint32_t *access_tracking_writes); | |
506 | ||
2d21ac55 A |
507 | extern kern_return_t mach_memory_entry_purgable_control( |
508 | ipc_port_t entry_port, | |
509 | vm_purgable_t control, | |
510 | int *state); | |
511 | ||
39236c6e A |
512 | extern kern_return_t mach_memory_entry_get_page_counts( |
513 | ipc_port_t entry_port, | |
514 | unsigned int *resident_page_count, | |
515 | unsigned int *dirty_page_count); | |
516 | ||
2d21ac55 A |
517 | extern kern_return_t mach_memory_entry_page_op( |
518 | ipc_port_t entry_port, | |
519 | vm_object_offset_t offset, | |
520 | int ops, | |
521 | ppnum_t *phys_entry, | |
522 | int *flags); | |
523 | ||
524 | extern kern_return_t mach_memory_entry_range_op( | |
525 | ipc_port_t entry_port, | |
526 | vm_object_offset_t offset_beg, | |
527 | vm_object_offset_t offset_end, | |
528 | int ops, | |
529 | int *range); | |
530 | ||
531 | extern void mach_memory_entry_port_release(ipc_port_t port); | |
532 | extern void mach_destroy_memory_entry(ipc_port_t port); | |
533 | extern kern_return_t mach_memory_entry_allocate( | |
534 | struct vm_named_entry **user_entry_p, | |
535 | ipc_port_t *user_handle_p); | |
536 | ||
537 | extern void vm_paging_map_init(void); | |
0c530ab8 | 538 | |
b0d623f7 A |
539 | extern int macx_backing_store_compaction(int flags); |
540 | extern unsigned int mach_vm_ctl_page_free_wanted(void); | |
541 | ||
fe8ab488 | 542 | extern int no_paging_space_action(void); |
6d2010ae A |
543 | |
544 | #define VM_TOGGLE_CLEAR 0 | |
545 | #define VM_TOGGLE_SET 1 | |
546 | #define VM_TOGGLE_GETVALUE 999 | |
547 | int vm_toggle_entry_reuse(int, int*); | |
39236c6e A |
548 | |
549 | #define SWAP_WRITE 0x00000000 /* Write buffer (pseudo flag). */ | |
550 | #define SWAP_READ 0x00000001 /* Read buffer. */ | |
551 | #define SWAP_ASYNC 0x00000002 /* Start I/O, do not wait. */ | |
552 | ||
553 | extern void vm_compressor_pager_init(void); | |
554 | extern kern_return_t compressor_memory_object_create( | |
22ba694c | 555 | memory_object_size_t, |
39236c6e A |
556 | memory_object_t *); |
557 | ||
3e170ce0 | 558 | extern boolean_t vm_compressor_low_on_space(void); |
5ba3f43e | 559 | extern boolean_t vm_compressor_out_of_space(void); |
3e170ce0 | 560 | extern int vm_swap_low_on_space(void); |
d190cdc3 | 561 | void do_fastwake_warmup_all(void); |
fe8ab488 A |
562 | #if CONFIG_JETSAM |
563 | extern int proc_get_memstat_priority(struct proc*, boolean_t); | |
564 | #endif /* CONFIG_JETSAM */ | |
565 | ||
39236c6e A |
566 | /* the object purger. purges the next eligible object from memory. */ |
567 | /* returns TRUE if an object was purged, otherwise FALSE. */ | |
568 | boolean_t vm_purgeable_object_purge_one_unlocked(int force_purge_below_group); | |
fe8ab488 | 569 | void vm_purgeable_disown(task_t task); |
d9a64523 A |
570 | void vm_purgeable_nonvolatile_owner_update(task_t owner, |
571 | int delta); | |
572 | void vm_purgeable_volatile_owner_update(task_t owner, | |
573 | int delta); | |
574 | ||
39236c6e A |
575 | |
576 | struct trim_list { | |
577 | uint64_t tl_offset; | |
578 | uint64_t tl_length; | |
579 | struct trim_list *tl_next; | |
580 | }; | |
581 | ||
fe8ab488 A |
582 | u_int32_t vnode_trim_list(struct vnode *vp, struct trim_list *tl, boolean_t route_only); |
583 | ||
584 | #define MAX_SWAPFILENAME_LEN 1024 | |
585 | #define SWAPFILENAME_INDEX_LEN 2 /* Doesn't include the terminating NULL character */ | |
586 | ||
587 | extern char swapfilename[MAX_SWAPFILENAME_LEN + 1]; | |
588 | ||
589 | struct vm_counters { | |
590 | unsigned int do_collapse_compressor; | |
591 | unsigned int do_collapse_compressor_pages; | |
592 | unsigned int do_collapse_terminate; | |
593 | unsigned int do_collapse_terminate_failure; | |
594 | unsigned int should_cow_but_wired; | |
595 | unsigned int create_upl_extra_cow; | |
596 | unsigned int create_upl_extra_cow_pages; | |
597 | unsigned int create_upl_lookup_failure_write; | |
598 | unsigned int create_upl_lookup_failure_copy; | |
599 | }; | |
600 | extern struct vm_counters vm_counters; | |
39236c6e | 601 | |
39037602 A |
602 | #if CONFIG_SECLUDED_MEMORY |
603 | struct vm_page_secluded_data { | |
604 | int eligible_for_secluded; | |
605 | int grab_success_free; | |
606 | int grab_success_other; | |
607 | int grab_failure_locked; | |
608 | int grab_failure_state; | |
609 | int grab_failure_dirty; | |
610 | int grab_for_iokit; | |
611 | int grab_for_iokit_success; | |
612 | }; | |
613 | extern struct vm_page_secluded_data vm_page_secluded; | |
614 | ||
615 | extern int num_tasks_can_use_secluded_mem; | |
616 | ||
617 | /* boot-args */ | |
618 | extern int secluded_for_apps; | |
619 | extern int secluded_for_iokit; | |
620 | extern int secluded_for_filecache; | |
621 | #if 11 | |
622 | extern int secluded_for_fbdp; | |
623 | #endif | |
624 | ||
39037602 A |
625 | extern void memory_object_mark_eligible_for_secluded( |
626 | memory_object_control_t control, | |
627 | boolean_t eligible_for_secluded); | |
628 | ||
629 | #endif /* CONFIG_SECLUDED_MEMORY */ | |
630 | ||
5ba3f43e A |
631 | #define MAX_PAGE_RANGE_QUERY (1ULL * 1024 * 1024 * 1024) /* 1 GB */ |
632 | ||
9d749ea3 A |
633 | extern kern_return_t mach_make_memory_entry_internal( |
634 | vm_map_t target_map, | |
635 | memory_object_size_t *size, | |
636 | memory_object_offset_t offset, | |
637 | vm_prot_t permission, | |
638 | ipc_port_t *object_handle, | |
639 | ipc_port_t parent_handle); | |
640 | ||
d9a64523 A |
641 | #define roundup(x, y) ((((x) % (y)) == 0) ? \ |
642 | (x) : ((x) + ((y) - ((x) % (y))))) | |
643 | ||
39037602 A |
644 | #ifdef __cplusplus |
645 | } | |
646 | #endif | |
647 | ||
d9a64523 A |
648 | /* |
649 | * Flags for the VM swapper/reclaimer. | |
650 | * Used by vm_swap_consider_defragment() | |
651 | * to force defrag/reclaim by the swap | |
652 | * GC thread. | |
653 | */ | |
654 | #define VM_SWAP_FLAGS_NONE 0 | |
655 | #define VM_SWAP_FLAGS_FORCE_DEFRAG 1 | |
656 | #define VM_SWAP_FLAGS_FORCE_RECLAIM 2 | |
657 | ||
91447636 A |
658 | #endif /* _VM_VM_PROTOS_H_ */ |
659 | ||
660 | #endif /* XNU_KERNEL_PRIVATE */ |