2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
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.
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.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
58 * Page fault handling module declarations.
61 #ifndef _VM_VM_FAULT_H_
62 #define _VM_VM_FAULT_H_
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>
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
81 extern void vm_fault_init(void);
84 * Page fault handling based on vm_object only.
87 extern vm_fault_return_t
vm_fault_page(
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 */
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 */
112 extern void vm_fault_cleanup(
116 * Page fault handling based on vm_map (or entries therein)
119 extern kern_return_t
vm_fault(
122 vm_prot_t fault_type
,
123 boolean_t change_wiring
,
126 vm_offset_t pmap_addr
);
128 extern kern_return_t
vm_fault_wire(
130 vm_map_entry_t entry
,
132 vm_offset_t pmap_addr
);
134 extern void vm_fault_unwire(
136 vm_map_entry_t entry
,
137 boolean_t deallocate
,
139 vm_offset_t pmap_addr
);
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
,
148 vm_map_version_t
*dst_version
,
151 #endif /* _VM_VM_FAULT_H_ */