Kernel: Correct Host Context on Threads and Scheduler.
This commit is contained in:
parent
0e4c35c591
commit
d240143588
@ -736,15 +736,15 @@ void Scheduler::SwitchContext() {
|
|||||||
previous_thread->context_guard.unlock();
|
previous_thread->context_guard.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Common::Fiber> old_context;
|
std::shared_ptr<Common::Fiber>* old_context;
|
||||||
if (previous_thread != nullptr) {
|
if (previous_thread != nullptr) {
|
||||||
old_context = previous_thread->GetHostContext();
|
old_context = &previous_thread->GetHostContext();
|
||||||
} else {
|
} else {
|
||||||
old_context = idle_thread->GetHostContext();
|
old_context = &idle_thread->GetHostContext();
|
||||||
}
|
}
|
||||||
guard.unlock();
|
guard.unlock();
|
||||||
|
|
||||||
Common::Fiber::YieldTo(old_context, switch_fiber);
|
Common::Fiber::YieldTo(*old_context, switch_fiber);
|
||||||
/// When a thread wakes up, the scheduler may have changed to other in another core.
|
/// When a thread wakes up, the scheduler may have changed to other in another core.
|
||||||
auto& next_scheduler = system.Kernel().CurrentScheduler();
|
auto& next_scheduler = system.Kernel().CurrentScheduler();
|
||||||
next_scheduler.SwitchContextStep2();
|
next_scheduler.SwitchContextStep2();
|
||||||
@ -774,13 +774,13 @@ void Scheduler::SwitchToCurrent() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::shared_ptr<Common::Fiber> next_context;
|
std::shared_ptr<Common::Fiber>* next_context;
|
||||||
if (current_thread != nullptr) {
|
if (current_thread != nullptr) {
|
||||||
next_context = current_thread->GetHostContext();
|
next_context = ¤t_thread->GetHostContext();
|
||||||
} else {
|
} else {
|
||||||
next_context = idle_thread->GetHostContext();
|
next_context = &idle_thread->GetHostContext();
|
||||||
}
|
}
|
||||||
Common::Fiber::YieldTo(switch_fiber, next_context);
|
Common::Fiber::YieldTo(switch_fiber, *next_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ public:
|
|||||||
|
|
||||||
void OnThreadStart();
|
void OnThreadStart();
|
||||||
|
|
||||||
std::shared_ptr<Common::Fiber> ControlContext() {
|
std::shared_ptr<Common::Fiber>& ControlContext() {
|
||||||
return switch_fiber;
|
return switch_fiber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ static void ResetThreadContext64(Core::ARM_Interface::ThreadContext64& context,
|
|||||||
context.fpcr = 0;
|
context.fpcr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Common::Fiber> Thread::GetHostContext() const {
|
std::shared_ptr<Common::Fiber>& Thread::GetHostContext() {
|
||||||
return host_context;
|
return host_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ public:
|
|||||||
was_running = value;
|
was_running = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Common::Fiber> GetHostContext() const;
|
std::shared_ptr<Common::Fiber>& GetHostContext();
|
||||||
|
|
||||||
ThreadStatus GetStatus() const {
|
ThreadStatus GetStatus() const {
|
||||||
return status;
|
return status;
|
||||||
|
Loading…
Reference in New Issue
Block a user