diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2022-03-18 03:09:01 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2022-03-18 07:13:02 +0100 |
commit | d618bba8a6a748654559fd9edac09a775aa6f0fa (patch) | |
tree | 52542c3a41e7da8719cf3263f598149cd1ca37d6 /src/core/hle/kernel | |
parent | Merge pull request #8024 from liamwhite/const-indexing (diff) | |
download | yuzu-d618bba8a6a748654559fd9edac09a775aa6f0fa.tar yuzu-d618bba8a6a748654559fd9edac09a775aa6f0fa.tar.gz yuzu-d618bba8a6a748654559fd9edac09a775aa6f0fa.tar.bz2 yuzu-d618bba8a6a748654559fd9edac09a775aa6f0fa.tar.lz yuzu-d618bba8a6a748654559fd9edac09a775aa6f0fa.tar.xz yuzu-d618bba8a6a748654559fd9edac09a775aa6f0fa.tar.zst yuzu-d618bba8a6a748654559fd9edac09a775aa6f0fa.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/k_page_buffer.cpp | 19 | ||||
-rw-r--r-- | src/core/hle/kernel/k_page_buffer.h | 9 | ||||
-rw-r--r-- | src/core/hle/kernel/k_thread_local_page.cpp | 1 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/core/hle/kernel/k_page_buffer.cpp b/src/core/hle/kernel/k_page_buffer.cpp new file mode 100644 index 000000000..f7df4a9a8 --- /dev/null +++ b/src/core/hle/kernel/k_page_buffer.cpp @@ -0,0 +1,19 @@ +// Copyright 2022 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/alignment.h" +#include "common/assert.h" +#include "core/core.h" +#include "core/device_memory.h" +#include "core/hle/kernel/k_page_buffer.h" +#include "core/hle/kernel/memory_types.h" + +namespace Kernel { + +KPageBuffer* KPageBuffer::FromPhysicalAddress(Core::System& system, PAddr phys_addr) { + ASSERT(Common::IsAligned(phys_addr, PageSize)); + return reinterpret_cast<KPageBuffer*>(system.DeviceMemory().GetPointer(phys_addr)); +} + +} // namespace Kernel diff --git a/src/core/hle/kernel/k_page_buffer.h b/src/core/hle/kernel/k_page_buffer.h index 0a9451228..6ff3c1568 100644 --- a/src/core/hle/kernel/k_page_buffer.h +++ b/src/core/hle/kernel/k_page_buffer.h @@ -6,12 +6,10 @@ #include <array> -#include "common/alignment.h" -#include "common/assert.h" #include "common/common_types.h" -#include "core/core.h" #include "core/device_memory.h" #include "core/hle/kernel/memory_types.h" +#include "core/hle/kernel/slab_helpers.h" namespace Kernel { @@ -19,10 +17,7 @@ class KPageBuffer final : public KSlabAllocated<KPageBuffer> { public: KPageBuffer() = default; - static KPageBuffer* FromPhysicalAddress(Core::System& system, PAddr phys_addr) { - ASSERT(Common::IsAligned(phys_addr, PageSize)); - return reinterpret_cast<KPageBuffer*>(system.DeviceMemory().GetPointer(phys_addr)); - } + static KPageBuffer* FromPhysicalAddress(Core::System& system, PAddr phys_addr); private: [[maybe_unused]] alignas(PageSize) std::array<u8, PageSize> m_buffer{}; diff --git a/src/core/hle/kernel/k_thread_local_page.cpp b/src/core/hle/kernel/k_thread_local_page.cpp index 4653c29f6..17b233fca 100644 --- a/src/core/hle/kernel/k_thread_local_page.cpp +++ b/src/core/hle/kernel/k_thread_local_page.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/scope_exit.h" +#include "core/core.h" #include "core/hle/kernel/k_memory_block.h" #include "core/hle/kernel/k_page_table.h" #include "core/hle/kernel/k_process.h" |