Deleted Added
full compact
vm_fault.c (14865) vm_fault.c (15809)
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 * $Id: vm_fault.c,v 1.42 1996/03/09 06:48:26 dyson Exp $
69 * $Id: vm_fault.c,v 1.43 1996/03/28 04:53:23 dyson Exp $
70 */
71
72/*
73 * Page fault handling module.
74 */
75
76#include <sys/param.h>
77#include <sys/systm.h>

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

264 /*
265 * If the page is being brought in, wait for it and
266 * then retry.
267 */
268 if ((m->flags & PG_BUSY) || m->busy) {
269 int s;
270
271 UNLOCK_THINGS;
70 */
71
72/*
73 * Page fault handling module.
74 */
75
76#include <sys/param.h>
77#include <sys/systm.h>

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

264 /*
265 * If the page is being brought in, wait for it and
266 * then retry.
267 */
268 if ((m->flags & PG_BUSY) || m->busy) {
269 int s;
270
271 UNLOCK_THINGS;
272 s = splhigh();
273 if ((m->flags & PG_BUSY) || m->busy) {
272 s = splvm();
273 if (((m->flags & PG_BUSY) || m->busy)) {
274 m->flags |= PG_WANTED | PG_REFERENCED;
275 cnt.v_intrans++;
276 tsleep(m, PSWP, "vmpfw", 0);
277 }
278 splx(s);
279 vm_object_deallocate(first_object);
280 goto RetryFault;
281 }

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

306 UNLOCK_AND_DEALLOCATE;
307 return (KERN_PROTECTION_FAILURE);
308 }
309
310 /*
311 * Allocate a new page for this object/offset pair.
312 */
313 m = vm_page_alloc(object, pindex,
274 m->flags |= PG_WANTED | PG_REFERENCED;
275 cnt.v_intrans++;
276 tsleep(m, PSWP, "vmpfw", 0);
277 }
278 splx(s);
279 vm_object_deallocate(first_object);
280 goto RetryFault;
281 }

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

306 UNLOCK_AND_DEALLOCATE;
307 return (KERN_PROTECTION_FAILURE);
308 }
309
310 /*
311 * Allocate a new page for this object/offset pair.
312 */
313 m = vm_page_alloc(object, pindex,
314 vp?VM_ALLOC_NORMAL:VM_ALLOC_ZERO);
314 (vp || object->backing_object)?VM_ALLOC_NORMAL:VM_ALLOC_ZERO);
315
316 if (m == NULL) {
317 UNLOCK_AND_DEALLOCATE;
318 VM_WAIT;
319 goto RetryFault;
320 }
321 }
322readrest:

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

546 * We don't bother chasing down object chain
547 */
548 (object == first_object->backing_object)) {
549
550 vm_object_t other_object;
551 vm_pindex_t other_pindex, other_pindex_offset;
552 vm_page_t tm;
553
315
316 if (m == NULL) {
317 UNLOCK_AND_DEALLOCATE;
318 VM_WAIT;
319 goto RetryFault;
320 }
321 }
322readrest:

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

546 * We don't bother chasing down object chain
547 */
548 (object == first_object->backing_object)) {
549
550 vm_object_t other_object;
551 vm_pindex_t other_pindex, other_pindex_offset;
552 vm_page_t tm;
553
554 other_object = object->shadow_head.tqh_first;
554 other_object = TAILQ_FIRST(&object->shadow_head);
555 if (other_object == first_object)
555 if (other_object == first_object)
556 other_object = other_object->shadow_list.tqe_next;
556 other_object = TAILQ_NEXT(other_object, shadow_list);
557 if (!other_object)
558 panic("vm_fault: other object missing");
559 if (other_object &&
560 (other_object->type == OBJT_DEFAULT) &&
561 (other_object->paging_in_progress == 0)) {
562 other_pindex_offset =
563 OFF_TO_IDX(other_object->backing_object_offset);
564 if (pindex >= other_pindex_offset) {

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

707
708 UNLOCK_THINGS;
709
710 m->flags |= PG_MAPPED|PG_REFERENCED;
711 m->flags &= ~PG_ZERO;
712 m->valid = VM_PAGE_BITS_ALL;
713
714 pmap_enter(map->pmap, vaddr, VM_PAGE_TO_PHYS(m), prot, wired);
557 if (!other_object)
558 panic("vm_fault: other object missing");
559 if (other_object &&
560 (other_object->type == OBJT_DEFAULT) &&
561 (other_object->paging_in_progress == 0)) {
562 other_pindex_offset =
563 OFF_TO_IDX(other_object->backing_object_offset);
564 if (pindex >= other_pindex_offset) {

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

707
708 UNLOCK_THINGS;
709
710 m->flags |= PG_MAPPED|PG_REFERENCED;
711 m->flags &= ~PG_ZERO;
712 m->valid = VM_PAGE_BITS_ALL;
713
714 pmap_enter(map->pmap, vaddr, VM_PAGE_TO_PHYS(m), prot, wired);
715 if (vp && (change_wiring == 0) && (wired == 0))
715 if ((change_wiring == 0) && (wired == 0))
716 pmap_prefault(map->pmap, vaddr, entry, first_object);
717
718 /*
719 * If the page is not wired down, then put it where the pageout daemon
720 * can find it.
721 */
722 if (change_wiring) {
723 if (wired)

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

775 /*
776 * We simulate a fault to get the page and enter it in the physical
777 * map.
778 */
779
780 for (va = start; va < end; va += PAGE_SIZE) {
781
782 while( curproc != pageproc &&
716 pmap_prefault(map->pmap, vaddr, entry, first_object);
717
718 /*
719 * If the page is not wired down, then put it where the pageout daemon
720 * can find it.
721 */
722 if (change_wiring) {
723 if (wired)

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

775 /*
776 * We simulate a fault to get the page and enter it in the physical
777 * map.
778 */
779
780 for (va = start; va < end; va += PAGE_SIZE) {
781
782 while( curproc != pageproc &&
783 (cnt.v_free_count <= cnt.v_pageout_free_min))
783 (cnt.v_free_count <= cnt.v_pageout_free_min)) {
784 VM_WAIT;
784 VM_WAIT;
785 }
785
786 rv = vm_fault(map, va, VM_PROT_READ|VM_PROT_WRITE, TRUE);
787 if (rv) {
788 if (va != start)
789 vm_fault_unwire(map, start, va);
790 return (rv);
791 }
792 }

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

812
813 /*
814 * Since the pages are wired down, we must be able to get their
815 * mappings from the physical map system.
816 */
817
818 for (va = start; va < end; va += PAGE_SIZE) {
819 pa = pmap_extract(pmap, va);
786
787 rv = vm_fault(map, va, VM_PROT_READ|VM_PROT_WRITE, TRUE);
788 if (rv) {
789 if (va != start)
790 vm_fault_unwire(map, start, va);
791 return (rv);
792 }
793 }

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

813
814 /*
815 * Since the pages are wired down, we must be able to get their
816 * mappings from the physical map system.
817 */
818
819 for (va = start; va < end; va += PAGE_SIZE) {
820 pa = pmap_extract(pmap, va);
820 if (pa == (vm_offset_t) 0) {
821 panic("unwire: page not in pmap");
821 if (pa != (vm_offset_t) 0) {
822 pmap_change_wiring(pmap, va, FALSE);
823 vm_page_unwire(PHYS_TO_VM_PAGE(pa));
822 }
824 }
823 pmap_change_wiring(pmap, va, FALSE);
824 vm_page_unwire(PHYS_TO_VM_PAGE(pa));
825 }
826
827 /*
828 * Inform the physical mapping system that the range of addresses may
829 * fault, so that page tables and such may be unwired themselves.
830 */
831
832 pmap_pageable(pmap, start, end, TRUE);

--- 249 unchanged lines hidden ---
825 }
826
827 /*
828 * Inform the physical mapping system that the range of addresses may
829 * fault, so that page tables and such may be unwired themselves.
830 */
831
832 pmap_pageable(pmap, start, end, TRUE);

--- 249 unchanged lines hidden ---