diff options
| author | 2021-04-20 21:28:11 -0700 | |
|---|---|---|
| committer | 2021-05-05 16:40:52 -0700 | |
| commit | b57c5a9b54b23a348d7e80e51943f27a54fb8c2f (patch) | |
| tree | e3f3c81a2fddb94c43b6a1dd641c61a7ca9c8225 /src/core/hle/kernel/kernel.h | |
| parent | hle: kernel: svc: Migrate WaitSynchronization. (diff) | |
| download | yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar.gz yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.tar.xz yuzu-b57c5a9b54b23a348d7e80e51943f27a54fb8c2f.zip | |
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 f07f0276e..43e49603b 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -92,7 +92,10 @@ public: | |||
| 92 | void Shutdown(); | 92 | void Shutdown(); |
| 93 | 93 | ||
| 94 | /// Retrieves a shared pointer to the system resource limit instance. | 94 | /// Retrieves a shared pointer to the system resource limit instance. |
| 95 | std::shared_ptr<KResourceLimit> GetSystemResourceLimit() const; | 95 | const KResourceLimit* GetSystemResourceLimit() const; |
| 96 | |||
| 97 | /// Retrieves a shared pointer to the system resource limit instance. | ||
| 98 | KResourceLimit* GetSystemResourceLimit(); | ||
| 96 | 99 | ||
| 97 | /// Retrieves a shared pointer to a Thread instance within the thread wakeup handle table. | 100 | /// Retrieves a shared pointer to a Thread instance within the thread wakeup handle table. |
| 98 | KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const; | 101 | KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const; |
| @@ -263,24 +266,26 @@ public: | |||
| 263 | /// Gets the slab heap for the specified kernel object type. | 266 | /// Gets the slab heap for the specified kernel object type. |
| 264 | template <typename T> | 267 | template <typename T> |
| 265 | KSlabHeap<T>& SlabHeap() { | 268 | KSlabHeap<T>& SlabHeap() { |
| 266 | if constexpr (std::is_same_v<T, Process>) { | 269 | if constexpr (std::is_same_v<T, KClientSession>) { |
| 267 | return slab_heap_container->process; | 270 | return slab_heap_container->client_session; |
| 268 | } else if constexpr (std::is_same_v<T, KThread>) { | ||
| 269 | return slab_heap_container->thread; | ||
| 270 | } else if constexpr (std::is_same_v<T, KEvent>) { | 271 | } else if constexpr (std::is_same_v<T, KEvent>) { |
| 271 | return slab_heap_container->event; | 272 | return slab_heap_container->event; |
| 272 | } else if constexpr (std::is_same_v<T, KSharedMemory>) { | ||
| 273 | return slab_heap_container->shared_memory; | ||
| 274 | } else if constexpr (std::is_same_v<T, KLinkedListNode>) { | 273 | } else if constexpr (std::is_same_v<T, KLinkedListNode>) { |
| 275 | return slab_heap_container->linked_list_node; | 274 | return slab_heap_container->linked_list_node; |
| 276 | } else if constexpr (std::is_same_v<T, KWritableEvent>) { | 275 | } else if constexpr (std::is_same_v<T, Process>) { |
| 277 | return slab_heap_container->writeable_event; | 276 | return slab_heap_container->process; |
| 278 | } else if constexpr (std::is_same_v<T, KClientSession>) { | 277 | } else if constexpr (std::is_same_v<T, KResourceLimit>) { |
| 279 | return slab_heap_container->client_session; | 278 | return slab_heap_container->resource_limit; |
| 280 | } else if constexpr (std::is_same_v<T, KSession>) { | 279 | } else if constexpr (std::is_same_v<T, KSession>) { |
| 281 | return slab_heap_container->session; | 280 | return slab_heap_container->session; |
| 281 | } else if constexpr (std::is_same_v<T, KSharedMemory>) { | ||
| 282 | return slab_heap_container->shared_memory; | ||
| 283 | } else if constexpr (std::is_same_v<T, KThread>) { | ||
| 284 | return slab_heap_container->thread; | ||
| 282 | } else if constexpr (std::is_same_v<T, KTransferMemory>) { | 285 | } else if constexpr (std::is_same_v<T, KTransferMemory>) { |
| 283 | return slab_heap_container->transfer_memory; | 286 | return slab_heap_container->transfer_memory; |
| 287 | } else if constexpr (std::is_same_v<T, KWritableEvent>) { | ||
| 288 | return slab_heap_container->writeable_event; | ||
| 284 | } | 289 | } |
| 285 | } | 290 | } |
| 286 | 291 | ||
| @@ -315,15 +320,16 @@ private: | |||
| 315 | private: | 320 | private: |
| 316 | /// Helper to encapsulate all slab heaps in a single heap allocated container | 321 | /// Helper to encapsulate all slab heaps in a single heap allocated container |
| 317 | struct SlabHeapContainer { | 322 | struct SlabHeapContainer { |
| 318 | KSlabHeap<Process> process; | 323 | KSlabHeap<KClientSession> client_session; |
| 319 | KSlabHeap<KThread> thread; | ||
| 320 | KSlabHeap<KEvent> event; | 324 | KSlabHeap<KEvent> event; |
| 321 | KSlabHeap<KSharedMemory> shared_memory; | ||
| 322 | KSlabHeap<KLinkedListNode> linked_list_node; | 325 | KSlabHeap<KLinkedListNode> linked_list_node; |
| 323 | KSlabHeap<KWritableEvent> writeable_event; | 326 | KSlabHeap<Process> process; |
| 324 | KSlabHeap<KClientSession> client_session; | 327 | KSlabHeap<KResourceLimit> resource_limit; |
| 325 | KSlabHeap<KSession> session; | 328 | KSlabHeap<KSession> session; |
| 329 | KSlabHeap<KSharedMemory> shared_memory; | ||
| 330 | KSlabHeap<KThread> thread; | ||
| 326 | KSlabHeap<KTransferMemory> transfer_memory; | 331 | KSlabHeap<KTransferMemory> transfer_memory; |
| 332 | KSlabHeap<KWritableEvent> writeable_event; | ||
| 327 | }; | 333 | }; |
| 328 | 334 | ||
| 329 | std::unique_ptr<SlabHeapContainer> slab_heap_container; | 335 | std::unique_ptr<SlabHeapContainer> slab_heap_container; |