summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-06 19:56:05 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:29 +0200
commita33fbaddec5d516328d7cd179114dcf0b93cfb69 (patch)
tree3c4a4ffaae67165e5d4fc380c3f6f899d73f8dac /src/core/hle/kernel
parentScheduler: Release old thread fiber before trying to switch to the next thread fiber. (diff)
downloadyuzu-a33fbaddec5d516328d7cd179114dcf0b93cfb69.tar
yuzu-a33fbaddec5d516328d7cd179114dcf0b93cfb69.tar.gz
yuzu-a33fbaddec5d516328d7cd179114dcf0b93cfb69.tar.bz2
yuzu-a33fbaddec5d516328d7cd179114dcf0b93cfb69.tar.lz
yuzu-a33fbaddec5d516328d7cd179114dcf0b93cfb69.tar.xz
yuzu-a33fbaddec5d516328d7cd179114dcf0b93cfb69.tar.zst
yuzu-a33fbaddec5d516328d7cd179114dcf0b93cfb69.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/scheduler.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index aa1f1a305..ae89e908f 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -552,8 +552,7 @@ void GlobalScheduler::Unlock() {
EnableInterruptAndSchedule(cores_pending_reschedule, leaving_thread);
}
-Scheduler::Scheduler(Core::System& system, std::size_t core_id)
- : system(system), core_id(core_id) {
+Scheduler::Scheduler(Core::System& system, std::size_t core_id) : system(system), core_id(core_id) {
switch_fiber = std::make_shared<Common::Fiber>(std::function<void(void*)>(OnSwitch), this);
}
@@ -601,9 +600,10 @@ void Scheduler::SwitchContextStep2() {
// Load context of new thread
Process* const previous_process =
- previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr;
+ previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr;
if (new_thread) {
+ auto& cpu_core = system.ArmInterface(core_id);
new_thread->context_guard.lock();
cpu_core.Lock();
ASSERT_MSG(new_thread->GetProcessorID() == s32(this->core_id),
@@ -619,7 +619,6 @@ void Scheduler::SwitchContextStep2() {
system.Kernel().MakeCurrentProcess(thread_owner_process);
}
if (!new_thread->IsHLEThread()) {
- auto& cpu_core = system.ArmInterface(core_id);
cpu_core.LoadContext(new_thread->GetContext32());
cpu_core.LoadContext(new_thread->GetContext64());
cpu_core.SetTlsAddress(new_thread->GetTLSAddress());
@@ -651,12 +650,12 @@ void Scheduler::SwitchContext() {
// Save context for previous thread
if (previous_thread) {
+ auto& cpu_core = system.ArmInterface(core_id);
if (!previous_thread->IsHLEThread()) {
- auto& cpu_core = system.ArmInterface(core_id);
cpu_core.SaveContext(previous_thread->GetContext32());
cpu_core.SaveContext(previous_thread->GetContext64());
// Save the TPIDR_EL0 system register in case it was modified.
- previous_thread->SetTPIDR_EL0(cpu_core.GetTPIDR_EL0());
+ previous_thread->SetTPIDR_EL0(cpu_core.GetTPIDR_EL0());
cpu_core.ClearExclusiveState();
}
if (previous_thread->GetStatus() == ThreadStatus::Running) {