diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-17 09:52:53 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-06 01:40:51 +0200 |
commit | c7d8b7421cd6bdb64410bbb0094ce540f0280c27 (patch) | |
tree | 0b24ec86f194395fac5f5688a6e14fc5dec0b7dd /src/core/hle/kernel/k_transfer_memory.h | |
parent | hle: kernel: Migrate KSession, KClientSession, and KServerSession to KAutoObject. (diff) | |
download | yuzu-c7d8b7421cd6bdb64410bbb0094ce540f0280c27.tar yuzu-c7d8b7421cd6bdb64410bbb0094ce540f0280c27.tar.gz yuzu-c7d8b7421cd6bdb64410bbb0094ce540f0280c27.tar.bz2 yuzu-c7d8b7421cd6bdb64410bbb0094ce540f0280c27.tar.lz yuzu-c7d8b7421cd6bdb64410bbb0094ce540f0280c27.tar.xz yuzu-c7d8b7421cd6bdb64410bbb0094ce540f0280c27.tar.zst yuzu-c7d8b7421cd6bdb64410bbb0094ce540f0280c27.zip |
Diffstat (limited to 'src/core/hle/kernel/k_transfer_memory.h')
-rw-r--r-- | src/core/hle/kernel/k_transfer_memory.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_transfer_memory.h b/src/core/hle/kernel/k_transfer_memory.h new file mode 100644 index 000000000..f43725c7f --- /dev/null +++ b/src/core/hle/kernel/k_transfer_memory.h @@ -0,0 +1,82 @@ +// Copyright 2021 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <memory> + +#include "core/hle/kernel/slab_helpers.h" +#include "core/hle/kernel/svc_types.h" +#include "core/hle/result.h" + +union ResultCode; + +namespace Core::Memory { +class Memory; +} + +namespace Kernel { + +class KernelCore; +class Process; + +class KTransferMemory final + : public KAutoObjectWithSlabHeapAndContainer<KTransferMemory, KAutoObjectWithList> { + KERNEL_AUTOOBJECT_TRAITS(KTransferMemory, KAutoObject); + +public: + explicit KTransferMemory(KernelCore& kernel); + ~KTransferMemory() override; + + static constexpr HandleType HANDLE_TYPE = HandleType::TransferMemory; + + ResultCode Initialize(VAddr address_, std::size_t size_, Svc::MemoryPermission owner_perm_); + + virtual void Finalize() override; + + virtual bool IsInitialized() const override { + return is_initialized; + } + + virtual uintptr_t GetPostDestroyArgument() const override { + return reinterpret_cast<uintptr_t>(owner); + } + + static void PostDestroy(uintptr_t arg); + + Process* GetOwner() const { + return owner; + } + + VAddr GetSourceAddress() const { + return address; + } + + size_t GetSize() const { + return is_initialized ? size * PageSize : 0; + } + + // DEPRECATED + + std::string GetTypeName() const override { + return "TransferMemory"; + } + + std::string GetName() const override { + return GetTypeName(); + } + + HandleType GetHandleType() const override { + return HANDLE_TYPE; + } + +private: + Process* owner{}; + VAddr address{}; + Svc::MemoryPermission owner_perm{}; + size_t size{}; + bool is_initialized{}; +}; + +} // namespace Kernel |