summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/kernel/process.h2
-rw-r--r--src/core/hle/svc.cpp5
-rw-r--r--src/core/loader/ncch.cpp3
3 files changed, 10 insertions, 0 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h
index 6d2ca96a2..a06afef2b 100644
--- a/src/core/hle/kernel/process.h
+++ b/src/core/hle/kernel/process.h
@@ -107,6 +107,8 @@ public:
107 ProcessFlags flags; 107 ProcessFlags flags;
108 /// Kernel compatibility version for this process 108 /// Kernel compatibility version for this process
109 u16 kernel_version = 0; 109 u16 kernel_version = 0;
110 /// The default CPU for this process, threads are scheduled on this cpu by default.
111 u8 ideal_processor = 0;
110 112
111 /// The id of this process 113 /// The id of this process
112 u32 process_id = next_process_id++; 114 u32 process_id = next_process_id++;
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index ae54afb1c..761e1b45b 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -497,6 +497,11 @@ static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point
497 break; 497 break;
498 } 498 }
499 499
500 if (processor_id == THREADPROCESSORID_1 || processor_id == THREADPROCESSORID_ALL ||
501 (processor_id == THREADPROCESSORID_DEFAULT && Kernel::g_current_process->ideal_processor == THREADPROCESSORID_1)) {
502 LOG_WARNING(Kernel_SVC, "Newly created thread is allowed to be run in the SysCore, unimplemented.");
503 }
504
500 CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create( 505 CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create(
501 name, entry_point, priority, arg, processor_id, stack_top)); 506 name, entry_point, priority, arg, processor_id, stack_top));
502 CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread))); 507 CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread)));
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index a4b47ef8c..52c5fbaaf 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -156,6 +156,9 @@ ResultStatus AppLoader_NCCH::LoadExec() {
156 Kernel::g_current_process->resource_limit = Kernel::ResourceLimit::GetForCategory( 156 Kernel::g_current_process->resource_limit = Kernel::ResourceLimit::GetForCategory(
157 static_cast<Kernel::ResourceLimitCategory>(exheader_header.arm11_system_local_caps.resource_limit_category)); 157 static_cast<Kernel::ResourceLimitCategory>(exheader_header.arm11_system_local_caps.resource_limit_category));
158 158
159 // Set the default CPU core for this process
160 Kernel::g_current_process->ideal_processor = exheader_header.arm11_system_local_caps.ideal_processor;
161
159 // Copy data while converting endianess 162 // Copy data while converting endianess
160 std::array<u32, ARRAY_SIZE(exheader_header.arm11_kernel_caps.descriptors)> kernel_caps; 163 std::array<u32, ARRAY_SIZE(exheader_header.arm11_kernel_caps.descriptors)> kernel_caps;
161 std::copy_n(exheader_header.arm11_kernel_caps.descriptors, kernel_caps.size(), begin(kernel_caps)); 164 std::copy_n(exheader_header.arm11_kernel_caps.descriptors, kernel_caps.size(), begin(kernel_caps));