From b57c5a9b54b23a348d7e80e51943f27a54fb8c2f Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 20 Apr 2021 21:28:11 -0700 Subject: hle: kernel: Migrate KResourceLimit to KAutoObject. --- src/core/hle/kernel/kernel.h | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/core/hle/kernel/kernel.h') diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index f07f0276e..43e49603b 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 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 RetrieveThreadFromGlobalHandleTable(Handle handle) const; @@ -263,24 +266,26 @@ public: /// Gets the slab heap for the specified kernel object type. template KSlabHeap& SlabHeap() { - if constexpr (std::is_same_v) { - return slab_heap_container->process; - } else if constexpr (std::is_same_v) { - return slab_heap_container->thread; + if constexpr (std::is_same_v) { + return slab_heap_container->client_session; } else if constexpr (std::is_same_v) { return slab_heap_container->event; - } else if constexpr (std::is_same_v) { - return slab_heap_container->shared_memory; } else if constexpr (std::is_same_v) { return slab_heap_container->linked_list_node; - } else if constexpr (std::is_same_v) { - return slab_heap_container->writeable_event; - } else if constexpr (std::is_same_v) { - return slab_heap_container->client_session; + } else if constexpr (std::is_same_v) { + return slab_heap_container->process; + } else if constexpr (std::is_same_v) { + return slab_heap_container->resource_limit; } else if constexpr (std::is_same_v) { return slab_heap_container->session; + } else if constexpr (std::is_same_v) { + return slab_heap_container->shared_memory; + } else if constexpr (std::is_same_v) { + return slab_heap_container->thread; } else if constexpr (std::is_same_v) { return slab_heap_container->transfer_memory; + } else if constexpr (std::is_same_v) { + 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; - KSlabHeap thread; + KSlabHeap client_session; KSlabHeap event; - KSlabHeap shared_memory; KSlabHeap linked_list_node; - KSlabHeap writeable_event; - KSlabHeap client_session; + KSlabHeap process; + KSlabHeap resource_limit; KSlabHeap session; + KSlabHeap shared_memory; + KSlabHeap thread; KSlabHeap transfer_memory; + KSlabHeap writeable_event; }; std::unique_ptr slab_heap_container; -- cgit v1.2.3