+/*
+ * Record which high pages have been allocated so far,
+ * so that pmap_init() can mark them PMAP_NOENCRYPT, which
+ * makes hibernation faster.
+ *
+ * Because of the code in pmap_next_page_large(), we could
+ * theoretically have fragments in several regions.
+ * In practice that just doesn't happen. The last pmap region
+ * is normally the largest and will satisfy all pmap_next_hi/large()
+ * allocations. Since this information is used as an optimization
+ * and it's ok to be conservative, we'll just record the information
+ * for the final region.
+ */
+void
+pmap_hi_pages_done(void)
+{
+ pmap_memory_region_t *r;
+
+ r = &pmap_memory_regions[pmap_memory_region_count - 1];
+ pmap_high_used_top = r->end;
+ if (r->alloc_frag_up <= r->alloc_frag_down) {
+ pmap_high_used_bottom = r->alloc_frag_down + 1;
+ pmap_middle_used_top = r->alloc_frag_up - 1;
+ if (r->alloc_up <= r->alloc_down) {
+ pmap_middle_used_bottom = r->alloc_down + 1;
+ } else {
+ pmap_high_used_bottom = r->base;
+ }
+ } else {
+ if (r->alloc_up <= r->alloc_down) {
+ pmap_high_used_bottom = r->alloc_down + 1;
+ } else {
+ pmap_high_used_bottom = r->base;
+ }
+ }
+#if DEBUG || DEVELOPMENT
+ kprintf("pmap_high_used_top 0x%x\n", pmap_high_used_top);
+ kprintf("pmap_high_used_bottom 0x%x\n", pmap_high_used_bottom);
+ kprintf("pmap_middle_used_top 0x%x\n", pmap_middle_used_top);
+ kprintf("pmap_middle_used_bottom 0x%x\n", pmap_middle_used_bottom);
+#endif
+}