diff options
| author | bunnei <bunneidev@gmail.com> | 2021-04-20 21:28:11 -0700 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2021-05-05 16:40:52 -0700 |
| commit | 22a67a4627e86fe75aa16a7cb5d26be8b282fbaa (patch) | |
| tree | e3f3c81a2fddb94c43b6a1dd641c61a7ca9c8225 /src/core/hle/kernel/kernel.h | |
| parent | d4b1153e1b7423d374c9a936e299284a0486659c (diff) | |
hle: kernel: Migrate KResourceLimit to KAutoObject.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index f07f0276ed..43e49603ba 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -92,7 +92,10 @@ public: void Shutdown(); /// Retrieves a shared pointer to the system resource limit instance. - std::shared_ptr<KResourceLimit> GetSystemResourceLimit() const; + const KResourceLimit* GetSystemResourceLimit() const; + + /// Retrieves a shared pointer to the system resource limit instance. + KResourceLimit* GetSystemResourceLimit(); /// Retrieves a shared pointer to a Thread instance within the thread wakeup handle table. KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const; @@ -263,24 +266,26 @@ public: /// Gets the slab heap for the specified kernel object type. template <typename T> KSlabHeap<T>& SlabHeap() { - if constexpr (std::is_same_v<T, Process>) { - return slab_heap_container->process; - } else if constexpr (std::is_same_v<T, KThread>) { - return slab_heap_container->thread; + if constexpr (std::is_same_v<T, KClientSession>) { + return slab_heap_container->client_session; } else if constexpr (std::is_same_v<T, KEvent>) { return slab_heap_container->event; - } else if constexpr (std::is_same_v<T, KSharedMemory>) { - return slab_heap_container->shared_memory; } else if constexpr (std::is_same_v<T, KLinkedListNode>) { return slab_heap_container->linked_list_node; - } else if constexpr (std::is_same_v<T, KWritableEvent>) { - return slab_heap_container->writeable_event; - } else if constexpr (std::is_same_v<T, KClientSession>) { - return slab_heap_container->client_session; + } else if constexpr (std::is_same_v<T, Process>) { + return slab_heap_container->process; + } else if constexpr (std::is_same_v<T, KResourceLimit>) { + return slab_heap_container->resource_limit; } else if constexpr (std::is_same_v<T, KSession>) { return slab_heap_container->session; + } else if constexpr (std::is_same_v<T, KSharedMemory>) { + return slab_heap_container->shared_memory; + } else if constexpr (std::is_same_v<T, KThread>) { + return slab_heap_container->thread; } else if constexpr (std::is_same_v<T, KTransferMemory>) { return slab_heap_container->transfer_memory; + } else if constexpr (std::is_same_v<T, KWritableEvent>) { + return slab_heap_container->writeable_event; } } @@ -315,15 +320,16 @@ private: private: /// Helper to encapsulate all slab heaps in a single heap allocated container struct SlabHeapContainer { - KSlabHeap<Process> process; - KSlabHeap<KThread> thread; + KSlabHeap<KClientSession> client_session; KSlabHeap<KEvent> event; - KSlabHeap<KSharedMemory> shared_memory; KSlabHeap<KLinkedListNode> linked_list_node; - KSlabHeap<KWritableEvent> writeable_event; - KSlabHeap<KClientSession> client_session; + KSlabHeap<Process> process; + KSlabHeap<KResourceLimit> resource_limit; KSlabHeap<KSession> session; + KSlabHeap<KSharedMemory> shared_memory; + KSlabHeap<KThread> thread; KSlabHeap<KTransferMemory> transfer_memory; + KSlabHeap<KWritableEvent> writeable_event; }; std::unique_ptr<SlabHeapContainer> slab_heap_container; |
