mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 21:14:19 +01:00
hle: kernel: KThread: Fix ThreadType definition.
This commit is contained in:
parent
4782985013
commit
0530292b97
@ -763,7 +763,7 @@ void KScheduler::Initialize() {
|
|||||||
std::string name = "Idle Thread Id:" + std::to_string(core_id);
|
std::string name = "Idle Thread Id:" + std::to_string(core_id);
|
||||||
std::function<void(void*)> init_func = Core::CpuManager::GetIdleThreadStartFunc();
|
std::function<void(void*)> init_func = Core::CpuManager::GetIdleThreadStartFunc();
|
||||||
void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater();
|
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),
|
static_cast<u32>(core_id), 0, nullptr, std::move(init_func),
|
||||||
init_func_parameter);
|
init_func_parameter);
|
||||||
idle_thread = thread_res.Unwrap().get();
|
idle_thread = thread_res.Unwrap().get();
|
||||||
|
@ -48,10 +48,13 @@ enum ThreadPriority : u32 {
|
|||||||
THREADPRIO_COUNT = 64, ///< Total number of possible thread priorities.
|
THREADPRIO_COUNT = 64, ///< Total number of possible thread priorities.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ThreadType : u32 {
|
enum class ThreadType : u32 {
|
||||||
THREADTYPE_USER = 0x1,
|
Main = 0,
|
||||||
THREADTYPE_KERNEL = 0x2,
|
Kernel = 1,
|
||||||
|
HighPriority = 2,
|
||||||
|
User = 3,
|
||||||
};
|
};
|
||||||
|
DECLARE_ENUM_FLAG_OPERATORS(ThreadType);
|
||||||
|
|
||||||
enum ThreadProcessorId : s32 {
|
enum ThreadProcessorId : s32 {
|
||||||
/// Indicates that no particular processor core is preferred.
|
/// Indicates that no particular processor core is preferred.
|
||||||
@ -307,7 +310,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsKernelThread() const {
|
bool IsKernelThread() const {
|
||||||
return (type & THREADTYPE_KERNEL) != 0;
|
return type == ThreadType::Kernel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WasRunning() const {
|
bool WasRunning() const {
|
||||||
|
@ -169,7 +169,7 @@ struct KernelCore::Impl {
|
|||||||
std::string name = "Suspend Thread Id:" + std::to_string(i);
|
std::string name = "Suspend Thread Id:" + std::to_string(i);
|
||||||
std::function<void(void*)> init_func = Core::CpuManager::GetSuspendThreadStartFunc();
|
std::function<void(void*)> init_func = Core::CpuManager::GetSuspendThreadStartFunc();
|
||||||
void* init_func_parameter = system.GetCpuManager().GetStartFuncParamater();
|
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),
|
static_cast<u32>(i), 0, nullptr, std::move(init_func),
|
||||||
init_func_parameter);
|
init_func_parameter);
|
||||||
|
|
||||||
|
@ -38,8 +38,7 @@ namespace {
|
|||||||
*/
|
*/
|
||||||
void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) {
|
void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) {
|
||||||
const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart();
|
const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart();
|
||||||
ThreadType type = THREADTYPE_USER;
|
auto thread_res = KThread::Create(system, ThreadType::User, "main", entry_point, priority, 0,
|
||||||
auto thread_res = KThread::Create(system, type, "main", entry_point, priority, 0,
|
|
||||||
owner_process.GetIdealCore(), stack_top, &owner_process);
|
owner_process.GetIdealCore(), stack_top, &owner_process);
|
||||||
|
|
||||||
std::shared_ptr<KThread> thread = std::move(thread_res).Unwrap();
|
std::shared_ptr<KThread> thread = std::move(thread_res).Unwrap();
|
||||||
|
@ -1488,10 +1488,9 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e
|
|||||||
|
|
||||||
ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1));
|
ASSERT(kernel.CurrentProcess()->GetResourceLimit()->Reserve(ResourceType::Threads, 1));
|
||||||
|
|
||||||
ThreadType type = THREADTYPE_USER;
|
|
||||||
CASCADE_RESULT(std::shared_ptr<KThread> thread,
|
CASCADE_RESULT(std::shared_ptr<KThread> thread,
|
||||||
KThread::Create(system, type, "", entry_point, priority, arg, processor_id,
|
KThread::Create(system, ThreadType::User, "", entry_point, priority, arg,
|
||||||
stack_top, current_process));
|
processor_id, stack_top, current_process));
|
||||||
|
|
||||||
const auto new_thread_handle = current_process->GetHandleTable().Create(thread);
|
const auto new_thread_handle = current_process->GetHandleTable().Create(thread);
|
||||||
if (new_thread_handle.Failed()) {
|
if (new_thread_handle.Failed()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user