X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3903760236c30e3b5ace7a4eefac3a269d68957c..5c9f46613a83ebfc29a5b1f099448259e96a98f0:/iokit/Kernel/IOHibernateRestoreKernel.c diff --git a/iokit/Kernel/IOHibernateRestoreKernel.c b/iokit/Kernel/IOHibernateRestoreKernel.c index 7c2d3931f..fc5a1b7f2 100644 --- a/iokit/Kernel/IOHibernateRestoreKernel.c +++ b/iokit/Kernel/IOHibernateRestoreKernel.c @@ -73,17 +73,7 @@ extern void acpi_wake_prot_entry(void); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #if defined(__i386__) || defined(__x86_64__) - -#define rdtsc(lo,hi) \ - __asm__ volatile("lfence; rdtsc; lfence" : "=a" (lo), "=d" (hi)) - -static inline uint64_t rdtsc64(void) -{ - uint64_t lo, hi; - rdtsc(lo, hi); - return ((hi) << 32) | (lo); -} - +#include #else static inline uint64_t rdtsc64(void) @@ -402,15 +392,15 @@ store_one_page(uint32_t procFlags, uint32_t * src, uint32_t compressedSize, { 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) __nosan_bzero((void *) dst, PAGE_SIZE); + else for (i = 0; i < (PAGE_SIZE / sizeof(int32_t)); i++) *d++ = s; } } else @@ -465,7 +455,7 @@ hibernate_kernel_entrypoint(uint32_t p1, debug_code(kIOHibernateRestoreCodeImageStart, headerPhys); - memcpy(gIOHibernateCurrentHeader, + __nosan_memcpy(gIOHibernateCurrentHeader, (void *) pal_hib_map(IMAGE_AREA, headerPhys), sizeof(IOHibernateImageHeader)); @@ -638,7 +628,7 @@ hibernate_kernel_entrypoint(uint32_t p1, // alloc new buffer page bufferPage = hibernate_page_list_grab(map, &nextFree); dst = (uint32_t *)pal_hib_map(DEST_COPY_AREA, ptoa_64(bufferPage)); - memcpy(dst, src, compressedSize); + __nosan_memcpy(dst, src, compressedSize); } if (copyPageIndex > ((PAGE_SIZE >> 2) - 3)) {