]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/zalloc.c
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / kern / zalloc.c
index fa4ad972e8707f735ffd026860b26b332017f5b4..49133c50eedb527d76b0d0f52e275076ce121b71 100644 (file)
@@ -1,24 +1,31 @@
 /*
  * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_LICENSE_OSREFERENCE_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
+ * 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
+ *
+ * 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_HEADER_END@
+ *
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
 #else /* !defined(__alpha) */
 
 #define is_kernel_data_addr(a)                                         \
-  (!(a) || ((a) >= VM_MIN_KERNEL_ADDRESS && !((a) & 0x3)))
+  (!(a) || ((a) >= vm_min_kernel_address && !((a) & 0x3)))
 
 #endif /* defined(__alpha) */
 
@@ -1228,7 +1235,7 @@ zone_gc(void)
                 */
 
                scan = (void *)z->free_elements;
-               (void *)z->free_elements = NULL;
+               z->free_elements = 0;
 
                unlock_zone(z);
 
@@ -1272,7 +1279,7 @@ zone_gc(void)
 
                                        if (keep != NULL) {
                                                tail->next = (void *)z->free_elements;
-                                               (void *)z->free_elements = keep;
+                                               z->free_elements = (vm_offset_t) keep;
                                                tail = keep = NULL;
                                        } else {
                                                m =0;
@@ -1284,7 +1291,7 @@ zone_gc(void)
                                                }
                                                if (m !=0 ) {
                                                        prev->next = (void *)z->free_elements;
-                                                       (void *)z->free_elements = (void *)base_elt;
+                                                       z->free_elements = (vm_offset_t) base_elt;
                                                        base_prev->next = elt;
                                                        prev = base_prev;
                                                }
@@ -1309,7 +1316,7 @@ zone_gc(void)
                        lock_zone(z);
 
                        tail->next = (void *)z->free_elements;
-                       (void *)z->free_elements = keep;
+                       z->free_elements = (vm_offset_t) keep;
 
                        unlock_zone(z);
                }
@@ -1362,7 +1369,7 @@ zone_gc(void)
 
                                if (keep != NULL) {
                                        tail->next = (void *)z->free_elements;
-                                       (void *)z->free_elements = keep;
+                                       z->free_elements = (vm_offset_t) keep;
                                }
 
                                if (z->waiting) {
@@ -1389,7 +1396,7 @@ zone_gc(void)
 
                        if (keep != NULL) {
                                tail->next = (void *)z->free_elements;
-                               (void *)z->free_elements = keep;
+                               z->free_elements = (vm_offset_t) keep;
                        }
 
                }
@@ -1475,7 +1482,7 @@ host_zone_info(
 #ifdef ppc
        max_zones = num_zones + 4;
 #else
-       max_zones = num_zones + 2;
+       max_zones = num_zones + 3; /* ATN: count the number below!! */
 #endif
        z = first_zone;
        simple_unlock(&all_zones_lock);
@@ -1559,6 +1566,15 @@ host_zone_info(
        zn++;
        zi++;
 #endif
+
+#ifdef i386
+       strcpy(zn->zn_name, "page_tables");
+       pt_fake_zone_info(&zi->zi_count, &zi->zi_cur_size, &zi->zi_max_size, &zi->zi_elem_size,
+                         &zi->zi_alloc_size, &zi->zi_collectable, &zi->zi_exhaustible);
+       zn++;
+       zi++;
+#endif
+
        strcpy(zn->zn_name, "kalloc.large");
        kalloc_fake_zone_info(&zi->zi_count, &zi->zi_cur_size, &zi->zi_max_size, &zi->zi_elem_size,
                               &zi->zi_alloc_size, &zi->zi_collectable, &zi->zi_exhaustible);