From f0cba1371ccc998ac06296a95cd9c0b7a51b7913 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 24 Nov 2020 00:50:48 +0300 Subject: [PATCH] vm: adjustments Increase max range lock size (less than 512 MiB) Remove "range_executable" flag, make it reserved. --- rpcs3/Emu/Memory/vm.cpp | 6 ++---- rpcs3/Emu/Memory/vm_locking.h | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index 2eadbb9936..73026ff676 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -289,8 +289,8 @@ namespace vm return; } - // Limit to 256 MiB at once; make sure if it operates on big amount of data, it's page-aligned - if (size > 256 * 1024 * 1024 || (size > 65536 && size % 4096)) + // Limit to <512 MiB at once; make sure if it operates on big amount of data, it's page-aligned + if (size >= 512 * 1024 * 1024 || (size > 65536 && size % 4096)) { fmt::throw_exception("Failed to lock range (flags=0x%x, addr=0x%x, size=0x%x)" HERE, flags >> 32, addr, size); } @@ -827,8 +827,6 @@ namespace vm safe_bits |= range_readable; if (old_val & start_value & page_writable && safe_bits & range_readable) safe_bits |= range_writable; - if (old_val & start_value & page_executable && safe_bits & range_readable) - safe_bits |= range_executable; // Protect range locks from observing changes in memory protection _lock_main_range_lock(safe_bits, start * 4096, page_size); diff --git a/rpcs3/Emu/Memory/vm_locking.h b/rpcs3/Emu/Memory/vm_locking.h index 2467a5063e..98daa7ebb5 100644 --- a/rpcs3/Emu/Memory/vm_locking.h +++ b/rpcs3/Emu/Memory/vm_locking.h @@ -13,16 +13,16 @@ namespace vm enum range_lock_flags : u64 { - /* flags (3 bits, RWX) */ + /* flags (3 bits, W + R + Reserved) */ - range_readable = 4ull << 61, - range_writable = 2ull << 61, - range_executable = 1ull << 61, + range_writable = 4ull << 61, + range_readable = 2ull << 61, + range_reserved = 1ull << 61, range_full_mask = 7ull << 61, /* flag combinations with special meaning */ - range_locked = 1ull << 61, // R+W as well, but being exclusively accessed (size extends addr) + range_locked = 4ull << 61, // R+W as well, but being exclusively accessed (size extends addr) range_allocation = 0, // Allocation, no safe access, g_shmem may change at ANY location range_pos = 61,