summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-12-31 03:20:07 +0100
committerLioncash <mathew1800@gmail.com>2018-12-31 03:23:56 +0100
commit3a8d38be7e584d1fba5f35f1e4e4449f40fa2073 (patch)
tree6a3bade5daf2447bbf6e3888b7a66def0183650f /src/core/hle
parentkernel/process: Rename GetAllowedProcessorMask() and GetAllowedThreadPriorityMask() (diff)
downloadyuzu-3a8d38be7e584d1fba5f35f1e4e4449f40fa2073.tar
yuzu-3a8d38be7e584d1fba5f35f1e4e4449f40fa2073.tar.gz
yuzu-3a8d38be7e584d1fba5f35f1e4e4449f40fa2073.tar.bz2
yuzu-3a8d38be7e584d1fba5f35f1e4e4449f40fa2073.tar.lz
yuzu-3a8d38be7e584d1fba5f35f1e4e4449f40fa2073.tar.xz
yuzu-3a8d38be7e584d1fba5f35f1e4e4449f40fa2073.tar.zst
yuzu-3a8d38be7e584d1fba5f35f1e4e4449f40fa2073.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/svc.cpp23
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
"threadpriority=0x{:08X}, processorid=0x{:08X} : created handle=0x{:08X}",
entry_point, arg, stack_top, priority, processor_id, *out_handle);
- if (priority > THREADPRIO_LOWEST) {
- LOG_ERROR(Kernel_SVC, "An invalid priority was specified, expected {} but got {}",
- THREADPRIO_LOWEST, priority);
- return ERR_INVALID_THREAD_PRIORITY;
- }
-
auto* const current_process = Core::CurrentProcess();
if (processor_id == THREADPROCESSORID_IDEAL) {
@@ -1238,6 +1232,23 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
return ERR_INVALID_PROCESSOR_ID;
}
+ const u64 core_mask = current_process->GetCoreMask();
+ if ((core_mask | (1ULL << processor_id)) != core_mask) {
+ LOG_ERROR(Kernel_SVC, "Invalid thread core specified ({})", processor_id);
+ return ERR_INVALID_PROCESSOR_ID;
+ }
+
+ if (priority > THREADPRIO_LOWEST) {
+ LOG_ERROR(Kernel_SVC, "An invalid priority was specified, expected {} but got {}",
+ THREADPRIO_LOWEST, priority);
+ return ERR_INVALID_THREAD_PRIORITY;
+ }
+
+ if (((1ULL << priority) & current_process->GetPriorityMask()) == 0) {
+ LOG_ERROR(Kernel_SVC, "Invalid thread priority specified ({})", priority);
+ return ERR_INVALID_THREAD_PRIORITY;
+ }
+
const std::string name = fmt::format("thread-{:X}", entry_point);
auto& kernel = Core::System::GetInstance().Kernel();
CASCADE_RESULT(SharedPtr<Thread> thread,