diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-09 22:10:14 -0700 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-05 16:40:51 -0700 |
commit | b6156e735cd78d4b7863491ae6bdc63e44404b73 (patch) | |
tree | e1ec7753ea7c86223135e2f51b1b1f649af48b90 /src/core/hle/kernel/kernel.h | |
parent | ab704acab80d17f9a8e34dcbb753d60de2a86f86 (diff) |
hle: kernel: Move slab heap management to KernelCore.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r-- | src/core/hle/kernel/kernel.h | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index b78602f460..855bb590a1 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -11,9 +11,10 @@ #include <vector> #include "core/arm/cpu_interrupt_handler.h" #include "core/hardware_properties.h" +#include "core/hle/kernel/k_auto_object.h" +#include "core/hle/kernel/k_slab_heap.h" #include "core/hle/kernel/memory_types.h" #include "core/hle/kernel/object.h" -#include "core/hle/kernel/k_auto_object.h" namespace Core { class CPUInterruptHandler; @@ -32,6 +33,8 @@ class ClientPort; class GlobalSchedulerContext; class HandleTable; class KAutoObjectWithListContainer; +class KEvent; +class KLinkedListNode; class KMemoryManager; class KResourceLimit; class KScheduler; @@ -231,9 +234,10 @@ public: /** * Creates an HLE service thread, which are used to execute service routines asynchronously. - * While these are allocated per ServerSession, these need to be owned and managed outside of - * ServerSession to avoid a circular dependency. - * @param name String name for the ServerSession creating this thread, used for debug purposes. + * While these are allocated per ServerSession, these need to be owned and managed outside + * of ServerSession to avoid a circular dependency. + * @param name String name for the ServerSession creating this thread, used for debug + * purposes. * @returns The a weak pointer newly created service thread. */ std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(const std::string& name); @@ -252,6 +256,22 @@ public: Core::System& System(); const Core::System& System() const; + /// 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_Process; + } else if constexpr (std::is_same_v<T, KThread>) { + return slab_heap_KThread; + } else if constexpr (std::is_same_v<T, KEvent>) { + return slab_heap_KEvent; + } else if constexpr (std::is_same_v<T, KSharedMemory>) { + return slab_heap_KSharedMemory; + } else if constexpr (std::is_same_v<T, KLinkedListNode>) { + return slab_heap_KLinkedListNode; + } + } + private: friend class Object; friend class Process; @@ -277,7 +297,15 @@ private: struct Impl; std::unique_ptr<Impl> impl; + bool exception_exited{}; + +private: + KSlabHeap<Process> slab_heap_Process; + KSlabHeap<KThread> slab_heap_KThread; + KSlabHeap<KEvent> slab_heap_KEvent; + KSlabHeap<KSharedMemory> slab_heap_KSharedMemory; + KSlabHeap<KLinkedListNode> slab_heap_KLinkedListNode; }; } // namespace Kernel |