Permalink
Browse files

Module: Avoid scanning stubs if possible.

In this case, we often scan some garbage, but let's reduce it at least.
  • Loading branch information...
unknownbrackets committed Jan 3, 2018
1 parent 00a05e9 commit 29ed48c32aabe03cb086634b6dd0a26c6a57d7f1
Showing with 12 additions and 1 deletion.
  1. +12 −1 Core/HLE/sceKernelModule.cpp
@@ -1283,7 +1283,18 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 loadAdd
// Some games don't have any sections at all.
if (scan && codeSections.empty()) {
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
u32 scanStart = module->textStart;
u32 scanEnd = module->textEnd;
// Skip the exports and imports sections, they're not code.
if (scanEnd >= std::min(modinfo->libent, modinfo->libstub)) {
MIPSAnalyst::ScanForFunctions(scanStart, std::min(modinfo->libent, modinfo->libstub) - 4, !gotSymbols);
scanStart = std::min(modinfo->libentend, modinfo->libstubend);
}
if (scanEnd >= std::max(modinfo->libent, modinfo->libstub)) {
MIPSAnalyst::ScanForFunctions(scanStart, std::max(modinfo->libent, modinfo->libstub) - 4, !gotSymbols);
scanStart = std::max(modinfo->libentend, modinfo->libstubend);
}
MIPSAnalyst::ScanForFunctions(scanStart, scanEnd, !gotSymbols);
}
}

0 comments on commit 29ed48c

Please sign in to comment.