diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/kernel/k_scheduler.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_thread.h | 11 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 5 |
5 files changed, 12 insertions, 11 deletions
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index edc5df733..0f34a8a69 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp | |||
| @@ -763,7 +763,7 @@ void KScheduler::Initialize() { | |||
| 763 | std::string name = "Idle Thread Id:" + std::to_string(core_id); | 763 | std::string name = "Idle Thread Id:" + std::to_string(core_id); |
| 764 | std::function<void(void*)> init_func = Core::CpuManager::GetIdleThreadStartFunc(); | 764 | std::function<void(void*)> init_func = Core::CpuManager::GetIdleThreadStartFunc(); |
| 765 | void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater(); | 765 | void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater(); |
| 766 | auto thread_res = KThread::Create(system, THREADTYPE_KERNEL, name, 0, THREADPRIO_LOWEST, 0, | 766 | auto thread_res = KThread::Create(system, ThreadType::Kernel, name, 0, THREADPRIO_LOWEST, 0, |
| 767 | static_cast<u32>(core_id), 0, nullptr, std::move(init_func), | 767 | static_cast<u32>(core_id), 0, nullptr, std::move(init_func), |
| 768 | init_func_parameter); | 768 | init_func_parameter); |
| 769 | idle_thread = thread_res.Unwrap().get(); | 769 | idle_thread = thread_res.Unwrap().get(); |
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 7dec9449e..bef480dd7 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h | |||
| @@ -48,10 +48,13 @@ enum ThreadPriority : u32 { | |||
| 48 | THREADPRIO_COUNT = 64, ///< Total number of possible thread priorities. | 48 | THREADPRIO_COUNT = 64, ///< Total number of possible thread priorities. |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | enum ThreadType : u32 { | 51 | enum class ThreadType : u32 { |
| 52 | THREADTYPE_USER = 0x1, | 52 | Main = 0, |
| 53 | THREADTYPE_KERNEL = 0x2, | 53 | Kernel = 1, |
| 54 | HighPriority = 2, | ||
| 55 | User = 3, | ||
| 54 | }; | 56 | }; |
| 57 | DECLARE_ENUM_FLAG_OPERATORS(ThreadType); | ||
| 55 | 58 | ||
| 56 | enum ThreadProcessorId : s32 { | 59 | enum ThreadProcessorId : s32 { |
| 57 | /// Indicates that no particular processor core is preferred. | 60 | /// Indicates that no particular processor core is preferred. |
| @@ -307,7 +310,7 @@ public: | |||
| 307 | } | 310 | } |
| 308 | 311 | ||
| 309 | bool IsKernelThread() const { | 312 | bool IsKernelThread() const { |
| 310 | return (type & THREADTYPE_KERNEL) != 0; | 313 | return type == ThreadType::Kernel; |
| 311 | } | 314 | } |
| 312 | 315 | ||
| 313 | bool WasRunning() const { | 316 | bool WasRunning() const { |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 80a78e643..97a5dc2e0 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -169,7 +169,7 @@ struct KernelCore::Impl { | |||
| 169 | std::string name = "Suspend Thread Id:" + std::to_string(i); | 169 | std::string name = "Suspend Thread Id:" + std::to_string(i); |
| 170 | std::function<void(void*)> init_func = Core::CpuManager::GetSuspendThreadStartFunc(); | 170 | std::function<void(void*)> init_func = Core::CpuManager::GetSuspendThreadStartFunc(); |
| 171 | void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater(); | 171 | void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater(); |
| 172 | auto thread_res = KThread::Create(system, THREADTYPE_KERNEL, std::move(name), 0, 0, 0, | 172 | auto thread_res = KThread::Create(system, ThreadType::Kernel, std::move(name), 0, 0, 0, |
| 173 | static_cast<u32>(i), 0, nullptr, std::move(init_func), | 173 | static_cast<u32>(i), 0, nullptr, std::move(init_func), |
| 174 | init_func_parameter); | 174 | init_func_parameter); |
| 175 | 175 | ||
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index ccd371aba..e47da2b7f 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -38,8 +38,7 @@ namespace { | |||
| 38 | */ | 38 | */ |
| 39 | void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) { | 39 | void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) { |
| 40 | const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart(); | 40 | const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart(); |
| 41 | ThreadType type = THREADTYPE_USER; | 41 | auto thread_res = KThread::Create(system, ThreadType::User, "main", entry_point, priority, 0, |
| 42 | auto thread_res = KThread::Create(system, type, "main", entry_point, priority, 0, | ||
| 43 | owner_process.GetIdealCore(), stack_top, &owner_process); | 42 | owner_process.GetIdealCore(), stack_top, &owner_process); |
| 44 | 43 | ||
| 45 | std::shared_ptr<KThread> thread = std::move(thread_res).Unwrap(); | 44 | std::shared_ptr<KThread> thread = std::move(thread_res).Unwrap(); |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 3609346d6..711b9d520 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -1488,10 +1488,9 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e | |||
| 1488 | 1488 | ||
| 1489 | ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1)); | 1489 | ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1)); |
| 1490 | 1490 | ||
| 1491 | ThreadType type = THREADTYPE_USER; | ||
| 1492 | CASCADE_RESULT(std::shared_ptr<KThread> thread, | 1491 | CASCADE_RESULT(std::shared_ptr<KThread> thread, |
| 1493 | KThread::Create(system, type, "", entry_point, priority, arg, processor_id, | 1492 | KThread::Create(system, ThreadType::User, "", entry_point, priority, arg, |
| 1494 | stack_top, current_process)); | 1493 | processor_id, stack_top, current_process)); |
| 1495 | 1494 | ||
| 1496 | const auto new_thread_handle = current_process->GetHandleTable().Create(thread); | 1495 | const auto new_thread_handle = current_process->GetHandleTable().Create(thread); |
| 1497 | if (new_thread_handle.Failed()) { | 1496 | if (new_thread_handle.Failed()) { |