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 fb2aecbf2..60c8747f3 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -496,6 +496,11 @@ static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point
496 break; 496 break;
497 } 497 }
498 498
499 if (processor_id == THREADPROCESSORID_1 || processor_id == THREADPROCESSORID_ALL ||
500 (processor_id == THREADPROCESSORID_DEFAULT && Kernel::g_current_process->ideal_processor == THREADPROCESSORID_1)) {
501 LOG_WARNING(Kernel_SVC, "Newly created thread is allowed to be run in the SysCore, unimplemented.");
502 }
503
499 CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create( 504 CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create(
500 name, entry_point, priority, arg, processor_id, stack_top)); 505 name, entry_point, priority, arg, processor_id, stack_top));
501 CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(thread))); 506 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 d362a4419..7391bdb26 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));