]> git.saurik.com Git - apple/xnu.git/blob - osfmk/vm/vm_pageout.h
xnu-517.3.7.tar.gz
[apple/xnu.git] / osfmk / vm / vm_pageout.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
13 * file.
14 *
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28 /*
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
32 *
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.
38 *
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.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53 /*
54 */
55 /*
56 * File: vm/vm_pageout.h
57 * Author: Avadis Tevanian, Jr.
58 * Date: 1986
59 *
60 * Declarations for the pageout daemon interface.
61 */
62
63 #ifndef _VM_VM_PAGEOUT_H_
64 #define _VM_VM_PAGEOUT_H_
65
66 #include <mach/boolean.h>
67 #include <mach/machine/vm_types.h>
68 #include <vm/vm_object.h>
69 #include <vm/vm_page.h>
70
71
72
73
74 extern unsigned int vm_pageout_scan_event_counter;
75 extern unsigned int vm_zf_count;
76
77 /*
78 * The following ifdef only exists because XMM must (currently)
79 * be given a page at a time. This should be removed
80 * in the future.
81 */
82 #define DATA_WRITE_MAX 16
83 #define POINTER_T(copy) (pointer_t)(copy)
84
85 /*
86 * Exported routines.
87 */
88 extern void vm_pageout(void);
89
90 extern vm_object_t vm_pageout_object_allocate(
91 vm_page_t m,
92 vm_size_t size,
93 vm_object_offset_t offset);
94
95 extern void vm_pageout_object_terminate(
96 vm_object_t object);
97
98 extern vm_page_t vm_pageout_setup(
99 vm_page_t m,
100 vm_object_t new_object,
101 vm_object_offset_t new_offset);
102
103 extern void vm_pageout_cluster(
104 vm_page_t m);
105
106 extern void vm_pageout_initialize_page(
107 vm_page_t m);
108
109 extern void vm_pageclean_setup(
110 vm_page_t m,
111 vm_page_t new_m,
112 vm_object_t new_object,
113 vm_object_offset_t new_offset);
114
115 extern void vm_pageclean_copy(
116 vm_page_t m,
117 vm_page_t new_m,
118 vm_object_t new_object,
119 vm_object_offset_t new_offset);
120
121 /* UPL exported routines and structures */
122
123 #define UPL_COMPOSITE_PAGE_LIST_MAX 16
124
125
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)
129
130
131 /* universal page list structure */
132
133 struct upl {
134 decl_mutex_data(, Lock) /* Synchronization */
135 int ref_count;
136 int flags;
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;
142 #ifdef UBC_DEBUG
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 */
147
148 };
149
150
151
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
163
164 #define UPL_PAGE_TICKET_MASK 0xF00
165 #define UPL_PAGE_TICKET_SHIFT 8
166
167
168
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
173
174
175
176 /* wired page list structure */
177 typedef unsigned long *wpl_array_t;
178
179
180
181 #endif /* _VM_VM_PAGEOUT_H_ */