diff --git a/source/skyline/inlinehook/controlledpages.cpp b/source/skyline/inlinehook/controlledpages.cpp index 309ff1f..b31ee95 100755 --- a/source/skyline/inlinehook/controlledpages.cpp +++ b/source/skyline/inlinehook/controlledpages.cpp @@ -157,7 +157,7 @@ namespace skyline::inlinehook { if(!isClaimed) { // get actual pages u64 alignedSrc = ALIGN_DOWN((u64)rx, PAGE_SIZE); - size_t alignedSize = ALIGN_UP(size, PAGE_SIZE); + size_t alignedSize = ALIGN_UP((u64)rx + size, PAGE_SIZE) - alignedSrc; // reserve space for rw pages u64 dst; @@ -182,7 +182,7 @@ namespace skyline::inlinehook { // get actual pages u64 alignedSrc = ALIGN_DOWN((u64)rx, PAGE_SIZE); void* alignedDst = (void*) ALIGN_DOWN((u64)rw, PAGE_SIZE); - size_t alignedSize = ALIGN_UP(size, PAGE_SIZE); + size_t alignedSize = ALIGN_UP((u64)rx + size, PAGE_SIZE) - alignedSrc; // invalidate caches armDCacheFlush((void*)alignedDst, size); @@ -197,4 +197,4 @@ namespace skyline::inlinehook { } } -}; \ No newline at end of file +};