diff options
| author | bunnei <bunneidev@gmail.com> | 2022-02-02 17:58:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-02 17:58:55 -0700 |
| commit | 03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa (patch) | |
| tree | 40b52d9a20f917144653ce926bbdb827f63e9180 /src/core/hle/kernel/k_page_table.h | |
| parent | d68eb751c53df785f842d56983ce4dfbb89aae3f (diff) | |
| parent | 995e27e9b734c8cdd7df6279c698bbd9123bc483 (diff) | |
Merge pull request #7835 from bunnei/page-table-lock
hle: kernel: KPageTable: Migrate locks to KScopedLightLock.
Diffstat (limited to 'src/core/hle/kernel/k_page_table.h')
| -rw-r--r-- | src/core/hle/kernel/k_page_table.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/hle/kernel/k_page_table.h b/src/core/hle/kernel/k_page_table.h index ecae939a0..c98887d34 100644 --- a/src/core/hle/kernel/k_page_table.h +++ b/src/core/hle/kernel/k_page_table.h @@ -5,12 +5,12 @@ #pragma once #include <memory> -#include <mutex> #include "common/common_funcs.h" #include "common/common_types.h" #include "common/page_table.h" #include "core/file_sys/program_metadata.h" +#include "core/hle/kernel/k_light_lock.h" #include "core/hle/kernel/k_memory_block.h" #include "core/hle/kernel/k_memory_manager.h" #include "core/hle/result.h" @@ -147,11 +147,12 @@ private: } bool IsLockedByCurrentThread() const { - return true; + return general_lock.IsLockedByCurrentThread(); } - std::recursive_mutex page_table_lock; - std::mutex map_physical_memory_lock; + mutable KLightLock general_lock; + mutable KLightLock map_physical_memory_lock; + std::unique_ptr<KMemoryBlockManager> block_manager; public: @@ -210,7 +211,7 @@ public: return alias_code_region_end - alias_code_region_start; } size_t GetNormalMemorySize() { - std::lock_guard lk(page_table_lock); + KScopedLightLock lk(general_lock); return GetHeapSize() + mapped_physical_memory_size; } constexpr std::size_t GetAddressSpaceWidth() const { @@ -252,7 +253,9 @@ public: constexpr bool IsInsideASLRRegion(VAddr address, std::size_t size) const { return !IsOutsideASLRRegion(address, size); } - constexpr PAddr GetPhysicalAddr(VAddr addr) { + + PAddr GetPhysicalAddr(VAddr addr) { + ASSERT(IsLockedByCurrentThread()); const auto backing_addr = page_table_impl.backing_addr[addr >> PageBits]; ASSERT(backing_addr); return backing_addr + addr; |
