X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/9bccf70c0258c7cac2dcb80011b2a964d884c552..21362eb3e66fd2c787aee132bce100a44d71a99c:/osfmk/i386/read_fault.c diff --git a/osfmk/i386/read_fault.c b/osfmk/i386/read_fault.c index 1af4a97f2..c6f7b4379 100644 --- a/osfmk/i386/read_fault.c +++ b/osfmk/i386/read_fault.c @@ -1,23 +1,29 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ @@ -84,20 +90,19 @@ intel_read_fault( vm_object_offset_t offset; /* Top-level offset */ vm_prot_t prot; /* Protection for mapping */ vm_behavior_t behavior; /* Expected paging behavior */ - vm_object_offset_t lo_offset, hi_offset; + vm_map_offset_t lo_offset, hi_offset; vm_page_t result_page; /* Result of vm_fault_page */ vm_page_t top_page; /* Placeholder page */ boolean_t wired; /* Is map region wired? */ kern_return_t result; register vm_page_t m; - vm_map_t pmap_map; + vm_map_t map_pmap; vm_map_t original_map = map; thread_t cur_thread; boolean_t funnel_set; - funnel_t *curflock; + funnel_t *curflock = NULL; cur_thread = current_thread(); - if ((cur_thread->funnel_state & TH_FN_OWNED) == TH_FN_OWNED) { funnel_set = TRUE; curflock = cur_thread->funnel_lock; @@ -118,7 +123,7 @@ intel_read_fault( result = vm_map_lookup_locked(&map, vaddr, VM_PROT_READ, &version, &object, &offset, &prot, &wired, &behavior, &lo_offset, - &hi_offset, &pmap_map); + &hi_offset, &map_pmap); vm_map_unlock_read(map); @@ -128,9 +133,9 @@ intel_read_fault( return (result); } - if(pmap_map != map) { - vm_map_reference(pmap_map); - vm_map_unlock_read(pmap_map); + if(map_pmap != map) { + vm_map_reference(map_pmap); + vm_map_unlock_read(map_pmap); } /* @@ -150,8 +155,8 @@ intel_read_fault( if (result != VM_FAULT_SUCCESS) { vm_object_deallocate(object); - if(pmap_map != map) { - vm_map_deallocate(pmap_map); + if(map_pmap != map) { + vm_map_deallocate(map_pmap); } switch (result) { @@ -209,8 +214,8 @@ intel_read_fault( vm_object_offset_t retry_offset; vm_prot_t retry_prot; - if (map != pmap_map) { - vm_map_deallocate(pmap_map); + if (map != map_pmap) { + vm_map_deallocate(map_pmap); } map = original_map; @@ -219,7 +224,7 @@ intel_read_fault( result = vm_map_lookup_locked(&map, vaddr, VM_PROT_READ, &version, &retry_object, &retry_offset, &retry_prot, &wired, &behavior, &lo_offset, - &hi_offset, &pmap_map); + &hi_offset, &map_pmap); if (result != KERN_SUCCESS) { vm_map_unlock_read(map); @@ -231,8 +236,8 @@ intel_read_fault( return (result); } - if (map != pmap_map) { - vm_map_reference(pmap_map); + if (map != map_pmap) { + vm_map_reference(map_pmap); } vm_object_unlock(retry_object); @@ -241,9 +246,9 @@ intel_read_fault( vm_object_lock(m->object); RELEASE_PAGE(m); vm_map_unlock_read(map); - if(pmap_map != map) { - vm_map_unlock_read(pmap_map); - vm_map_deallocate(pmap_map); + if(map_pmap != map) { + vm_map_unlock_read(map_pmap); + vm_map_deallocate(map_pmap); } UNLOCK_AND_DEALLOCATE; goto RetryFault; @@ -254,11 +259,11 @@ intel_read_fault( * Put the page in the physical map. */ - PMAP_ENTER(pmap_map->pmap, vaddr, m, VM_PROT_READ, PMAP_DEFAULT_CACHE, wired); + PMAP_ENTER(map_pmap->pmap, vaddr, m, VM_PROT_READ, PMAP_DEFAULT_CACHE, wired); - if(pmap_map != map) { - vm_map_unlock_read(pmap_map); - vm_map_deallocate(pmap_map); + if(map_pmap != map) { + vm_map_unlock_read(map_pmap); + vm_map_deallocate(map_pmap); } vm_object_lock(m->object);