mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
MMU: Use templates for Read/Write functions
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MathUtil.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
@@ -141,4 +143,13 @@ concept TypedEnum = std::is_same_v<std::underlying_type_t<T>, Underlying>;
|
||||
|
||||
template <typename T>
|
||||
concept BooleanEnum = TypedEnum<T, bool>;
|
||||
|
||||
template <typename T>
|
||||
requires(sizeof(T) <= sizeof(u64) && std::has_single_bit(sizeof(T)))
|
||||
using MakeUnsignedSameSize =
|
||||
std::tuple_element_t<MathUtil::IntLog2(sizeof(T)), std::tuple<u8, u16, u32, u64>>;
|
||||
|
||||
template <std::unsigned_integral T>
|
||||
using MakeAtLeastU32 = std::conditional_t<std::is_same_v<T, u64>, u64, u32>;
|
||||
|
||||
} // namespace Common
|
||||
|
||||
@@ -1370,8 +1370,8 @@ u32 AchievementManager::MemoryPeeker(u32 address, u8* buffer, u32 num_bytes, rc_
|
||||
address += (MEM2_START - MEM1_SIZE);
|
||||
for (u32 num_read = 0; num_read < num_bytes; num_read++)
|
||||
{
|
||||
auto value = system.GetMMU().HostTryReadU8(thread_guard, address + num_read,
|
||||
PowerPC::RequestedAddressSpace::Physical);
|
||||
auto value = system.GetMMU().HostTryRead<u8>(thread_guard, address + num_read,
|
||||
PowerPC::RequestedAddressSpace::Physical);
|
||||
if (!value.has_value())
|
||||
return num_read;
|
||||
buffer[num_read] = value.value().value;
|
||||
|
||||
@@ -434,7 +434,7 @@ static bool Subtype_WriteToPointer(const Core::CPUThreadGuard& guard, const ARAd
|
||||
const u32 data)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
const u32 ptr = PowerPC::MMU::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);
|
||||
@@ -503,16 +503,17 @@ static bool Subtype_AddCode(const Core::CPUThreadGuard& guard, const ARAddr& add
|
||||
case DATATYPE_8BIT:
|
||||
LogInfo("8-bit Add");
|
||||
LogInfo("--------");
|
||||
ApplyMemoryPatch<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);
|
||||
ApplyMemoryPatch<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("--------");
|
||||
ApplyMemoryPatch<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),
|
||||
ApplyMemoryPatch<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;
|
||||
@@ -520,8 +521,8 @@ static bool Subtype_AddCode(const Core::CPUThreadGuard& guard, const ARAddr& add
|
||||
case DATATYPE_32BIT:
|
||||
LogInfo("32-bit Add");
|
||||
LogInfo("--------");
|
||||
ApplyMemoryPatch<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),
|
||||
ApplyMemoryPatch<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;
|
||||
@@ -531,7 +532,7 @@ static bool Subtype_AddCode(const Core::CPUThreadGuard& guard, const ARAddr& add
|
||||
LogInfo("32-bit floating Add");
|
||||
LogInfo("--------");
|
||||
|
||||
const u32 read = PowerPC::MMU::HostRead_U32(guard, new_addr);
|
||||
const u32 read = PowerPC::MMU::HostRead<u32>(guard, new_addr);
|
||||
const float read_float = std::bit_cast<float>(read);
|
||||
// data contains an (unsigned?) integer value
|
||||
const float fread = read_float + static_cast<float>(data);
|
||||
@@ -666,14 +667,14 @@ 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::MMU::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::MMU::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)
|
||||
{
|
||||
ApplyMemoryPatch<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),
|
||||
ApplyMemoryPatch<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("--------");
|
||||
@@ -684,8 +685,8 @@ static bool ZeroCode_MemoryCopy(const Core::CPUThreadGuard& guard, const u32 val
|
||||
LogInfo("--------");
|
||||
for (int i = 0; i < num_bytes; ++i)
|
||||
{
|
||||
ApplyMemoryPatch<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),
|
||||
ApplyMemoryPatch<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("--------");
|
||||
@@ -793,16 +794,17 @@ static bool ConditionalCode(const Core::CPUThreadGuard& guard, const ARAddr& add
|
||||
switch (addr.size)
|
||||
{
|
||||
case DATATYPE_8BIT:
|
||||
result = CompareValues(PowerPC::MMU::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::MMU::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::MMU::HostRead_U32(guard, new_addr), data, addr.type);
|
||||
result = CompareValues(PowerPC::MMU::HostRead<u32>(guard, new_addr), data, addr.type);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -52,7 +52,7 @@ void PresetTimeBaseTicks(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
|
||||
const u64 time_base_ticks = emulated_time * 40500000ULL;
|
||||
|
||||
PowerPC::MMU::HostWrite_U64(guard, time_base_ticks, 0x800030D8);
|
||||
PowerPC::MMU::HostWrite<u64>(guard, time_base_ticks, 0x800030D8);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
@@ -172,14 +172,14 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
ppc_state.gpr[4] = iAppLoaderFuncAddr + 4;
|
||||
ppc_state.gpr[5] = iAppLoaderFuncAddr + 8;
|
||||
RunFunction(system, *entry);
|
||||
const u32 iAppLoaderInit = mmu.Read_U32(iAppLoaderFuncAddr + 0);
|
||||
const u32 iAppLoaderMain = mmu.Read_U32(iAppLoaderFuncAddr + 4);
|
||||
const u32 iAppLoaderClose = mmu.Read_U32(iAppLoaderFuncAddr + 8);
|
||||
const u32 iAppLoaderInit = mmu.Read<u32>(iAppLoaderFuncAddr + 0);
|
||||
const u32 iAppLoaderMain = mmu.Read<u32>(iAppLoaderFuncAddr + 4);
|
||||
const u32 iAppLoaderClose = mmu.Read<u32>(iAppLoaderFuncAddr + 8);
|
||||
|
||||
// iAppLoaderInit
|
||||
DEBUG_LOG_FMT(BOOT, "Call iAppLoaderInit");
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4E800020, 0x81300000); // Write BLR
|
||||
HLE::Patch(system, 0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4E800020, 0x81300000); // Write BLR
|
||||
HLE::Patch(system, 0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader
|
||||
ppc_state.gpr[3] = 0x81300000;
|
||||
RunFunction(system, iAppLoaderInit);
|
||||
|
||||
@@ -200,9 +200,9 @@ bool CBoot::RunApploader(Core::System& system, const Core::CPUThreadGuard& guard
|
||||
// iAppLoaderMain returns 0 when there are no more sections to copy.
|
||||
while (ppc_state.gpr[3] != 0x00)
|
||||
{
|
||||
const u32 ram_address = mmu.Read_U32(0x81300004);
|
||||
const u32 length = mmu.Read_U32(0x81300008);
|
||||
const u32 dvd_offset = mmu.Read_U32(0x8130000c) << (is_wii ? 2 : 0);
|
||||
const u32 ram_address = mmu.Read<u32>(0x81300004);
|
||||
const u32 length = mmu.Read<u32>(0x81300008);
|
||||
const u32 dvd_offset = mmu.Read<u32>(0x8130000c) << (is_wii ? 2 : 0);
|
||||
|
||||
INFO_LOG_FMT(BOOT, "DVDRead: offset: {:08x} memOffset: {:08x} length: {}", dvd_offset,
|
||||
ram_address, length);
|
||||
@@ -243,35 +243,36 @@ void CBoot::SetupGCMemory(Core::System& system, const Core::CPUThreadGuard& guar
|
||||
auto& memory = system.GetMemory();
|
||||
|
||||
// Booted from bootrom. 0xE5207C22 = booted from jtag
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x0D15EA5E, 0x80000020);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x0D15EA5E, 0x80000020);
|
||||
|
||||
// Physical Memory Size (24MB on retail)
|
||||
PowerPC::MMU::HostWrite_U32(guard, memory.GetRamSizeReal(), 0x80000028);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, memory.GetRamSizeReal(), 0x80000028);
|
||||
|
||||
// Console type - DevKit (retail ID == 0x00000003) see YAGCD 4.2.1.1.2
|
||||
// TODO: determine why some games fail when using a retail ID.
|
||||
// (Seem to take different EXI paths, see Ikaruga for example)
|
||||
const u32 console_type = static_cast<u32>(Core::ConsoleType::LatestDevkit);
|
||||
PowerPC::MMU::HostWrite_U32(guard, console_type, 0x8000002C);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, console_type, 0x8000002C);
|
||||
|
||||
// Fake the VI Init of the IPL (YAGCD 4.2.1.4)
|
||||
PowerPC::MMU::HostWrite_U32(guard, DiscIO::IsNTSC(SConfig::GetInstance().m_region) ? 0 : 1,
|
||||
0x800000CC);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, DiscIO::IsNTSC(SConfig::GetInstance().m_region) ? 0 : 1,
|
||||
0x800000CC);
|
||||
|
||||
// ARAM Size. 16MB main + 4/16/32MB external. (retail consoles have no external ARAM)
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x01000000, 0x800000d0);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x01000000, 0x800000d0);
|
||||
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x09a7ec80, 0x800000F8); // Bus Clock Speed
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x1cf7c580, 0x800000FC); // CPU Clock Speed
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x09a7ec80, 0x800000F8); // Bus Clock Speed
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x1cf7c580, 0x800000FC); // CPU Clock Speed
|
||||
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4c000064, 0x80000300); // Write default DSI Handler: rfi
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4c000064, 0x80000800); // Write default FPU Handler: rfi
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x4c000064, 0x80000C00); // Write default Syscall Handler: rfi
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4c000064, 0x80000300); // Write default DSI Handler: rfi
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4c000064, 0x80000800); // Write default FPU Handler: rfi
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x4c000064,
|
||||
0x80000C00); // Write default Syscall Handler: rfi
|
||||
|
||||
PresetTimeBaseTicks(system, guard);
|
||||
|
||||
// HIO checks this
|
||||
// PowerPC::MMU::HostWrite_U16(0x8200, 0x000030e6); // Console type
|
||||
// PowerPC::MMU::HostWrite<u16>(guard, 0x8200, 0x000030e6); // Console type
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
|
||||
@@ -100,106 +100,14 @@ std::vector<u8> Cheats::GetValueAsByteVector(const Cheats::SearchValue& value)
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T>
|
||||
static std::optional<PowerPC::ReadResult<T>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space);
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<u8>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
return PowerPC::MMU::HostTryReadU8(guard, addr, space);
|
||||
return PowerPC::MMU::HostTryRead<T>(guard, addr, space);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<u16>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
return PowerPC::MMU::HostTryReadU16(guard, addr, space);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<u32>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
return PowerPC::MMU::HostTryReadU32(guard, addr, space);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<u64>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
return PowerPC::MMU::HostTryReadU64(guard, addr, space);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<s8>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
auto tmp = PowerPC::MMU::HostTryReadU8(guard, addr, space);
|
||||
if (!tmp)
|
||||
return std::nullopt;
|
||||
return PowerPC::ReadResult<s8>(tmp->translated, std::bit_cast<s8>(tmp->value));
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<s16>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
auto tmp = PowerPC::MMU::HostTryReadU16(guard, addr, space);
|
||||
if (!tmp)
|
||||
return std::nullopt;
|
||||
return PowerPC::ReadResult<s16>(tmp->translated, std::bit_cast<s16>(tmp->value));
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<s32>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
auto tmp = PowerPC::MMU::HostTryReadU32(guard, addr, space);
|
||||
if (!tmp)
|
||||
return std::nullopt;
|
||||
return PowerPC::ReadResult<s32>(tmp->translated, std::bit_cast<s32>(tmp->value));
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<s64>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
auto tmp = PowerPC::MMU::HostTryReadU64(guard, addr, space);
|
||||
if (!tmp)
|
||||
return std::nullopt;
|
||||
return PowerPC::ReadResult<s64>(tmp->translated, std::bit_cast<s64>(tmp->value));
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<float>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
return PowerPC::MMU::HostTryReadF32(guard, addr, space);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::optional<PowerPC::ReadResult<double>>
|
||||
TryReadValueFromEmulatedMemory(const Core::CPUThreadGuard& guard, u32 addr,
|
||||
PowerPC::RequestedAddressSpace space)
|
||||
{
|
||||
return PowerPC::MMU::HostTryReadF64(guard, addr, space);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
template <typename T>
|
||||
Common::Result<Cheats::SearchErrorCode, std::vector<Cheats::SearchResult<T>>>
|
||||
Cheats::NewSearch(const Core::CPUThreadGuard& guard,
|
||||
|
||||
@@ -34,18 +34,18 @@ static void WalkTheStack(const Core::CPUThreadGuard& guard,
|
||||
|
||||
if (!IsStackBottom(guard, ppc_state.gpr[1]))
|
||||
{
|
||||
u32 addr = PowerPC::MMU::HostRead_U32(guard, ppc_state.gpr[1]); // SP
|
||||
u32 addr = PowerPC::MMU::HostRead<u32>(guard, ppc_state.gpr[1]); // SP
|
||||
|
||||
// Walk the stack chain
|
||||
for (int count = 0; !IsStackBottom(guard, addr + 4) && (count < 20); ++count)
|
||||
{
|
||||
u32 func_addr = PowerPC::MMU::HostRead_U32(guard, addr + 4);
|
||||
u32 func_addr = PowerPC::MMU::HostRead<u32>(guard, addr + 4);
|
||||
stack_step(func_addr);
|
||||
|
||||
if (IsStackBottom(guard, addr))
|
||||
break;
|
||||
|
||||
addr = PowerPC::MMU::HostRead_U32(guard, addr);
|
||||
addr = PowerPC::MMU::HostRead<u32>(guard, addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,23 +19,23 @@ namespace Core::Debug
|
||||
void OSContext::Read(const Core::CPUThreadGuard& guard, u32 addr)
|
||||
{
|
||||
for (std::size_t i = 0; i < gpr.size(); i++)
|
||||
gpr[i] = PowerPC::MMU::HostRead_U32(guard, addr + u32(i * sizeof(int)));
|
||||
cr = PowerPC::MMU::HostRead_U32(guard, addr + 0x80);
|
||||
lr = PowerPC::MMU::HostRead_U32(guard, addr + 0x84);
|
||||
ctr = PowerPC::MMU::HostRead_U32(guard, addr + 0x88);
|
||||
xer = PowerPC::MMU::HostRead_U32(guard, addr + 0x8C);
|
||||
gpr[i] = PowerPC::MMU::HostRead<u32>(guard, addr + u32(i * sizeof(int)));
|
||||
cr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x80);
|
||||
lr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x84);
|
||||
ctr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x88);
|
||||
xer = PowerPC::MMU::HostRead<u32>(guard, addr + 0x8C);
|
||||
for (std::size_t i = 0; i < fpr.size(); i++)
|
||||
fpr[i] = PowerPC::MMU::HostRead_F64(guard, addr + 0x90 + u32(i * sizeof(double)));
|
||||
fpscr = PowerPC::MMU::HostRead_U64(guard, addr + 0x190);
|
||||
srr0 = PowerPC::MMU::HostRead_U32(guard, addr + 0x198);
|
||||
srr1 = PowerPC::MMU::HostRead_U32(guard, addr + 0x19c);
|
||||
dummy = PowerPC::MMU::HostRead_U16(guard, addr + 0x1a0);
|
||||
state = static_cast<OSContext::State>(PowerPC::MMU::HostRead_U16(guard, addr + 0x1a2));
|
||||
fpr[i] = PowerPC::MMU::HostRead<double>(guard, addr + 0x90 + u32(i * sizeof(double)));
|
||||
fpscr = PowerPC::MMU::HostRead<u64>(guard, addr + 0x190);
|
||||
srr0 = PowerPC::MMU::HostRead<u32>(guard, addr + 0x198);
|
||||
srr1 = PowerPC::MMU::HostRead<u32>(guard, addr + 0x19c);
|
||||
dummy = PowerPC::MMU::HostRead<u16>(guard, addr + 0x1a0);
|
||||
state = static_cast<OSContext::State>(PowerPC::MMU::HostRead<u16>(guard, addr + 0x1a2));
|
||||
for (std::size_t i = 0; i < gqr.size(); i++)
|
||||
gqr[i] = PowerPC::MMU::HostRead_U32(guard, addr + 0x1a4 + u32(i * sizeof(int)));
|
||||
gqr[i] = PowerPC::MMU::HostRead<u32>(guard, addr + 0x1a4 + u32(i * sizeof(int)));
|
||||
psf_padding = 0;
|
||||
for (std::size_t i = 0; i < psf.size(); i++)
|
||||
psf[i] = PowerPC::MMU::HostRead_F64(guard, addr + 0x1c8 + u32(i * sizeof(double)));
|
||||
psf[i] = PowerPC::MMU::HostRead<double>(guard, addr + 0x1c8 + u32(i * sizeof(double)));
|
||||
}
|
||||
|
||||
// Mutex offsets based on the following functions:
|
||||
@@ -44,12 +44,12 @@ void OSContext::Read(const Core::CPUThreadGuard& guard, u32 addr)
|
||||
// - __OSUnlockAllMutex
|
||||
void OSMutex::Read(const Core::CPUThreadGuard& guard, u32 addr)
|
||||
{
|
||||
thread_queue.head = PowerPC::MMU::HostRead_U32(guard, addr);
|
||||
thread_queue.tail = PowerPC::MMU::HostRead_U32(guard, addr + 0x4);
|
||||
owner_addr = PowerPC::MMU::HostRead_U32(guard, addr + 0x8);
|
||||
lock_count = PowerPC::MMU::HostRead_U32(guard, addr + 0xc);
|
||||
link.next = PowerPC::MMU::HostRead_U32(guard, addr + 0x10);
|
||||
link.prev = PowerPC::MMU::HostRead_U32(guard, addr + 0x14);
|
||||
thread_queue.head = PowerPC::MMU::HostRead<u32>(guard, addr);
|
||||
thread_queue.tail = PowerPC::MMU::HostRead<u32>(guard, addr + 0x4);
|
||||
owner_addr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x8);
|
||||
lock_count = PowerPC::MMU::HostRead<u32>(guard, addr + 0xc);
|
||||
link.next = PowerPC::MMU::HostRead<u32>(guard, addr + 0x10);
|
||||
link.prev = PowerPC::MMU::HostRead<u32>(guard, addr + 0x14);
|
||||
}
|
||||
|
||||
// Thread offsets based on the following functions:
|
||||
@@ -67,38 +67,38 @@ void OSMutex::Read(const Core::CPUThreadGuard& guard, u32 addr)
|
||||
void OSThread::Read(const Core::CPUThreadGuard& guard, u32 addr)
|
||||
{
|
||||
context.Read(guard, addr);
|
||||
state = PowerPC::MMU::HostRead_U16(guard, addr + 0x2c8);
|
||||
is_detached = PowerPC::MMU::HostRead_U16(guard, addr + 0x2ca);
|
||||
suspend = PowerPC::MMU::HostRead_U32(guard, addr + 0x2cc);
|
||||
effective_priority = PowerPC::MMU::HostRead_U32(guard, addr + 0x2d0);
|
||||
base_priority = PowerPC::MMU::HostRead_U32(guard, addr + 0x2d4);
|
||||
exit_code_addr = PowerPC::MMU::HostRead_U32(guard, addr + 0x2d8);
|
||||
state = PowerPC::MMU::HostRead<u16>(guard, addr + 0x2c8);
|
||||
is_detached = PowerPC::MMU::HostRead<u16>(guard, addr + 0x2ca);
|
||||
suspend = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2cc);
|
||||
effective_priority = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2d0);
|
||||
base_priority = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2d4);
|
||||
exit_code_addr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2d8);
|
||||
|
||||
queue_addr = PowerPC::MMU::HostRead_U32(guard, addr + 0x2dc);
|
||||
queue_link.next = PowerPC::MMU::HostRead_U32(guard, addr + 0x2e0);
|
||||
queue_link.prev = PowerPC::MMU::HostRead_U32(guard, addr + 0x2e4);
|
||||
queue_addr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2dc);
|
||||
queue_link.next = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2e0);
|
||||
queue_link.prev = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2e4);
|
||||
|
||||
join_queue.head = PowerPC::MMU::HostRead_U32(guard, addr + 0x2e8);
|
||||
join_queue.tail = PowerPC::MMU::HostRead_U32(guard, addr + 0x2ec);
|
||||
join_queue.head = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2e8);
|
||||
join_queue.tail = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2ec);
|
||||
|
||||
mutex_addr = PowerPC::MMU::HostRead_U32(guard, addr + 0x2f0);
|
||||
mutex_queue.head = PowerPC::MMU::HostRead_U32(guard, addr + 0x2f4);
|
||||
mutex_queue.tail = PowerPC::MMU::HostRead_U32(guard, addr + 0x2f8);
|
||||
mutex_addr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2f0);
|
||||
mutex_queue.head = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2f4);
|
||||
mutex_queue.tail = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2f8);
|
||||
|
||||
thread_link.next = PowerPC::MMU::HostRead_U32(guard, addr + 0x2fc);
|
||||
thread_link.prev = PowerPC::MMU::HostRead_U32(guard, addr + 0x300);
|
||||
thread_link.next = PowerPC::MMU::HostRead<u32>(guard, addr + 0x2fc);
|
||||
thread_link.prev = PowerPC::MMU::HostRead<u32>(guard, addr + 0x300);
|
||||
|
||||
stack_addr = PowerPC::MMU::HostRead_U32(guard, addr + 0x304);
|
||||
stack_end = PowerPC::MMU::HostRead_U32(guard, addr + 0x308);
|
||||
error = PowerPC::MMU::HostRead_U32(guard, addr + 0x30c);
|
||||
specific[0] = PowerPC::MMU::HostRead_U32(guard, addr + 0x310);
|
||||
specific[1] = PowerPC::MMU::HostRead_U32(guard, addr + 0x314);
|
||||
stack_addr = PowerPC::MMU::HostRead<u32>(guard, addr + 0x304);
|
||||
stack_end = PowerPC::MMU::HostRead<u32>(guard, addr + 0x308);
|
||||
error = PowerPC::MMU::HostRead<u32>(guard, addr + 0x30c);
|
||||
specific[0] = PowerPC::MMU::HostRead<u32>(guard, addr + 0x310);
|
||||
specific[1] = PowerPC::MMU::HostRead<u32>(guard, addr + 0x314);
|
||||
}
|
||||
|
||||
bool OSThread::IsValid(const Core::CPUThreadGuard& guard) const
|
||||
{
|
||||
return PowerPC::MMU::HostIsRAMAddress(guard, stack_end) &&
|
||||
PowerPC::MMU::HostRead_U32(guard, stack_end) == STACK_MAGIC;
|
||||
PowerPC::MMU::HostRead<u32>(guard, stack_end) == STACK_MAGIC;
|
||||
}
|
||||
|
||||
OSThreadView::OSThreadView(const Core::CPUThreadGuard& guard, u32 addr)
|
||||
|
||||
@@ -47,10 +47,10 @@ void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, std::span<u8> value, co
|
||||
bool should_invalidate_cache = false;
|
||||
for (u32 offset = 0; offset < size; ++offset)
|
||||
{
|
||||
u8 old_value = PowerPC::MMU::HostRead_U8(guard, address + offset);
|
||||
u8 old_value = PowerPC::MMU::HostRead<u8>(guard, address + offset);
|
||||
if (old_value != value[offset])
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U8(guard, value[offset], address + offset);
|
||||
PowerPC::MMU::HostWrite<u8>(guard, value[offset], address + offset);
|
||||
should_invalidate_cache = true;
|
||||
if (store_existing_value)
|
||||
value[offset] = old_value;
|
||||
@@ -245,7 +245,7 @@ Common::Debug::Threads PPCDebugInterface::GetThreads(const Core::CPUThreadGuard&
|
||||
constexpr u32 ACTIVE_QUEUE_HEAD_ADDR = 0x800000dc;
|
||||
if (!PowerPC::MMU::HostIsRAMAddress(guard, ACTIVE_QUEUE_HEAD_ADDR))
|
||||
return threads;
|
||||
const u32 active_queue_head = PowerPC::MMU::HostRead_U32(guard, ACTIVE_QUEUE_HEAD_ADDR);
|
||||
const u32 active_queue_head = PowerPC::MMU::HostRead<u32>(guard, ACTIVE_QUEUE_HEAD_ADDR);
|
||||
if (!PowerPC::MMU::HostIsRAMAddress(guard, active_queue_head))
|
||||
return threads;
|
||||
|
||||
@@ -326,7 +326,7 @@ std::string PPCDebugInterface::GetRawMemoryString(const Core::CPUThreadGuard& gu
|
||||
|
||||
u32 PPCDebugInterface::ReadMemory(const Core::CPUThreadGuard& guard, u32 address) const
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U32(guard, address);
|
||||
return PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
}
|
||||
|
||||
u32 PPCDebugInterface::ReadExtraMemory(const Core::CPUThreadGuard& guard, int memory,
|
||||
@@ -335,7 +335,7 @@ u32 PPCDebugInterface::ReadExtraMemory(const Core::CPUThreadGuard& guard, int me
|
||||
switch (memory)
|
||||
{
|
||||
case 0:
|
||||
return PowerPC::MMU::HostRead_U32(guard, address);
|
||||
return PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
case 1:
|
||||
{
|
||||
const auto& dsp = guard.GetSystem().GetDSP();
|
||||
|
||||
@@ -17,31 +17,32 @@
|
||||
void RSOHeaderView::Load(const Core::CPUThreadGuard& guard, u32 address)
|
||||
{
|
||||
m_address = address;
|
||||
m_header.entry.next_entry = PowerPC::MMU::HostRead_U32(guard, address);
|
||||
m_header.entry.prev_entry = PowerPC::MMU::HostRead_U32(guard, address + 0x04);
|
||||
m_header.entry.section_count = PowerPC::MMU::HostRead_U32(guard, address + 0x08);
|
||||
m_header.entry.section_table_offset = PowerPC::MMU::HostRead_U32(guard, address + 0xC);
|
||||
m_header.entry.name_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x10);
|
||||
m_header.entry.name_size = PowerPC::MMU::HostRead_U32(guard, address + 0x14);
|
||||
m_header.entry.version = PowerPC::MMU::HostRead_U32(guard, address + 0x18);
|
||||
m_header.entry.bss_size = PowerPC::MMU::HostRead_U32(guard, address + 0x1C);
|
||||
m_header.section_info.prolog_section_index = PowerPC::MMU::HostRead_U8(guard, address + 0x20);
|
||||
m_header.section_info.epilog_section_index = PowerPC::MMU::HostRead_U8(guard, address + 0x21);
|
||||
m_header.section_info.unresolved_section_index = PowerPC::MMU::HostRead_U8(guard, address + 0x22);
|
||||
m_header.section_info.bss_section_index = PowerPC::MMU::HostRead_U8(guard, address + 0x23);
|
||||
m_header.section_info.prolog_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x24);
|
||||
m_header.section_info.epilog_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x28);
|
||||
m_header.section_info.unresolved_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x2C);
|
||||
m_header.relocation_tables.internals_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x30);
|
||||
m_header.relocation_tables.internals_size = PowerPC::MMU::HostRead_U32(guard, address + 0x34);
|
||||
m_header.relocation_tables.externals_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x38);
|
||||
m_header.relocation_tables.externals_size = PowerPC::MMU::HostRead_U32(guard, address + 0x3C);
|
||||
m_header.symbol_tables.exports_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x40);
|
||||
m_header.symbol_tables.exports_size = PowerPC::MMU::HostRead_U32(guard, address + 0x44);
|
||||
m_header.symbol_tables.exports_name_table = PowerPC::MMU::HostRead_U32(guard, address + 0x48);
|
||||
m_header.symbol_tables.imports_offset = PowerPC::MMU::HostRead_U32(guard, address + 0x4C);
|
||||
m_header.symbol_tables.imports_size = PowerPC::MMU::HostRead_U32(guard, address + 0x50);
|
||||
m_header.symbol_tables.imports_name_table = PowerPC::MMU::HostRead_U32(guard, address + 0x54);
|
||||
m_header.entry.next_entry = PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
m_header.entry.prev_entry = PowerPC::MMU::HostRead<u32>(guard, address + 0x04);
|
||||
m_header.entry.section_count = PowerPC::MMU::HostRead<u32>(guard, address + 0x08);
|
||||
m_header.entry.section_table_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0xC);
|
||||
m_header.entry.name_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x10);
|
||||
m_header.entry.name_size = PowerPC::MMU::HostRead<u32>(guard, address + 0x14);
|
||||
m_header.entry.version = PowerPC::MMU::HostRead<u32>(guard, address + 0x18);
|
||||
m_header.entry.bss_size = PowerPC::MMU::HostRead<u32>(guard, address + 0x1C);
|
||||
m_header.section_info.prolog_section_index = PowerPC::MMU::HostRead<u8>(guard, address + 0x20);
|
||||
m_header.section_info.epilog_section_index = PowerPC::MMU::HostRead<u8>(guard, address + 0x21);
|
||||
m_header.section_info.unresolved_section_index =
|
||||
PowerPC::MMU::HostRead<u8>(guard, address + 0x22);
|
||||
m_header.section_info.bss_section_index = PowerPC::MMU::HostRead<u8>(guard, address + 0x23);
|
||||
m_header.section_info.prolog_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x24);
|
||||
m_header.section_info.epilog_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x28);
|
||||
m_header.section_info.unresolved_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x2C);
|
||||
m_header.relocation_tables.internals_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x30);
|
||||
m_header.relocation_tables.internals_size = PowerPC::MMU::HostRead<u32>(guard, address + 0x34);
|
||||
m_header.relocation_tables.externals_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x38);
|
||||
m_header.relocation_tables.externals_size = PowerPC::MMU::HostRead<u32>(guard, address + 0x3C);
|
||||
m_header.symbol_tables.exports_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x40);
|
||||
m_header.symbol_tables.exports_size = PowerPC::MMU::HostRead<u32>(guard, address + 0x44);
|
||||
m_header.symbol_tables.exports_name_table = PowerPC::MMU::HostRead<u32>(guard, address + 0x48);
|
||||
m_header.symbol_tables.imports_offset = PowerPC::MMU::HostRead<u32>(guard, address + 0x4C);
|
||||
m_header.symbol_tables.imports_size = PowerPC::MMU::HostRead<u32>(guard, address + 0x50);
|
||||
m_header.symbol_tables.imports_name_table = PowerPC::MMU::HostRead<u32>(guard, address + 0x54);
|
||||
|
||||
// Prevent an invalid name going wild
|
||||
if (m_header.entry.name_size < 0x100)
|
||||
@@ -181,8 +182,8 @@ void RSOSectionsView::Load(const Core::CPUThreadGuard& guard, u32 address, std::
|
||||
for (std::size_t i = 0; i < count; ++i)
|
||||
{
|
||||
RSOSection section;
|
||||
section.offset = PowerPC::MMU::HostRead_U32(guard, address);
|
||||
section.size = PowerPC::MMU::HostRead_U32(guard, address + 4);
|
||||
section.offset = PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
section.size = PowerPC::MMU::HostRead<u32>(guard, address + 4);
|
||||
m_sections.emplace_back(std::move(section));
|
||||
address += sizeof(RSOSection);
|
||||
}
|
||||
@@ -209,9 +210,9 @@ void RSOImportsView::Load(const Core::CPUThreadGuard& guard, u32 address, std::s
|
||||
for (std::size_t i = 0; i < count; ++i)
|
||||
{
|
||||
RSOImport rso_import;
|
||||
rso_import.name_offset = PowerPC::MMU::HostRead_U32(guard, address);
|
||||
rso_import.code_offset = PowerPC::MMU::HostRead_U32(guard, address + 4);
|
||||
rso_import.entry_offset = PowerPC::MMU::HostRead_U32(guard, address + 8);
|
||||
rso_import.name_offset = PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
rso_import.code_offset = PowerPC::MMU::HostRead<u32>(guard, address + 4);
|
||||
rso_import.entry_offset = PowerPC::MMU::HostRead<u32>(guard, address + 8);
|
||||
m_imports.emplace_back(std::move(rso_import));
|
||||
address += sizeof(RSOImport);
|
||||
}
|
||||
@@ -238,10 +239,10 @@ void RSOExportsView::Load(const Core::CPUThreadGuard& guard, u32 address, std::s
|
||||
for (std::size_t i = 0; i < count; ++i)
|
||||
{
|
||||
RSOExport rso_export;
|
||||
rso_export.name_offset = PowerPC::MMU::HostRead_U32(guard, address);
|
||||
rso_export.code_offset = PowerPC::MMU::HostRead_U32(guard, address + 4);
|
||||
rso_export.section_index = PowerPC::MMU::HostRead_U32(guard, address + 8);
|
||||
rso_export.hash = PowerPC::MMU::HostRead_U32(guard, address + 12);
|
||||
rso_export.name_offset = PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
rso_export.code_offset = PowerPC::MMU::HostRead<u32>(guard, address + 4);
|
||||
rso_export.section_index = PowerPC::MMU::HostRead<u32>(guard, address + 8);
|
||||
rso_export.hash = PowerPC::MMU::HostRead<u32>(guard, address + 12);
|
||||
m_exports.emplace_back(std::move(rso_export));
|
||||
address += sizeof(RSOExport);
|
||||
}
|
||||
@@ -268,9 +269,9 @@ void RSOInternalsView::Load(const Core::CPUThreadGuard& guard, u32 address, std:
|
||||
for (std::size_t i = 0; i < count; ++i)
|
||||
{
|
||||
RSOInternalsEntry entry;
|
||||
entry.r_offset = PowerPC::MMU::HostRead_U32(guard, address);
|
||||
entry.r_info = PowerPC::MMU::HostRead_U32(guard, address + 4);
|
||||
entry.r_addend = PowerPC::MMU::HostRead_U32(guard, address + 8);
|
||||
entry.r_offset = PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
entry.r_info = PowerPC::MMU::HostRead<u32>(guard, address + 4);
|
||||
entry.r_addend = PowerPC::MMU::HostRead<u32>(guard, address + 8);
|
||||
m_entries.emplace_back(std::move(entry));
|
||||
address += sizeof(RSOInternalsEntry);
|
||||
}
|
||||
@@ -297,9 +298,9 @@ void RSOExternalsView::Load(const Core::CPUThreadGuard& guard, u32 address, std:
|
||||
for (std::size_t i = 0; i < count; ++i)
|
||||
{
|
||||
RSOExternalsEntry entry;
|
||||
entry.r_offset = PowerPC::MMU::HostRead_U32(guard, address);
|
||||
entry.r_info = PowerPC::MMU::HostRead_U32(guard, address + 4);
|
||||
entry.r_addend = PowerPC::MMU::HostRead_U32(guard, address + 8);
|
||||
entry.r_offset = PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
entry.r_info = PowerPC::MMU::HostRead<u32>(guard, address + 4);
|
||||
entry.r_addend = PowerPC::MMU::HostRead<u32>(guard, address + 8);
|
||||
m_entries.emplace_back(std::move(entry));
|
||||
address += sizeof(RSOExternalsEntry);
|
||||
}
|
||||
|
||||
@@ -706,12 +706,12 @@ void FifoPlayer::LoadTextureMemory()
|
||||
|
||||
void FifoPlayer::WriteCP(u32 address, u16 value)
|
||||
{
|
||||
m_system.GetMMU().Write_U16(value, 0xCC000000 | address);
|
||||
m_system.GetMMU().Write<u16>(value, 0xCC000000 | address);
|
||||
}
|
||||
|
||||
void FifoPlayer::WritePI(u32 address, u32 value)
|
||||
{
|
||||
m_system.GetMMU().Write_U32(value, 0xCC003000 | address);
|
||||
m_system.GetMMU().Write<u32>(value, 0xCC003000 | address);
|
||||
}
|
||||
|
||||
void FifoPlayer::FlushWGP()
|
||||
@@ -810,13 +810,13 @@ bool FifoPlayer::ShouldLoadXF(u8 reg)
|
||||
bool FifoPlayer::IsIdleSet() const
|
||||
{
|
||||
CommandProcessor::UCPStatusReg status =
|
||||
m_system.GetMMU().Read_U16(0xCC000000 | CommandProcessor::STATUS_REGISTER);
|
||||
m_system.GetMMU().Read<u16>(0xCC000000 | CommandProcessor::STATUS_REGISTER);
|
||||
return status.CommandIdle;
|
||||
}
|
||||
|
||||
bool FifoPlayer::IsHighWatermarkSet() const
|
||||
{
|
||||
CommandProcessor::UCPStatusReg status =
|
||||
m_system.GetMMU().Read_U16(0xCC000000 | CommandProcessor::STATUS_REGISTER);
|
||||
m_system.GetMMU().Read<u16>(0xCC000000 | CommandProcessor::STATUS_REGISTER);
|
||||
return status.OverflowHiWatermark;
|
||||
}
|
||||
|
||||
@@ -139,17 +139,17 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
||||
|
||||
// Install code handler
|
||||
for (u32 i = 0; i < data.size(); ++i)
|
||||
PowerPC::MMU::HostWrite_U8(guard, data[i], INSTALLER_BASE_ADDRESS + i);
|
||||
PowerPC::MMU::HostWrite<u8>(guard, data[i], INSTALLER_BASE_ADDRESS + i);
|
||||
|
||||
// Patch the code handler to the current system type (Gamecube/Wii)
|
||||
for (u32 h = 0; h < data.length(); h += 4)
|
||||
{
|
||||
// Patch MMIO address
|
||||
if (PowerPC::MMU::HostRead_U32(guard, INSTALLER_BASE_ADDRESS + h) ==
|
||||
if (PowerPC::MMU::HostRead<u32>(guard, INSTALLER_BASE_ADDRESS + h) ==
|
||||
(0x3f000000u | ((mmio_addr ^ 1) << 8)))
|
||||
{
|
||||
NOTICE_LOG_FMT(ACTIONREPLAY, "Patching MMIO access at {:08x}", INSTALLER_BASE_ADDRESS + h);
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x3f000000u | mmio_addr << 8, INSTALLER_BASE_ADDRESS + h);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x3f000000u | mmio_addr << 8, INSTALLER_BASE_ADDRESS + h);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,11 +159,11 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
||||
|
||||
// Write a magic value to 'gameid' (codehandleronly does not actually read this).
|
||||
// This value will be read back and modified over time by HLE_Misc::GeckoCodeHandlerICacheFlush.
|
||||
PowerPC::MMU::HostWrite_U32(guard, MAGIC_GAMEID, INSTALLER_BASE_ADDRESS);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, MAGIC_GAMEID, INSTALLER_BASE_ADDRESS);
|
||||
|
||||
// Create GCT in memory
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x00d0c0de, codelist_base_address);
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x00d0c0de, codelist_base_address + 4);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x00d0c0de, codelist_base_address);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x00d0c0de, codelist_base_address + 4);
|
||||
|
||||
// Each code is 8 bytes (2 words) wide. There is a starter code and an end code.
|
||||
const u32 start_address = codelist_base_address + CODE_SIZE;
|
||||
@@ -186,8 +186,8 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
||||
|
||||
for (const GeckoCode::Code& code : active_code.codes)
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U32(guard, code.address, next_address);
|
||||
PowerPC::MMU::HostWrite_U32(guard, code.data, next_address + 4);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, code.address, next_address);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, code.data, next_address + 4);
|
||||
next_address += CODE_SIZE;
|
||||
}
|
||||
}
|
||||
@@ -196,12 +196,12 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
||||
end_address - start_address);
|
||||
|
||||
// Stop code. Tells the handler that this is the end of the list.
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0xF0000000, next_address);
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0x00000000, next_address + 4);
|
||||
PowerPC::MMU::HostWrite_U32(guard, 0, HLE_TRAMPOLINE_ADDRESS);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0xF0000000, next_address);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0x00000000, next_address + 4);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, 0, HLE_TRAMPOLINE_ADDRESS);
|
||||
|
||||
// Turn on codes
|
||||
PowerPC::MMU::HostWrite_U8(guard, 1, INSTALLER_BASE_ADDRESS + 7);
|
||||
PowerPC::MMU::HostWrite<u8>(guard, 1, INSTALLER_BASE_ADDRESS + 7);
|
||||
|
||||
// Invalidate the icache and any asm codes
|
||||
auto& ppc_state = guard.GetSystem().GetPPCState();
|
||||
@@ -271,18 +271,18 @@ void RunCodeHandler(const Core::CPUThreadGuard& guard)
|
||||
ppc_state.gpr[1] -= 8; // Fake stack frame for codehandler
|
||||
ppc_state.gpr[1] &= 0xFFFFFFF0; // Align stack to 16bytes
|
||||
u32 SP = ppc_state.gpr[1]; // Stack Pointer
|
||||
PowerPC::MMU::HostWrite_U32(guard, SP + 8, SP);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, SP + 8, SP);
|
||||
// SP + 4 is reserved for the codehandler to save LR to the stack.
|
||||
PowerPC::MMU::HostWrite_U32(guard, SFP, SP + 8); // Real stack frame
|
||||
PowerPC::MMU::HostWrite_U32(guard, ppc_state.pc, SP + 12);
|
||||
PowerPC::MMU::HostWrite_U32(guard, LR(ppc_state), SP + 16);
|
||||
PowerPC::MMU::HostWrite_U32(guard, ppc_state.cr.Get(), SP + 20);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, SFP, SP + 8); // Real stack frame
|
||||
PowerPC::MMU::HostWrite<u32>(guard, ppc_state.pc, SP + 12);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, LR(ppc_state), SP + 16);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, ppc_state.cr.Get(), SP + 20);
|
||||
// Registers FPR0->13 are volatile
|
||||
for (u32 i = 0; i < 14; ++i)
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U64(guard, ppc_state.ps[i].PS0AsU64(), SP + 24 + 2 * i * sizeof(u64));
|
||||
PowerPC::MMU::HostWrite_U64(guard, ppc_state.ps[i].PS1AsU64(),
|
||||
SP + 24 + (2 * i + 1) * sizeof(u64));
|
||||
PowerPC::MMU::HostWrite<u64>(guard, ppc_state.ps[i].PS0AsU64(), SP + 24 + 2 * i * sizeof(u64));
|
||||
PowerPC::MMU::HostWrite<u64>(guard, ppc_state.ps[i].PS1AsU64(),
|
||||
SP + 24 + (2 * i + 1) * sizeof(u64));
|
||||
}
|
||||
DEBUG_LOG_FMT(ACTIONREPLAY,
|
||||
"GeckoCodes: Initiating phantom branch-and-link. "
|
||||
|
||||
@@ -44,7 +44,7 @@ void GeckoCodeHandlerICacheFlush(const Core::CPUThreadGuard& guard)
|
||||
// been read into memory, or such, so we do the first 5 frames. More
|
||||
// robust alternative would be to actually detect memory writes, but that
|
||||
// would be even uglier.)
|
||||
u32 gch_gameid = PowerPC::MMU::HostRead_U32(guard, Gecko::INSTALLER_BASE_ADDRESS);
|
||||
u32 gch_gameid = PowerPC::MMU::HostRead<u32>(guard, Gecko::INSTALLER_BASE_ADDRESS);
|
||||
if (gch_gameid - Gecko::MAGIC_GAMEID == 5)
|
||||
{
|
||||
return;
|
||||
@@ -53,7 +53,7 @@ void GeckoCodeHandlerICacheFlush(const Core::CPUThreadGuard& guard)
|
||||
{
|
||||
gch_gameid = Gecko::MAGIC_GAMEID;
|
||||
}
|
||||
PowerPC::MMU::HostWrite_U32(guard, gch_gameid + 1, Gecko::INSTALLER_BASE_ADDRESS);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, gch_gameid + 1, Gecko::INSTALLER_BASE_ADDRESS);
|
||||
|
||||
ppc_state.iCache.Reset(jit_interface);
|
||||
}
|
||||
@@ -69,14 +69,15 @@ void GeckoReturnTrampoline(const Core::CPUThreadGuard& guard)
|
||||
|
||||
// Stack frame is built in GeckoCode.cpp, Gecko::RunCodeHandler.
|
||||
const u32 SP = ppc_state.gpr[1];
|
||||
ppc_state.gpr[1] = PowerPC::MMU::HostRead_U32(guard, SP + 8);
|
||||
ppc_state.npc = PowerPC::MMU::HostRead_U32(guard, SP + 12);
|
||||
LR(ppc_state) = PowerPC::MMU::HostRead_U32(guard, SP + 16);
|
||||
ppc_state.cr.Set(PowerPC::MMU::HostRead_U32(guard, SP + 20));
|
||||
ppc_state.gpr[1] = PowerPC::MMU::HostRead<u32>(guard, SP + 8);
|
||||
ppc_state.npc = PowerPC::MMU::HostRead<u32>(guard, SP + 12);
|
||||
LR(ppc_state) = PowerPC::MMU::HostRead<u32>(guard, SP + 16);
|
||||
ppc_state.cr.Set(PowerPC::MMU::HostRead<u32>(guard, SP + 20));
|
||||
for (int i = 0; i < 14; ++i)
|
||||
{
|
||||
ppc_state.ps[i].SetBoth(PowerPC::MMU::HostRead_U64(guard, SP + 24 + 2 * i * sizeof(u64)),
|
||||
PowerPC::MMU::HostRead_U64(guard, SP + 24 + (2 * i + 1) * sizeof(u64)));
|
||||
ppc_state.ps[i].SetBoth(
|
||||
PowerPC::MMU::HostRead<u64>(guard, SP + 24 + 2 * i * sizeof(u64)),
|
||||
PowerPC::MMU::HostRead<u64>(guard, SP + 24 + (2 * i + 1) * sizeof(u64)));
|
||||
}
|
||||
}
|
||||
} // namespace HLE_Misc
|
||||
|
||||
@@ -62,8 +62,9 @@ static void HLE_GeneralDebugPrint(const Core::CPUThreadGuard& guard, ParameterTy
|
||||
|
||||
// Is gpr3 pointing to a pointer (including nullptr) rather than an ASCII string
|
||||
if (PowerPC::MMU::HostIsRAMAddress(guard, ppc_state.gpr[3]) &&
|
||||
(PowerPC::MMU::HostIsRAMAddress(guard, PowerPC::MMU::HostRead_U32(guard, ppc_state.gpr[3])) ||
|
||||
PowerPC::MMU::HostRead_U32(guard, ppc_state.gpr[3]) == 0))
|
||||
(PowerPC::MMU::HostIsRAMAddress(guard,
|
||||
PowerPC::MMU::HostRead<u32>(guard, ppc_state.gpr[3])) ||
|
||||
PowerPC::MMU::HostRead<u32>(guard, ppc_state.gpr[3]) == 0))
|
||||
{
|
||||
if (PowerPC::MMU::HostIsRAMAddress(guard, ppc_state.gpr[4]))
|
||||
{
|
||||
@@ -117,7 +118,7 @@ void HLE_write_console(const Core::CPUThreadGuard& guard)
|
||||
std::string report_message = GetStringVA(system, guard, 4);
|
||||
if (PowerPC::MMU::HostIsRAMAddress(guard, ppc_state.gpr[5]))
|
||||
{
|
||||
const u32 size = system.GetMMU().Read_U32(ppc_state.gpr[5]);
|
||||
const u32 size = system.GetMMU().Read<u32>(ppc_state.gpr[5]);
|
||||
if (size > report_message.size())
|
||||
WARN_LOG_FMT(OSREPORT_HLE, "__write_console uses an invalid size of {:#010x}", size);
|
||||
else if (size == 0)
|
||||
@@ -178,12 +179,12 @@ static void HLE_LogFPrint(const Core::CPUThreadGuard& guard, ParameterType param
|
||||
PowerPC::MMU::HostIsRAMAddress(guard, ppc_state.gpr[3] + 0xF))
|
||||
{
|
||||
// The fd is stored as a short at FILE+0xE.
|
||||
fd = static_cast<short>(PowerPC::MMU::HostRead_U16(guard, ppc_state.gpr[3] + 0xE));
|
||||
fd = static_cast<short>(PowerPC::MMU::HostRead<u16>(guard, ppc_state.gpr[3] + 0xE));
|
||||
}
|
||||
if (fd != 1 && fd != 2)
|
||||
{
|
||||
// On RVL SDK it seems stored at FILE+0x2.
|
||||
fd = static_cast<short>(PowerPC::MMU::HostRead_U16(guard, ppc_state.gpr[3] + 0x2));
|
||||
fd = static_cast<short>(PowerPC::MMU::HostRead<u16>(guard, ppc_state.gpr[3] + 0x2));
|
||||
}
|
||||
if (fd != 1 && fd != 2)
|
||||
return;
|
||||
|
||||
@@ -21,10 +21,10 @@ double HLE::SystemVABI::VAList::GetFPR(u32 fpr) const
|
||||
}
|
||||
|
||||
HLE::SystemVABI::VAListStruct::VAListStruct(const Core::CPUThreadGuard& guard, u32 address)
|
||||
: VAList(guard, 0), m_va_list{PowerPC::MMU::HostRead_U8(guard, address),
|
||||
PowerPC::MMU::HostRead_U8(guard, address + 1),
|
||||
PowerPC::MMU::HostRead_U32(guard, address + 4),
|
||||
PowerPC::MMU::HostRead_U32(guard, address + 8)},
|
||||
: VAList(guard, 0), m_va_list{PowerPC::MMU::HostRead<u8>(guard, address),
|
||||
PowerPC::MMU::HostRead<u8>(guard, address + 1),
|
||||
PowerPC::MMU::HostRead<u32>(guard, address + 4),
|
||||
PowerPC::MMU::HostRead<u32>(guard, address + 8)},
|
||||
m_address(address), m_has_fpr_area(guard.GetSystem().GetPPCState().cr.GetBit(6) == 1)
|
||||
{
|
||||
m_stack = m_va_list.overflow_arg_area;
|
||||
@@ -50,7 +50,7 @@ u32 HLE::SystemVABI::VAListStruct::GetGPR(u32 gpr) const
|
||||
return 0;
|
||||
}
|
||||
const u32 gpr_address = Common::AlignUp(GetGPRArea() + 4 * (gpr - 3), 4);
|
||||
return PowerPC::MMU::HostRead_U32(m_guard, gpr_address);
|
||||
return PowerPC::MMU::HostRead<u32>(m_guard, gpr_address);
|
||||
}
|
||||
|
||||
double HLE::SystemVABI::VAListStruct::GetFPR(u32 fpr) const
|
||||
@@ -61,5 +61,5 @@ double HLE::SystemVABI::VAListStruct::GetFPR(u32 fpr) const
|
||||
return 0.0;
|
||||
}
|
||||
const u32 fpr_address = Common::AlignUp(GetFPRArea() + 8 * (fpr - 1), 8);
|
||||
return PowerPC::MMU::HostRead_F64(m_guard, fpr_address);
|
||||
return PowerPC::MMU::HostRead<double>(m_guard, fpr_address);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
for (size_t i = 0; i < sizeof(T); i += 1, addr += 1)
|
||||
{
|
||||
reinterpret_cast<u8*>(&obj)[i] = PowerPC::MMU::HostRead_U8(m_guard, addr);
|
||||
reinterpret_cast<u8*>(&obj)[i] = PowerPC::MMU::HostRead<u8>(m_guard, addr);
|
||||
}
|
||||
|
||||
return obj;
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
else
|
||||
{
|
||||
m_stack = Common::AlignUp(m_stack, 4);
|
||||
value = PowerPC::MMU::HostRead_U32(m_guard, m_stack);
|
||||
value = PowerPC::MMU::HostRead<u32>(m_guard, m_stack);
|
||||
m_stack += 4;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
else
|
||||
{
|
||||
m_stack = Common::AlignUp(m_stack, 8);
|
||||
value = PowerPC::MMU::HostRead_U64(m_guard, m_stack);
|
||||
value = PowerPC::MMU::HostRead<u64>(m_guard, m_stack);
|
||||
m_stack += 8;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
else
|
||||
{
|
||||
m_stack = Common::AlignUp(m_stack, 8);
|
||||
value = PowerPC::MMU::HostRead_F64(m_guard, m_stack);
|
||||
value = PowerPC::MMU::HostRead<double>(m_guard, m_stack);
|
||||
m_stack += 8;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,39 +87,39 @@ struct EffectiveAddressSpaceAccessors : Accessors
|
||||
}
|
||||
u8 ReadU8(const Core::CPUThreadGuard& guard, u32 address) const override
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U8(guard, address);
|
||||
return PowerPC::MMU::HostRead<u8>(guard, address);
|
||||
}
|
||||
void WriteU8(const Core::CPUThreadGuard& guard, u32 address, u8 value) override
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U8(guard, value, address);
|
||||
PowerPC::MMU::HostWrite<u8>(guard, value, address);
|
||||
}
|
||||
u16 ReadU16(const Core::CPUThreadGuard& guard, u32 address) const override
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U16(guard, address);
|
||||
return PowerPC::MMU::HostRead<u16>(guard, address);
|
||||
}
|
||||
void WriteU16(const Core::CPUThreadGuard& guard, u32 address, u16 value) override
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U16(guard, value, address);
|
||||
PowerPC::MMU::HostWrite<u16>(guard, value, address);
|
||||
}
|
||||
u32 ReadU32(const Core::CPUThreadGuard& guard, u32 address) const override
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U32(guard, address);
|
||||
return PowerPC::MMU::HostRead<u32>(guard, address);
|
||||
}
|
||||
void WriteU32(const Core::CPUThreadGuard& guard, u32 address, u32 value) override
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U32(guard, value, address);
|
||||
PowerPC::MMU::HostWrite<u32>(guard, value, address);
|
||||
}
|
||||
u64 ReadU64(const Core::CPUThreadGuard& guard, u32 address) const override
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U64(guard, address);
|
||||
return PowerPC::MMU::HostRead<u64>(guard, address);
|
||||
}
|
||||
void WriteU64(const Core::CPUThreadGuard& guard, u32 address, u64 value) override
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U64(guard, value, address);
|
||||
PowerPC::MMU::HostWrite<u64>(guard, value, address);
|
||||
}
|
||||
float ReadF32(const Core::CPUThreadGuard& guard, u32 address) const override
|
||||
{
|
||||
return PowerPC::MMU::HostRead_F32(guard, address);
|
||||
return PowerPC::MMU::HostRead<float>(guard, address);
|
||||
}
|
||||
|
||||
bool Matches(const Core::CPUThreadGuard& guard, u32 haystack_start, const u8* needle_start,
|
||||
|
||||
@@ -72,7 +72,7 @@ u32 MemoryWatcher::ChasePointer(const Core::CPUThreadGuard& guard, const std::st
|
||||
u32 value = 0;
|
||||
for (u32 offset : m_addresses[line])
|
||||
{
|
||||
value = PowerPC::MMU::HostRead_U32(guard, value + offset);
|
||||
value = PowerPC::MMU::HostRead<u32>(guard, value + offset);
|
||||
if (!PowerPC::MMU::HostIsRAMAddress(guard, value))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -230,20 +230,20 @@ static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector<Pa
|
||||
{
|
||||
case PatchType::Patch8Bit:
|
||||
if (!entry.conditional ||
|
||||
PowerPC::MMU::HostRead_U8(guard, addr) == static_cast<u8>(comparand))
|
||||
PowerPC::MMU::HostRead<u8>(guard, addr) == static_cast<u8>(comparand))
|
||||
{
|
||||
ApplyMemoryPatch<u8>(guard, static_cast<u8>(value), addr);
|
||||
}
|
||||
break;
|
||||
case PatchType::Patch16Bit:
|
||||
if (!entry.conditional ||
|
||||
PowerPC::MMU::HostRead_U16(guard, addr) == static_cast<u16>(comparand))
|
||||
PowerPC::MMU::HostRead<u16>(guard, addr) == static_cast<u16>(comparand))
|
||||
{
|
||||
ApplyMemoryPatch<u16>(guard, static_cast<u16>(value), addr);
|
||||
}
|
||||
break;
|
||||
case PatchType::Patch32Bit:
|
||||
if (!entry.conditional || PowerPC::MMU::HostRead_U32(guard, addr) == comparand)
|
||||
if (!entry.conditional || PowerPC::MMU::HostRead<u32>(guard, addr) == comparand)
|
||||
ApplyMemoryPatch<u32>(guard, value, addr);
|
||||
break;
|
||||
default:
|
||||
@@ -280,7 +280,7 @@ static bool IsStackValid(const Core::CPUThreadGuard& guard)
|
||||
return false;
|
||||
|
||||
// Read the frame pointer from the stack (find 2nd frame from top), assert that it makes sense
|
||||
const u32 next_SP = PowerPC::MMU::HostRead_U32(guard, SP);
|
||||
const u32 next_SP = PowerPC::MMU::HostRead<u32>(guard, SP);
|
||||
if (next_SP <= SP || !PowerPC::MMU::HostIsRAMAddress(guard, next_SP) ||
|
||||
!PowerPC::MMU::HostIsRAMAddress(guard, next_SP + 4))
|
||||
{
|
||||
@@ -288,7 +288,7 @@ static bool IsStackValid(const Core::CPUThreadGuard& guard)
|
||||
}
|
||||
|
||||
// Check the link register makes sense (that it points to a valid IBAT address)
|
||||
const u32 address = PowerPC::MMU::HostRead_U32(guard, next_SP + 4);
|
||||
const u32 address = PowerPC::MMU::HostRead<u32>(guard, next_SP + 4);
|
||||
return PowerPC::MMU::HostIsInstructionRAMAddress(guard, address) &&
|
||||
0 != PowerPC::MMU::HostRead_Instruction(guard, address);
|
||||
}
|
||||
|
||||
@@ -35,57 +35,15 @@ using std::isnan;
|
||||
#include "Core/System.h"
|
||||
|
||||
template <typename T>
|
||||
static T HostRead(const Core::CPUThreadGuard& guard, u32 address);
|
||||
static T HostRead(const Core::CPUThreadGuard& guard, u32 address)
|
||||
{
|
||||
return PowerPC::MMU::HostRead<T>(guard, address);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void HostWrite(const Core::CPUThreadGuard& guard, T var, u32 address);
|
||||
|
||||
template <>
|
||||
u8 HostRead(const Core::CPUThreadGuard& guard, u32 address)
|
||||
static void HostWrite(const Core::CPUThreadGuard& guard, T var, u32 address)
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U8(guard, address);
|
||||
}
|
||||
|
||||
template <>
|
||||
u16 HostRead(const Core::CPUThreadGuard& guard, u32 address)
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U16(guard, address);
|
||||
}
|
||||
|
||||
template <>
|
||||
u32 HostRead(const Core::CPUThreadGuard& guard, u32 address)
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U32(guard, address);
|
||||
}
|
||||
|
||||
template <>
|
||||
u64 HostRead(const Core::CPUThreadGuard& guard, u32 address)
|
||||
{
|
||||
return PowerPC::MMU::HostRead_U64(guard, address);
|
||||
}
|
||||
|
||||
template <>
|
||||
void HostWrite(const Core::CPUThreadGuard& guard, u8 var, u32 address)
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U8(guard, var, address);
|
||||
}
|
||||
|
||||
template <>
|
||||
void HostWrite(const Core::CPUThreadGuard& guard, u16 var, u32 address)
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U16(guard, var, address);
|
||||
}
|
||||
|
||||
template <>
|
||||
void HostWrite(const Core::CPUThreadGuard& guard, u32 var, u32 address)
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U32(guard, var, address);
|
||||
}
|
||||
|
||||
template <>
|
||||
void HostWrite(const Core::CPUThreadGuard& guard, u64 var, u32 address)
|
||||
{
|
||||
PowerPC::MMU::HostWrite_U64(guard, var, address);
|
||||
PowerPC::MMU::HostWrite<T>(guard, var, address);
|
||||
}
|
||||
|
||||
template <typename T, typename U = T>
|
||||
|
||||
@@ -293,7 +293,7 @@ void Interpreter::unknown_instruction(Interpreter& interpreter, UGeckoInstructio
|
||||
Core::CPUThreadGuard guard(system);
|
||||
|
||||
const u32 last_pc = interpreter.m_last_pc;
|
||||
const u32 opcode = PowerPC::MMU::HostRead_U32(guard, last_pc);
|
||||
const u32 opcode = PowerPC::MMU::HostRead<u32>(guard, last_pc);
|
||||
const std::string disasm = Common::GekkoDisassembler::Disassemble(opcode, last_pc);
|
||||
NOTICE_LOG_FMT(POWERPC, "Last PC = {:08x} : {}", last_pc, disasm);
|
||||
Dolphin_Debugger::PrintCallstack(guard, Common::Log::LogType::POWERPC,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user