diff options
| author | 2021-04-03 22:22:36 -0700 | |
|---|---|---|
| committer | 2021-05-05 16:40:50 -0700 | |
| commit | 7ccbdd4d8d3dea7294d2cac38779cceea9745d52 (patch) | |
| tree | 3106289a5c5a6e4bf50bc09a548c8408aa29fbad /src/core/hle/kernel/process.h | |
| parent | hle: kernel: Refactor IPC interfaces to not use std::shared_ptr. (diff) | |
| download | yuzu-7ccbdd4d8d3dea7294d2cac38779cceea9745d52.tar.gz yuzu-7ccbdd4d8d3dea7294d2cac38779cceea9745d52.tar.xz yuzu-7ccbdd4d8d3dea7294d2cac38779cceea9745d52.zip | |
hle: kernel: Migrate KProcess to KAutoObject.
Diffstat (limited to 'src/core/hle/kernel/process.h')
| -rw-r--r-- | src/core/hle/kernel/process.h | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 45eefb90e..df3c7997d 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -13,9 +13,11 @@ | |||
| 13 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 14 | #include "core/hle/kernel/handle_table.h" | 14 | #include "core/hle/kernel/handle_table.h" |
| 15 | #include "core/hle/kernel/k_address_arbiter.h" | 15 | #include "core/hle/kernel/k_address_arbiter.h" |
| 16 | #include "core/hle/kernel/k_auto_object.h" | ||
| 16 | #include "core/hle/kernel/k_condition_variable.h" | 17 | #include "core/hle/kernel/k_condition_variable.h" |
| 17 | #include "core/hle/kernel/k_synchronization_object.h" | 18 | #include "core/hle/kernel/k_synchronization_object.h" |
| 18 | #include "core/hle/kernel/process_capability.h" | 19 | #include "core/hle/kernel/process_capability.h" |
| 20 | #include "core/hle/kernel/slab_helpers.h" | ||
| 19 | #include "core/hle/result.h" | 21 | #include "core/hle/result.h" |
| 20 | 22 | ||
| 21 | namespace Core { | 23 | namespace Core { |
| @@ -60,9 +62,11 @@ enum class ProcessStatus { | |||
| 60 | DebugBreak, | 62 | DebugBreak, |
| 61 | }; | 63 | }; |
| 62 | 64 | ||
| 63 | class Process final : public KSynchronizationObject { | 65 | class Process final : public KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject> { |
| 66 | KERNEL_AUTOOBJECT_TRAITS(Process, KSynchronizationObject); | ||
| 67 | |||
| 64 | public: | 68 | public: |
| 65 | explicit Process(Core::System& system); | 69 | explicit Process(KernelCore& kernel); |
| 66 | ~Process() override; | 70 | ~Process() override; |
| 67 | 71 | ||
| 68 | enum : u64 { | 72 | enum : u64 { |
| @@ -85,8 +89,8 @@ public: | |||
| 85 | 89 | ||
| 86 | static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4; | 90 | static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4; |
| 87 | 91 | ||
| 88 | static std::shared_ptr<Process> Create(Core::System& system, std::string name, | 92 | static ResultCode Initialize(Process* process, Core::System& system, std::string name, |
| 89 | ProcessType type); | 93 | ProcessType type); |
| 90 | 94 | ||
| 91 | std::string GetTypeName() const override { | 95 | std::string GetTypeName() const override { |
| 92 | return "Process"; | 96 | return "Process"; |
| @@ -338,9 +342,21 @@ public: | |||
| 338 | 342 | ||
| 339 | void LoadModule(CodeSet code_set, VAddr base_addr); | 343 | void LoadModule(CodeSet code_set, VAddr base_addr); |
| 340 | 344 | ||
| 341 | bool IsSignaled() const override; | 345 | virtual bool IsInitialized() const override { |
| 346 | return is_initialized; | ||
| 347 | } | ||
| 348 | |||
| 349 | static void PostDestroy([[maybe_unused]] uintptr_t arg) {} | ||
| 350 | |||
| 351 | virtual void Finalize() override { | ||
| 352 | UNIMPLEMENTED(); | ||
| 353 | } | ||
| 354 | |||
| 355 | virtual u64 GetId() const override final { | ||
| 356 | return GetProcessID(); | ||
| 357 | } | ||
| 342 | 358 | ||
| 343 | void Finalize() override {} | 359 | virtual bool IsSignaled() const override; |
| 344 | 360 | ||
| 345 | void PinCurrentThread(); | 361 | void PinCurrentThread(); |
| 346 | void UnpinCurrentThread(); | 362 | void UnpinCurrentThread(); |
| @@ -462,6 +478,7 @@ private: | |||
| 462 | 478 | ||
| 463 | bool is_signaled{}; | 479 | bool is_signaled{}; |
| 464 | bool is_suspended{}; | 480 | bool is_suspended{}; |
| 481 | bool is_initialized{}; | ||
| 465 | 482 | ||
| 466 | std::atomic<s32> num_created_threads{}; | 483 | std::atomic<s32> num_created_threads{}; |
| 467 | std::atomic<u16> num_threads{}; | 484 | std::atomic<u16> num_threads{}; |
| @@ -474,9 +491,6 @@ private: | |||
| 474 | KThread* exception_thread{}; | 491 | KThread* exception_thread{}; |
| 475 | 492 | ||
| 476 | KLightLock state_lock; | 493 | KLightLock state_lock; |
| 477 | |||
| 478 | /// System context | ||
| 479 | Core::System& system; | ||
| 480 | }; | 494 | }; |
| 481 | 495 | ||
| 482 | } // namespace Kernel | 496 | } // namespace Kernel |