kernel: fix single-core preemption points

This commit is contained in:
Liam
2022-07-07 12:34:46 -04:00
parent 21945ae127
commit da07e13e07
6 changed files with 27 additions and 39 deletions

View File

@ -103,7 +103,20 @@ void KScheduler::ScheduleOnInterrupt() {
GetCurrentThread(kernel).EnableDispatch();
}
void KScheduler::PreemptSingleCore() {
GetCurrentThread(kernel).DisableDispatch();
auto* thread = GetCurrentThreadPointer(kernel);
auto& previous_scheduler = kernel.Scheduler(thread->GetCurrentCore());
previous_scheduler.Unload(thread);
Common::Fiber::YieldTo(thread->GetHostContext(), *m_switch_fiber);
GetCurrentThread(kernel).EnableDispatch();
}
void KScheduler::RescheduleCurrentCore() {
ASSERT(!kernel.IsPhantomModeForSingleCore());
ASSERT(GetCurrentThread(kernel).GetDisableDispatchCount() == 1);
GetCurrentThread(kernel).EnableDispatch();