From f331b5e5d1bd8b8bf50b5a86595f0e5772c6c60f Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Mon, 12 May 2025 16:45:25 -0700 Subject: [PATCH] Fix aligned_size error and clang-format. --- src/core/memory.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index e4b89fa96..2e55a1bfb 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -554,12 +554,13 @@ s32 MemoryManager::Protect(VAddr addr, size_t size, MemoryProt prot) { s64 protected_bytes = 0; auto aligned_addr = Common::AlignDown(addr, 16_KB); - auto aligned_size = Common::AlignUp(size, 16_KB); + auto aligned_size = Common::AlignUp(size + addr - aligned_addr, 16_KB); do { auto it = FindVMA(aligned_addr + protected_bytes); auto& vma_base = it->second; auto result = 0; - result = ProtectBytes(aligned_addr + protected_bytes, vma_base, aligned_size - protected_bytes, prot); + result = ProtectBytes(aligned_addr + protected_bytes, vma_base, + aligned_size - protected_bytes, prot); if (result < 0) { // ProtectBytes returned an error, return it return result;