]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/read_fault.c
xnu-792.21.3.tar.gz
[apple/xnu.git] / osfmk / i386 / read_fault.c
index 17adc5879867d4a218feee8f169ced91dfeec580..c6f7b437977201d0b8daab5609dcef5f44de7172 100644 (file)
@@ -1,16 +1,19 @@
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * 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. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * 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.
+ * 
+ * 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
@@ -20,7 +23,7 @@
  * 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@
@@ -87,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;
@@ -121,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);
 
@@ -131,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);
        }
 
        /*
@@ -153,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) {
@@ -212,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;
@@ -222,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);
@@ -234,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);
@@ -244,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;
@@ -257,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);