Skip to content

Commit

Permalink
Fix flushing the correct addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Jun 16, 2023
1 parent d950ea9 commit 3e42af8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/module/ModuleDataFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3e42af8

Please sign in to comment.