summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-06-10 00:28:33 -0400
committerGravatar Zach Hilman2019-06-10 00:28:33 -0400
commitfc0bf91a969cddeb2f84c3e7c3a862fe98f1d438 (patch)
treed0773fbb4563392af144e5caf70a2c4c7664d58c /src/core/hle/kernel/kernel.cpp
parentMerge pull request #2571 from lioncash/ref (diff)
downloadyuzu-fc0bf91a969cddeb2f84c3e7c3a862fe98f1d438.tar.gz
yuzu-fc0bf91a969cddeb2f84c3e7c3a862fe98f1d438.tar.xz
yuzu-fc0bf91a969cddeb2f84c3e7c3a862fe98f1d438.zip
kernel: Differentiate kernel and user processes when picking ID
This allows kernel internal type processes to be assigned IDs in the KIP range while userland processes are assigned in the user range.
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 757e5f21f..799e5e0d8 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -99,7 +99,8 @@ struct KernelCore::Impl {
99 99
100 void Shutdown() { 100 void Shutdown() {
101 next_object_id = 0; 101 next_object_id = 0;
102 next_process_id = Process::ProcessIDMin; 102 next_kernel_process_id = Process::InitialKIPIDMin;
103 next_user_process_id = Process::ProcessIDMin;
103 next_thread_id = 1; 104 next_thread_id = 1;
104 105
105 process_list.clear(); 106 process_list.clear();
@@ -132,7 +133,8 @@ struct KernelCore::Impl {
132 } 133 }
133 134
134 std::atomic<u32> next_object_id{0}; 135 std::atomic<u32> next_object_id{0};
135 std::atomic<u64> next_process_id{Process::ProcessIDMin}; 136 std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin};
137 std::atomic<u64> next_user_process_id{Process::ProcessIDMin};
136 std::atomic<u64> next_thread_id{1}; 138 std::atomic<u64> next_thread_id{1};
137 139
138 // Lists all processes that exist in the current session. 140 // Lists all processes that exist in the current session.
@@ -226,8 +228,12 @@ u64 KernelCore::CreateNewThreadID() {
226 return impl->next_thread_id++; 228 return impl->next_thread_id++;
227} 229}
228 230
229u64 KernelCore::CreateNewProcessID() { 231u64 KernelCore::CreateNewKernelProcessID() {
230 return impl->next_process_id++; 232 return impl->next_kernel_process_id++;
233}
234
235u64 KernelCore::CreateNewUserProcessID() {
236 return impl->next_user_process_id++;
231} 237}
232 238
233Core::Timing::EventType* KernelCore::ThreadWakeupCallbackEventType() const { 239Core::Timing::EventType* KernelCore::ThreadWakeupCallbackEventType() const {