]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/zalloc.c
xnu-792.10.96.tar.gz
[apple/xnu.git] / osfmk / kern / zalloc.c
index fa4ad972e8707f735ffd026860b26b332017f5b4..0661d36a3140d982b505ef71a91dbf5bf84ab6b6 100644 (file)
@@ -3,20 +3,19 @@
  *
  * @APPLE_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.
+ * 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.
  * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This 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.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
 #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 +1227,7 @@ zone_gc(void)
                 */
 
                scan = (void *)z->free_elements;
-               (void *)z->free_elements = NULL;
+               z->free_elements = 0;
 
                unlock_zone(z);
 
@@ -1272,7 +1271,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 +1283,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 +1308,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 +1361,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 +1388,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 +1474,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 +1558,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);