2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
56 * File: vm/vm_pageout.h
57 * Author: Avadis Tevanian, Jr.
60 * Declarations for the pageout daemon interface.
63 #ifndef _VM_VM_PAGEOUT_H_
64 #define _VM_VM_PAGEOUT_H_
66 #include <mach/boolean.h>
67 #include <mach/machine/vm_types.h>
68 #include <vm/vm_object.h>
69 #include <vm/vm_page.h>
74 extern unsigned int vm_pageout_scan_event_counter
;
75 extern unsigned int vm_zf_count
;
78 * The following ifdef only exists because XMM must (currently)
79 * be given a page at a time. This should be removed
82 #define DATA_WRITE_MAX 16
83 #define POINTER_T(copy) (pointer_t)(copy)
88 extern void vm_pageout(void);
90 extern vm_object_t
vm_pageout_object_allocate(
93 vm_object_offset_t offset
);
95 extern void vm_pageout_object_terminate(
98 extern vm_page_t
vm_pageout_setup(
100 vm_object_t new_object
,
101 vm_object_offset_t new_offset
);
103 extern void vm_pageout_cluster(
106 extern void vm_pageout_initialize_page(
109 extern void vm_pageclean_setup(
112 vm_object_t new_object
,
113 vm_object_offset_t new_offset
);
115 extern void vm_pageclean_copy(
118 vm_object_t new_object
,
119 vm_object_offset_t new_offset
);
121 /* UPL exported routines and structures */
123 #define UPL_COMPOSITE_PAGE_LIST_MAX 16
126 #define upl_lock_init(object) mutex_init(&(object)->Lock, ETAP_VM_OBJ)
127 #define upl_lock(object) mutex_lock(&(object)->Lock)
128 #define upl_unlock(object) mutex_unlock(&(object)->Lock)
131 /* universal page list structure */
134 decl_mutex_data(, Lock
) /* Synchronization */
137 vm_object_t src_object
; /* object derived from */
138 vm_object_offset_t offset
;
139 vm_size_t size
; /* size in bytes of the address space */
140 vm_offset_t kaddr
; /* secondary mapping in kernel */
141 vm_object_t map_object
;
143 unsigned int ubc_alias1
;
144 unsigned int ubc_alias2
;
145 queue_chain_t uplq
; /* List of outstanding upls on an obj */
146 #endif /* UBC_DEBUG */
152 /* upl struct flags */
153 #define UPL_PAGE_LIST_MAPPED 0x1
154 #define UPL_KERNEL_MAPPED 0x2
155 #define UPL_CLEAR_DIRTY 0x4
156 #define UPL_COMPOSITE_LIST 0x8
157 #define UPL_INTERNAL 0x10
158 #define UPL_PAGE_SYNC_DONE 0x20
159 #define UPL_DEVICE_MEMORY 0x40
160 #define UPL_PAGEOUT 0x80
161 #define UPL_LITE 0x100
162 #define UPL_IO_WIRE 0x200
164 #define UPL_PAGE_TICKET_MASK 0xF00
165 #define UPL_PAGE_TICKET_SHIFT 8
169 /* flags for upl_create flags parameter */
170 #define UPL_CREATE_EXTERNAL 0
171 #define UPL_CREATE_INTERNAL 0x1
172 #define UPL_CREATE_LITE 0x2
176 /* wired page list structure */
177 typedef unsigned long *wpl_array_t
;
181 #endif /* _VM_VM_PAGEOUT_H_ */