]> git.saurik.com Git - apple/xnu.git/blob - osfmk/vm/vm_fault.h
xnu-517.3.7.tar.gz
[apple/xnu.git] / osfmk / vm / vm_fault.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_fault.h
57 *
58 * Page fault handling module declarations.
59 */
60
61 #ifndef _VM_VM_FAULT_H_
62 #define _VM_VM_FAULT_H_
63
64 #include <mach/kern_return.h>
65 #include <mach/boolean.h>
66 #include <mach/vm_prot.h>
67 #include <mach/vm_param.h>
68 #include <mach/vm_behavior.h>
69 #include <vm/vm_page.h>
70 #include <vm/vm_object.h>
71 #include <vm/vm_map.h>
72
73 typedef kern_return_t vm_fault_return_t;
74 #define VM_FAULT_SUCCESS 0
75 #define VM_FAULT_RETRY 1
76 #define VM_FAULT_INTERRUPTED 2
77 #define VM_FAULT_MEMORY_SHORTAGE 3
78 #define VM_FAULT_FICTITIOUS_SHORTAGE 4
79 #define VM_FAULT_MEMORY_ERROR 5
80
81 extern void vm_fault_init(void);
82
83 /*
84 * Page fault handling based on vm_object only.
85 */
86
87 extern vm_fault_return_t vm_fault_page(
88 /* Arguments: */
89 vm_object_t first_object, /* Object to begin search */
90 vm_object_offset_t first_offset,/* Offset into object */
91 vm_prot_t fault_type, /* What access is requested */
92 boolean_t must_be_resident,/* Must page be resident? */
93 int interruptible,/* how may fault be interrupted */
94 vm_object_offset_t lo_offset, /* Map entry start */
95 vm_object_offset_t hi_offset, /* Map entry end */
96 vm_behavior_t behavior, /* Expected paging behavior */
97 /* Modifies in place: */
98 vm_prot_t *protection, /* Protection for mapping */
99 /* Returns: */
100 vm_page_t *result_page, /* Page found, if successful */
101 vm_page_t *top_page, /* Page in top object, if
102 * not result_page. */
103 int *type_of_fault, /* if non-zero, return COW, zero-filled, etc...
104 * used by kernel trace point in vm_fault */
105 /* More arguments: */
106 kern_return_t *error_code, /* code if page is in error */
107 boolean_t no_zero_fill, /* don't fill absent pages */
108 boolean_t data_supply, /* treat as data_supply */
109 vm_map_t map,
110 vm_offset_t vaddr);
111
112 extern void vm_fault_cleanup(
113 vm_object_t object,
114 vm_page_t top_page);
115 /*
116 * Page fault handling based on vm_map (or entries therein)
117 */
118
119 extern kern_return_t vm_fault(
120 vm_map_t map,
121 vm_offset_t vaddr,
122 vm_prot_t fault_type,
123 boolean_t change_wiring,
124 int interruptible,
125 pmap_t pmap,
126 vm_offset_t pmap_addr);
127
128 extern kern_return_t vm_fault_wire(
129 vm_map_t map,
130 vm_map_entry_t entry,
131 pmap_t pmap,
132 vm_offset_t pmap_addr);
133
134 extern void vm_fault_unwire(
135 vm_map_t map,
136 vm_map_entry_t entry,
137 boolean_t deallocate,
138 pmap_t pmap,
139 vm_offset_t pmap_addr);
140
141 extern kern_return_t vm_fault_copy(
142 vm_object_t src_object,
143 vm_object_offset_t src_offset,
144 vm_size_t *src_size, /* INOUT */
145 vm_object_t dst_object,
146 vm_object_offset_t dst_offset,
147 vm_map_t dst_map,
148 vm_map_version_t *dst_version,
149 int interruptible);
150
151 #endif /* _VM_VM_FAULT_H_ */