summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-10 07:10:14 +0200
committerbunnei <bunneidev@gmail.com>2021-05-06 01:40:51 +0200
commitb6156e735cd78d4b7863491ae6bdc63e44404b73 (patch)
treee1ec7753ea7c86223135e2f51b1b1f649af48b90 /src/core/hle/kernel/kernel.h
parenthle: kernel: Ensure all kernel objects with KAutoObject are properly created. (diff)
downloadyuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar.gz
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar.bz2
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar.lz
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar.xz
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar.zst
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/kernel.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index b78602f46..855bb590a 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