Various small cleanups and logs

This commit is contained in:
Maschell 2022-01-21 18:52:58 +01:00
parent 0f069ac840
commit 124b73a5fe
2 changed files with 8 additions and 4 deletions

View File

@ -114,7 +114,8 @@ extern "C" int _start(int argc, char **argv) {
if (memory_end == memory_start) {
break;
}
free(&memory_end[1]);
auto mem_ptr = &memory_end[1]; // &memory_end + sizeof(MEMExpHeapBlock);
free(mem_ptr);
leak_count++;
}
OSReport("Freed %d leaked memory blocks\n", leak_count);
@ -208,7 +209,7 @@ bool doRelocation(const std::vector<RelocationData> &relocData, relocation_tramp
std::string functionName = cur.getName();
std::string rplName = cur.getImportRPLInformation().getName();
int32_t isData = cur.getImportRPLInformation().isData();
OSDynLoad_Module rplHandle = 0;
OSDynLoad_Module rplHandle = nullptr;
OSDynLoad_Acquire(rplName.c_str(), &rplHandle);
uint32_t functionAddress = 0;
@ -246,7 +247,6 @@ void SplashScreen(const char *message, int32_t durationInMs) {
OSScreenPutFontEx(SCREEN_TV, 0, 0, message);
OSScreenPutFontEx(SCREEN_DRC, 0, 0, message);
OSScreenFlipBuffersEx(SCREEN_TV);
OSScreenFlipBuffersEx(SCREEN_DRC);

View File

@ -38,7 +38,7 @@ ModuleDataFactory::load(const std::string &path, uint32_t destination_address, u
uint32_t sec_num = reader.sections.size();
auto **destinations = (uint8_t **) malloc(sizeof(uint8_t * ) * sec_num);
auto **destinations = (uint8_t **) malloc(sizeof(uint8_t *) * sec_num);
uint32_t sizeOfModule = 0;
for (uint32_t i = 0; i < sec_num; ++i) {
@ -116,7 +116,9 @@ ModuleDataFactory::load(const std::string &path, uint32_t destination_address, u
}
totalSize += sectionSize;
DEBUG_FUNCTION_LINE("DCFlushRange %08X - %08X", destination, destination + sectionSize);
DCFlushRange((void *) destination, sectionSize);
DEBUG_FUNCTION_LINE("ICInvalidateRange %08X - %08X", destination, destination + sectionSize);
ICInvalidateRange((void *) destination, sectionSize);
}
}
@ -138,7 +140,9 @@ 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);
free(destinations);