2 * Copyright (c) 2000 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/kern_return.h>
62 #include <mach/boolean.h>
63 #include <mach/vm_prot.h>
64 #include <mach/vm_param.h>
65 #include <mach/vm_behavior.h>
66 #include <vm/vm_page.h>
67 #include <vm/vm_object.h>
68 #include <vm/vm_map.h>
70 typedef kern_return_t vm_fault_return_t
;
71 #define VM_FAULT_SUCCESS 0
72 #define VM_FAULT_RETRY 1
73 #define VM_FAULT_INTERRUPTED 2
74 #define VM_FAULT_MEMORY_SHORTAGE 3
75 #define VM_FAULT_FICTITIOUS_SHORTAGE 4
76 #define VM_FAULT_MEMORY_ERROR 5
78 extern void vm_fault_init(void);
81 * Page fault handling based on vm_object only.
84 extern vm_fault_return_t
vm_fault_page(
86 vm_object_t first_object
, /* Object to begin search */
87 vm_object_offset_t first_offset
,/* Offset into object */
88 vm_prot_t fault_type
, /* What access is requested */
89 boolean_t must_be_resident
,/* Must page be resident? */
90 int interruptible
,/* how may fault be interrupted */
91 vm_object_offset_t lo_offset
, /* Map entry start */
92 vm_object_offset_t hi_offset
, /* Map entry end */
93 vm_behavior_t behavior
, /* Expected paging behavior */
94 /* Modifies in place: */
95 vm_prot_t
*protection
, /* Protection for mapping */
97 vm_page_t
*result_page
, /* Page found, if successful */
98 vm_page_t
*top_page
, /* Page in top object, if
100 int *type_of_fault
, /* if non-zero, return COW, zero-filled, etc...
101 * used by kernel trace point in vm_fault */
102 /* More arguments: */
103 kern_return_t
*error_code
, /* code if page is in error */
104 boolean_t no_zero_fill
, /* don't fill absent pages */
105 boolean_t data_supply
, /* treat as data_supply */
109 extern void vm_fault_cleanup(
113 * Page fault handling based on vm_map (or entries therein)
116 extern kern_return_t
vm_fault(
119 vm_prot_t fault_type
,
120 boolean_t change_wiring
,
123 vm_offset_t pmap_addr
);
125 extern kern_return_t
vm_fault_wire(
127 vm_map_entry_t entry
,
129 vm_offset_t pmap_addr
);
131 extern void vm_fault_unwire(
133 vm_map_entry_t entry
,
134 boolean_t deallocate
,
136 vm_offset_t pmap_addr
);
138 extern kern_return_t
vm_fault_copy(
139 vm_object_t src_object
,
140 vm_object_offset_t src_offset
,
141 vm_size_t
*src_size
, /* INOUT */
142 vm_object_t dst_object
,
143 vm_object_offset_t dst_offset
,
145 vm_map_version_t
*dst_version
,
148 #endif /* _VM_VM_FAULT_H_ */