Deleted Added
full compact
vm_fault.c (94912) vm_fault.c (94977)
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1994 John S. Dyson
5 * All rights reserved.
6 * Copyright (c) 1994 David Greenman
7 * All rights reserved.
8 *

--- 52 unchanged lines hidden (view full) ---

61 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
62 * School of Computer Science
63 * Carnegie Mellon University
64 * Pittsburgh PA 15213-3890
65 *
66 * any improvements or extensions that they make and grant Carnegie the
67 * rights to redistribute these changes.
68 *
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1994 John S. Dyson
5 * All rights reserved.
6 * Copyright (c) 1994 David Greenman
7 * All rights reserved.
8 *

--- 52 unchanged lines hidden (view full) ---

61 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
62 * School of Computer Science
63 * Carnegie Mellon University
64 * Pittsburgh PA 15213-3890
65 *
66 * any improvements or extensions that they make and grant Carnegie the
67 * rights to redistribute these changes.
68 *
69 * $FreeBSD: head/sys/vm/vm_fault.c 94912 2002-04-17 02:23:57Z alc $
69 * $FreeBSD: head/sys/vm/vm_fault.c 94977 2002-04-18 03:28:27Z alc $
70 */
71
72/*
73 * Page fault handling module.
74 */
75#include <sys/param.h>
76#include <sys/systm.h>
77#include <sys/kernel.h>

--- 120 unchanged lines hidden (view full) ---

198}
199
200static int
201vm_fault1(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type,
202 int fault_flags)
203{
204 vm_prot_t prot;
205 int result;
70 */
71
72/*
73 * Page fault handling module.
74 */
75#include <sys/param.h>
76#include <sys/systm.h>
77#include <sys/kernel.h>

--- 120 unchanged lines hidden (view full) ---

198}
199
200static int
201vm_fault1(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type,
202 int fault_flags)
203{
204 vm_prot_t prot;
205 int result;
206 boolean_t wired;
206 boolean_t growstack, wired;
207 int map_generation;
208 vm_object_t next_object;
209 vm_page_t marray[VM_FAULT_READ];
210 int hardfault;
211 int faultcount;
212 struct faultstate fs;
213
214 GIANT_REQUIRED;
215
216 cnt.v_vm_faults++;
217 hardfault = 0;
207 int map_generation;
208 vm_object_t next_object;
209 vm_page_t marray[VM_FAULT_READ];
210 int hardfault;
211 int faultcount;
212 struct faultstate fs;
213
214 GIANT_REQUIRED;
215
216 cnt.v_vm_faults++;
217 hardfault = 0;
218 growstack = TRUE;
218
219RetryFault:;
220
221 /*
222 * Find the backing store object and offset into it to begin the
223 * search.
224 */
225 fs.map = map;
226 if ((result = vm_map_lookup(&fs.map, vaddr,
227 fault_type, &fs.entry, &fs.first_object,
228 &fs.first_pindex, &prot, &wired)) != KERN_SUCCESS) {
229 if ((result != KERN_PROTECTION_FAILURE) ||
230 ((fault_flags & VM_FAULT_WIRE_MASK) != VM_FAULT_USER_WIRE)) {
219
220RetryFault:;
221
222 /*
223 * Find the backing store object and offset into it to begin the
224 * search.
225 */
226 fs.map = map;
227 if ((result = vm_map_lookup(&fs.map, vaddr,
228 fault_type, &fs.entry, &fs.first_object,
229 &fs.first_pindex, &prot, &wired)) != KERN_SUCCESS) {
230 if ((result != KERN_PROTECTION_FAILURE) ||
231 ((fault_flags & VM_FAULT_WIRE_MASK) != VM_FAULT_USER_WIRE)) {
232 if (growstack && result == KERN_INVALID_ADDRESS &&
233 map != kernel_map && curproc != NULL) {
234 result = vm_map_growstack(curproc, vaddr);
235 if (result != KERN_SUCCESS)
236 return (KERN_FAILURE);
237 growstack = FALSE;
238 goto RetryFault;
239 }
231 return result;
232 }
233
234 /*
235 * If we are user-wiring a r/w segment, and it is COW, then
236 * we need to do the COW operation. Note that we don't COW
237 * currently RO sections now, because it is NOT desirable
238 * to COW .text. We simply keep .text from ever being COW'ed

--- 999 unchanged lines hidden ---
240 return result;
241 }
242
243 /*
244 * If we are user-wiring a r/w segment, and it is COW, then
245 * we need to do the COW operation. Note that we don't COW
246 * currently RO sections now, because it is NOT desirable
247 * to COW .text. We simply keep .text from ever being COW'ed

--- 999 unchanged lines hidden ---