diff --git a/source/function_replacements.cpp b/source/function_replacements.cpp index 128a2f0..fdb767f 100644 --- a/source/function_replacements.cpp +++ b/source/function_replacements.cpp @@ -11,7 +11,7 @@ DECL_FUNCTION(uint32_t, KiEffectiveToPhysical, uint32_t addressSpace, uint32_t v } DECL_FUNCTION(int32_t, sCheckDataRange, uint32_t address, uint32_t maxDataSize) { - if ((address & 0xF0000000) == 0x80000000) { + if ((address & 0xF0000000) == (MEMORY_START_BASE & 0xF0000000)) { return 1; } diff --git a/source/memory_mapping.cpp b/source/memory_mapping.cpp index f7f3201..cae6572 100644 --- a/source/memory_mapping.cpp +++ b/source/memory_mapping.cpp @@ -26,10 +26,15 @@ void runOnAllCores(CThread::Callback callback, void *callbackArg, int32_t iAttr void writeKernelNOPs(CThread *thread, void *arg) { DEBUG_FUNCTION_LINE_VERBOSE("Writing kernel NOPs on core %d", OSGetThreadAffinity(OSGetCurrentThread()) / 2); - // Patch out any writes to SR8 - KernelNOPAtPhysicalAddress(0xFFF1D754); - KernelNOPAtPhysicalAddress(0xFFF1D64C); - KernelNOPAtPhysicalAddress(0xFFE00638); + // Patch out any writes to SR + int sr = MEMORY_START_BASE >> 28; + KernelNOPAtPhysicalAddress(0xfff1d734 + 0x4 * sr); + if (sr < 7) { + KernelNOPAtPhysicalAddress(0xfff1d604 + 0x4 * sr); + } else { + KernelNOPAtPhysicalAddress(0xfff1d648 + 0x4 * (sr - 7)); + } + KernelNOPAtPhysicalAddress(0xffe00618 + 0x4 * sr); // nop out branches to app panic 0x17 KernelNOPAtPhysicalAddress(0xfff01db0);