From 74f2be73078ef90c1950a899275bab1f34811860 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 5 Jul 2017 22:52:02 +0300 Subject: [PATCH] PPU: free prx segments --- rpcs3/Emu/Cell/PPUModule.cpp | 8 ++++++++ rpcs3/Emu/Cell/lv2/sys_prx.cpp | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 53b2b90f3c..c7aff3b97f 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -890,6 +890,14 @@ std::shared_ptr ppu_load_prx(const ppu_prx_object& elf, const std::stri return prx; } +void ppu_unload_prx(const lv2_prx& prx) +{ + for (auto& seg : prx.segs) + { + vm::dealloc(seg.addr, vm::main); + } +} + void ppu_load_exec(const ppu_exec_object& elf) { if (g_cfg.core.hook_functions) diff --git a/rpcs3/Emu/Cell/lv2/sys_prx.cpp b/rpcs3/Emu/Cell/lv2/sys_prx.cpp index bf80f0c0ab..62326d48b8 100644 --- a/rpcs3/Emu/Cell/lv2/sys_prx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_prx.cpp @@ -12,6 +12,7 @@ namespace vm { using namespace ps3; } extern std::shared_ptr ppu_load_prx(const ppu_prx_object&, const std::string&); +extern void ppu_unload_prx(const lv2_prx& prx); extern void ppu_initialize(const ppu_module&); logs::channel sys_prx("sys_prx"); @@ -233,7 +234,7 @@ error_code _sys_prx_unload_module(u32 id, u64 flags, vm::ptraddress); + ppu_unload_prx(*prx); //s32 result = prx->exit ? prx->exit() : CELL_OK;