]> git.saurik.com Git - apple/xnu.git/blame - osfmk/vm/vm_pageout.h
xnu-344.23.tar.gz
[apple/xnu.git] / osfmk / vm / vm_pageout.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
de355530
A
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.
1c79356b 11 *
de355530
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
de355530
A
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.
1c79356b
A
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
0b4e3aa0
A
68
69
70
71extern unsigned int vm_pageout_scan_event_counter;
9bccf70c 72extern unsigned int vm_zf_count;
0b4e3aa0 73
1c79356b
A
74/*
75 * The following ifdef only exists because XMM must (currently)
76 * be given a page at a time. This should be removed
77 * in the future.
78 */
79#define DATA_WRITE_MAX 16
80#define POINTER_T(copy) (pointer_t)(copy)
81
82/*
83 * Exported routines.
84 */
85extern void vm_pageout(void);
86
87extern vm_object_t vm_pageout_object_allocate(
88 vm_page_t m,
89 vm_size_t size,
90 vm_object_offset_t offset);
91
92extern void vm_pageout_object_terminate(
93 vm_object_t object);
94
95extern vm_page_t vm_pageout_setup(
96 vm_page_t m,
97 vm_object_t new_object,
98 vm_object_offset_t new_offset);
99
100extern void vm_pageout_cluster(
101 vm_page_t m);
102
103extern void vm_pageout_initialize_page(
104 vm_page_t m);
105
106extern void vm_pageclean_setup(
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
112extern void vm_pageclean_copy(
113 vm_page_t m,
114 vm_page_t new_m,
115 vm_object_t new_object,
116 vm_object_offset_t new_offset);
117
118/* UPL exported routines and structures */
119
120#define UPL_COMPOSITE_PAGE_LIST_MAX 16
121
122
123#define upl_lock_init(object) mutex_init(&(object)->Lock, ETAP_VM_OBJ)
124#define upl_lock(object) mutex_lock(&(object)->Lock)
125#define upl_unlock(object) mutex_unlock(&(object)->Lock)
126
127
128/* universal page list structure */
129
130struct upl {
131 decl_mutex_data(, Lock) /* Synchronization */
132 int ref_count;
133 int flags;
134 vm_object_t src_object; /* object derived from */
135 vm_object_offset_t offset;
136 vm_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#ifdef UBC_DEBUG
140 unsigned int ubc_alias1;
141 unsigned int ubc_alias2;
142 queue_chain_t uplq; /* List of outstanding upls on an obj */
143#endif /* UBC_DEBUG */
144
145};
146
147
148
149/* upl struct flags */
150#define UPL_PAGE_LIST_MAPPED 0x1
151#define UPL_KERNEL_MAPPED 0x2
152#define UPL_CLEAR_DIRTY 0x4
153#define UPL_COMPOSITE_LIST 0x8
154#define UPL_INTERNAL 0x10
155#define UPL_PAGE_SYNC_DONE 0x20
156#define UPL_DEVICE_MEMORY 0x40
0b4e3aa0
A
157#define UPL_PAGEOUT 0x80
158
159#define UPL_PAGE_TICKET_MASK 0xF00
160#define UPL_PAGE_TICKET_SHIFT 8
1c79356b
A
161
162
163
164
165
166
167
168#endif /* _VM_VM_PAGEOUT_H_ */