1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

PPU Analyser: better constraints for SPRX

This commit is contained in:
Nekotekina 2021-01-28 21:32:26 +03:00
parent c89362f6a2
commit d5f16ce272
3 changed files with 14 additions and 4 deletions

View File

@ -529,11 +529,15 @@ namespace ppu_patterns
}; };
} }
void ppu_module::analyse(u32 lib_toc, u32 entry) void ppu_module::analyse(u32 lib_toc, u32 entry, u32 end)
{ {
// Assume first segment is executable // Assume first segment is executable
const u32 start = segs[0].addr; const u32 start = segs[0].addr;
const u32 end = segs[0].addr + segs[0].size;
if (end == umax)
{
end = segs[0].addr + segs[0].size;
}
// Known TOCs (usually only 1) // Known TOCs (usually only 1)
std::unordered_set<u32> TOCs; std::unordered_set<u32> TOCs;
@ -1565,6 +1569,12 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
block.size = size; block.size = size;
block.toc = func.toc; block.toc = func.toc;
ppu_log.trace("Block __0x%x added (func=0x%x, size=0x%x, toc=0x%x)", block.addr, _, block.size, block.toc); ppu_log.trace("Block __0x%x added (func=0x%x, size=0x%x, toc=0x%x)", block.addr, _, block.size, block.toc);
if (!entry)
{
// Workaround for SPRX: update end to the last found function
end = block.addr + block.size;
}
} }
} }

View File

@ -89,7 +89,7 @@ struct ppu_module
secs = info.secs; secs = info.secs;
} }
void analyse(u32 lib_toc, u32 entry); void analyse(u32 lib_toc, u32 entry, u32 end = -1);
void validate(u32 reloc); void validate(u32 reloc);
}; };

View File

@ -1058,7 +1058,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
prx->specials = ppu_load_exports(link, lib_info->exports_start, lib_info->exports_end); prx->specials = ppu_load_exports(link, lib_info->exports_start, lib_info->exports_end);
prx->imports = ppu_load_imports(prx->relocs, link, lib_info->imports_start, lib_info->imports_end); prx->imports = ppu_load_imports(prx->relocs, link, lib_info->imports_start, lib_info->imports_end);
std::stable_sort(prx->relocs.begin(), prx->relocs.end()); std::stable_sort(prx->relocs.begin(), prx->relocs.end());
prx->analyse(lib_info->toc, 0); prx->analyse(lib_info->toc, 0, std::min<u32>(lib_info.addr(), prx->segs[0].addr + prx->segs[0].size));
} }
else else
{ {