Fix aligned_size error and clang-format.

This commit is contained in:
squidbus 2025-05-12 16:45:25 -07:00 committed by GitHub
parent b929ecf44e
commit f331b5e5d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -554,12 +554,13 @@ s32 MemoryManager::Protect(VAddr addr, size_t size, MemoryProt prot) {
s64 protected_bytes = 0; s64 protected_bytes = 0;
auto aligned_addr = Common::AlignDown(addr, 16_KB); 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 { do {
auto it = FindVMA(aligned_addr + protected_bytes); auto it = FindVMA(aligned_addr + protected_bytes);
auto& vma_base = it->second; auto& vma_base = it->second;
auto result = 0; 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) { if (result < 0) {
// ProtectBytes returned an error, return it // ProtectBytes returned an error, return it
return result; return result;