From 3e42af85fa85dacb361b01e76772024503d2fcc5 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 16 Jun 2023 16:59:37 +0200 Subject: [PATCH] Fix flushing the correct addresses --- src/module/ModuleDataFactory.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/module/ModuleDataFactory.cpp b/src/module/ModuleDataFactory.cpp index e3b9b32..3c93981 100644 --- a/src/module/ModuleDataFactory.cpp +++ b/src/module/ModuleDataFactory.cpp @@ -74,7 +74,8 @@ ModuleDataFactory::load(const std::string &path, uint32_t destination_address, u return {}; } - uint32_t baseOffset = (destination_address - sizeOfModule) & 0xFFFFFF00; + uint32_t targetAddress = (destination_address - sizeOfModule) & 0xFFFFFF00; + uint32_t baseOffset = targetAddress; uint32_t offset_text = baseOffset; uint32_t offset_data = offset_text; @@ -161,10 +162,10 @@ ModuleDataFactory::load(const std::string &path, uint32_t destination_address, u moduleData.addRelocationData(reloc); } - DEBUG_FUNCTION_LINE("DCFlushRange %08X - %08X", baseOffset, baseOffset + totalSize); - DCFlushRange((void *) baseOffset, totalSize); - DEBUG_FUNCTION_LINE("ICInvalidateRange %08X - %08X", baseOffset, baseOffset + totalSize); - ICInvalidateRange((void *) baseOffset, totalSize); + DEBUG_FUNCTION_LINE("DCFlushRange %08X - %08X", targetAddress, destination_address); + DCFlushRange((void *) targetAddress, destination_address - targetAddress); + DEBUG_FUNCTION_LINE("ICInvalidateRange %08X - %08X", targetAddress, destination_address); + ICInvalidateRange((void *) targetAddress, destination_address - targetAddress); free(destinations); free(buffer);