mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 04:08:55 +00:00
PowerPC/MMU: Refactor to class, move to System.
This commit is contained in:
parent
012044eb64
commit
8dabd1a025
51 changed files with 1314 additions and 1149 deletions
|
@ -375,7 +375,7 @@ static bool Subtype_RamWriteAndFill(const Core::CPUThreadGuard& guard, const ARA
|
|||
const u32 repeat = data >> 8;
|
||||
for (u32 i = 0; i <= repeat; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U8(guard, data & 0xFF, new_addr + i);
|
||||
PowerPC::MMU::HostWrite_U8(guard, data & 0xFF, new_addr + i);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", data & 0xFF, new_addr + i);
|
||||
}
|
||||
LogInfo("--------");
|
||||
|
@ -389,7 +389,7 @@ static bool Subtype_RamWriteAndFill(const Core::CPUThreadGuard& guard, const ARA
|
|||
const u32 repeat = data >> 16;
|
||||
for (u32 i = 0; i <= repeat; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U16(guard, data & 0xFFFF, new_addr + i * 2);
|
||||
PowerPC::MMU::HostWrite_U16(guard, data & 0xFFFF, new_addr + i * 2);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", data & 0xFFFF, new_addr + i * 2);
|
||||
}
|
||||
LogInfo("--------");
|
||||
|
@ -400,7 +400,7 @@ static bool Subtype_RamWriteAndFill(const Core::CPUThreadGuard& guard, const ARA
|
|||
case DATATYPE_32BIT: // Dword write
|
||||
LogInfo("32-bit Write");
|
||||
LogInfo("--------");
|
||||
PowerPC::HostWrite_U32(guard, data, new_addr);
|
||||
PowerPC::MMU::HostWrite_U32(guard, data, new_addr);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", data, new_addr);
|
||||
LogInfo("--------");
|
||||
break;
|
||||
|
@ -420,7 +420,7 @@ static bool Subtype_WriteToPointer(const Core::CPUThreadGuard& guard, const ARAd
|
|||
const u32 data)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
const u32 ptr = PowerPC::HostRead_U32(guard, new_addr);
|
||||
const u32 ptr = PowerPC::MMU::HostRead_U32(guard, new_addr);
|
||||
|
||||
LogInfo("Hardware Address: {:08x}", new_addr);
|
||||
LogInfo("Size: {:08x}", addr.size);
|
||||
|
@ -436,7 +436,7 @@ static bool Subtype_WriteToPointer(const Core::CPUThreadGuard& guard, const ARAd
|
|||
LogInfo("Pointer: {:08x}", ptr);
|
||||
LogInfo("Byte: {:08x}", thebyte);
|
||||
LogInfo("Offset: {:08x}", offset);
|
||||
PowerPC::HostWrite_U8(guard, thebyte, ptr + offset);
|
||||
PowerPC::MMU::HostWrite_U8(guard, thebyte, ptr + offset);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", thebyte, ptr + offset);
|
||||
LogInfo("--------");
|
||||
break;
|
||||
|
@ -451,7 +451,7 @@ static bool Subtype_WriteToPointer(const Core::CPUThreadGuard& guard, const ARAd
|
|||
LogInfo("Pointer: {:08x}", ptr);
|
||||
LogInfo("Byte: {:08x}", theshort);
|
||||
LogInfo("Offset: {:08x}", offset);
|
||||
PowerPC::HostWrite_U16(guard, theshort, ptr + offset);
|
||||
PowerPC::MMU::HostWrite_U16(guard, theshort, ptr + offset);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", theshort, ptr + offset);
|
||||
LogInfo("--------");
|
||||
break;
|
||||
|
@ -461,7 +461,7 @@ static bool Subtype_WriteToPointer(const Core::CPUThreadGuard& guard, const ARAd
|
|||
case DATATYPE_32BIT:
|
||||
LogInfo("Write 32-bit to pointer");
|
||||
LogInfo("--------");
|
||||
PowerPC::HostWrite_U32(guard, data, ptr);
|
||||
PowerPC::MMU::HostWrite_U32(guard, data, ptr);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", data, ptr);
|
||||
LogInfo("--------");
|
||||
break;
|
||||
|
@ -489,24 +489,28 @@ static bool Subtype_AddCode(const Core::CPUThreadGuard& guard, const ARAddr& add
|
|||
case DATATYPE_8BIT:
|
||||
LogInfo("8-bit Add");
|
||||
LogInfo("--------");
|
||||
PowerPC::HostWrite_U8(guard, PowerPC::HostRead_U8(guard, new_addr) + data, new_addr);
|
||||
LogInfo("Wrote {:02x} to address {:08x}", PowerPC::HostRead_U8(guard, new_addr), new_addr);
|
||||
PowerPC::MMU::HostWrite_U8(guard, PowerPC::MMU::HostRead_U8(guard, new_addr) + data, new_addr);
|
||||
LogInfo("Wrote {:02x} to address {:08x}", PowerPC::MMU::HostRead_U8(guard, new_addr), new_addr);
|
||||
LogInfo("--------");
|
||||
break;
|
||||
|
||||
case DATATYPE_16BIT:
|
||||
LogInfo("16-bit Add");
|
||||
LogInfo("--------");
|
||||
PowerPC::HostWrite_U16(guard, PowerPC::HostRead_U16(guard, new_addr) + data, new_addr);
|
||||
LogInfo("Wrote {:04x} to address {:08x}", PowerPC::HostRead_U16(guard, new_addr), new_addr);
|
||||
PowerPC::MMU::HostWrite_U16(guard, PowerPC::MMU::HostRead_U16(guard, new_addr) + data,
|
||||
new_addr);
|
||||
LogInfo("Wrote {:04x} to address {:08x}", PowerPC::MMU::HostRead_U16(guard, new_addr),
|
||||
new_addr);
|
||||
LogInfo("--------");
|
||||
break;
|
||||
|
||||
case DATATYPE_32BIT:
|
||||
LogInfo("32-bit Add");
|
||||
LogInfo("--------");
|
||||
PowerPC::HostWrite_U32(guard, PowerPC::HostRead_U32(guard, new_addr) + data, new_addr);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", PowerPC::HostRead_U32(guard, new_addr), new_addr);
|
||||
PowerPC::MMU::HostWrite_U32(guard, PowerPC::MMU::HostRead_U32(guard, new_addr) + data,
|
||||
new_addr);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", PowerPC::MMU::HostRead_U32(guard, new_addr),
|
||||
new_addr);
|
||||
LogInfo("--------");
|
||||
break;
|
||||
|
||||
|
@ -515,12 +519,12 @@ static bool Subtype_AddCode(const Core::CPUThreadGuard& guard, const ARAddr& add
|
|||
LogInfo("32-bit floating Add");
|
||||
LogInfo("--------");
|
||||
|
||||
const u32 read = PowerPC::HostRead_U32(guard, new_addr);
|
||||
const u32 read = PowerPC::MMU::HostRead_U32(guard, new_addr);
|
||||
const float read_float = Common::BitCast<float>(read);
|
||||
// data contains an (unsigned?) integer value
|
||||
const float fread = read_float + static_cast<float>(data);
|
||||
const u32 newval = Common::BitCast<u32>(fread);
|
||||
PowerPC::HostWrite_U32(guard, newval, new_addr);
|
||||
PowerPC::MMU::HostWrite_U32(guard, newval, new_addr);
|
||||
LogInfo("Old Value {:08x}", read);
|
||||
LogInfo("Increment {:08x}", data);
|
||||
LogInfo("New value {:08x}", newval);
|
||||
|
@ -578,7 +582,7 @@ static bool ZeroCode_FillAndSlide(const Core::CPUThreadGuard& guard, const u32 v
|
|||
LogInfo("--------");
|
||||
for (int i = 0; i < write_num; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U8(guard, val & 0xFF, curr_addr);
|
||||
PowerPC::MMU::HostWrite_U8(guard, val & 0xFF, curr_addr);
|
||||
curr_addr += addr_incr;
|
||||
val += val_incr;
|
||||
LogInfo("Write {:08x} to address {:08x}", val & 0xFF, curr_addr);
|
||||
|
@ -594,7 +598,7 @@ static bool ZeroCode_FillAndSlide(const Core::CPUThreadGuard& guard, const u32 v
|
|||
LogInfo("--------");
|
||||
for (int i = 0; i < write_num; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U16(guard, val & 0xFFFF, curr_addr);
|
||||
PowerPC::MMU::HostWrite_U16(guard, val & 0xFFFF, curr_addr);
|
||||
LogInfo("Write {:08x} to address {:08x}", val & 0xFFFF, curr_addr);
|
||||
curr_addr += addr_incr * 2;
|
||||
val += val_incr;
|
||||
|
@ -609,7 +613,7 @@ static bool ZeroCode_FillAndSlide(const Core::CPUThreadGuard& guard, const u32 v
|
|||
LogInfo("--------");
|
||||
for (int i = 0; i < write_num; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U32(guard, val, curr_addr);
|
||||
PowerPC::MMU::HostWrite_U32(guard, val, curr_addr);
|
||||
LogInfo("Write {:08x} to address {:08x}", val, curr_addr);
|
||||
curr_addr += addr_incr * 4;
|
||||
val += val_incr;
|
||||
|
@ -650,14 +654,15 @@ static bool ZeroCode_MemoryCopy(const Core::CPUThreadGuard& guard, const u32 val
|
|||
{ // Memory Copy With Pointers Support
|
||||
LogInfo("Memory Copy With Pointers Support");
|
||||
LogInfo("--------");
|
||||
const u32 ptr_dest = PowerPC::HostRead_U32(guard, addr_dest);
|
||||
const u32 ptr_dest = PowerPC::MMU::HostRead_U32(guard, addr_dest);
|
||||
LogInfo("Resolved Dest Address to: {:08x}", ptr_dest);
|
||||
const u32 ptr_src = PowerPC::HostRead_U32(guard, addr_src);
|
||||
const u32 ptr_src = PowerPC::MMU::HostRead_U32(guard, addr_src);
|
||||
LogInfo("Resolved Src Address to: {:08x}", ptr_src);
|
||||
for (int i = 0; i < num_bytes; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U8(guard, PowerPC::HostRead_U8(guard, ptr_src + i), ptr_dest + i);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", PowerPC::HostRead_U8(guard, ptr_src + i),
|
||||
PowerPC::MMU::HostWrite_U8(guard, PowerPC::MMU::HostRead_U8(guard, ptr_src + i),
|
||||
ptr_dest + i);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", PowerPC::MMU::HostRead_U8(guard, ptr_src + i),
|
||||
ptr_dest + i);
|
||||
}
|
||||
LogInfo("--------");
|
||||
|
@ -668,8 +673,9 @@ static bool ZeroCode_MemoryCopy(const Core::CPUThreadGuard& guard, const u32 val
|
|||
LogInfo("--------");
|
||||
for (int i = 0; i < num_bytes; ++i)
|
||||
{
|
||||
PowerPC::HostWrite_U8(guard, PowerPC::HostRead_U8(guard, addr_src + i), addr_dest + i);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", PowerPC::HostRead_U8(guard, addr_src + i),
|
||||
PowerPC::MMU::HostWrite_U8(guard, PowerPC::MMU::HostRead_U8(guard, addr_src + i),
|
||||
addr_dest + i);
|
||||
LogInfo("Wrote {:08x} to address {:08x}", PowerPC::MMU::HostRead_U8(guard, addr_src + i),
|
||||
addr_dest + i);
|
||||
}
|
||||
LogInfo("--------");
|
||||
|
@ -777,16 +783,16 @@ static bool ConditionalCode(const Core::CPUThreadGuard& guard, const ARAddr& add
|
|||
switch (addr.size)
|
||||
{
|
||||
case DATATYPE_8BIT:
|
||||
result = CompareValues(PowerPC::HostRead_U8(guard, new_addr), (data & 0xFF), addr.type);
|
||||
result = CompareValues(PowerPC::MMU::HostRead_U8(guard, new_addr), (data & 0xFF), addr.type);
|
||||
break;
|
||||
|
||||
case DATATYPE_16BIT:
|
||||
result = CompareValues(PowerPC::HostRead_U16(guard, new_addr), (data & 0xFFFF), addr.type);
|
||||
result = CompareValues(PowerPC::MMU::HostRead_U16(guard, new_addr), (data & 0xFFFF), addr.type);
|
||||
break;
|
||||
|
||||
case DATATYPE_32BIT_FLOAT:
|
||||
case DATATYPE_32BIT:
|
||||
result = CompareValues(PowerPC::HostRead_U32(guard, new_addr), data, addr.type);
|
||||
result = CompareValues(PowerPC::MMU::HostRead_U32(guard, new_addr), data, addr.type);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue