]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ppc/savearea.c
xnu-1228.3.13.tar.gz
[apple/xnu.git] / osfmk / ppc / savearea.c
index c9ed0a9c6a5d3f90e3e0616b974f796817669381..a86f6d3ccb699e9af15072c94313241f1ca1c93e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -56,7 +56,6 @@
 #include <ddb/db_output.h>
 
 
 #include <ddb/db_output.h>
 
 
-extern struct  Saveanchor saveanchor;                                                  /* Aliged savearea anchor */
 struct Saveanchor backpocket;                                                                  /* Emergency saveareas */
 unsigned int   debsave0 = 0;                                                                   /* Debug flag */
 unsigned int   backchain = 0;                                                                  /* Debug flag */
 struct Saveanchor backpocket;                                                                  /* Emergency saveareas */
 unsigned int   debsave0 = 0;                                                                   /* Debug flag */
 unsigned int   backchain = 0;                                                                  /* Debug flag */
@@ -137,7 +136,7 @@ void savearea_init(vm_offset_t addr) {
 
        savearea_comm   *savec;
        vm_offset_t     save;
 
        savearea_comm   *savec;
        vm_offset_t     save;
-       int i;
+       unsigned int i;
 
        
        saveanchor.savetarget   = InitialSaveTarget;            /* Initial target value */
 
        
        saveanchor.savetarget   = InitialSaveTarget;            /* Initial target value */
@@ -209,12 +208,12 @@ void savearea_init(vm_offset_t addr) {
 /*
  * This will populate the local list  and get the first one for the system
  */    
 /*
  * This will populate the local list  and get the first one for the system
  */    
-       getPerProc()->next_savearea = (vm_offset_t)save_get();
+       /* XXX next_savearea should be a void * 4425541 */
+       getPerProc()->next_savearea = (unsigned long)(void *)save_get();
 
 /*
  *     The system is now able to take interruptions
  */
 
 /*
  *     The system is now able to take interruptions
  */
-       return;
 }
 
 
 }
 
 
@@ -235,23 +234,22 @@ struct savearea   *save_alloc(void) {                                             /* Reserve a save area */
 
 
 /*
 
 
 /*
- *             This routine releases a save area to the free queue.  If after that, we have more than our maximum target,
- *             we start releasing what we can until we hit the normal target. 
+ * This routine releases a save area to the free queue.  If after that,
+ * we have more than our maximum target, we start releasing what we can
+ * until we hit the normal target. 
  */
 
  */
 
+void
+save_release(struct savearea *save)
+{
+       /* Return a savearea to the free list */
+       save_ret(save);
 
 
-
-void save_release(struct savearea *save) {                             /* Release a save area */
-       
-       save_ret(save);                                                                         /* Return a savearea to the free list */
-       
-       if(saveanchor.saveadjust) save_adjust();                        /* Adjust the savearea free list and pool size if needed */
-       
-       return;
-       
+       /* Adjust the savearea free list and pool size if needed */
+       if(saveanchor.saveadjust)
+               save_adjust(); 
 }
 
 }
 
-
 /*
  *             Adjusts the size of the free list.  Can either release or allocate full pages
  *             of kernel memory.  This can block.
 /*
  *             Adjusts the size of the free list.  Can either release or allocate full pages
  *             of kernel memory.  This can block.
@@ -271,7 +269,6 @@ void save_adjust(void) {
        
        savearea_comm   *sctl, *sctlnext, *freepage;
        kern_return_t ret;
        
        savearea_comm   *sctl, *sctlnext, *freepage;
        kern_return_t ret;
-       uint64_t vtopmask;
        ppnum_t physpage;
 
        if(saveanchor.saveadjust < 0)                                   {       /* Do we need to adjust down? */
        ppnum_t physpage;
 
        if(saveanchor.saveadjust < 0)                                   {       /* Do we need to adjust down? */
@@ -297,7 +294,7 @@ void save_adjust(void) {
                        
                        physpage = pmap_find_phys(kernel_pmap, (vm_offset_t)freepage);  /* Find physical page */
                        if(!physpage) {                                                         /* See if we actually have this mapped*/
                        
                        physpage = pmap_find_phys(kernel_pmap, (vm_offset_t)freepage);  /* Find physical page */
                        if(!physpage) {                                                         /* See if we actually have this mapped*/
-                               panic("save_adjust: wired page not mapped - va = %08X\n", freepage);    /* Die */
+                               panic("save_adjust: wired page not mapped - va = %p\n", freepage);      /* Die */
                        }
                        
                        bzero((void *)freepage, PAGE_SIZE);                     /* Clear it all to zeros */
                        }
                        
                        bzero((void *)freepage, PAGE_SIZE);                     /* Clear it all to zeros */
@@ -321,7 +318,7 @@ save_fake_zone_info(int *count, vm_size_t *cur_size, vm_size_t *max_size, vm_siz
        *count      = saveanchor.saveinuse;
        *cur_size   = (saveanchor.savefreecnt + saveanchor.saveinuse) * (PAGE_SIZE / sac_cnt);
        *max_size   = saveanchor.savemaxcount * (PAGE_SIZE / sac_cnt);
        *count      = saveanchor.saveinuse;
        *cur_size   = (saveanchor.savefreecnt + saveanchor.saveinuse) * (PAGE_SIZE / sac_cnt);
        *max_size   = saveanchor.savemaxcount * (PAGE_SIZE / sac_cnt);
-       *elem_size  = sizeof(savearea);
+       *elem_size  = sizeof(struct savearea);
        *alloc_size = PAGE_SIZE;
        *collectable = 1;
        *exhaustable = 0;
        *alloc_size = PAGE_SIZE;
        *collectable = 1;
        *exhaustable = 0;