yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

hle: kernel: KThread: Fix ThreadType definition.

This commit is contained in:
bunnei 2021-01-01 01:04:30 -08:00
parent 4782985013
commit 0530292b97
5 changed files with 12 additions and 11 deletions

View File

@ -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();

View File

@ -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 {

View File

@ -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);

View File

@ -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();

View File

@ -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()) {