summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar bunnei2021-04-09 22:10:14 -0700
committerGravatar bunnei2021-05-05 16:40:51 -0700
commitb6156e735cd78d4b7863491ae6bdc63e44404b73 (patch)
treee1ec7753ea7c86223135e2f51b1b1f649af48b90 /src/core/hle/kernel/kernel.h
parenthle: kernel: Ensure all kernel objects with KAutoObject are properly created. (diff)
downloadyuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar.gz
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.tar.xz
yuzu-b6156e735cd78d4b7863491ae6bdc63e44404b73.zip
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.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 @@
11#include <vector> 11#include <vector>
12#include "core/arm/cpu_interrupt_handler.h" 12#include "core/arm/cpu_interrupt_handler.h"
13#include "core/hardware_properties.h" 13#include "core/hardware_properties.h"
14#include "core/hle/kernel/k_auto_object.h"
15#include "core/hle/kernel/k_slab_heap.h"
14#include "core/hle/kernel/memory_types.h" 16#include "core/hle/kernel/memory_types.h"
15#include "core/hle/kernel/object.h" 17#include "core/hle/kernel/object.h"
16#include "core/hle/kernel/k_auto_object.h"
17 18
18namespace Core { 19namespace Core {
19class CPUInterruptHandler; 20class CPUInterruptHandler;
@@ -32,6 +33,8 @@ class ClientPort;
32class GlobalSchedulerContext; 33class GlobalSchedulerContext;
33class HandleTable; 34class HandleTable;
34class KAutoObjectWithListContainer; 35class KAutoObjectWithListContainer;
36class KEvent;
37class KLinkedListNode;
35class KMemoryManager; 38class KMemoryManager;
36class KResourceLimit; 39class KResourceLimit;
37class KScheduler; 40class KScheduler;
@@ -231,9 +234,10 @@ public:
231 234
232 /** 235 /**
233 * Creates an HLE service thread, which are used to execute service routines asynchronously. 236 * Creates an HLE service thread, which are used to execute service routines asynchronously.
234 * While these are allocated per ServerSession, these need to be owned and managed outside of 237 * While these are allocated per ServerSession, these need to be owned and managed outside
235 * ServerSession to avoid a circular dependency. 238 * of ServerSession to avoid a circular dependency.
236 * @param name String name for the ServerSession creating this thread, used for debug purposes. 239 * @param name String name for the ServerSession creating this thread, used for debug
240 * purposes.
237 * @returns The a weak pointer newly created service thread. 241 * @returns The a weak pointer newly created service thread.
238 */ 242 */
239 std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(const std::string& name); 243 std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(const std::string& name);
@@ -252,6 +256,22 @@ public:
252 Core::System& System(); 256 Core::System& System();
253 const Core::System& System() const; 257 const Core::System& System() const;
254 258
259 /// Gets the slab heap for the specified kernel object type.
260 template <typename T>
261 KSlabHeap<T>& SlabHeap() {
262 if constexpr (std::is_same_v<T, Process>) {
263 return slab_heap_Process;
264 } else if constexpr (std::is_same_v<T, KThread>) {
265 return slab_heap_KThread;
266 } else if constexpr (std::is_same_v<T, KEvent>) {
267 return slab_heap_KEvent;
268 } else if constexpr (std::is_same_v<T, KSharedMemory>) {
269 return slab_heap_KSharedMemory;
270 } else if constexpr (std::is_same_v<T, KLinkedListNode>) {
271 return slab_heap_KLinkedListNode;
272 }
273 }
274
255private: 275private:
256 friend class Object; 276 friend class Object;
257 friend class Process; 277 friend class Process;
@@ -277,7 +297,15 @@ private:
277 297
278 struct Impl; 298 struct Impl;
279 std::unique_ptr<Impl> impl; 299 std::unique_ptr<Impl> impl;
300
280 bool exception_exited{}; 301 bool exception_exited{};
302
303private:
304 KSlabHeap<Process> slab_heap_Process;
305 KSlabHeap<KThread> slab_heap_KThread;
306 KSlabHeap<KEvent> slab_heap_KEvent;
307 KSlabHeap<KSharedMemory> slab_heap_KSharedMemory;
308 KSlabHeap<KLinkedListNode> slab_heap_KLinkedListNode;
281}; 309};
282 310
283} // namespace Kernel 311} // namespace Kernel