PPU LLVM: Function table dependent resolver hashing

This commit is contained in:
Elad
2025-01-07 13:41:41 +02:00
parent c443326fb1
commit 0b784ff2c1
5 changed files with 26 additions and 2 deletions
+19
View File
@@ -4898,6 +4898,25 @@ bool ppu_initialize(const ppu_module<lv2_obj>& info, bool check_only, u64 file_s
sha1_update(&ctx, ensure(info.get_ptr<const u8>(func.addr)), func.size);
}
if (!workload.empty() && fpos >= info.funcs.size())
{
// Hash the entire function grouped addresses for the integrity of the symbol resolver function
// Potentially occuring during patches
// Avoid doing it for files with a single module such as most PRX
std::vector<be_t<u32>> addrs(info.funcs.size() + 1);
usz addr_index = 0;
for (const ppu_function& func : info.funcs)
{
addrs[addr_index++] = func.addr - reloc;
}
addrs.back() = ::size32(info.funcs);
sha1_update(&ctx, reinterpret_cast<const u8*>(addrs.data()), addrs.size() * sizeof(be_t<u32>));
}
if (false)
{
const be_t<u64> forced_upd = 3;