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
;
99 * Routines exported to Mach.
101 extern void vm_pageout(void);
103 extern vm_object_t
vm_pageout_object_allocate(
106 vm_object_offset_t offset
);
108 extern void vm_pageout_object_terminate(
111 extern vm_page_t
vm_pageout_setup(
113 vm_object_t new_object
,
114 vm_object_offset_t new_offset
);
116 extern void vm_pageout_cluster(
119 extern void vm_pageout_initialize_page(
122 extern void vm_pageclean_setup(
125 vm_object_t new_object
,
126 vm_object_offset_t new_offset
);
128 extern void vm_pageclean_copy(
131 vm_object_t new_object
,
132 vm_object_offset_t new_offset
);
134 /* UPL exported routines and structures */
136 #define upl_lock_init(object) mutex_init(&(object)->Lock, 0)
137 #define upl_lock(object) mutex_lock(&(object)->Lock)
138 #define upl_unlock(object) mutex_unlock(&(object)->Lock)
141 /* universal page list structure */
144 decl_mutex_data(, Lock
) /* Synchronization */
147 vm_object_t src_object
; /* object derived from */
148 vm_object_offset_t offset
;
149 upl_size_t size
; /* size in bytes of the address space */
150 vm_offset_t kaddr
; /* secondary mapping in kernel */
151 vm_object_t map_object
;
152 ppnum_t highest_page
;
154 unsigned int ubc_alias1
;
155 unsigned int ubc_alias2
;
156 queue_chain_t uplq
; /* List of outstanding upls on an obj */
157 #endif /* UPL_DEBUG */
160 /* upl struct flags */
161 #define UPL_PAGE_LIST_MAPPED 0x1
162 #define UPL_KERNEL_MAPPED 0x2
163 #define UPL_CLEAR_DIRTY 0x4
164 #define UPL_COMPOSITE_LIST 0x8
165 #define UPL_INTERNAL 0x10
166 #define UPL_PAGE_SYNC_DONE 0x20
167 #define UPL_DEVICE_MEMORY 0x40
168 #define UPL_PAGEOUT 0x80
169 #define UPL_LITE 0x100
170 #define UPL_IO_WIRE 0x200
171 #define UPL_ACCESS_BLOCKED 0x400
172 #define UPL_ENCRYPTED 0x800
175 /* flags for upl_create flags parameter */
176 #define UPL_CREATE_EXTERNAL 0
177 #define UPL_CREATE_INTERNAL 0x1
178 #define UPL_CREATE_LITE 0x2
180 extern kern_return_t
vm_object_iopl_request(
182 vm_object_offset_t offset
,
185 upl_page_info_array_t user_page_list
,
186 unsigned int *page_list_count
,
189 extern kern_return_t
vm_object_super_upl_request(
191 vm_object_offset_t offset
,
193 upl_size_t super_cluster
,
195 upl_page_info_t
*user_page_list
,
196 unsigned int *page_list_count
,
199 /* should be just a regular vm_map_enter() */
200 extern kern_return_t
vm_map_enter_upl(
203 vm_map_offset_t
*dst_addr
);
205 /* should be just a regular vm_map_remove() */
206 extern kern_return_t
vm_map_remove_upl(
211 extern kern_return_t
upl_ubc_alias_set(
214 unsigned int alias2
);
215 extern int upl_ubc_alias_get(
219 #endif /* UPL_DEBUG */
221 /* wired page list structure */
222 typedef unsigned long *wpl_array_t
;
224 extern void vm_page_free_list(
225 register vm_page_t mem
);
227 extern void vm_page_free_reserve(int pages
);
229 extern void vm_pageout_throttle_down(vm_page_t page
);
230 extern void vm_pageout_throttle_up(vm_page_t page
);
235 extern void upl_encrypt(
237 upl_offset_t crypt_offset
,
238 upl_size_t crypt_size
);
239 extern void vm_page_encrypt(
241 vm_map_offset_t kernel_map_offset
);
242 extern boolean_t vm_pages_encrypted
; /* are there encrypted pages ? */
243 extern void vm_page_decrypt(
245 vm_map_offset_t kernel_map_offset
);
246 extern kern_return_t
vm_paging_map_object(
247 vm_map_offset_t
*address
,
250 vm_object_offset_t offset
,
251 vm_map_size_t
*size
);
252 extern void vm_paging_unmap_object(
254 vm_map_offset_t start
,
255 vm_map_offset_t end
);
256 decl_simple_lock_data(extern, vm_paging_lock
)
259 * Backing store throttle when BS is exhausted
261 extern unsigned int vm_backing_store_low
;
263 #endif /* MACH_KERNEL_PRIVATE */
265 extern void vm_countdirtypages(void);
267 extern void vm_backing_store_disable(
270 extern kern_return_t
upl_transpose(
274 #endif /* KERNEL_PRIVATE */
276 #endif /* _VM_VM_PAGEOUT_H_ */