From 701ef616b265d8914f77a399d9a1f41e68683a72 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 12 Feb 2021 15:29:25 -0800 Subject: hle: kernel: memory_manager: Rename AllocateContinuous to AllocateContinuous. --- src/core/hle/kernel/memory/memory_manager.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/core/hle/kernel/memory/memory_manager.h') diff --git a/src/core/hle/kernel/memory/memory_manager.h b/src/core/hle/kernel/memory/memory_manager.h index 00c04eebd..80dfbc8c2 100644 --- a/src/core/hle/kernel/memory/memory_manager.h +++ b/src/core/hle/kernel/memory/memory_manager.h @@ -6,7 +6,9 @@ #include #include +#include +#include "common/common_funcs.h" #include "common/common_types.h" #include "core/hle/kernel/memory/page_heap.h" #include "core/hle/result.h" @@ -44,8 +46,8 @@ public: } void InitializeManager(Pool pool, u64 start_address, u64 end_address); - VAddr AllocateContinuous(std::size_t num_pages, std::size_t align_pages, Pool pool, - Direction dir = Direction::FromFront); + + VAddr AllocateAndOpenContinuous(size_t num_pages, size_t align_pages, u32 option); ResultCode Allocate(PageLinkedList& page_list, std::size_t num_pages, Pool pool, Direction dir = Direction::FromFront); ResultCode Free(PageLinkedList& page_list, std::size_t num_pages, Pool pool, @@ -53,6 +55,27 @@ public: static constexpr std::size_t MaxManagerCount = 10; +public: + static constexpr u32 EncodeOption(Pool pool, Direction dir) { + return (static_cast(pool) << static_cast(Pool::Shift)) | + (static_cast(dir) << static_cast(Direction::Shift)); + } + + static constexpr Pool GetPool(u32 option) { + return static_cast((static_cast(option) & static_cast(Pool::Mask)) >> + static_cast(Pool::Shift)); + } + + static constexpr Direction GetDirection(u32 option) { + return static_cast( + (static_cast(option) & static_cast(Direction::Mask)) >> + static_cast(Direction::Shift)); + } + + static constexpr std::tuple DecodeOption(u32 option) { + return std::make_tuple(GetPool(option), GetDirection(option)); + } + private: class Impl final : NonCopyable { private: -- cgit v1.2.3