X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d1ecb069dfe24481e4a83f44cb5217a2b06746d7..0b4c1975fb5e4eccf1012a35081f7e7799b81046:/osfmk/i386/hibernate_i386.c diff --git a/osfmk/i386/hibernate_i386.c b/osfmk/i386/hibernate_i386.c index f164b8ec9..b333db549 100644 --- a/osfmk/i386/hibernate_i386.c +++ b/osfmk/i386/hibernate_i386.c @@ -44,8 +44,12 @@ #include #include +extern ppnum_t max_ppnum; + #define MAX_BANKS 32 +int hibernate_page_list_allocate_avoided; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ hibernate_page_list_t * @@ -69,11 +73,18 @@ hibernate_page_list_allocate(void) msize = args->MemoryMapDescriptorSize; mcount = args->MemoryMapSize / msize; + hibernate_page_list_allocate_avoided = 0; + num_banks = 0; for (i = 0; i < mcount; i++, mptr = (EfiMemoryRange *)(((vm_offset_t)mptr) + msize)) { base = (ppnum_t) (mptr->PhysicalStart >> I386_PGSHIFT); num = (ppnum_t) mptr->NumberOfPages; + + if (base > max_ppnum) + continue; + if ((base + num - 1) > max_ppnum) + num = max_ppnum - base + 1; if (!num) continue; @@ -120,6 +131,9 @@ hibernate_page_list_allocate(void) case kEfiRuntimeServicesData: // contents are volatile once the platform expert starts case kEfiACPIReclaimMemory: + hibernate_page_list_allocate_avoided += num; + break; + // non dram case kEfiReservedMemoryType: case kEfiUnusableMemory: