early-access version 2793

This commit is contained in:
pineappleEA 2022-06-17 01:43:45 +02:00
parent f41d375e23
commit 4439b53627
5 changed files with 8 additions and 15 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2792. This is the source code for early-access 2793.
## Legal Notice ## Legal Notice

View File

@ -57,18 +57,13 @@ void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority
thread->GetContext64().cpu_registers[0] = 0; thread->GetContext64().cpu_registers[0] = 0;
thread->GetContext32().cpu_registers[1] = thread_handle; thread->GetContext32().cpu_registers[1] = thread_handle;
thread->GetContext64().cpu_registers[1] = thread_handle; thread->GetContext64().cpu_registers[1] = thread_handle;
thread->DisableDispatch();
auto& kernel = system.Kernel();
// Threads by default are dormant, wake up the main thread so it runs when the scheduler fires
{
KScopedSchedulerLock lock{kernel};
thread->SetState(ThreadState::Runnable);
if (system.DebuggerEnabled()) { if (system.DebuggerEnabled()) {
thread->RequestSuspend(SuspendType::Debug); thread->RequestSuspend(SuspendType::Debug);
} }
}
// Run our thread.
void(thread->Run());
} }
} // Anonymous namespace } // Anonymous namespace

View File

@ -829,6 +829,7 @@ void KScheduler::Initialize() {
idle_thread = KThread::Create(system.Kernel()); idle_thread = KThread::Create(system.Kernel());
ASSERT(KThread::InitializeIdleThread(system, idle_thread, core_id).IsSuccess()); ASSERT(KThread::InitializeIdleThread(system, idle_thread, core_id).IsSuccess());
idle_thread->SetName(fmt::format("IdleThread:{}", core_id)); idle_thread->SetName(fmt::format("IdleThread:{}", core_id));
idle_thread->EnableDispatch();
} }
KScopedSchedulerLock::KScopedSchedulerLock(KernelCore& kernel) KScopedSchedulerLock::KScopedSchedulerLock(KernelCore& kernel)

View File

@ -225,7 +225,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
// Setup the stack parameters. // Setup the stack parameters.
StackParameters& sp = GetStackParameters(); StackParameters& sp = GetStackParameters();
sp.cur_thread = this; sp.cur_thread = this;
sp.disable_count = 0; sp.disable_count = 1;
SetInExceptionHandler(); SetInExceptionHandler();
// Set thread ID. // Set thread ID.
@ -1014,8 +1014,6 @@ ResultCode KThread::Run() {
// Set our state and finish. // Set our state and finish.
SetState(ThreadState::Runnable); SetState(ThreadState::Runnable);
DisableDispatch();
return ResultSuccess; return ResultSuccess;
} }
} }

View File

@ -254,7 +254,6 @@ struct KernelCore::Impl {
core_id) core_id)
.IsSuccess()); .IsSuccess());
shutdown_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id)); shutdown_threads[core_id]->SetName(fmt::format("SuspendThread:{}", core_id));
shutdown_threads[core_id]->DisableDispatch();
} }
} }