summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/process.h')
-rw-r--r--src/core/hle/kernel/process.h32
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
21namespace Core { 23namespace Core {
@@ -60,9 +62,11 @@ enum class ProcessStatus {
60 DebugBreak, 62 DebugBreak,
61}; 63};
62 64
63class Process final : public KSynchronizationObject { 65class Process final : public KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject> {
66 KERNEL_AUTOOBJECT_TRAITS(Process, KSynchronizationObject);
67
64public: 68public:
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