X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3e170ce000f1506b7b5d2c5c7faec85ceabb573d..d7b9d919dbe8fc675bbf1e877590398ba6051e9c:/iokit/Kernel/IOHibernateRestoreKernel.c?ds=inline diff --git a/iokit/Kernel/IOHibernateRestoreKernel.c b/iokit/Kernel/IOHibernateRestoreKernel.c index 141a280a5..017d4d4f8 100644 --- a/iokit/Kernel/IOHibernateRestoreKernel.c +++ b/iokit/Kernel/IOHibernateRestoreKernel.c @@ -396,21 +396,21 @@ store_one_page(uint32_t procFlags, uint32_t * src, uint32_t compressedSize, uint32_t * buffer, uint32_t ppnum) { uint64_t dst = ptoa_64(ppnum); - uint8_t scratch[WKdm_SCRATCH_BUF_SIZE] __attribute__ ((aligned (16))); + uint8_t scratch[WKdm_SCRATCH_BUF_SIZE_INTERNAL] __attribute__ ((aligned (16))); if (compressedSize != PAGE_SIZE) { dst = pal_hib_map(DEST_COPY_AREA, dst); if (compressedSize != 4) WKdm_decompress_new((WK_word*) src, (WK_word*)(uintptr_t)dst, (WK_word*) &scratch[0], compressedSize); - else { - int i; - uint32_t *s, *d; - - s = src; - d = (uint32_t *)(uintptr_t)dst; + else + { + size_t i; + uint32_t s, *d; - for (i = 0; i < (int)(PAGE_SIZE / sizeof(int32_t)); i++) - *d++ = *s; + s = *src; + d = (uint32_t *)(uintptr_t)dst; + if (!s) bzero((void *) dst, PAGE_SIZE); + else for (i = 0; i < (PAGE_SIZE / sizeof(int32_t)); i++) *d++ = s; } } else @@ -456,7 +456,7 @@ hibernate_kernel_entrypoint(uint32_t p1, uint64_t timeStart; timeStart = rdtsc64(); - assert_static(sizeof(IOHibernateImageHeader) == 512); + static_assert(sizeof(IOHibernateImageHeader) == 512); headerPhys = ptoa_64(p1);