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) WKdm_decompress_new((WK_word*) src, (WK_word*)(uintptr_t)dst, (WK_word*) &scratch[0], PAGE_SIZE);
- else bzero((void *) dst, PAGE_SIZE);
+ if (compressedSize != 4) WKdm_decompress_new((WK_word*) src, (WK_word*)(uintptr_t)dst, (WK_word*) &scratch[0], compressedSize);
+ else
+ {
+ size_t i;
+ uint32_t s, *d;
+
+ 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
{
return hibernate_sum_page((uint8_t *)(uintptr_t)dst, ppnum);
}
-#define C_ASSERT(e) typedef char __C_ASSERT__[(e) ? 1 : -1]
-
long
hibernate_kernel_entrypoint(uint32_t p1,
uint32_t p2, uint32_t p3, uint32_t p4)
uint64_t timeStart;
timeStart = rdtsc64();
- C_ASSERT(sizeof(IOHibernateImageHeader) == 512);
+ static_assert(sizeof(IOHibernateImageHeader) == 512);
headerPhys = ptoa_64(p1);
gIOHibernateCurrentHeader->trampolineTime = (((rdtsc64() - timeStart)) >> 8);
+// debug_code('done', 0);
+
#if CONFIG_SLEEP
#if defined(__i386__) || defined(__x86_64__)
typedef void (*ResetProc)(void);