summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp2
-rw-r--r--src/core/hle/kernel/k_thread.h11
-rw-r--r--src/core/hle/kernel/kernel.cpp2
-rw-r--r--src/core/hle/kernel/process.cpp3
-rw-r--r--src/core/hle/kernel/svc.cpp5
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() {
std::string name = "Idle Thread Id:" + std::to_string(core_id);
std::function<void(void*)> init_func = Core::CpuManager::GetIdleThreadStartFunc();
void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater();
- auto thread_res = KThread::Create(system, THREADTYPE_KERNEL, name, 0, THREADPRIO_LOWEST, 0,
+ auto thread_res = KThread::Create(system, ThreadType::Kernel, name, 0, THREADPRIO_LOWEST, 0,
static_cast<u32>(core_id), 0, nullptr, std::move(init_func),
init_func_parameter);
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 {
THREADPRIO_COUNT = 64, ///< Total number of possible thread priorities.
};
-enum ThreadType : u32 {
- THREADTYPE_USER = 0x1,
- THREADTYPE_KERNEL = 0x2,
+enum class ThreadType : u32 {
+ Main = 0,
+ Kernel = 1,
+ HighPriority = 2,
+ User = 3,
};
+DECLARE_ENUM_FLAG_OPERATORS(ThreadType);
enum ThreadProcessorId : s32 {
/// Indicates that no particular processor core is preferred.
@@ -307,7 +310,7 @@ public:
}
bool IsKernelThread() const {
- return (type & THREADTYPE_KERNEL) != 0;
+ return type == ThreadType::Kernel;
}
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 {
std::string name = "Suspend Thread Id:" + std::to_string(i);
std::function<void(void*)> init_func = Core::CpuManager::GetSuspendThreadStartFunc();
void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater();
- auto thread_res = KThread::Create(system, THREADTYPE_KERNEL, std::move(name), 0, 0, 0,
+ auto thread_res = KThread::Create(system, ThreadType::Kernel, std::move(name), 0, 0, 0,
static_cast<u32>(i), 0, nullptr, std::move(init_func),
init_func_parameter);
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 {
*/
void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) {
const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart();
- ThreadType type = THREADTYPE_USER;
- auto thread_res = KThread::Create(system, type, "main", entry_point, priority, 0,
+ auto thread_res = KThread::Create(system, ThreadType::User, "main", entry_point, priority, 0,
owner_process.GetIdealCore(), stack_top, &owner_process);
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
ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1));
- ThreadType type = THREADTYPE_USER;
CASCADE_RESULT(std::shared_ptr<KThread> thread,
- KThread::Create(system, type, "", entry_point, priority, arg, processor_id,
- stack_top, current_process));
+ KThread::Create(system, ThreadType::User, "", entry_point, priority, arg,
+ processor_id, stack_top, current_process));
const auto new_thread_handle = current_process->GetHandleTable().Create(thread);
if (new_thread_handle.Failed()) {