mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
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.
This commit is contained in:
parent
3d44dc3981
commit
5d42f31539
@ -164,7 +164,7 @@ static void EFB_Write(u32 data, u32 addr)
|
|||||||
BatTable ibat_table;
|
BatTable ibat_table;
|
||||||
BatTable dbat_table;
|
BatTable dbat_table;
|
||||||
|
|
||||||
static void GenerateDSIException(u32 _EffectiveAddress, bool _bWrite);
|
static void GenerateDSIException(u32 effective_address, bool write);
|
||||||
|
|
||||||
template <XCheckTLBFlag flag, typename T, bool never_translate = false>
|
template <XCheckTLBFlag flag, typename T, bool never_translate = false>
|
||||||
static T ReadFromHardware(u32 em_address)
|
static T ReadFromHardware(u32 em_address)
|
||||||
@ -689,68 +689,68 @@ bool HostIsInstructionRAMAddress(u32 address)
|
|||||||
return !(address & 3) && IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, MSR.IR);
|
return !(address & 3) && IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(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;
|
// 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?
|
// what would happen if, for example, the DVD drive tried to write to the EFB?
|
||||||
// TODO: This is terribly slow.
|
// TODO: This is terribly slow.
|
||||||
// TODO: Refactor.
|
// TODO: Refactor.
|
||||||
// Avatar: The Last Airbender (GC) uses this for videos.
|
// 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));
|
const u32 data = Common::swap32(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF));
|
||||||
EFB_Write(data, memAddr + i);
|
EFB_Write(data, mem_address + i);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No known game uses this; here for completeness.
|
// No known game uses this; here for completeness.
|
||||||
// TODO: Refactor.
|
// 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));
|
const u32 data = Common::swap32(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF));
|
||||||
Memory::mmio_mapping->Write(memAddr + i, data);
|
Memory::mmio_mapping->Write(mem_address + i, data);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8* src = Memory::m_pL1Cache + (cacheAddr & 0x3FFFF);
|
const u8* src = Memory::m_pL1Cache + (cache_address & 0x3FFFF);
|
||||||
u8* dst = Memory::GetPointer(memAddr);
|
u8* dst = Memory::GetPointer(mem_address);
|
||||||
if (dst == nullptr)
|
if (dst == nullptr)
|
||||||
return;
|
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);
|
const u8* src = Memory::GetPointer(mem_address);
|
||||||
u8* dst = Memory::m_pL1Cache + (cacheAddr & 0x3FFFF);
|
u8* dst = Memory::m_pL1Cache + (cache_address & 0x3FFFF);
|
||||||
|
|
||||||
// No known game uses this; here for completeness.
|
// No known game uses this; here for completeness.
|
||||||
// TODO: Refactor.
|
// 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));
|
const u32 data = Common::swap32(EFB_Read(mem_address + i));
|
||||||
std::memcpy(Memory::m_pL1Cache + ((cacheAddr + i) & 0x3FFFF), &data, sizeof(u32));
|
std::memcpy(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF), &data, sizeof(u32));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No known game uses this.
|
// No known game uses this.
|
||||||
// TODO: Refactor.
|
// 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<u32>(memAddr + i));
|
const u32 data = Common::swap32(Memory::mmio_mapping->Read<u32>(mem_address + i));
|
||||||
std::memcpy(Memory::m_pL1Cache + ((cacheAddr + i) & 0x3FFFF), &data, sizeof(u32));
|
std::memcpy(Memory::m_pL1Cache + ((cache_address + i) & 0x3FFFF), &data, sizeof(u32));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -758,7 +758,7 @@ void DMA_MemoryToLC(const u32 cacheAddr, const u32 memAddr, const u32 numBlocks)
|
|||||||
if (src == nullptr)
|
if (src == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memcpy(dst, src, 32 * numBlocks);
|
memcpy(dst, src, 32 * num_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCacheLine(u32 address)
|
void ClearCacheLine(u32 address)
|
||||||
@ -789,7 +789,7 @@ void ClearCacheLine(u32 address)
|
|||||||
WriteToHardware<XCheckTLBFlag::Write, u64, true>(address + i, 0);
|
WriteToHardware<XCheckTLBFlag::Write, u64, true>(address + i, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 IsOptimizableMMIOAccess(u32 address, u32 accessSize)
|
u32 IsOptimizableMMIOAccess(u32 address, u32 access_size)
|
||||||
{
|
{
|
||||||
if (PowerPC::memchecks.HasAny())
|
if (PowerPC::memchecks.HasAny())
|
||||||
return 0;
|
return 0;
|
||||||
@ -804,7 +804,7 @@ u32 IsOptimizableMMIOAccess(u32 address, u32 accessSize)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Check whether the address is an aligned address of an MMIO register.
|
// 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))
|
if (!aligned || !MMIO::IsMMIOAddress(address))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -937,30 +937,30 @@ union UPTE2
|
|||||||
u32 Hex;
|
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.
|
// DSI exceptions are only supported in MMU mode.
|
||||||
if (!SConfig::GetInstance().bMMU)
|
if (!SConfig::GetInstance().bMMU)
|
||||||
{
|
{
|
||||||
PanicAlert("Invalid %s 0x%08x, PC = 0x%08x ", write ? "write to" : "read from",
|
PanicAlert("Invalid %s 0x%08x, PC = 0x%08x ", write ? "write to" : "read from",
|
||||||
effectiveAddress, PC);
|
effective_address, PC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effectiveAddress)
|
if (effective_address)
|
||||||
PowerPC::ppcState.spr[SPR_DSISR] = PPC_EXC_DSISR_PAGE | PPC_EXC_DSISR_STORE;
|
PowerPC::ppcState.spr[SPR_DSISR] = PPC_EXC_DSISR_PAGE | PPC_EXC_DSISR_STORE;
|
||||||
else
|
else
|
||||||
PowerPC::ppcState.spr[SPR_DSISR] = PPC_EXC_DSISR_PAGE;
|
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;
|
PowerPC::ppcState.Exceptions |= EXCEPTION_DSI;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GenerateISIException(u32 _EffectiveAddress)
|
static void GenerateISIException(u32 effective_address)
|
||||||
{
|
{
|
||||||
// Address of instruction could not be translated
|
// Address of instruction could not be translated
|
||||||
NPC = _EffectiveAddress;
|
NPC = effective_address;
|
||||||
|
|
||||||
PowerPC::ppcState.Exceptions |= EXCEPTION_ISI;
|
PowerPC::ppcState.Exceptions |= EXCEPTION_ISI;
|
||||||
WARN_LOG(POWERPC, "ISI exception at 0x%08x", PC);
|
WARN_LOG(POWERPC, "ISI exception at 0x%08x", PC);
|
||||||
|
Loading…
Reference in New Issue
Block a user