summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2021-04-23 22:04:28 -0700
committerGravatar bunnei2021-05-05 16:40:52 -0700
commit2a7eff57a8048933a89c1a8f8d6dced7b5d604f2 (patch)
tree757a2207ab4d29b39ee8d9ddfa79966283d4d24a /src/core/hle/kernel
parenthle: kernel: Remove deprecated Object class. (diff)
downloadyuzu-2a7eff57a8048933a89c1a8f8d6dced7b5d604f2.tar.gz
yuzu-2a7eff57a8048933a89c1a8f8d6dced7b5d604f2.tar.xz
yuzu-2a7eff57a8048933a89c1a8f8d6dced7b5d604f2.zip
hle: kernel: Rename Process to KProcess.
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/handle_table.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.h2
-rw-r--r--src/core/hle/kernel/init/init_slab_setup.cpp8
-rw-r--r--src/core/hle/kernel/init/init_slab_setup.h2
-rw-r--r--src/core/hle/kernel/k_auto_object.h4
-rw-r--r--src/core/hle/kernel/k_auto_object_container.cpp2
-rw-r--r--src/core/hle/kernel/k_auto_object_container.h4
-rw-r--r--src/core/hle/kernel/k_class_token.h2
-rw-r--r--src/core/hle/kernel/k_condition_variable.cpp2
-rw-r--r--src/core/hle/kernel/k_event.cpp4
-rw-r--r--src/core/hle/kernel/k_event.h6
-rw-r--r--src/core/hle/kernel/k_page_table.cpp2
-rw-r--r--src/core/hle/kernel/k_process.cpp (renamed from src/core/hle/kernel/process.cpp)62
-rw-r--r--src/core/hle/kernel/k_process.h (renamed from src/core/hle/kernel/process.h)11
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp16
-rw-r--r--src/core/hle/kernel/k_scheduler.h6
-rw-r--r--src/core/hle/kernel/k_scoped_resource_reservation.h6
-rw-r--r--src/core/hle/kernel/k_server_session.cpp2
-rw-r--r--src/core/hle/kernel/k_session.cpp2
-rw-r--r--src/core/hle/kernel/k_session.h2
-rw-r--r--src/core/hle/kernel/k_shared_memory.cpp4
-rw-r--r--src/core/hle/kernel/k_shared_memory.h8
-rw-r--r--src/core/hle/kernel/k_thread.cpp10
-rw-r--r--src/core/hle/kernel/k_thread.h16
-rw-r--r--src/core/hle/kernel/k_transfer_memory.cpp4
-rw-r--r--src/core/hle/kernel/k_transfer_memory.h6
-rw-r--r--src/core/hle/kernel/kernel.cpp26
-rw-r--r--src/core/hle/kernel/kernel.h18
-rw-r--r--src/core/hle/kernel/svc.cpp30
30 files changed, 136 insertions, 135 deletions
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp
index cd752da4e..16c528f5b 100644
--- a/src/core/hle/kernel/handle_table.cpp
+++ b/src/core/hle/kernel/handle_table.cpp
@@ -7,10 +7,10 @@
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core.h" 8#include "core/core.h"
9#include "core/hle/kernel/handle_table.h" 9#include "core/hle/kernel/handle_table.h"
10#include "core/hle/kernel/k_process.h"
10#include "core/hle/kernel/k_scheduler.h" 11#include "core/hle/kernel/k_scheduler.h"
11#include "core/hle/kernel/k_thread.h" 12#include "core/hle/kernel/k_thread.h"
12#include "core/hle/kernel/kernel.h" 13#include "core/hle/kernel/kernel.h"
13#include "core/hle/kernel/process.h"
14#include "core/hle/kernel/svc_results.h" 14#include "core/hle/kernel/svc_results.h"
15 15
16namespace Kernel { 16namespace Kernel {
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index a11528f28..69190286d 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -16,6 +16,7 @@
16#include "core/hle/ipc_helpers.h" 16#include "core/hle/ipc_helpers.h"
17#include "core/hle/kernel/handle_table.h" 17#include "core/hle/kernel/handle_table.h"
18#include "core/hle/kernel/hle_ipc.h" 18#include "core/hle/kernel/hle_ipc.h"
19#include "core/hle/kernel/k_process.h"
19#include "core/hle/kernel/k_readable_event.h" 20#include "core/hle/kernel/k_readable_event.h"
20#include "core/hle/kernel/k_scheduler.h" 21#include "core/hle/kernel/k_scheduler.h"
21#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" 22#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
@@ -23,7 +24,6 @@
23#include "core/hle/kernel/k_thread.h" 24#include "core/hle/kernel/k_thread.h"
24#include "core/hle/kernel/k_writable_event.h" 25#include "core/hle/kernel/k_writable_event.h"
25#include "core/hle/kernel/kernel.h" 26#include "core/hle/kernel/kernel.h"
26#include "core/hle/kernel/process.h"
27#include "core/hle/kernel/svc_results.h" 27#include "core/hle/kernel/svc_results.h"
28#include "core/hle/kernel/time_manager.h" 28#include "core/hle/kernel/time_manager.h"
29#include "core/memory.h" 29#include "core/memory.h"
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 7f7ab74dd..4b92ba655 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -38,7 +38,7 @@ class Domain;
38class HandleTable; 38class HandleTable;
39class HLERequestContext; 39class HLERequestContext;
40class KernelCore; 40class KernelCore;
41class Process; 41class KProcess;
42class KServerSession; 42class KServerSession;
43class KThread; 43class KThread;
44class KReadableEvent; 44class KReadableEvent;
diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp
index f8c255732..04e481a0a 100644
--- a/src/core/hle/kernel/init/init_slab_setup.cpp
+++ b/src/core/hle/kernel/init/init_slab_setup.cpp
@@ -13,6 +13,7 @@
13#include "core/hle/kernel/k_memory_layout.h" 13#include "core/hle/kernel/k_memory_layout.h"
14#include "core/hle/kernel/k_memory_manager.h" 14#include "core/hle/kernel/k_memory_manager.h"
15#include "core/hle/kernel/k_port.h" 15#include "core/hle/kernel/k_port.h"
16#include "core/hle/kernel/k_process.h"
16#include "core/hle/kernel/k_resource_limit.h" 17#include "core/hle/kernel/k_resource_limit.h"
17#include "core/hle/kernel/k_session.h" 18#include "core/hle/kernel/k_session.h"
18#include "core/hle/kernel/k_shared_memory.h" 19#include "core/hle/kernel/k_shared_memory.h"
@@ -20,7 +21,6 @@
20#include "core/hle/kernel/k_thread.h" 21#include "core/hle/kernel/k_thread.h"
21#include "core/hle/kernel/k_transfer_memory.h" 22#include "core/hle/kernel/k_transfer_memory.h"
22#include "core/hle/kernel/memory_types.h" 23#include "core/hle/kernel/memory_types.h"
23#include "core/hle/kernel/process.h"
24#include "core/memory.h" 24#include "core/memory.h"
25 25
26namespace Kernel::Init { 26namespace Kernel::Init {
@@ -28,7 +28,7 @@ namespace Kernel::Init {
28#define SLAB_COUNT(CLASS) g_slab_resource_counts.num_##CLASS 28#define SLAB_COUNT(CLASS) g_slab_resource_counts.num_##CLASS
29 29
30#define FOREACH_SLAB_TYPE(HANDLER, ...) \ 30#define FOREACH_SLAB_TYPE(HANDLER, ...) \
31 HANDLER(Process, (SLAB_COUNT(Process)), ##__VA_ARGS__) \ 31 HANDLER(KProcess, (SLAB_COUNT(KProcess)), ##__VA_ARGS__) \
32 HANDLER(KThread, (SLAB_COUNT(KThread)), ##__VA_ARGS__) \ 32 HANDLER(KThread, (SLAB_COUNT(KThread)), ##__VA_ARGS__) \
33 HANDLER(KEvent, (SLAB_COUNT(KEvent)), ##__VA_ARGS__) \ 33 HANDLER(KEvent, (SLAB_COUNT(KEvent)), ##__VA_ARGS__) \
34 HANDLER(KPort, (SLAB_COUNT(KPort)), ##__VA_ARGS__) \ 34 HANDLER(KPort, (SLAB_COUNT(KPort)), ##__VA_ARGS__) \
@@ -48,7 +48,7 @@ enum KSlabType : u32 {
48#undef DEFINE_SLAB_TYPE_ENUM_MEMBER 48#undef DEFINE_SLAB_TYPE_ENUM_MEMBER
49 49
50// Constexpr counts. 50// Constexpr counts.
51constexpr size_t SlabCountProcess = 80; 51constexpr size_t SlabCountKProcess = 80;
52constexpr size_t SlabCountKThread = 800; 52constexpr size_t SlabCountKThread = 800;
53constexpr size_t SlabCountKEvent = 700; 53constexpr size_t SlabCountKEvent = 700;
54constexpr size_t SlabCountKInterruptEvent = 100; 54constexpr size_t SlabCountKInterruptEvent = 100;
@@ -69,7 +69,7 @@ constexpr size_t SlabCountExtraKThread = 160;
69 69
70// Global to hold our resource counts. 70// Global to hold our resource counts.
71KSlabResourceCounts g_slab_resource_counts = { 71KSlabResourceCounts g_slab_resource_counts = {
72 .num_Process = SlabCountProcess, 72 .num_KProcess = SlabCountKProcess,
73 .num_KThread = SlabCountKThread, 73 .num_KThread = SlabCountKThread,
74 .num_KEvent = SlabCountKEvent, 74 .num_KEvent = SlabCountKEvent,
75 .num_KInterruptEvent = SlabCountKInterruptEvent, 75 .num_KInterruptEvent = SlabCountKInterruptEvent,
diff --git a/src/core/hle/kernel/init/init_slab_setup.h b/src/core/hle/kernel/init/init_slab_setup.h
index 8876678b3..6418b97ac 100644
--- a/src/core/hle/kernel/init/init_slab_setup.h
+++ b/src/core/hle/kernel/init/init_slab_setup.h
@@ -15,7 +15,7 @@ class KMemoryLayout;
15namespace Kernel::Init { 15namespace Kernel::Init {
16 16
17struct KSlabResourceCounts { 17struct KSlabResourceCounts {
18 size_t num_Process; 18 size_t num_KProcess;
19 size_t num_KThread; 19 size_t num_KThread;
20 size_t num_KEvent; 20 size_t num_KEvent;
21 size_t num_KInterruptEvent; 21 size_t num_KInterruptEvent;
diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h
index fd6405a0e..5a180b7dc 100644
--- a/src/core/hle/kernel/k_auto_object.h
+++ b/src/core/hle/kernel/k_auto_object.h
@@ -15,7 +15,7 @@
15namespace Kernel { 15namespace Kernel {
16 16
17class KernelCore; 17class KernelCore;
18class Process; 18class KProcess;
19 19
20using Handle = u32; 20using Handle = u32;
21 21
@@ -106,7 +106,7 @@ public:
106 // Finalize is responsible for cleaning up resource, but does not destroy the object. 106 // Finalize is responsible for cleaning up resource, but does not destroy the object.
107 virtual void Finalize() {} 107 virtual void Finalize() {}
108 108
109 virtual Process* GetOwner() const { 109 virtual KProcess* GetOwner() const {
110 return nullptr; 110 return nullptr;
111 } 111 }
112 112
diff --git a/src/core/hle/kernel/k_auto_object_container.cpp b/src/core/hle/kernel/k_auto_object_container.cpp
index 9ba8a54c7..85d03ebe3 100644
--- a/src/core/hle/kernel/k_auto_object_container.cpp
+++ b/src/core/hle/kernel/k_auto_object_container.cpp
@@ -18,7 +18,7 @@ void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) {
18 m_object_list.erase(m_object_list.iterator_to(*obj)); 18 m_object_list.erase(m_object_list.iterator_to(*obj));
19} 19}
20 20
21size_t KAutoObjectWithListContainer::GetOwnedCount(Process* owner) { 21size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) {
22 KScopedLightLock lk(m_lock); 22 KScopedLightLock lk(m_lock);
23 23
24 size_t count = 0; 24 size_t count = 0;
diff --git a/src/core/hle/kernel/k_auto_object_container.h b/src/core/hle/kernel/k_auto_object_container.h
index 4b599b7c3..6d1cd4862 100644
--- a/src/core/hle/kernel/k_auto_object_container.h
+++ b/src/core/hle/kernel/k_auto_object_container.h
@@ -16,7 +16,7 @@
16namespace Kernel { 16namespace Kernel {
17 17
18class KernelCore; 18class KernelCore;
19class Process; 19class KProcess;
20 20
21class KAutoObjectWithListContainer { 21class KAutoObjectWithListContainer {
22 NON_COPYABLE(KAutoObjectWithListContainer); 22 NON_COPYABLE(KAutoObjectWithListContainer);
@@ -66,7 +66,7 @@ public:
66 66
67 void Register(KAutoObjectWithList* obj); 67 void Register(KAutoObjectWithList* obj);
68 void Unregister(KAutoObjectWithList* obj); 68 void Unregister(KAutoObjectWithList* obj);
69 size_t GetOwnedCount(Process* owner); 69 size_t GetOwnedCount(KProcess* owner);
70}; 70};
71 71
72} // namespace Kernel 72} // namespace Kernel
diff --git a/src/core/hle/kernel/k_class_token.h b/src/core/hle/kernel/k_class_token.h
index 89b80a341..fb4307cd0 100644
--- a/src/core/hle/kernel/k_class_token.h
+++ b/src/core/hle/kernel/k_class_token.h
@@ -97,7 +97,7 @@ public:
97 KServerSession, 97 KServerSession,
98 KClientPort, 98 KClientPort,
99 KClientSession, 99 KClientSession,
100 Process, 100 KProcess,
101 KResourceLimit, 101 KResourceLimit,
102 KLightSession, 102 KLightSession,
103 KPort, 103 KPort,
diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp
index 72565af05..a9738f7ce 100644
--- a/src/core/hle/kernel/k_condition_variable.cpp
+++ b/src/core/hle/kernel/k_condition_variable.cpp
@@ -8,12 +8,12 @@
8#include "core/core.h" 8#include "core/core.h"
9#include "core/hle/kernel/k_condition_variable.h" 9#include "core/hle/kernel/k_condition_variable.h"
10#include "core/hle/kernel/k_linked_list.h" 10#include "core/hle/kernel/k_linked_list.h"
11#include "core/hle/kernel/k_process.h"
11#include "core/hle/kernel/k_scheduler.h" 12#include "core/hle/kernel/k_scheduler.h"
12#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" 13#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
13#include "core/hle/kernel/k_synchronization_object.h" 14#include "core/hle/kernel/k_synchronization_object.h"
14#include "core/hle/kernel/k_thread.h" 15#include "core/hle/kernel/k_thread.h"
15#include "core/hle/kernel/kernel.h" 16#include "core/hle/kernel/kernel.h"
16#include "core/hle/kernel/process.h"
17#include "core/hle/kernel/svc_common.h" 17#include "core/hle/kernel/svc_common.h"
18#include "core/hle/kernel/svc_results.h" 18#include "core/hle/kernel/svc_results.h"
19#include "core/memory.h" 19#include "core/memory.h"
diff --git a/src/core/hle/kernel/k_event.cpp b/src/core/hle/kernel/k_event.cpp
index fdec0c36f..986355b78 100644
--- a/src/core/hle/kernel/k_event.cpp
+++ b/src/core/hle/kernel/k_event.cpp
@@ -3,8 +3,8 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "core/hle/kernel/k_event.h" 5#include "core/hle/kernel/k_event.h"
6#include "core/hle/kernel/k_process.h"
6#include "core/hle/kernel/k_resource_limit.h" 7#include "core/hle/kernel/k_resource_limit.h"
7#include "core/hle/kernel/process.h"
8 8
9namespace Kernel { 9namespace Kernel {
10 10
@@ -45,7 +45,7 @@ void KEvent::Finalize() {
45 45
46void KEvent::PostDestroy(uintptr_t arg) { 46void KEvent::PostDestroy(uintptr_t arg) {
47 // Release the event count resource the owner process holds. 47 // Release the event count resource the owner process holds.
48 Process* owner = reinterpret_cast<Process*>(arg); 48 KProcess* owner = reinterpret_cast<KProcess*>(arg);
49 if (owner) { 49 if (owner) {
50 owner->GetResourceLimit()->Release(LimitableResource::Events, 1); 50 owner->GetResourceLimit()->Release(LimitableResource::Events, 1);
51 owner->Close(); 51 owner->Close();
diff --git a/src/core/hle/kernel/k_event.h b/src/core/hle/kernel/k_event.h
index f0b89f882..4ca869930 100644
--- a/src/core/hle/kernel/k_event.h
+++ b/src/core/hle/kernel/k_event.h
@@ -13,7 +13,7 @@ namespace Kernel {
13class KernelCore; 13class KernelCore;
14class KReadableEvent; 14class KReadableEvent;
15class KWritableEvent; 15class KWritableEvent;
16class Process; 16class KProcess;
17 17
18class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> { 18class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> {
19 KERNEL_AUTOOBJECT_TRAITS(KEvent, KAutoObject); 19 KERNEL_AUTOOBJECT_TRAITS(KEvent, KAutoObject);
@@ -36,7 +36,7 @@ public:
36 36
37 static void PostDestroy(uintptr_t arg); 37 static void PostDestroy(uintptr_t arg);
38 38
39 virtual Process* GetOwner() const override { 39 virtual KProcess* GetOwner() const override {
40 return owner; 40 return owner;
41 } 41 }
42 42
@@ -51,7 +51,7 @@ public:
51private: 51private:
52 KReadableEvent readable_event; 52 KReadableEvent readable_event;
53 KWritableEvent writable_event; 53 KWritableEvent writable_event;
54 Process* owner{}; 54 KProcess* owner{};
55 bool initialized{}; 55 bool initialized{};
56}; 56};
57 57
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp
index 5f60b95cd..2f33cb6c1 100644
--- a/src/core/hle/kernel/k_page_table.cpp
+++ b/src/core/hle/kernel/k_page_table.cpp
@@ -11,11 +11,11 @@
11#include "core/hle/kernel/k_memory_block_manager.h" 11#include "core/hle/kernel/k_memory_block_manager.h"
12#include "core/hle/kernel/k_page_linked_list.h" 12#include "core/hle/kernel/k_page_linked_list.h"
13#include "core/hle/kernel/k_page_table.h" 13#include "core/hle/kernel/k_page_table.h"
14#include "core/hle/kernel/k_process.h"
14#include "core/hle/kernel/k_resource_limit.h" 15#include "core/hle/kernel/k_resource_limit.h"
15#include "core/hle/kernel/k_scoped_resource_reservation.h" 16#include "core/hle/kernel/k_scoped_resource_reservation.h"
16#include "core/hle/kernel/k_system_control.h" 17#include "core/hle/kernel/k_system_control.h"
17#include "core/hle/kernel/kernel.h" 18#include "core/hle/kernel/kernel.h"
18#include "core/hle/kernel/process.h"
19#include "core/hle/kernel/svc_results.h" 19#include "core/hle/kernel/svc_results.h"
20#include "core/memory.h" 20#include "core/memory.h"
21 21
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/k_process.cpp
index 315640bea..edc3b5175 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -17,13 +17,13 @@
17#include "core/hle/kernel/code_set.h" 17#include "core/hle/kernel/code_set.h"
18#include "core/hle/kernel/k_memory_block_manager.h" 18#include "core/hle/kernel/k_memory_block_manager.h"
19#include "core/hle/kernel/k_page_table.h" 19#include "core/hle/kernel/k_page_table.h"
20#include "core/hle/kernel/k_process.h"
20#include "core/hle/kernel/k_resource_limit.h" 21#include "core/hle/kernel/k_resource_limit.h"
21#include "core/hle/kernel/k_scheduler.h" 22#include "core/hle/kernel/k_scheduler.h"
22#include "core/hle/kernel/k_scoped_resource_reservation.h" 23#include "core/hle/kernel/k_scoped_resource_reservation.h"
23#include "core/hle/kernel/k_slab_heap.h" 24#include "core/hle/kernel/k_slab_heap.h"
24#include "core/hle/kernel/k_thread.h" 25#include "core/hle/kernel/k_thread.h"
25#include "core/hle/kernel/kernel.h" 26#include "core/hle/kernel/kernel.h"
26#include "core/hle/kernel/process.h"
27#include "core/hle/kernel/svc_results.h" 27#include "core/hle/kernel/svc_results.h"
28#include "core/hle/lock.h" 28#include "core/hle/lock.h"
29#include "core/memory.h" 29#include "core/memory.h"
@@ -37,7 +37,7 @@ namespace {
37 * @param owner_process The parent process for the main thread 37 * @param owner_process The parent process for the main thread
38 * @param priority The priority to give the main thread 38 * @param priority The priority to give the main thread
39 */ 39 */
40void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) { 40void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority, VAddr stack_top) {
41 const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart(); 41 const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart();
42 ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::Threads, 1)); 42 ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::Threads, 1));
43 43
@@ -117,8 +117,8 @@ private:
117 std::bitset<num_slot_entries> is_slot_used; 117 std::bitset<num_slot_entries> is_slot_used;
118}; 118};
119 119
120ResultCode Process::Initialize(Process* process, Core::System& system, std::string name, 120ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::string name,
121 ProcessType type) { 121 ProcessType type) {
122 auto& kernel = system.Kernel(); 122 auto& kernel = system.Kernel();
123 123
124 process->name = std::move(name); 124 process->name = std::move(name);
@@ -144,11 +144,11 @@ ResultCode Process::Initialize(Process* process, Core::System& system, std::stri
144 return RESULT_SUCCESS; 144 return RESULT_SUCCESS;
145} 145}
146 146
147KResourceLimit* Process::GetResourceLimit() const { 147KResourceLimit* KProcess::GetResourceLimit() const {
148 return resource_limit; 148 return resource_limit;
149} 149}
150 150
151void Process::IncrementThreadCount() { 151void KProcess::IncrementThreadCount() {
152 ASSERT(num_threads >= 0); 152 ASSERT(num_threads >= 0);
153 num_created_threads++; 153 num_created_threads++;
154 154
@@ -157,7 +157,7 @@ void Process::IncrementThreadCount() {
157 } 157 }
158} 158}
159 159
160void Process::DecrementThreadCount() { 160void KProcess::DecrementThreadCount() {
161 ASSERT(num_threads > 0); 161 ASSERT(num_threads > 0);
162 162
163 if (const auto count = --num_threads; count == 0) { 163 if (const auto count = --num_threads; count == 0) {
@@ -165,7 +165,7 @@ void Process::DecrementThreadCount() {
165 } 165 }
166} 166}
167 167
168u64 Process::GetTotalPhysicalMemoryAvailable() const { 168u64 KProcess::GetTotalPhysicalMemoryAvailable() const {
169 const u64 capacity{resource_limit->GetFreeValue(LimitableResource::PhysicalMemory) + 169 const u64 capacity{resource_limit->GetFreeValue(LimitableResource::PhysicalMemory) +
170 page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size + 170 page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size +
171 main_thread_stack_size}; 171 main_thread_stack_size};
@@ -179,20 +179,20 @@ u64 Process::GetTotalPhysicalMemoryAvailable() const {
179 return memory_usage_capacity; 179 return memory_usage_capacity;
180} 180}
181 181
182u64 Process::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const { 182u64 KProcess::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const {
183 return GetTotalPhysicalMemoryAvailable() - GetSystemResourceSize(); 183 return GetTotalPhysicalMemoryAvailable() - GetSystemResourceSize();
184} 184}
185 185
186u64 Process::GetTotalPhysicalMemoryUsed() const { 186u64 KProcess::GetTotalPhysicalMemoryUsed() const {
187 return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() + 187 return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() +
188 GetSystemResourceSize(); 188 GetSystemResourceSize();
189} 189}
190 190
191u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const { 191u64 KProcess::GetTotalPhysicalMemoryUsedWithoutSystemResource() const {
192 return GetTotalPhysicalMemoryUsed() - GetSystemResourceUsage(); 192 return GetTotalPhysicalMemoryUsed() - GetSystemResourceUsage();
193} 193}
194 194
195bool Process::ReleaseUserException(KThread* thread) { 195bool KProcess::ReleaseUserException(KThread* thread) {
196 KScopedSchedulerLock sl{kernel}; 196 KScopedSchedulerLock sl{kernel};
197 197
198 if (exception_thread == thread) { 198 if (exception_thread == thread) {
@@ -217,7 +217,7 @@ bool Process::ReleaseUserException(KThread* thread) {
217 } 217 }
218} 218}
219 219
220void Process::PinCurrentThread() { 220void KProcess::PinCurrentThread() {
221 ASSERT(kernel.GlobalSchedulerContext().IsLocked()); 221 ASSERT(kernel.GlobalSchedulerContext().IsLocked());
222 222
223 // Get the current thread. 223 // Get the current thread.
@@ -232,7 +232,7 @@ void Process::PinCurrentThread() {
232 KScheduler::SetSchedulerUpdateNeeded(kernel); 232 KScheduler::SetSchedulerUpdateNeeded(kernel);
233} 233}
234 234
235void Process::UnpinCurrentThread() { 235void KProcess::UnpinCurrentThread() {
236 ASSERT(kernel.GlobalSchedulerContext().IsLocked()); 236 ASSERT(kernel.GlobalSchedulerContext().IsLocked());
237 237
238 // Get the current thread. 238 // Get the current thread.
@@ -247,15 +247,15 @@ void Process::UnpinCurrentThread() {
247 KScheduler::SetSchedulerUpdateNeeded(kernel); 247 KScheduler::SetSchedulerUpdateNeeded(kernel);
248} 248}
249 249
250void Process::RegisterThread(const KThread* thread) { 250void KProcess::RegisterThread(const KThread* thread) {
251 thread_list.push_back(thread); 251 thread_list.push_back(thread);
252} 252}
253 253
254void Process::UnregisterThread(const KThread* thread) { 254void KProcess::UnregisterThread(const KThread* thread) {
255 thread_list.remove(thread); 255 thread_list.remove(thread);
256} 256}
257 257
258ResultCode Process::Reset() { 258ResultCode KProcess::Reset() {
259 // Lock the process and the scheduler. 259 // Lock the process and the scheduler.
260 KScopedLightLock lk(state_lock); 260 KScopedLightLock lk(state_lock);
261 KScopedSchedulerLock sl{kernel}; 261 KScopedSchedulerLock sl{kernel};
@@ -269,8 +269,8 @@ ResultCode Process::Reset() {
269 return RESULT_SUCCESS; 269 return RESULT_SUCCESS;
270} 270}
271 271
272ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, 272ResultCode KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
273 std::size_t code_size) { 273 std::size_t code_size) {
274 program_id = metadata.GetTitleID(); 274 program_id = metadata.GetTitleID();
275 ideal_core = metadata.GetMainThreadCore(); 275 ideal_core = metadata.GetMainThreadCore();
276 is_64bit_process = metadata.Is64BitProgram(); 276 is_64bit_process = metadata.Is64BitProgram();
@@ -332,7 +332,7 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
332 return handle_table.SetSize(capabilities.GetHandleTableSize()); 332 return handle_table.SetSize(capabilities.GetHandleTableSize());
333} 333}
334 334
335void Process::Run(s32 main_thread_priority, u64 stack_size) { 335void KProcess::Run(s32 main_thread_priority, u64 stack_size) {
336 AllocateMainThreadStack(stack_size); 336 AllocateMainThreadStack(stack_size);
337 resource_limit->Reserve(LimitableResource::Threads, 1); 337 resource_limit->Reserve(LimitableResource::Threads, 1);
338 resource_limit->Reserve(LimitableResource::PhysicalMemory, main_thread_stack_size); 338 resource_limit->Reserve(LimitableResource::PhysicalMemory, main_thread_stack_size);
@@ -345,7 +345,7 @@ void Process::Run(s32 main_thread_priority, u64 stack_size) {
345 SetupMainThread(kernel.System(), *this, main_thread_priority, main_thread_stack_top); 345 SetupMainThread(kernel.System(), *this, main_thread_priority, main_thread_stack_top);
346} 346}
347 347
348void Process::PrepareForTermination() { 348void KProcess::PrepareForTermination() {
349 ChangeStatus(ProcessStatus::Exiting); 349 ChangeStatus(ProcessStatus::Exiting);
350 350
351 const auto stop_threads = [this](const std::vector<KThread*>& thread_list) { 351 const auto stop_threads = [this](const std::vector<KThread*>& thread_list) {
@@ -377,14 +377,14 @@ void Process::PrepareForTermination() {
377 ChangeStatus(ProcessStatus::Exited); 377 ChangeStatus(ProcessStatus::Exited);
378} 378}
379 379
380void Process::Finalize() { 380void KProcess::Finalize() {
381 // Release memory to the resource limit. 381 // Release memory to the resource limit.
382 if (resource_limit != nullptr) { 382 if (resource_limit != nullptr) {
383 resource_limit->Close(); 383 resource_limit->Close();
384 } 384 }
385 385
386 // Perform inherited finalization. 386 // Perform inherited finalization.
387 KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject>::Finalize(); 387 KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject>::Finalize();
388} 388}
389 389
390/** 390/**
@@ -400,7 +400,7 @@ static auto FindTLSPageWithAvailableSlots(std::vector<TLSPage>& tls_pages) {
400 [](const auto& page) { return page.HasAvailableSlots(); }); 400 [](const auto& page) { return page.HasAvailableSlots(); });
401} 401}
402 402
403VAddr Process::CreateTLSRegion() { 403VAddr KProcess::CreateTLSRegion() {
404 KScopedSchedulerLock lock(kernel); 404 KScopedSchedulerLock lock(kernel);
405 if (auto tls_page_iter{FindTLSPageWithAvailableSlots(tls_pages)}; 405 if (auto tls_page_iter{FindTLSPageWithAvailableSlots(tls_pages)};
406 tls_page_iter != tls_pages.cend()) { 406 tls_page_iter != tls_pages.cend()) {
@@ -431,7 +431,7 @@ VAddr Process::CreateTLSRegion() {
431 return *reserve_result; 431 return *reserve_result;
432} 432}
433 433
434void Process::FreeTLSRegion(VAddr tls_address) { 434void KProcess::FreeTLSRegion(VAddr tls_address) {
435 KScopedSchedulerLock lock(kernel); 435 KScopedSchedulerLock lock(kernel);
436 const VAddr aligned_address = Common::AlignDown(tls_address, Core::Memory::PAGE_SIZE); 436 const VAddr aligned_address = Common::AlignDown(tls_address, Core::Memory::PAGE_SIZE);
437 auto iter = 437 auto iter =
@@ -446,7 +446,7 @@ void Process::FreeTLSRegion(VAddr tls_address) {
446 iter->ReleaseSlot(tls_address); 446 iter->ReleaseSlot(tls_address);
447} 447}
448 448
449void Process::LoadModule(CodeSet code_set, VAddr base_addr) { 449void KProcess::LoadModule(CodeSet code_set, VAddr base_addr) {
450 std::lock_guard lock{HLE::g_hle_lock}; 450 std::lock_guard lock{HLE::g_hle_lock};
451 const auto ReprotectSegment = [&](const CodeSet::Segment& segment, 451 const auto ReprotectSegment = [&](const CodeSet::Segment& segment,
452 KMemoryPermission permission) { 452 KMemoryPermission permission) {
@@ -461,19 +461,19 @@ void Process::LoadModule(CodeSet code_set, VAddr base_addr) {
461 ReprotectSegment(code_set.DataSegment(), KMemoryPermission::ReadAndWrite); 461 ReprotectSegment(code_set.DataSegment(), KMemoryPermission::ReadAndWrite);
462} 462}
463 463
464bool Process::IsSignaled() const { 464bool KProcess::IsSignaled() const {
465 ASSERT(kernel.GlobalSchedulerContext().IsLocked()); 465 ASSERT(kernel.GlobalSchedulerContext().IsLocked());
466 return is_signaled; 466 return is_signaled;
467} 467}
468 468
469Process::Process(KernelCore& kernel) 469KProcess::KProcess(KernelCore& kernel)
470 : KAutoObjectWithSlabHeapAndContainer{kernel}, 470 : KAutoObjectWithSlabHeapAndContainer{kernel},
471 page_table{std::make_unique<KPageTable>(kernel.System())}, handle_table{kernel}, 471 page_table{std::make_unique<KPageTable>(kernel.System())}, handle_table{kernel},
472 address_arbiter{kernel.System()}, condition_var{kernel.System()}, state_lock{kernel} {} 472 address_arbiter{kernel.System()}, condition_var{kernel.System()}, state_lock{kernel} {}
473 473
474Process::~Process() = default; 474KProcess::~KProcess() = default;
475 475
476void Process::ChangeStatus(ProcessStatus new_status) { 476void KProcess::ChangeStatus(ProcessStatus new_status) {
477 if (status == new_status) { 477 if (status == new_status) {
478 return; 478 return;
479 } 479 }
@@ -483,7 +483,7 @@ void Process::ChangeStatus(ProcessStatus new_status) {
483 NotifyAvailable(); 483 NotifyAvailable();
484} 484}
485 485
486ResultCode Process::AllocateMainThreadStack(std::size_t stack_size) { 486ResultCode KProcess::AllocateMainThreadStack(std::size_t stack_size) {
487 ASSERT(stack_size); 487 ASSERT(stack_size);
488 488
489 // The kernel always ensures that the given stack size is page aligned. 489 // The kernel always ensures that the given stack size is page aligned.
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/k_process.h
index b775e1fd0..961c0d9ba 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/k_process.h
@@ -62,12 +62,13 @@ enum class ProcessStatus {
62 DebugBreak, 62 DebugBreak,
63}; 63};
64 64
65class Process final : public KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject> { 65class KProcess final
66 KERNEL_AUTOOBJECT_TRAITS(Process, KSynchronizationObject); 66 : public KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject> {
67 KERNEL_AUTOOBJECT_TRAITS(KProcess, KSynchronizationObject);
67 68
68public: 69public:
69 explicit Process(KernelCore& kernel); 70 explicit KProcess(KernelCore& kernel);
70 ~Process() override; 71 ~KProcess() override;
71 72
72 enum : u64 { 73 enum : u64 {
73 /// Lowest allowed process ID for a kernel initial process. 74 /// Lowest allowed process ID for a kernel initial process.
@@ -89,7 +90,7 @@ public:
89 90
90 static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4; 91 static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4;
91 92
92 static ResultCode Initialize(Process* process, Core::System& system, std::string name, 93 static ResultCode Initialize(KProcess* process, Core::System& system, std::string name,
93 ProcessType type); 94 ProcessType type);
94 95
95 /// Gets a reference to the process' page table. 96 /// Gets a reference to the process' page table.
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp
index 38c6b50fa..0115fe6d1 100644
--- a/src/core/hle/kernel/k_scheduler.cpp
+++ b/src/core/hle/kernel/k_scheduler.cpp
@@ -15,12 +15,12 @@
15#include "core/core.h" 15#include "core/core.h"
16#include "core/core_timing.h" 16#include "core/core_timing.h"
17#include "core/cpu_manager.h" 17#include "core/cpu_manager.h"
18#include "core/hle/kernel/k_process.h"
18#include "core/hle/kernel/k_scheduler.h" 19#include "core/hle/kernel/k_scheduler.h"
19#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" 20#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
20#include "core/hle/kernel/k_thread.h" 21#include "core/hle/kernel/k_thread.h"
21#include "core/hle/kernel/kernel.h" 22#include "core/hle/kernel/kernel.h"
22#include "core/hle/kernel/physical_core.h" 23#include "core/hle/kernel/physical_core.h"
23#include "core/hle/kernel/process.h"
24#include "core/hle/kernel/time_manager.h" 24#include "core/hle/kernel/time_manager.h"
25 25
26namespace Kernel { 26namespace Kernel {
@@ -71,7 +71,7 @@ u64 KScheduler::UpdateHighestPriorityThread(KThread* highest_thread) {
71 } 71 }
72 if (state.should_count_idle) { 72 if (state.should_count_idle) {
73 if (highest_thread != nullptr) { 73 if (highest_thread != nullptr) {
74 if (Process* process = highest_thread->GetOwnerProcess(); process != nullptr) { 74 if (KProcess* process = highest_thread->GetOwnerProcess(); process != nullptr) {
75 process->SetRunningThread(core_id, highest_thread, state.idle_count); 75 process->SetRunningThread(core_id, highest_thread, state.idle_count);
76 } 76 }
77 } else { 77 } else {
@@ -104,7 +104,7 @@ u64 KScheduler::UpdateHighestPriorityThreadsImpl(KernelCore& kernel) {
104 if (top_thread != nullptr) { 104 if (top_thread != nullptr) {
105 // If the thread has no waiters, we need to check if the process has a thread pinned. 105 // If the thread has no waiters, we need to check if the process has a thread pinned.
106 if (top_thread->GetNumKernelWaiters() == 0) { 106 if (top_thread->GetNumKernelWaiters() == 0) {
107 if (Process* parent = top_thread->GetOwnerProcess(); parent != nullptr) { 107 if (KProcess* parent = top_thread->GetOwnerProcess(); parent != nullptr) {
108 if (KThread* pinned = parent->GetPinnedThread(static_cast<s32>(core_id)); 108 if (KThread* pinned = parent->GetPinnedThread(static_cast<s32>(core_id));
109 pinned != nullptr && pinned != top_thread) { 109 pinned != nullptr && pinned != top_thread) {
110 // We prefer our parent's pinned thread if possible. However, we also don't 110 // We prefer our parent's pinned thread if possible. However, we also don't
@@ -411,7 +411,7 @@ void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) {
411 411
412 // Get the current thread and process. 412 // Get the current thread and process.
413 KThread& cur_thread = Kernel::GetCurrentThread(kernel); 413 KThread& cur_thread = Kernel::GetCurrentThread(kernel);
414 Process& cur_process = *kernel.CurrentProcess(); 414 KProcess& cur_process = *kernel.CurrentProcess();
415 415
416 // If the thread's yield count matches, there's nothing for us to do. 416 // If the thread's yield count matches, there's nothing for us to do.
417 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { 417 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
@@ -450,7 +450,7 @@ void KScheduler::YieldWithCoreMigration(KernelCore& kernel) {
450 450
451 // Get the current thread and process. 451 // Get the current thread and process.
452 KThread& cur_thread = Kernel::GetCurrentThread(kernel); 452 KThread& cur_thread = Kernel::GetCurrentThread(kernel);
453 Process& cur_process = *kernel.CurrentProcess(); 453 KProcess& cur_process = *kernel.CurrentProcess();
454 454
455 // If the thread's yield count matches, there's nothing for us to do. 455 // If the thread's yield count matches, there's nothing for us to do.
456 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { 456 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
@@ -538,7 +538,7 @@ void KScheduler::YieldToAnyThread(KernelCore& kernel) {
538 538
539 // Get the current thread and process. 539 // Get the current thread and process.
540 KThread& cur_thread = Kernel::GetCurrentThread(kernel); 540 KThread& cur_thread = Kernel::GetCurrentThread(kernel);
541 Process& cur_process = *kernel.CurrentProcess(); 541 KProcess& cur_process = *kernel.CurrentProcess();
542 542
543 // If the thread's yield count matches, there's nothing for us to do. 543 // If the thread's yield count matches, there's nothing for us to do.
544 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { 544 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
@@ -724,7 +724,7 @@ void KScheduler::ScheduleImpl() {
724 724
725 current_thread.store(next_thread); 725 current_thread.store(next_thread);
726 726
727 Process* const previous_process = system.Kernel().CurrentProcess(); 727 KProcess* const previous_process = system.Kernel().CurrentProcess();
728 728
729 UpdateLastContextSwitchTime(previous_thread, previous_process); 729 UpdateLastContextSwitchTime(previous_thread, previous_process);
730 730
@@ -780,7 +780,7 @@ void KScheduler::SwitchToCurrent() {
780 } 780 }
781} 781}
782 782
783void KScheduler::UpdateLastContextSwitchTime(KThread* thread, Process* process) { 783void KScheduler::UpdateLastContextSwitchTime(KThread* thread, KProcess* process) {
784 const u64 prev_switch_ticks = last_context_switch_time; 784 const u64 prev_switch_ticks = last_context_switch_time;
785 const u64 most_recent_switch_ticks = system.CoreTiming().GetCPUTicks(); 785 const u64 most_recent_switch_ticks = system.CoreTiming().GetCPUTicks();
786 const u64 update_ticks = most_recent_switch_ticks - prev_switch_ticks; 786 const u64 update_ticks = most_recent_switch_ticks - prev_switch_ticks;
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h
index 01387b892..282c1863b 100644
--- a/src/core/hle/kernel/k_scheduler.h
+++ b/src/core/hle/kernel/k_scheduler.h
@@ -24,7 +24,7 @@ class System;
24namespace Kernel { 24namespace Kernel {
25 25
26class KernelCore; 26class KernelCore;
27class Process; 27class KProcess;
28class SchedulerLock; 28class SchedulerLock;
29class KThread; 29class KThread;
30 30
@@ -165,7 +165,7 @@ private:
165 * most recent tick count retrieved. No special arithmetic is 165 * most recent tick count retrieved. No special arithmetic is
166 * applied to it. 166 * applied to it.
167 */ 167 */
168 void UpdateLastContextSwitchTime(KThread* thread, Process* process); 168 void UpdateLastContextSwitchTime(KThread* thread, KProcess* process);
169 169
170 static void OnSwitch(void* this_scheduler); 170 static void OnSwitch(void* this_scheduler);
171 void SwitchToCurrent(); 171 void SwitchToCurrent();
@@ -197,7 +197,7 @@ private:
197 197
198class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { 198class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> {
199public: 199public:
200 explicit KScopedSchedulerLock(KernelCore & kernel); 200 explicit KScopedSchedulerLock(KernelCore& kernel);
201 ~KScopedSchedulerLock(); 201 ~KScopedSchedulerLock();
202}; 202};
203 203
diff --git a/src/core/hle/kernel/k_scoped_resource_reservation.h b/src/core/hle/kernel/k_scoped_resource_reservation.h
index b160587c5..07272075d 100644
--- a/src/core/hle/kernel/k_scoped_resource_reservation.h
+++ b/src/core/hle/kernel/k_scoped_resource_reservation.h
@@ -8,8 +8,8 @@
8#pragma once 8#pragma once
9 9
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/hle/kernel/k_process.h"
11#include "core/hle/kernel/k_resource_limit.h" 12#include "core/hle/kernel/k_resource_limit.h"
12#include "core/hle/kernel/process.h"
13 13
14namespace Kernel { 14namespace Kernel {
15 15
@@ -33,10 +33,10 @@ public:
33 } 33 }
34 } 34 }
35 35
36 explicit KScopedResourceReservation(const Process* p, LimitableResource r, s64 v, s64 t) 36 explicit KScopedResourceReservation(const KProcess* p, LimitableResource r, s64 v, s64 t)
37 : KScopedResourceReservation(p->GetResourceLimit(), r, v, t) {} 37 : KScopedResourceReservation(p->GetResourceLimit(), r, v, t) {}
38 38
39 explicit KScopedResourceReservation(const Process* p, LimitableResource r, s64 v = 1) 39 explicit KScopedResourceReservation(const KProcess* p, LimitableResource r, s64 v = 1)
40 : KScopedResourceReservation(p->GetResourceLimit(), r, v) {} 40 : KScopedResourceReservation(p->GetResourceLimit(), r, v) {}
41 41
42 ~KScopedResourceReservation() noexcept { 42 ~KScopedResourceReservation() noexcept {
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp
index 863f9aa5f..3bc259693 100644
--- a/src/core/hle/kernel/k_server_session.cpp
+++ b/src/core/hle/kernel/k_server_session.cpp
@@ -13,12 +13,12 @@
13#include "core/hle/kernel/handle_table.h" 13#include "core/hle/kernel/handle_table.h"
14#include "core/hle/kernel/hle_ipc.h" 14#include "core/hle/kernel/hle_ipc.h"
15#include "core/hle/kernel/k_client_port.h" 15#include "core/hle/kernel/k_client_port.h"
16#include "core/hle/kernel/k_process.h"
16#include "core/hle/kernel/k_scheduler.h" 17#include "core/hle/kernel/k_scheduler.h"
17#include "core/hle/kernel/k_server_session.h" 18#include "core/hle/kernel/k_server_session.h"
18#include "core/hle/kernel/k_session.h" 19#include "core/hle/kernel/k_session.h"
19#include "core/hle/kernel/k_thread.h" 20#include "core/hle/kernel/k_thread.h"
20#include "core/hle/kernel/kernel.h" 21#include "core/hle/kernel/kernel.h"
21#include "core/hle/kernel/process.h"
22#include "core/memory.h" 22#include "core/memory.h"
23 23
24namespace Kernel { 24namespace Kernel {
diff --git a/src/core/hle/kernel/k_session.cpp b/src/core/hle/kernel/k_session.cpp
index 6f5947ce7..5e629d446 100644
--- a/src/core/hle/kernel/k_session.cpp
+++ b/src/core/hle/kernel/k_session.cpp
@@ -71,7 +71,7 @@ void KSession::OnClientClosed() {
71 71
72void KSession::PostDestroy(uintptr_t arg) { 72void KSession::PostDestroy(uintptr_t arg) {
73 // Release the session count resource the owner process holds. 73 // Release the session count resource the owner process holds.
74 Process* owner = reinterpret_cast<Process*>(arg); 74 KProcess* owner = reinterpret_cast<KProcess*>(arg);
75 owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1); 75 owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1);
76 owner->Close(); 76 owner->Close();
77} 77}
diff --git a/src/core/hle/kernel/k_session.h b/src/core/hle/kernel/k_session.h
index f29195fa0..d50e21f3f 100644
--- a/src/core/hle/kernel/k_session.h
+++ b/src/core/hle/kernel/k_session.h
@@ -89,7 +89,7 @@ private:
89 std::atomic<std::underlying_type<State>::type> atomic_state{ 89 std::atomic<std::underlying_type<State>::type> atomic_state{
90 static_cast<std::underlying_type<State>::type>(State::Invalid)}; 90 static_cast<std::underlying_type<State>::type>(State::Invalid)};
91 KClientPort* port{}; 91 KClientPort* port{};
92 Process* process{}; 92 KProcess* process{};
93 bool initialized{}; 93 bool initialized{};
94}; 94};
95 95
diff --git a/src/core/hle/kernel/k_shared_memory.cpp b/src/core/hle/kernel/k_shared_memory.cpp
index e91bc94bd..f137a182a 100644
--- a/src/core/hle/kernel/k_shared_memory.cpp
+++ b/src/core/hle/kernel/k_shared_memory.cpp
@@ -19,7 +19,7 @@ KSharedMemory::~KSharedMemory() {
19} 19}
20 20
21ResultCode KSharedMemory::Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_, 21ResultCode KSharedMemory::Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_,
22 Process* owner_process_, KPageLinkedList&& page_list_, 22 KProcess* owner_process_, KPageLinkedList&& page_list_,
23 KMemoryPermission owner_permission_, 23 KMemoryPermission owner_permission_,
24 KMemoryPermission user_permission_, PAddr physical_address_, 24 KMemoryPermission user_permission_, PAddr physical_address_,
25 std::size_t size_, std::string name_) { 25 std::size_t size_, std::string name_) {
@@ -74,7 +74,7 @@ void KSharedMemory::Finalize() {
74 KAutoObjectWithSlabHeapAndContainer<KSharedMemory, KAutoObjectWithList>::Finalize(); 74 KAutoObjectWithSlabHeapAndContainer<KSharedMemory, KAutoObjectWithList>::Finalize();
75} 75}
76 76
77ResultCode KSharedMemory::Map(Process& target_process, VAddr address, std::size_t size, 77ResultCode KSharedMemory::Map(KProcess& target_process, VAddr address, std::size_t size,
78 KMemoryPermission permissions) { 78 KMemoryPermission permissions) {
79 const u64 page_count{(size + PageSize - 1) / PageSize}; 79 const u64 page_count{(size + PageSize - 1) / PageSize};
80 80
diff --git a/src/core/hle/kernel/k_shared_memory.h b/src/core/hle/kernel/k_shared_memory.h
index 9547546a5..2d315c916 100644
--- a/src/core/hle/kernel/k_shared_memory.h
+++ b/src/core/hle/kernel/k_shared_memory.h
@@ -11,7 +11,7 @@
11#include "core/device_memory.h" 11#include "core/device_memory.h"
12#include "core/hle/kernel/k_memory_block.h" 12#include "core/hle/kernel/k_memory_block.h"
13#include "core/hle/kernel/k_page_linked_list.h" 13#include "core/hle/kernel/k_page_linked_list.h"
14#include "core/hle/kernel/process.h" 14#include "core/hle/kernel/k_process.h"
15#include "core/hle/kernel/slab_helpers.h" 15#include "core/hle/kernel/slab_helpers.h"
16#include "core/hle/result.h" 16#include "core/hle/result.h"
17 17
@@ -28,7 +28,7 @@ public:
28 ~KSharedMemory() override; 28 ~KSharedMemory() override;
29 29
30 ResultCode Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_, 30 ResultCode Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_,
31 Process* owner_process_, KPageLinkedList&& page_list_, 31 KProcess* owner_process_, KPageLinkedList&& page_list_,
32 KMemoryPermission owner_permission_, KMemoryPermission user_permission_, 32 KMemoryPermission owner_permission_, KMemoryPermission user_permission_,
33 PAddr physical_address_, std::size_t size_, std::string name_); 33 PAddr physical_address_, std::size_t size_, std::string name_);
34 34
@@ -39,7 +39,7 @@ public:
39 * @param size Size of the shared memory block to map 39 * @param size Size of the shared memory block to map
40 * @param permissions Memory block map permissions (specified by SVC field) 40 * @param permissions Memory block map permissions (specified by SVC field)
41 */ 41 */
42 ResultCode Map(Process& target_process, VAddr address, std::size_t size, 42 ResultCode Map(KProcess& target_process, VAddr address, std::size_t size,
43 KMemoryPermission permissions); 43 KMemoryPermission permissions);
44 44
45 /** 45 /**
@@ -69,7 +69,7 @@ public:
69 69
70private: 70private:
71 Core::DeviceMemory* device_memory; 71 Core::DeviceMemory* device_memory;
72 Process* owner_process{}; 72 KProcess* owner_process{};
73 KPageLinkedList page_list; 73 KPageLinkedList page_list;
74 KMemoryPermission owner_permission{}; 74 KMemoryPermission owner_permission{};
75 KMemoryPermission user_permission{}; 75 KMemoryPermission user_permission{};
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index c59f3113c..3de0157ac 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -21,13 +21,13 @@
21#include "core/hle/kernel/handle_table.h" 21#include "core/hle/kernel/handle_table.h"
22#include "core/hle/kernel/k_condition_variable.h" 22#include "core/hle/kernel/k_condition_variable.h"
23#include "core/hle/kernel/k_memory_layout.h" 23#include "core/hle/kernel/k_memory_layout.h"
24#include "core/hle/kernel/k_process.h"
24#include "core/hle/kernel/k_resource_limit.h" 25#include "core/hle/kernel/k_resource_limit.h"
25#include "core/hle/kernel/k_scheduler.h" 26#include "core/hle/kernel/k_scheduler.h"
26#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" 27#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
27#include "core/hle/kernel/k_thread.h" 28#include "core/hle/kernel/k_thread.h"
28#include "core/hle/kernel/k_thread_queue.h" 29#include "core/hle/kernel/k_thread_queue.h"
29#include "core/hle/kernel/kernel.h" 30#include "core/hle/kernel/kernel.h"
30#include "core/hle/kernel/process.h"
31#include "core/hle/kernel/svc_results.h" 31#include "core/hle/kernel/svc_results.h"
32#include "core/hle/kernel/time_manager.h" 32#include "core/hle/kernel/time_manager.h"
33#include "core/hle/result.h" 33#include "core/hle/result.h"
@@ -65,7 +65,7 @@ KThread::KThread(KernelCore& kernel)
65KThread::~KThread() = default; 65KThread::~KThread() = default;
66 66
67ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, s32 prio, 67ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, s32 prio,
68 s32 virt_core, Process* owner, ThreadType type) { 68 s32 virt_core, KProcess* owner, ThreadType type) {
69 // Assert parameters are valid. 69 // Assert parameters are valid.
70 ASSERT((type == ThreadType::Main) || 70 ASSERT((type == ThreadType::Main) ||
71 (Svc::HighestThreadPriority <= prio && prio <= Svc::LowestThreadPriority)); 71 (Svc::HighestThreadPriority <= prio && prio <= Svc::LowestThreadPriority));
@@ -209,7 +209,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
209} 209}
210 210
211ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg, 211ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg,
212 VAddr user_stack_top, s32 prio, s32 core, Process* owner, 212 VAddr user_stack_top, s32 prio, s32 core, KProcess* owner,
213 ThreadType type, std::function<void(void*)>&& init_func, 213 ThreadType type, std::function<void(void*)>&& init_func,
214 void* init_func_parameter) { 214 void* init_func_parameter) {
215 // Initialize the thread. 215 // Initialize the thread.
@@ -242,7 +242,7 @@ ResultCode KThread::InitializeHighPriorityThread(Core::System& system, KThread*
242 242
243ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread, 243ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread,
244 KThreadFunction func, uintptr_t arg, VAddr user_stack_top, 244 KThreadFunction func, uintptr_t arg, VAddr user_stack_top,
245 s32 prio, s32 virt_core, Process* owner) { 245 s32 prio, s32 virt_core, KProcess* owner) {
246 system.Kernel().GlobalSchedulerContext().AddThread(thread); 246 system.Kernel().GlobalSchedulerContext().AddThread(thread);
247 return InitializeThread(thread, func, arg, user_stack_top, prio, virt_core, owner, 247 return InitializeThread(thread, func, arg, user_stack_top, prio, virt_core, owner,
248 ThreadType::User, Core::CpuManager::GetGuestThreadStartFunc(), 248 ThreadType::User, Core::CpuManager::GetGuestThreadStartFunc(),
@@ -250,7 +250,7 @@ ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread,
250} 250}
251 251
252void KThread::PostDestroy(uintptr_t arg) { 252void KThread::PostDestroy(uintptr_t arg) {
253 Process* owner = reinterpret_cast<Process*>(arg & ~1ULL); 253 KProcess* owner = reinterpret_cast<KProcess*>(arg & ~1ULL);
254 const bool resource_limit_release_hint = (arg & 1); 254 const bool resource_limit_release_hint = (arg & 1);
255 const s64 hint_value = (resource_limit_release_hint ? 0 : 1); 255 const s64 hint_value = (resource_limit_release_hint ? 0 : 1);
256 if (owner != nullptr) { 256 if (owner != nullptr) {
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h
index 5b943b18b..4145ef56c 100644
--- a/src/core/hle/kernel/k_thread.h
+++ b/src/core/hle/kernel/k_thread.h
@@ -37,7 +37,7 @@ namespace Kernel {
37 37
38class GlobalSchedulerContext; 38class GlobalSchedulerContext;
39class KernelCore; 39class KernelCore;
40class Process; 40class KProcess;
41class KScheduler; 41class KScheduler;
42class KThreadQueue; 42class KThreadQueue;
43 43
@@ -105,7 +105,7 @@ class KThread final : public KAutoObjectWithSlabHeapAndContainer<KThread, KSynch
105 105
106private: 106private:
107 friend class KScheduler; 107 friend class KScheduler;
108 friend class Process; 108 friend class KProcess;
109 109
110public: 110public:
111 static constexpr s32 DefaultThreadPriority = 44; 111 static constexpr s32 DefaultThreadPriority = 44;
@@ -290,11 +290,11 @@ public:
290 current_core_id = core; 290 current_core_id = core;
291 } 291 }
292 292
293 [[nodiscard]] Process* GetOwnerProcess() { 293 [[nodiscard]] KProcess* GetOwnerProcess() {
294 return parent; 294 return parent;
295 } 295 }
296 296
297 [[nodiscard]] const Process* GetOwnerProcess() const { 297 [[nodiscard]] const KProcess* GetOwnerProcess() const {
298 return parent; 298 return parent;
299 } 299 }
300 300
@@ -389,7 +389,7 @@ public:
389 [[nodiscard]] static ResultCode InitializeUserThread(Core::System& system, KThread* thread, 389 [[nodiscard]] static ResultCode InitializeUserThread(Core::System& system, KThread* thread,
390 KThreadFunction func, uintptr_t arg, 390 KThreadFunction func, uintptr_t arg,
391 VAddr user_stack_top, s32 prio, 391 VAddr user_stack_top, s32 prio,
392 s32 virt_core, Process* owner); 392 s32 virt_core, KProcess* owner);
393 393
394public: 394public:
395 struct StackParameters { 395 struct StackParameters {
@@ -641,11 +641,11 @@ private:
641 void StartTermination(); 641 void StartTermination();
642 642
643 [[nodiscard]] ResultCode Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, 643 [[nodiscard]] ResultCode Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top,
644 s32 prio, s32 virt_core, Process* owner, ThreadType type); 644 s32 prio, s32 virt_core, KProcess* owner, ThreadType type);
645 645
646 [[nodiscard]] static ResultCode InitializeThread(KThread* thread, KThreadFunction func, 646 [[nodiscard]] static ResultCode InitializeThread(KThread* thread, KThreadFunction func,
647 uintptr_t arg, VAddr user_stack_top, s32 prio, 647 uintptr_t arg, VAddr user_stack_top, s32 prio,
648 s32 core, Process* owner, ThreadType type, 648 s32 core, KProcess* owner, ThreadType type,
649 std::function<void(void*)>&& init_func, 649 std::function<void(void*)>&& init_func,
650 void* init_func_parameter); 650 void* init_func_parameter);
651 651
@@ -669,7 +669,7 @@ private:
669 std::atomic<s64> cpu_time{}; 669 std::atomic<s64> cpu_time{};
670 KSynchronizationObject* synced_object{}; 670 KSynchronizationObject* synced_object{};
671 VAddr address_key{}; 671 VAddr address_key{};
672 Process* parent{}; 672 KProcess* parent{};
673 VAddr kernel_stack_top{}; 673 VAddr kernel_stack_top{};
674 u32* light_ipc_data{}; 674 u32* light_ipc_data{};
675 VAddr tls_address{}; 675 VAddr tls_address{};
diff --git a/src/core/hle/kernel/k_transfer_memory.cpp b/src/core/hle/kernel/k_transfer_memory.cpp
index 09c067f95..201617d32 100644
--- a/src/core/hle/kernel/k_transfer_memory.cpp
+++ b/src/core/hle/kernel/k_transfer_memory.cpp
@@ -2,10 +2,10 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "core/hle/kernel/k_process.h"
5#include "core/hle/kernel/k_resource_limit.h" 6#include "core/hle/kernel/k_resource_limit.h"
6#include "core/hle/kernel/k_transfer_memory.h" 7#include "core/hle/kernel/k_transfer_memory.h"
7#include "core/hle/kernel/kernel.h" 8#include "core/hle/kernel/kernel.h"
8#include "core/hle/kernel/process.h"
9 9
10namespace Kernel { 10namespace Kernel {
11 11
@@ -37,7 +37,7 @@ void KTransferMemory::Finalize() {
37} 37}
38 38
39void KTransferMemory::PostDestroy(uintptr_t arg) { 39void KTransferMemory::PostDestroy(uintptr_t arg) {
40 Process* owner = reinterpret_cast<Process*>(arg); 40 KProcess* owner = reinterpret_cast<KProcess*>(arg);
41 owner->GetResourceLimit()->Release(LimitableResource::TransferMemory, 1); 41 owner->GetResourceLimit()->Release(LimitableResource::TransferMemory, 1);
42 owner->Close(); 42 owner->Close();
43} 43}
diff --git a/src/core/hle/kernel/k_transfer_memory.h b/src/core/hle/kernel/k_transfer_memory.h
index 1e4fa9323..f56398b9c 100644
--- a/src/core/hle/kernel/k_transfer_memory.h
+++ b/src/core/hle/kernel/k_transfer_memory.h
@@ -19,7 +19,7 @@ class Memory;
19namespace Kernel { 19namespace Kernel {
20 20
21class KernelCore; 21class KernelCore;
22class Process; 22class KProcess;
23 23
24class KTransferMemory final 24class KTransferMemory final
25 : public KAutoObjectWithSlabHeapAndContainer<KTransferMemory, KAutoObjectWithList> { 25 : public KAutoObjectWithSlabHeapAndContainer<KTransferMemory, KAutoObjectWithList> {
@@ -43,7 +43,7 @@ public:
43 43
44 static void PostDestroy(uintptr_t arg); 44 static void PostDestroy(uintptr_t arg);
45 45
46 Process* GetOwner() const { 46 KProcess* GetOwner() const {
47 return owner; 47 return owner;
48 } 48 }
49 49
@@ -56,7 +56,7 @@ public:
56 } 56 }
57 57
58private: 58private:
59 Process* owner{}; 59 KProcess* owner{};
60 VAddr address{}; 60 VAddr address{};
61 Svc::MemoryPermission owner_perm{}; 61 Svc::MemoryPermission owner_perm{};
62 size_t size{}; 62 size_t size{};
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 409bcfaa0..718525c4c 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -31,6 +31,7 @@
31#include "core/hle/kernel/k_client_port.h" 31#include "core/hle/kernel/k_client_port.h"
32#include "core/hle/kernel/k_memory_layout.h" 32#include "core/hle/kernel/k_memory_layout.h"
33#include "core/hle/kernel/k_memory_manager.h" 33#include "core/hle/kernel/k_memory_manager.h"
34#include "core/hle/kernel/k_process.h"
34#include "core/hle/kernel/k_resource_limit.h" 35#include "core/hle/kernel/k_resource_limit.h"
35#include "core/hle/kernel/k_scheduler.h" 36#include "core/hle/kernel/k_scheduler.h"
36#include "core/hle/kernel/k_shared_memory.h" 37#include "core/hle/kernel/k_shared_memory.h"
@@ -38,7 +39,6 @@
38#include "core/hle/kernel/k_thread.h" 39#include "core/hle/kernel/k_thread.h"
39#include "core/hle/kernel/kernel.h" 40#include "core/hle/kernel/kernel.h"
40#include "core/hle/kernel/physical_core.h" 41#include "core/hle/kernel/physical_core.h"
41#include "core/hle/kernel/process.h"
42#include "core/hle/kernel/service_thread.h" 42#include "core/hle/kernel/service_thread.h"
43#include "core/hle/kernel/svc_results.h" 43#include "core/hle/kernel/svc_results.h"
44#include "core/hle/kernel/time_manager.h" 44#include "core/hle/kernel/time_manager.h"
@@ -98,8 +98,8 @@ struct KernelCore::Impl {
98 service_threads.clear(); 98 service_threads.clear();
99 99
100 next_object_id = 0; 100 next_object_id = 0;
101 next_kernel_process_id = Process::InitialKIPIDMin; 101 next_kernel_process_id = KProcess::InitialKIPIDMin;
102 next_user_process_id = Process::ProcessIDMin; 102 next_user_process_id = KProcess::ProcessIDMin;
103 next_thread_id = 1; 103 next_thread_id = 1;
104 104
105 for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) { 105 for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
@@ -220,7 +220,7 @@ struct KernelCore::Impl {
220 } 220 }
221 } 221 }
222 222
223 void MakeCurrentProcess(Process* process) { 223 void MakeCurrentProcess(KProcess* process) {
224 current_process = process; 224 current_process = process;
225 if (process == nullptr) { 225 if (process == nullptr) {
226 return; 226 return;
@@ -632,13 +632,13 @@ struct KernelCore::Impl {
632 } 632 }
633 633
634 std::atomic<u32> next_object_id{0}; 634 std::atomic<u32> next_object_id{0};
635 std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin}; 635 std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin};
636 std::atomic<u64> next_user_process_id{Process::ProcessIDMin}; 636 std::atomic<u64> next_user_process_id{KProcess::ProcessIDMin};
637 std::atomic<u64> next_thread_id{1}; 637 std::atomic<u64> next_thread_id{1};
638 638
639 // Lists all processes that exist in the current session. 639 // Lists all processes that exist in the current session.
640 std::vector<Process*> process_list; 640 std::vector<KProcess*> process_list;
641 Process* current_process{}; 641 KProcess* current_process{};
642 std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context; 642 std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context;
643 Kernel::TimeManager time_manager; 643 Kernel::TimeManager time_manager;
644 644
@@ -725,23 +725,23 @@ KScopedAutoObject<KThread> KernelCore::RetrieveThreadFromGlobalHandleTable(Handl
725 return impl->global_handle_table.GetObject<KThread>(handle); 725 return impl->global_handle_table.GetObject<KThread>(handle);
726} 726}
727 727
728void KernelCore::AppendNewProcess(Process* process) { 728void KernelCore::AppendNewProcess(KProcess* process) {
729 impl->process_list.push_back(process); 729 impl->process_list.push_back(process);
730} 730}
731 731
732void KernelCore::MakeCurrentProcess(Process* process) { 732void KernelCore::MakeCurrentProcess(KProcess* process) {
733 impl->MakeCurrentProcess(process); 733 impl->MakeCurrentProcess(process);
734} 734}
735 735
736Process* KernelCore::CurrentProcess() { 736KProcess* KernelCore::CurrentProcess() {
737 return impl->current_process; 737 return impl->current_process;
738} 738}
739 739
740const Process* KernelCore::CurrentProcess() const { 740const KProcess* KernelCore::CurrentProcess() const {
741 return impl->current_process; 741 return impl->current_process;
742} 742}
743 743
744const std::vector<Process*>& KernelCore::GetProcessList() const { 744const std::vector<KProcess*>& KernelCore::GetProcessList() const {
745 return impl->process_list; 745 return impl->process_list;
746} 746}
747 747
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index de7f83423..0dd9deaeb 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -37,7 +37,7 @@ class KEvent;
37class KLinkedListNode; 37class KLinkedListNode;
38class KMemoryManager; 38class KMemoryManager;
39class KPort; 39class KPort;
40class Process; 40class KProcess;
41class KResourceLimit; 41class KResourceLimit;
42class KScheduler; 42class KScheduler;
43class KSession; 43class KSession;
@@ -101,19 +101,19 @@ public:
101 KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const; 101 KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const;
102 102
103 /// Adds the given shared pointer to an internal list of active processes. 103 /// Adds the given shared pointer to an internal list of active processes.
104 void AppendNewProcess(Process* process); 104 void AppendNewProcess(KProcess* process);
105 105
106 /// Makes the given process the new current process. 106 /// Makes the given process the new current process.
107 void MakeCurrentProcess(Process* process); 107 void MakeCurrentProcess(KProcess* process);
108 108
109 /// Retrieves a pointer to the current process. 109 /// Retrieves a pointer to the current process.
110 Process* CurrentProcess(); 110 KProcess* CurrentProcess();
111 111
112 /// Retrieves a const pointer to the current process. 112 /// Retrieves a const pointer to the current process.
113 const Process* CurrentProcess() const; 113 const KProcess* CurrentProcess() const;
114 114
115 /// Retrieves the list of processes. 115 /// Retrieves the list of processes.
116 const std::vector<Process*>& GetProcessList() const; 116 const std::vector<KProcess*>& GetProcessList() const;
117 117
118 /// Gets the sole instance of the global scheduler 118 /// Gets the sole instance of the global scheduler
119 Kernel::GlobalSchedulerContext& GlobalSchedulerContext(); 119 Kernel::GlobalSchedulerContext& GlobalSchedulerContext();
@@ -274,7 +274,7 @@ public:
274 return slab_heap_container->linked_list_node; 274 return slab_heap_container->linked_list_node;
275 } else if constexpr (std::is_same_v<T, KPort>) { 275 } else if constexpr (std::is_same_v<T, KPort>) {
276 return slab_heap_container->port; 276 return slab_heap_container->port;
277 } else if constexpr (std::is_same_v<T, Process>) { 277 } else if constexpr (std::is_same_v<T, KProcess>) {
278 return slab_heap_container->process; 278 return slab_heap_container->process;
279 } else if constexpr (std::is_same_v<T, KResourceLimit>) { 279 } else if constexpr (std::is_same_v<T, KResourceLimit>) {
280 return slab_heap_container->resource_limit; 280 return slab_heap_container->resource_limit;
@@ -292,7 +292,7 @@ public:
292 } 292 }
293 293
294private: 294private:
295 friend class Process; 295 friend class KProcess;
296 friend class KThread; 296 friend class KThread;
297 297
298 /// Creates a new object ID, incrementing the internal object ID counter. 298 /// Creates a new object ID, incrementing the internal object ID counter.
@@ -325,7 +325,7 @@ private:
325 KSlabHeap<KEvent> event; 325 KSlabHeap<KEvent> event;
326 KSlabHeap<KLinkedListNode> linked_list_node; 326 KSlabHeap<KLinkedListNode> linked_list_node;
327 KSlabHeap<KPort> port; 327 KSlabHeap<KPort> port;
328 KSlabHeap<Process> process; 328 KSlabHeap<KProcess> process;
329 KSlabHeap<KResourceLimit> resource_limit; 329 KSlabHeap<KResourceLimit> resource_limit;
330 KSlabHeap<KSession> session; 330 KSlabHeap<KSession> session;
331 KSlabHeap<KSharedMemory> shared_memory; 331 KSlabHeap<KSharedMemory> shared_memory;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index ef8fa98a9..725f16ea4 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -30,6 +30,7 @@
30#include "core/hle/kernel/k_memory_block.h" 30#include "core/hle/kernel/k_memory_block.h"
31#include "core/hle/kernel/k_memory_layout.h" 31#include "core/hle/kernel/k_memory_layout.h"
32#include "core/hle/kernel/k_page_table.h" 32#include "core/hle/kernel/k_page_table.h"
33#include "core/hle/kernel/k_process.h"
33#include "core/hle/kernel/k_readable_event.h" 34#include "core/hle/kernel/k_readable_event.h"
34#include "core/hle/kernel/k_resource_limit.h" 35#include "core/hle/kernel/k_resource_limit.h"
35#include "core/hle/kernel/k_scheduler.h" 36#include "core/hle/kernel/k_scheduler.h"
@@ -42,7 +43,6 @@
42#include "core/hle/kernel/k_writable_event.h" 43#include "core/hle/kernel/k_writable_event.h"
43#include "core/hle/kernel/kernel.h" 44#include "core/hle/kernel/kernel.h"
44#include "core/hle/kernel/physical_core.h" 45#include "core/hle/kernel/physical_core.h"
45#include "core/hle/kernel/process.h"
46#include "core/hle/kernel/svc.h" 46#include "core/hle/kernel/svc.h"
47#include "core/hle/kernel/svc_results.h" 47#include "core/hle/kernel/svc_results.h"
48#include "core/hle/kernel/svc_types.h" 48#include "core/hle/kernel/svc_types.h"
@@ -402,8 +402,8 @@ static ResultCode GetProcessId(Core::System& system, u64* out_process_id, Handle
402 R_UNLESS(obj.IsNotNull(), ResultInvalidHandle); 402 R_UNLESS(obj.IsNotNull(), ResultInvalidHandle);
403 403
404 // Get the process from the object. 404 // Get the process from the object.
405 Process* process = nullptr; 405 KProcess* process = nullptr;
406 if (Process* p = obj->DynamicCast<Process*>(); p != nullptr) { 406 if (KProcess* p = obj->DynamicCast<KProcess*>(); p != nullptr) {
407 // The object is a process, so we can use it directly. 407 // The object is a process, so we can use it directly.
408 process = p; 408 process = p;
409 } else if (KThread* t = obj->DynamicCast<KThread*>(); t != nullptr) { 409 } else if (KThread* t = obj->DynamicCast<KThread*>(); t != nullptr) {
@@ -733,7 +733,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
733 } 733 }
734 734
735 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 735 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
736 KScopedAutoObject process = handle_table.GetObject<Process>(handle); 736 KScopedAutoObject process = handle_table.GetObject<KProcess>(handle);
737 if (process.IsNull()) { 737 if (process.IsNull()) {
738 LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}", 738 LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}",
739 info_id, info_sub_id, handle); 739 info_id, info_sub_id, handle);
@@ -838,7 +838,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
838 return ResultInvalidCombination; 838 return ResultInvalidCombination;
839 } 839 }
840 840
841 Process* const current_process = system.Kernel().CurrentProcess(); 841 KProcess* const current_process = system.Kernel().CurrentProcess();
842 HandleTable& handle_table = current_process->GetHandleTable(); 842 HandleTable& handle_table = current_process->GetHandleTable();
843 const auto resource_limit = current_process->GetResourceLimit(); 843 const auto resource_limit = current_process->GetResourceLimit();
844 if (!resource_limit) { 844 if (!resource_limit) {
@@ -861,9 +861,9 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
861 return ResultInvalidHandle; 861 return ResultInvalidHandle;
862 } 862 }
863 863
864 if (info_sub_id >= Process::RANDOM_ENTROPY_SIZE) { 864 if (info_sub_id >= KProcess::RANDOM_ENTROPY_SIZE) {
865 LOG_ERROR(Kernel_SVC, "Entropy size is out of range, expected {} but got {}", 865 LOG_ERROR(Kernel_SVC, "Entropy size is out of range, expected {} but got {}",
866 Process::RANDOM_ENTROPY_SIZE, info_sub_id); 866 KProcess::RANDOM_ENTROPY_SIZE, info_sub_id);
867 return ResultInvalidCombination; 867 return ResultInvalidCombination;
868 } 868 }
869 869
@@ -955,7 +955,7 @@ static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size)
955 return ResultInvalidMemoryRegion; 955 return ResultInvalidMemoryRegion;
956 } 956 }
957 957
958 Process* const current_process{system.Kernel().CurrentProcess()}; 958 KProcess* const current_process{system.Kernel().CurrentProcess()};
959 auto& page_table{current_process->PageTable()}; 959 auto& page_table{current_process->PageTable()};
960 960
961 if (current_process->GetSystemResourceSize() == 0) { 961 if (current_process->GetSystemResourceSize() == 0) {
@@ -1009,7 +1009,7 @@ static ResultCode UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size
1009 return ResultInvalidMemoryRegion; 1009 return ResultInvalidMemoryRegion;
1010 } 1010 }
1011 1011
1012 Process* const current_process{system.Kernel().CurrentProcess()}; 1012 KProcess* const current_process{system.Kernel().CurrentProcess()};
1013 auto& page_table{current_process->PageTable()}; 1013 auto& page_table{current_process->PageTable()};
1014 1014
1015 if (current_process->GetSystemResourceSize() == 0) { 1015 if (current_process->GetSystemResourceSize() == 0) {
@@ -1153,7 +1153,7 @@ static ResultCode GetThreadPriority32(Core::System& system, u32* out_priority, H
1153/// Sets the priority for the specified thread 1153/// Sets the priority for the specified thread
1154static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority) { 1154static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority) {
1155 // Get the current process. 1155 // Get the current process.
1156 Process& process = *system.Kernel().CurrentProcess(); 1156 KProcess& process = *system.Kernel().CurrentProcess();
1157 1157
1158 // Validate the priority. 1158 // Validate the priority.
1159 R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority, 1159 R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority,
@@ -1264,7 +1264,7 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add
1264 std::lock_guard lock{HLE::g_hle_lock}; 1264 std::lock_guard lock{HLE::g_hle_lock};
1265 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address); 1265 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
1266 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 1266 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
1267 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); 1267 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
1268 if (process.IsNull()) { 1268 if (process.IsNull()) {
1269 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", 1269 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
1270 process_handle); 1270 process_handle);
@@ -1346,7 +1346,7 @@ static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_hand
1346 } 1346 }
1347 1347
1348 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 1348 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
1349 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); 1349 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
1350 if (process.IsNull()) { 1350 if (process.IsNull()) {
1351 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", 1351 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
1352 process_handle); 1352 process_handle);
@@ -1414,7 +1414,7 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha
1414 } 1414 }
1415 1415
1416 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 1416 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
1417 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); 1417 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
1418 if (process.IsNull()) { 1418 if (process.IsNull()) {
1419 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", 1419 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
1420 process_handle); 1420 process_handle);
@@ -1830,7 +1830,7 @@ static ResultCode ResetSignal(Core::System& system, Handle handle) {
1830 1830
1831 // Try to reset as process. 1831 // Try to reset as process.
1832 { 1832 {
1833 KScopedAutoObject process = handle_table.GetObject<Process>(handle); 1833 KScopedAutoObject process = handle_table.GetObject<KProcess>(handle);
1834 if (process.IsNotNull()) { 1834 if (process.IsNotNull()) {
1835 return process->Reset(); 1835 return process->Reset();
1836 } 1836 }
@@ -2077,7 +2077,7 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_
2077 }; 2077 };
2078 2078
2079 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 2079 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
2080 KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); 2080 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
2081 if (process.IsNull()) { 2081 if (process.IsNull()) {
2082 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", 2082 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
2083 process_handle); 2083 process_handle);