diff options
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 8d8d4e0ab..ada05abd2 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -1219,12 +1219,6 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 1219 | "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}", | 1219 | "threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}", |
| 1220 | entry_point, arg, stack_top, priority, processor_id, *out_handle); | 1220 | entry_point, arg, stack_top, priority, processor_id, *out_handle); |
| 1221 | 1221 | ||
| 1222 | if (priority > THREADPRIO_LOWEST) { | ||
| 1223 | LOG_ERROR(Kernel_SVC, "An invalid priority was specified, expected {} but got {}", | ||
| 1224 | THREADPRIO_LOWEST, priority); | ||
| 1225 | return ERR_INVALID_THREAD_PRIORITY; | ||
| 1226 | } | ||
| 1227 | |||
| 1228 | auto* const current_process = Core::CurrentProcess(); | 1222 | auto* const current_process = Core::CurrentProcess(); |
| 1229 | 1223 | ||
| 1230 | if (processor_id == THREADPROCESSORID_IDEAL) { | 1224 | if (processor_id == THREADPROCESSORID_IDEAL) { |
| @@ -1238,6 +1232,23 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 1238 | return ERR_INVALID_PROCESSOR_ID; | 1232 | return ERR_INVALID_PROCESSOR_ID; |
| 1239 | } | 1233 | } |
| 1240 | 1234 | ||
| 1235 | const u64 core_mask = current_process->GetCoreMask(); | ||
| 1236 | if ((core_mask | (1ULL << processor_id)) != core_mask) { | ||
| 1237 | LOG_ERROR(Kernel_SVC, "Invalid thread core specified ({})", processor_id); | ||
| 1238 | return ERR_INVALID_PROCESSOR_ID; | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | if (priority > THREADPRIO_LOWEST) { | ||
| 1242 | LOG_ERROR(Kernel_SVC, "An invalid priority was specified, expected {} but got {}", | ||
| 1243 | THREADPRIO_LOWEST, priority); | ||
| 1244 | return ERR_INVALID_THREAD_PRIORITY; | ||
| 1245 | } | ||
| 1246 | |||
| 1247 | if (((1ULL << priority) & current_process->GetPriorityMask()) == 0) { | ||
| 1248 | LOG_ERROR(Kernel_SVC, "Invalid thread priority specified ({})", priority); | ||
| 1249 | return ERR_INVALID_THREAD_PRIORITY; | ||
| 1250 | } | ||
| 1251 | |||
| 1241 | const std::string name = fmt::format("thread-{:X}", entry_point); | 1252 | const std::string name = fmt::format("thread-{:X}", entry_point); |
| 1242 | auto& kernel = Core::System::GetInstance().Kernel(); | 1253 | auto& kernel = Core::System::GetInstance().Kernel(); |
| 1243 | CASCADE_RESULT(SharedPtr<Thread> thread, | 1254 | CASCADE_RESULT(SharedPtr<Thread> thread, |