]> git.saurik.com Git - apple/xnu.git/blob - osfmk/vm/vm_pageout.h
8e67e95534846b3ace7ebea211a52096e948d31d
[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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50 /*
51 */
52 /*
53 * File: vm/vm_pageout.h
54 * Author: Avadis Tevanian, Jr.
55 * Date: 1986
56 *
57 * Declarations for the pageout daemon interface.
58 */
59
60 #ifndef _VM_VM_PAGEOUT_H_
61 #define _VM_VM_PAGEOUT_H_
62
63 #include <mach/boolean.h>
64 #include <mach/machine/vm_types.h>
65 #include <vm/vm_object.h>
66 #include <vm/vm_page.h>
67
68 /*
69 * The following ifdef only exists because XMM must (currently)
70 * be given a page at a time. This should be removed
71 * in the future.
72 */
73 #define DATA_WRITE_MAX 16
74 #define POINTER_T(copy) (pointer_t)(copy)
75
76 /*
77 * Exported routines.
78 */
79 extern void vm_pageout(void);
80
81 extern vm_object_t vm_pageout_object_allocate(
82 vm_page_t m,
83 vm_size_t size,
84 vm_object_offset_t offset);
85
86 extern void vm_pageout_object_terminate(
87 vm_object_t object);
88
89 extern vm_page_t vm_pageout_setup(
90 vm_page_t m,
91 vm_object_t new_object,
92 vm_object_offset_t new_offset);
93
94 extern void vm_pageout_cluster(
95 vm_page_t m);
96
97 extern void vm_pageout_initialize_page(
98 vm_page_t m);
99
100 extern void vm_pageclean_setup(
101 vm_page_t m,
102 vm_page_t new_m,
103 vm_object_t new_object,
104 vm_object_offset_t new_offset);
105
106 extern void vm_pageclean_copy(
107 vm_page_t m,
108 vm_page_t new_m,
109 vm_object_t new_object,
110 vm_object_offset_t new_offset);
111
112 /* UPL exported routines and structures */
113
114 #define UPL_COMPOSITE_PAGE_LIST_MAX 16
115
116
117 #define upl_lock_init(object) mutex_init(&(object)->Lock, ETAP_VM_OBJ)
118 #define upl_lock(object) mutex_lock(&(object)->Lock)
119 #define upl_unlock(object) mutex_unlock(&(object)->Lock)
120
121
122 /* universal page list structure */
123
124 struct upl {
125 decl_mutex_data(, Lock) /* Synchronization */
126 int ref_count;
127 int flags;
128 vm_object_t src_object; /* object derived from */
129 vm_object_offset_t offset;
130 vm_size_t size; /* size in bytes of the address space */
131 vm_offset_t kaddr; /* secondary mapping in kernel */
132 vm_object_t map_object;
133 #ifdef UBC_DEBUG
134 unsigned int ubc_alias1;
135 unsigned int ubc_alias2;
136 queue_chain_t uplq; /* List of outstanding upls on an obj */
137 #endif /* UBC_DEBUG */
138
139 };
140
141
142
143 /* upl struct flags */
144 #define UPL_PAGE_LIST_MAPPED 0x1
145 #define UPL_KERNEL_MAPPED 0x2
146 #define UPL_CLEAR_DIRTY 0x4
147 #define UPL_COMPOSITE_LIST 0x8
148 #define UPL_INTERNAL 0x10
149 #define UPL_PAGE_SYNC_DONE 0x20
150 #define UPL_DEVICE_MEMORY 0x40
151
152
153
154
155
156
157
158 #endif /* _VM_VM_PAGEOUT_H_ */