mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
vm: Fix vm::unmap
* Make vm::unmap atomic, squash the memory unmapping process inside this function while still using the same VM mutex ownership. * Make vm::unmap not fail due to random vm::get calls, shared_ptr reference count is no longer a condition. * Fix sys_mmapper_free_address spuriously failing with EBUSY due to random vm::get calls. * Fix sys_vm_unmap race condition due to non-atomic vm::unmap. * Add an optional verification block ptr arg to vm::unmap, used by patches.
This commit is contained in:
parent
fe6cb4774e
commit
50ad7ba1f6
6 changed files with 99 additions and 23 deletions
|
@ -558,9 +558,7 @@ void unmap_vm_area(std::shared_ptr<vm::block_t>& ptr)
|
|||
{
|
||||
if (ptr && ptr->flags & (1ull << 62))
|
||||
{
|
||||
const u32 addr = ptr->addr;
|
||||
ptr.reset();
|
||||
vm::unmap(addr, true);
|
||||
vm::unmap(0, true, &ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -679,7 +677,7 @@ static usz apply_modification(std::basic_string<u32>& applied, const patch_engin
|
|||
const u32 out_branch = vm::try_get_addr(dst + (offset & -4)).first;
|
||||
|
||||
// Allow only if points to a PPU executable instruction
|
||||
if (out_branch < 0x10000 || out_branch >= 0x4000'0000 || !vm::check_addr<4>(out_branch, vm::alloc_executable))
|
||||
if (out_branch < 0x10000 || out_branch >= 0x4000'0000 || !vm::check_addr<4>(out_branch, vm::page_executable))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue