diff options
author | Tony Wasserka <neobrainx@gmail.com> | 2015-01-30 15:00:17 +0100 |
---|---|---|
committer | Tony Wasserka <neobrainx@gmail.com> | 2015-01-30 15:00:17 +0100 |
commit | 28702cbfeb1fe21109f8b1efa189785594319b78 (patch) | |
tree | 64e4b1ec43b7699fe1a6ab1be1c688b6d63c0d75 /src/core/hle/kernel/shared_memory.h | |
parent | Merge pull request #412 from purpasmart96/svc_table_cleanup (diff) | |
parent | Kernel: Mark all appropriate kernel objects as "final" (diff) | |
download | yuzu-28702cbfeb1fe21109f8b1efa189785594319b78.tar yuzu-28702cbfeb1fe21109f8b1efa189785594319b78.tar.gz yuzu-28702cbfeb1fe21109f8b1efa189785594319b78.tar.bz2 yuzu-28702cbfeb1fe21109f8b1efa189785594319b78.tar.lz yuzu-28702cbfeb1fe21109f8b1efa189785594319b78.tar.xz yuzu-28702cbfeb1fe21109f8b1efa189785594319b78.tar.zst yuzu-28702cbfeb1fe21109f8b1efa189785594319b78.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/shared_memory.h | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index bb65c7ccd..f9ae23e93 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h @@ -23,29 +23,41 @@ enum class MemoryPermission : u32 { DontCare = (1u << 28) }; -/** - * Creates a shared memory object - * @param name Optional name of shared memory object - * @return Handle of newly created shared memory object - */ -Handle CreateSharedMemory(const std::string& name="Unknown"); - -/** - * Maps a shared memory block to an address in system memory - * @param handle Shared memory block handle - * @param address Address in system memory to map shared memory block to - * @param permissions Memory block map permissions (specified by SVC field) - * @param other_permissions Memory block map other permissions (specified by SVC field) - */ -ResultCode MapSharedMemory(Handle handle, u32 address, MemoryPermission permissions, - MemoryPermission other_permissions); - -/** - * Gets a pointer to the shared memory block - * @param handle Shared memory block handle - * @param offset Offset from the start of the shared memory block to get pointer - * @return Pointer to the shared memory block from the specified offset - */ -ResultVal<u8*> GetSharedMemoryPointer(Handle handle, u32 offset); +class SharedMemory final : public Object { +public: + /** + * Creates a shared memory object + * @param name Optional object name, used only for debugging purposes. + */ + static ResultVal<SharedPtr<SharedMemory>> Create(std::string name = "Unknown"); + + std::string GetTypeName() const override { return "SharedMemory"; } + + static const HandleType HANDLE_TYPE = HandleType::SharedMemory; + HandleType GetHandleType() const override { return HANDLE_TYPE; } + + /** + * Maps a shared memory block to an address in system memory + * @param address Address in system memory to map shared memory block to + * @param permissions Memory block map permissions (specified by SVC field) + * @param other_permissions Memory block map other permissions (specified by SVC field) + */ + ResultCode Map(VAddr address, MemoryPermission permissions, MemoryPermission other_permissions); + + /** + * Gets a pointer to the shared memory block + * @param offset Offset from the start of the shared memory block to get pointer + * @return Pointer to the shared memory block from the specified offset + */ + ResultVal<u8*> GetPointer(u32 offset = 0); + + VAddr base_address; ///< Address of shared memory block in RAM + MemoryPermission permissions; ///< Permissions of shared memory block (SVC field) + MemoryPermission other_permissions; ///< Other permissions of shared memory block (SVC field) + std::string name; ///< Name of shared memory object (optional) + +private: + SharedMemory() = default; +}; } // namespace |