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