- if (m->absent || m->unusual || m->error)
- /*
- * If it's unusual in anyway, ignore it
- */
- break;
-
- if (m->cleaning)
- break;
-
- if (!m->dirty)
- {
- refmod_state = pmap_get_refmod(m->phys_page);
-
- if (refmod_state & VM_MEM_REFERENCED)
- m->reference = TRUE;
- if (refmod_state & VM_MEM_MODIFIED)
- m->dirty = TRUE;
- }
-
- /*
- * If it's clean we can discard the page on wakeup.
- */
- discard = !m->dirty;
- }
- while (FALSE);
-
- if (object)
- vm_object_unlock(object);
-
- return (discard);
-}
-
-
-static void
-discard_page(vm_page_t m)
-{
- if (m->absent || m->unusual || m->error)
- /*
- * If it's unusual in anyway, ignore
- */
- return;
-
- if (!m->no_isync)
- {
- int refmod_state = pmap_disconnect(m->phys_page);
-
- if (refmod_state & VM_MEM_REFERENCED)
- m->reference = TRUE;
- if (refmod_state & VM_MEM_MODIFIED)
- m->dirty = TRUE;
- }
-
- if (m->dirty)
- panic("discard_page(%p) dirty", m);
- if (m->laundry)
- panic("discard_page(%p) laundry", m);
- if (m->private)
- panic("discard_page(%p) private", m);
- if (m->fictitious)
- panic("discard_page(%p) fictitious", m);
-
- vm_page_free(m);
-}
-
-/*
- Bits zero in the bitmaps => needs to be saved. All pages default to be saved,
- pages known to VM to not need saving are subtracted.
- Wired pages to be saved are present in page_list_wired, pageable in page_list.
-*/
-
-void
-hibernate_page_list_setall(hibernate_page_list_t * page_list,
- hibernate_page_list_t * page_list_wired,
- uint32_t * pagesOut)
+kern_return_t
+hibernate_alloc_page_lists(
+ hibernate_page_list_t ** page_list_ret,
+ hibernate_page_list_t ** page_list_wired_ret,
+ hibernate_page_list_t ** page_list_pal_ret)