mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-10 21:40:43 +00:00
PPU LLVM: Function table dependent resolver hashing
This commit is contained in:
parent
c443326fb1
commit
0b784ff2c1
@ -1449,6 +1449,8 @@ static usz apply_modification(std::vector<u32>& applied, patch_engine::patch_inf
|
||||
|
||||
void patch_engine::apply(std::vector<u32>& applied_total, const std::string& name, std::function<u8*(u32, u32)> mem_translate, u32 filesz, u32 min_addr)
|
||||
{
|
||||
applied_total.clear();
|
||||
|
||||
if (!m_map.contains(name))
|
||||
{
|
||||
return;
|
||||
@ -1597,6 +1599,9 @@ void patch_engine::apply(std::vector<u32>& applied_total, const std::string& nam
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure consistent order
|
||||
std::sort(applied_total.begin(), applied_total.end());
|
||||
}
|
||||
|
||||
void patch_engine::unload(const std::string& name)
|
||||
|
@ -96,6 +96,7 @@ struct ppu_module : public Type
|
||||
std::vector<ppu_segment> segs{};
|
||||
std::vector<ppu_segment> secs{};
|
||||
std::vector<ppu_function> funcs{};
|
||||
std::vector<u32> applied_patches;
|
||||
std::deque<std::shared_ptr<void>> allocations;
|
||||
std::map<u32, u32> addr_to_seg_index;
|
||||
|
||||
@ -185,7 +186,6 @@ struct main_ppu_module : public ppu_module<T>
|
||||
{
|
||||
u32 elf_entry{};
|
||||
u32 seg0_code_end{};
|
||||
std::vector<u32> applied_patches;
|
||||
|
||||
// Disable inherited savestate ordering
|
||||
void save(utils::serial&) = delete;
|
||||
|
@ -1947,6 +1947,7 @@ shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, bool virtual_load, c
|
||||
ppu_check_patch_spu_images(*prx, seg);
|
||||
}
|
||||
|
||||
prx->applied_patches = applied;
|
||||
prx->analyse(toc, 0, end, applied, exported_funcs);
|
||||
|
||||
if (!ar && !virtual_load)
|
||||
|
@ -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;
|
||||
|
@ -11,7 +11,6 @@ struct lv2_overlay final : ppu_module<lv2_obj>
|
||||
|
||||
u32 entry{};
|
||||
u32 seg0_code_end{};
|
||||
std::vector<u32> applied_patches;
|
||||
|
||||
lv2_overlay() = default;
|
||||
lv2_overlay(utils::serial&){}
|
||||
|
Loading…
x
Reference in New Issue
Block a user