2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
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.
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.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
55 * Page fault handling module declarations.
58 #ifndef _VM_VM_FAULT_H_
59 #define _VM_VM_FAULT_H_
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>
70 typedef kern_return_t vm_fault_return_t
;
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
80 * Page fault handling based on vm_map (or entries therein)
83 extern kern_return_t
vm_fault(
85 vm_map_offset_t vaddr
,
87 boolean_t change_wiring
,
90 vm_map_offset_t pmap_addr
);
92 #ifdef MACH_KERNEL_PRIVATE
94 #include <vm/vm_page.h>
95 #include <vm/vm_object.h>
96 #include <vm/vm_map.h>
98 extern void vm_fault_init(void);
101 * Page fault handling based on vm_object only.
104 extern vm_fault_return_t
vm_fault_page(
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 */
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 */
127 vm_map_offset_t vaddr
);
129 extern void vm_fault_cleanup(
133 extern kern_return_t
vm_fault_wire(
135 vm_map_entry_t entry
,
137 vm_map_offset_t pmap_addr
);
139 extern void vm_fault_unwire(
141 vm_map_entry_t entry
,
142 boolean_t deallocate
,
144 vm_map_offset_t pmap_addr
);
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
,
153 vm_map_version_t
*dst_version
,
156 #endif /* MACH_KERNEL_PRIVATE */
158 #endif /* KERNEL_PRIVATE */
160 #endif /* _VM_VM_FAULT_H_ */