From 5d42f31539f6d97122480967b0d1047b4a8ca9ff Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 25 May 2018 12:43:05 -0400 Subject: [PATCH] MMU: Normalize parameter naming Makes all of the naming consistent with our code style, and makes parameters match their header equivalents. Essentially just a clean-up of things that weren't migrated over already. --- Source/Core/Core/PowerPC/MMU.cpp | 66 ++++++++++++++++---------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp index d8a07780d3..17bc64390f 100644 --- a/Source/Core/Core/PowerPC/MMU.cpp +++ b/Source/Core/Core/PowerPC/MMU.cpp @@ -164,7 +164,7 @@ static void EFB_Write(u32 data, u32 addr) BatTable ibat_table; BatTable dbat_table; -static void GenerateDSIException(u32 _EffectiveAddress, bool _bWrite); +static void GenerateDSIException(u32 effective_address, bool write); template static T ReadFromHardware(u32 em_address) @@ -689,68 +689,68 @@ bool HostIsInstructionRAMAddress(u32 address) return !(address & 3) && IsRAMAddress(address, MSR.IR); } -void DMA_LCToMemory(const u32 memAddr, const u32 cacheAddr, const u32 numBlocks) +void DMA_LCToMemory(const u32 mem_address, const u32 cache_address, const u32 num_blocks) { // TODO: It's not completely clear this is the right spot for this code; // what would happen if, for example, the DVD drive tried to write to the EFB? // TODO: This is terribly slow. // TODO: Refactor. // Avatar: The Last Airbender (GC) uses this for videos. - if ((memAddr & 0x0F000000) == 0x08000000) + if ((mem_address & 0x0F000000) == 0x08000000) { - for (u32 i = 0; i < 32 * numBlocks; i += 4) + for (u32 i = 0; i < 32 * num_blocks; i += 4) { - const u32 data = Common::swap32(Memory::m_pL1Cache + ((cacheAddr + i) & 0x3FFFF)); - EFB_Write(data, memAddr + i); + const u32 data = Common::swap32(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF)); + EFB_Write(data, mem_address + i); } return; } // No known game uses this; here for completeness. // TODO: Refactor. - if ((memAddr & 0x0F000000) == 0x0C000000) + if ((mem_address & 0x0F000000) == 0x0C000000) { - for (u32 i = 0; i < 32 * numBlocks; i += 4) + for (u32 i = 0; i < 32 * num_blocks; i += 4) { - const u32 data = Common::swap32(Memory::m_pL1Cache + ((cacheAddr + i) & 0x3FFFF)); - Memory::mmio_mapping->Write(memAddr + i, data); + const u32 data = Common::swap32(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF)); + Memory::mmio_mapping->Write(mem_address + i, data); } return; } - const u8* src = Memory::m_pL1Cache + (cacheAddr & 0x3FFFF); - u8* dst = Memory::GetPointer(memAddr); + const u8* src = Memory::m_pL1Cache + (cache_address & 0x3FFFF); + u8* dst = Memory::GetPointer(mem_address); if (dst == nullptr) return; - memcpy(dst, src, 32 * numBlocks); + memcpy(dst, src, 32 * num_blocks); } -void DMA_MemoryToLC(const u32 cacheAddr, const u32 memAddr, const u32 numBlocks) +void DMA_MemoryToLC(const u32 cache_address, const u32 mem_address, const u32 num_blocks) { - const u8* src = Memory::GetPointer(memAddr); - u8* dst = Memory::m_pL1Cache + (cacheAddr & 0x3FFFF); + const u8* src = Memory::GetPointer(mem_address); + u8* dst = Memory::m_pL1Cache + (cache_address & 0x3FFFF); // No known game uses this; here for completeness. // TODO: Refactor. - if ((memAddr & 0x0F000000) == 0x08000000) + if ((mem_address & 0x0F000000) == 0x08000000) { - for (u32 i = 0; i < 32 * numBlocks; i += 4) + for (u32 i = 0; i < 32 * num_blocks; i += 4) { - const u32 data = Common::swap32(EFB_Read(memAddr + i)); - std::memcpy(Memory::m_pL1Cache + ((cacheAddr + i) & 0x3FFFF), &data, sizeof(u32)); + const u32 data = Common::swap32(EFB_Read(mem_address + i)); + std::memcpy(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF), &data, sizeof(u32)); } return; } // No known game uses this. // TODO: Refactor. - if ((memAddr & 0x0F000000) == 0x0C000000) + if ((mem_address & 0x0F000000) == 0x0C000000) { - for (u32 i = 0; i < 32 * numBlocks; i += 4) + for (u32 i = 0; i < 32 * num_blocks; i += 4) { - const u32 data = Common::swap32(Memory::mmio_mapping->Read(memAddr + i)); - std::memcpy(Memory::m_pL1Cache + ((cacheAddr + i) & 0x3FFFF), &data, sizeof(u32)); + const u32 data = Common::swap32(Memory::mmio_mapping->Read(mem_address + i)); + std::memcpy(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF), &data, sizeof(u32)); } return; } @@ -758,7 +758,7 @@ void DMA_MemoryToLC(const u32 cacheAddr, const u32 memAddr, const u32 numBlocks) if (src == nullptr) return; - memcpy(dst, src, 32 * numBlocks); + memcpy(dst, src, 32 * num_blocks); } void ClearCacheLine(u32 address) @@ -789,7 +789,7 @@ void ClearCacheLine(u32 address) WriteToHardware(address + i, 0); } -u32 IsOptimizableMMIOAccess(u32 address, u32 accessSize) +u32 IsOptimizableMMIOAccess(u32 address, u32 access_size) { if (PowerPC::memchecks.HasAny()) return 0; @@ -804,7 +804,7 @@ u32 IsOptimizableMMIOAccess(u32 address, u32 accessSize) return 0; // Check whether the address is an aligned address of an MMIO register. - bool aligned = (address & ((accessSize >> 3) - 1)) == 0; + const bool aligned = (address & ((access_size >> 3) - 1)) == 0; if (!aligned || !MMIO::IsMMIOAddress(address)) return 0; @@ -937,30 +937,30 @@ union UPTE2 u32 Hex; }; -static void GenerateDSIException(u32 effectiveAddress, bool write) +static void GenerateDSIException(u32 effective_address, bool write) { // DSI exceptions are only supported in MMU mode. if (!SConfig::GetInstance().bMMU) { PanicAlert("Invalid %s 0x%08x, PC = 0x%08x ", write ? "write to" : "read from", - effectiveAddress, PC); + effective_address, PC); return; } - if (effectiveAddress) + if (effective_address) PowerPC::ppcState.spr[SPR_DSISR] = PPC_EXC_DSISR_PAGE | PPC_EXC_DSISR_STORE; else PowerPC::ppcState.spr[SPR_DSISR] = PPC_EXC_DSISR_PAGE; - PowerPC::ppcState.spr[SPR_DAR] = effectiveAddress; + PowerPC::ppcState.spr[SPR_DAR] = effective_address; PowerPC::ppcState.Exceptions |= EXCEPTION_DSI; } -static void GenerateISIException(u32 _EffectiveAddress) +static void GenerateISIException(u32 effective_address) { // Address of instruction could not be translated - NPC = _EffectiveAddress; + NPC = effective_address; PowerPC::ppcState.Exceptions |= EXCEPTION_ISI; WARN_LOG(POWERPC, "ISI exception at 0x%08x", PC);