From aaf9a1a082ea7113fea44ea899406e6cca52580a Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 26 Dec 2020 15:52:06 +0100 Subject: [PATCH] Add sCheckDataRange hook to allow loading .rpl files into our memory region via OSDynload_Acquire (and a custom allocator) --- source/function_replacements.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/function_replacements.cpp b/source/function_replacements.cpp index 083b442..b586414 100644 --- a/source/function_replacements.cpp +++ b/source/function_replacements.cpp @@ -12,6 +12,15 @@ DECL_FUNCTION(int32_t, KiEffectiveToPhysical, uint32_t addressSpace, uint32_t vi } + +DECL_FUNCTION(int32_t, sCheckDataRange, uint32_t address, uint32_t maxDataSize) { + if((address & 0xF0000000) == 0x80000000){ + return 1; + } + + return real_sCheckDataRange(address, maxDataSize); +} + DECL_FUNCTION(int32_t, KiPhysicalToEffectiveCached, uint32_t addressSpace, uint32_t virtualAddress) { int32_t result = real_KiPhysicalToEffectiveCached(addressSpace, virtualAddress); if (result == 0) { @@ -47,6 +56,7 @@ DECL_FUNCTION(uint32_t, KiIsEffectiveRangeValid, uint32_t addressSpace, uint32_t } function_replacement_data_t function_replacements[] __attribute__((section(".data"))) = { + REPLACE_FUNCTION_VIA_ADDRESS(sCheckDataRange, 0x3200cf60, 0x0100cf60), REPLACE_FUNCTION_VIA_ADDRESS(KiEffectiveToPhysical, 0xffee0aac, 0xffee0aac), REPLACE_FUNCTION_VIA_ADDRESS(KiPhysicalToEffectiveCached, 0xffee0a3c, 0xffee0a3c), REPLACE_FUNCTION_VIA_ADDRESS(KiPhysicalToEffectiveUncached, 0xffee0a80, 0xffee0a80),