]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/vm/vm_kern.c
xnu-792.21.3.tar.gz
[apple/xnu.git] / osfmk / vm / vm_kern.c
index 68f203028ea8809e08703e08f4ede8ddf7e2abd5..d5ed1f659d2e4e6d543d799e65c3798bfc966a3c 100644 (file)
@@ -1,31 +1,29 @@
 /*
  * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
+ * @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.  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 
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
- * Please see the License for the specific language governing rights and 
+ * 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.
+ * 
+ * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
  * limitations under the License.
- *
- * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
@@ -141,7 +139,7 @@ kmem_alloc_contig(
                object = vm_object_allocate(map_size);
        }
 
-       kr = vm_map_find_space(map, &map_addr, map_size, map_mask, 0, &entry);
+       kr = vm_map_find_space(map, &map_addr, map_size, map_mask, &entry);
        if (KERN_SUCCESS != kr) {
                vm_object_deallocate(object);
                return kr;
@@ -169,7 +167,6 @@ kmem_alloc_contig(
        for (i = 0; i < map_size; i += PAGE_SIZE) {
                m = pages;
                pages = NEXT_PAGE(m);
-               *(NEXT_PAGE_PTR(m)) = VM_PAGE_NULL;
                m->busy = FALSE;
                vm_page_insert(m, object, offset + i);
        }
@@ -208,10 +205,6 @@ kmem_alloc_contig(
  *               KMA_HERE              *addrp is base address, else "anywhere"
  *               KMA_NOPAGEWAIT        don't wait for pages if unavailable
  *               KMA_KOBJECT           use kernel_object
- *               KMA_LOMEM             support for 32 bit devices in a 64 bit world
- *                                     if set and a lomemory pool is available
- *                                     grab pages from it... this also implies
- *                                     KMA_NOPAGEWAIT
  */
 
 kern_return_t
@@ -235,12 +228,6 @@ kernel_memory_allocate(
                *addrp = 0;
                return KERN_INVALID_ARGUMENT;
        }
-       if (flags & KMA_LOMEM) {
-               if ( !(flags & KMA_NOPAGEWAIT) ) {
-                       *addrp = 0;
-                       return KERN_INVALID_ARGUMENT;
-               }
-       }
 
        map_size = vm_map_round_page(size);
        map_mask = (vm_map_offset_t) mask;
@@ -256,11 +243,12 @@ kernel_memory_allocate(
                object = vm_object_allocate(map_size);
        }
 
-       kr = vm_map_find_space(map, &map_addr, map_size, map_mask, 0, &entry);
+       kr = vm_map_find_space(map, &map_addr, map_size, map_mask, &entry);
        if (KERN_SUCCESS != kr) {
                vm_object_deallocate(object);
                return kr;
        }
+
        entry->object.vm_object = object;
        entry->offset = offset = (object == kernel_object) ? 
                        map_addr - VM_MIN_KERNEL_ADDRESS : 0;
@@ -272,15 +260,8 @@ kernel_memory_allocate(
        for (i = 0; i < map_size; i += PAGE_SIZE) {
                vm_page_t       mem;
 
-               for (;;) {
-                       if (flags & KMA_LOMEM)
-                               mem = vm_page_alloclo(object, offset + i);
-                       else
-                               mem = vm_page_alloc(object, offset + i);
-
-                       if (mem != VM_PAGE_NULL)
-                               break;
-
+               while (VM_PAGE_NULL == 
+                      (mem = vm_page_alloc(object, offset + i))) {
                        if (flags & KMA_NOPAGEWAIT) {
                                if (object == kernel_object)
                                        vm_object_page_remove(object, offset, offset + i);
@@ -408,7 +389,7 @@ kmem_realloc(
         */
 
        kr = vm_map_find_space(map, &newmapaddr, newmapsize,
-                              (vm_map_offset_t) 0, 0, &newentry);
+                              (vm_map_offset_t) 0, &newentry);
        if (kr != KERN_SUCCESS) {
                vm_object_lock(object);
                for(offset = oldmapsize;