diff options
author | bunnei <bunneidev@gmail.com> | 2022-02-03 01:58:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 01:58:55 +0100 |
commit | 03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa (patch) | |
tree | 40b52d9a20f917144653ce926bbdb827f63e9180 /src/core/hle/kernel/k_page_table.h | |
parent | Merge pull request #7838 from lioncash/noncopy (diff) | |
parent | hle: kernel: KPageTable: Migrate locks to KScopedLightLock. (diff) | |
download | yuzu-03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa.tar yuzu-03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa.tar.gz yuzu-03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa.tar.bz2 yuzu-03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa.tar.lz yuzu-03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa.tar.xz yuzu-03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa.tar.zst yuzu-03186af6a156a7d46aa1fa9d7b4f9ebbb221d4aa.zip |
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; |