2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
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.
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.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
59 * File: vm/vm_pageout.h
60 * Author: Avadis Tevanian, Jr.
63 * Declarations for the pageout daemon interface.
66 #ifndef _VM_VM_PAGEOUT_H_
67 #define _VM_VM_PAGEOUT_H_
71 #include <mach/mach_types.h>
72 #include <mach/boolean.h>
73 #include <mach/machine/vm_types.h>
74 #include <mach/memory_object_types.h>
76 #include <kern/kern_types.h>
77 #include <kern/lock.h>
79 extern kern_return_t
vm_map_create_upl(
81 vm_map_address_t offset
,
84 upl_page_info_array_t page_list
,
88 extern ppnum_t
upl_get_highest_page(
91 #ifdef MACH_KERNEL_PRIVATE
93 #include <vm/vm_page.h>
95 extern unsigned int vm_pageout_scan_event_counter
;
96 extern unsigned int vm_zf_count
;
97 extern unsigned int vm_zf_queue_count
;
100 * Routines exported to Mach.
102 extern void vm_pageout(void);
104 extern kern_return_t
vm_pageout_internal_start(void);
106 extern void vm_pageout_object_terminate(
109 extern void vm_pageout_cluster(
112 extern void vm_pageout_initialize_page(
115 extern void vm_pageclean_setup(
118 vm_object_t new_object
,
119 vm_object_offset_t new_offset
);
121 /* UPL exported routines and structures */
123 #define upl_lock_init(object) mutex_init(&(object)->Lock, 0)
124 #define upl_lock(object) mutex_lock(&(object)->Lock)
125 #define upl_unlock(object) mutex_unlock(&(object)->Lock)
128 /* universal page list structure */
131 decl_mutex_data(, Lock
) /* Synchronization */
134 vm_object_t src_object
; /* object derived from */
135 vm_object_offset_t offset
;
136 upl_size_t size
; /* size in bytes of the address space */
137 vm_offset_t kaddr
; /* secondary mapping in kernel */
138 vm_object_t map_object
;
139 ppnum_t highest_page
;
141 unsigned int ubc_alias1
;
142 unsigned int ubc_alias2
;
143 queue_chain_t uplq
; /* List of outstanding upls on an obj */
144 #endif /* UPL_DEBUG */
147 /* upl struct flags */
148 #define UPL_PAGE_LIST_MAPPED 0x1
149 #define UPL_KERNEL_MAPPED 0x2
150 #define UPL_CLEAR_DIRTY 0x4
151 #define UPL_COMPOSITE_LIST 0x8
152 #define UPL_INTERNAL 0x10
153 #define UPL_PAGE_SYNC_DONE 0x20
154 #define UPL_DEVICE_MEMORY 0x40
155 #define UPL_PAGEOUT 0x80
156 #define UPL_LITE 0x100
157 #define UPL_IO_WIRE 0x200
158 #define UPL_ACCESS_BLOCKED 0x400
159 #define UPL_ENCRYPTED 0x800
160 #define UPL_SHADOWED 0x1000
162 /* flags for upl_create flags parameter */
163 #define UPL_CREATE_EXTERNAL 0
164 #define UPL_CREATE_INTERNAL 0x1
165 #define UPL_CREATE_LITE 0x2
167 extern kern_return_t
vm_object_iopl_request(
169 vm_object_offset_t offset
,
172 upl_page_info_array_t user_page_list
,
173 unsigned int *page_list_count
,
176 extern kern_return_t
vm_object_super_upl_request(
178 vm_object_offset_t offset
,
180 upl_size_t super_cluster
,
182 upl_page_info_t
*user_page_list
,
183 unsigned int *page_list_count
,
186 /* should be just a regular vm_map_enter() */
187 extern kern_return_t
vm_map_enter_upl(
190 vm_map_offset_t
*dst_addr
);
192 /* should be just a regular vm_map_remove() */
193 extern kern_return_t
vm_map_remove_upl(
198 extern kern_return_t
upl_ubc_alias_set(
201 unsigned int alias2
);
202 extern int upl_ubc_alias_get(
206 #endif /* UPL_DEBUG */
208 /* wired page list structure */
209 typedef unsigned long *wpl_array_t
;
211 extern void vm_page_free_list(
212 register vm_page_t mem
);
214 extern void vm_page_free_reserve(int pages
);
216 extern void vm_pageout_throttle_down(vm_page_t page
);
217 extern void vm_pageout_throttle_up(vm_page_t page
);
222 extern void upl_encrypt(
224 upl_offset_t crypt_offset
,
225 upl_size_t crypt_size
);
226 extern void vm_page_encrypt(
228 vm_map_offset_t kernel_map_offset
);
229 extern boolean_t vm_pages_encrypted
; /* are there encrypted pages ? */
230 extern void vm_page_decrypt(
232 vm_map_offset_t kernel_map_offset
);
233 extern kern_return_t
vm_paging_map_object(
234 vm_map_offset_t
*address
,
237 vm_object_offset_t offset
,
239 boolean_t can_unlock_object
);
240 extern void vm_paging_unmap_object(
242 vm_map_offset_t start
,
243 vm_map_offset_t end
);
244 decl_simple_lock_data(extern, vm_paging_lock
)
247 * Backing store throttle when BS is exhausted
249 extern unsigned int vm_backing_store_low
;
251 #endif /* MACH_KERNEL_PRIVATE */
253 extern void vm_countdirtypages(void);
255 extern void vm_backing_store_disable(
258 extern kern_return_t
upl_transpose(
262 #endif /* KERNEL_PRIVATE */
264 #endif /* _VM_VM_PAGEOUT_H_ */