diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/k_memory_block.h | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/src/core/hle/kernel/k_memory_block.h b/src/core/hle/kernel/k_memory_block.h index 87ca65592..41a29da24 100644 --- a/src/core/hle/kernel/k_memory_block.h +++ b/src/core/hle/kernel/k_memory_block.h @@ -5,8 +5,8 @@ #include "common/alignment.h" #include "common/assert.h" -#include "common/common_types.h" #include "common/intrusive_red_black_tree.h" +#include "core/hle/kernel/k_typed_address.h" #include "core/hle/kernel/memory_types.h" #include "core/hle/kernel/svc_types.h" @@ -282,7 +282,7 @@ class KMemoryBlock : public Common::IntrusiveRedBlackTreeBaseNode<KMemoryBlock> private: u16 m_device_disable_merge_left_count{}; u16 m_device_disable_merge_right_count{}; - VAddr m_address{}; + KProcessAddress m_address{}; size_t m_num_pages{}; KMemoryState m_memory_state{KMemoryState::None}; u16 m_ipc_lock_count{}; @@ -306,7 +306,7 @@ public: } public: - constexpr VAddr GetAddress() const { + constexpr KProcessAddress GetAddress() const { return m_address; } @@ -318,11 +318,11 @@ public: return this->GetNumPages() * PageSize; } - constexpr VAddr GetEndAddress() const { + constexpr KProcessAddress GetEndAddress() const { return this->GetAddress() + this->GetSize(); } - constexpr VAddr GetLastAddress() const { + constexpr KProcessAddress GetLastAddress() const { return this->GetEndAddress() - 1; } @@ -348,7 +348,7 @@ public: constexpr KMemoryInfo GetMemoryInfo() const { return { - .m_address = this->GetAddress(), + .m_address = GetInteger(this->GetAddress()), .m_size = this->GetSize(), .m_state = m_memory_state, .m_device_disable_merge_left_count = m_device_disable_merge_left_count, @@ -366,12 +366,12 @@ public: public: explicit KMemoryBlock() = default; - constexpr KMemoryBlock(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p, + constexpr KMemoryBlock(KProcessAddress addr, size_t np, KMemoryState ms, KMemoryPermission p, KMemoryAttribute attr) : Common::IntrusiveRedBlackTreeBaseNode<KMemoryBlock>(), m_address(addr), m_num_pages(np), m_memory_state(ms), m_permission(p), m_attribute(attr) {} - constexpr void Initialize(VAddr addr, size_t np, KMemoryState ms, KMemoryPermission p, + constexpr void Initialize(KProcessAddress addr, size_t np, KMemoryState ms, KMemoryPermission p, KMemoryAttribute attr) { m_device_disable_merge_left_count = 0; m_device_disable_merge_right_count = 0; @@ -408,7 +408,7 @@ public: KMemoryBlockDisableMergeAttribute::None; } - constexpr bool Contains(VAddr addr) const { + constexpr bool Contains(KProcessAddress addr) const { return this->GetAddress() <= addr && addr <= this->GetEndAddress(); } @@ -443,10 +443,10 @@ public: } } - constexpr void Split(KMemoryBlock* block, VAddr addr) { + constexpr void Split(KMemoryBlock* block, KProcessAddress addr) { ASSERT(this->GetAddress() < addr); ASSERT(this->Contains(addr)); - ASSERT(Common::IsAligned(addr, PageSize)); + ASSERT(Common::IsAligned(GetInteger(addr), PageSize)); block->m_address = m_address; block->m_num_pages = (addr - this->GetAddress()) / PageSize; @@ -471,8 +471,8 @@ public: m_disable_merge_attribute & KMemoryBlockDisableMergeAttribute::AllRight); } - constexpr void UpdateDeviceDisableMergeStateForShareLeft( - [[maybe_unused]] KMemoryPermission new_perm, bool left, [[maybe_unused]] bool right) { + constexpr void UpdateDeviceDisableMergeStateForShareLeft(KMemoryPermission new_perm, bool left, + bool right) { // New permission/right aren't used. if (left) { m_disable_merge_attribute = static_cast<KMemoryBlockDisableMergeAttribute>( @@ -482,8 +482,8 @@ public: } } - constexpr void UpdateDeviceDisableMergeStateForShareRight( - [[maybe_unused]] KMemoryPermission new_perm, [[maybe_unused]] bool left, bool right) { + constexpr void UpdateDeviceDisableMergeStateForShareRight(KMemoryPermission new_perm, bool left, + bool right) { // New permission/left aren't used. if (right) { m_disable_merge_attribute = static_cast<KMemoryBlockDisableMergeAttribute>( @@ -499,8 +499,7 @@ public: this->UpdateDeviceDisableMergeStateForShareRight(new_perm, left, right); } - constexpr void ShareToDevice([[maybe_unused]] KMemoryPermission new_perm, bool left, - bool right) { + constexpr void ShareToDevice(KMemoryPermission new_perm, bool left, bool right) { // New permission isn't used. // We must either be shared or have a zero lock count. @@ -516,8 +515,8 @@ public: this->UpdateDeviceDisableMergeStateForShare(new_perm, left, right); } - constexpr void UpdateDeviceDisableMergeStateForUnshareLeft( - [[maybe_unused]] KMemoryPermission new_perm, bool left, [[maybe_unused]] bool right) { + constexpr void UpdateDeviceDisableMergeStateForUnshareLeft(KMemoryPermission new_perm, + bool left, bool right) { // New permission/right aren't used. if (left) { @@ -536,8 +535,8 @@ public: } } - constexpr void UpdateDeviceDisableMergeStateForUnshareRight( - [[maybe_unused]] KMemoryPermission new_perm, [[maybe_unused]] bool left, bool right) { + constexpr void UpdateDeviceDisableMergeStateForUnshareRight(KMemoryPermission new_perm, + bool left, bool right) { // New permission/left aren't used. if (right) { @@ -556,8 +555,7 @@ public: this->UpdateDeviceDisableMergeStateForUnshareRight(new_perm, left, right); } - constexpr void UnshareToDevice([[maybe_unused]] KMemoryPermission new_perm, bool left, - bool right) { + constexpr void UnshareToDevice(KMemoryPermission new_perm, bool left, bool right) { // New permission isn't used. // We must be shared. @@ -575,8 +573,7 @@ public: this->UpdateDeviceDisableMergeStateForUnshare(new_perm, left, right); } - constexpr void UnshareToDeviceRight([[maybe_unused]] KMemoryPermission new_perm, bool left, - bool right) { + constexpr void UnshareToDeviceRight(KMemoryPermission new_perm, bool left, bool right) { // New permission isn't used. // We must be shared. @@ -594,7 +591,7 @@ public: this->UpdateDeviceDisableMergeStateForUnshareRight(new_perm, left, right); } - constexpr void LockForIpc(KMemoryPermission new_perm, bool left, [[maybe_unused]] bool right) { + constexpr void LockForIpc(KMemoryPermission new_perm, bool left, bool right) { // We must either be locked or have a zero lock count. ASSERT((m_attribute & KMemoryAttribute::IpcLocked) == KMemoryAttribute::IpcLocked || m_ipc_lock_count == 0); @@ -626,8 +623,7 @@ public: } } - constexpr void UnlockForIpc([[maybe_unused]] KMemoryPermission new_perm, bool left, - [[maybe_unused]] bool right) { + constexpr void UnlockForIpc(KMemoryPermission new_perm, bool left, bool right) { // New permission isn't used. // We must be locked. |