mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 02:32:46 +01:00
Scheduler: Remove arm_interface lock and a few corrections.
This commit is contained in:
parent
38c6c497f6
commit
725bac1404
2 changed files with 3 additions and 17 deletions
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <mutex>
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
@ -165,14 +164,6 @@ public:
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Lock() {
|
|
||||||
guard.lock();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Unlock() {
|
|
||||||
guard.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<BacktraceEntry> GetBacktrace() const;
|
std::vector<BacktraceEntry> GetBacktrace() const;
|
||||||
|
|
||||||
/// fp (= r29) points to the last frame record.
|
/// fp (= r29) points to the last frame record.
|
||||||
|
@ -187,7 +178,6 @@ protected:
|
||||||
/// System context that this ARM interface is running under.
|
/// System context that this ARM interface is running under.
|
||||||
System& system;
|
System& system;
|
||||||
CPUInterruptHandler& interrupt_handler;
|
CPUInterruptHandler& interrupt_handler;
|
||||||
std::mutex guard;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -463,9 +463,7 @@ void GlobalScheduler::AdjustSchedulingOnPriority(Thread* thread, u32 old_priorit
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread->processor_id >= 0) {
|
if (thread->processor_id >= 0) {
|
||||||
// TODO(Blinkhawk): compare it with current thread running on current core, instead of
|
if (thread == kernel.CurrentScheduler().GetCurrentThread()) {
|
||||||
// checking running
|
|
||||||
if (thread->IsRunning()) {
|
|
||||||
SchedulePrepend(thread->current_priority, static_cast<u32>(thread->processor_id),
|
SchedulePrepend(thread->current_priority, static_cast<u32>(thread->processor_id),
|
||||||
thread);
|
thread);
|
||||||
} else {
|
} else {
|
||||||
|
@ -602,8 +600,6 @@ void Scheduler::SwitchContextStep2() {
|
||||||
previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr;
|
previous_thread != nullptr ? previous_thread->GetOwnerProcess() : nullptr;
|
||||||
|
|
||||||
if (new_thread) {
|
if (new_thread) {
|
||||||
auto& cpu_core = system.ArmInterface(core_id);
|
|
||||||
cpu_core.Lock();
|
|
||||||
ASSERT_MSG(new_thread->GetSchedulingStatus() == ThreadSchedStatus::Runnable,
|
ASSERT_MSG(new_thread->GetSchedulingStatus() == ThreadSchedStatus::Runnable,
|
||||||
"Thread must be runnable.");
|
"Thread must be runnable.");
|
||||||
|
|
||||||
|
@ -615,6 +611,7 @@ void Scheduler::SwitchContextStep2() {
|
||||||
system.Kernel().MakeCurrentProcess(thread_owner_process);
|
system.Kernel().MakeCurrentProcess(thread_owner_process);
|
||||||
}
|
}
|
||||||
if (!new_thread->IsHLEThread()) {
|
if (!new_thread->IsHLEThread()) {
|
||||||
|
auto& cpu_core = system.ArmInterface(core_id);
|
||||||
cpu_core.LoadContext(new_thread->GetContext32());
|
cpu_core.LoadContext(new_thread->GetContext32());
|
||||||
cpu_core.LoadContext(new_thread->GetContext64());
|
cpu_core.LoadContext(new_thread->GetContext64());
|
||||||
cpu_core.SetTlsAddress(new_thread->GetTLSAddress());
|
cpu_core.SetTlsAddress(new_thread->GetTLSAddress());
|
||||||
|
@ -646,8 +643,8 @@ void Scheduler::SwitchContext() {
|
||||||
|
|
||||||
// Save context for previous thread
|
// Save context for previous thread
|
||||||
if (previous_thread) {
|
if (previous_thread) {
|
||||||
auto& cpu_core = system.ArmInterface(core_id);
|
|
||||||
if (!previous_thread->IsHLEThread()) {
|
if (!previous_thread->IsHLEThread()) {
|
||||||
|
auto& cpu_core = system.ArmInterface(core_id);
|
||||||
cpu_core.SaveContext(previous_thread->GetContext32());
|
cpu_core.SaveContext(previous_thread->GetContext32());
|
||||||
cpu_core.SaveContext(previous_thread->GetContext64());
|
cpu_core.SaveContext(previous_thread->GetContext64());
|
||||||
// Save the TPIDR_EL0 system register in case it was modified.
|
// Save the TPIDR_EL0 system register in case it was modified.
|
||||||
|
@ -659,7 +656,6 @@ void Scheduler::SwitchContext() {
|
||||||
}
|
}
|
||||||
previous_thread->SetIsRunning(false);
|
previous_thread->SetIsRunning(false);
|
||||||
previous_thread->context_guard.unlock();
|
previous_thread->context_guard.unlock();
|
||||||
cpu_core.Unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Common::Fiber> old_context;
|
std::shared_ptr<Common::Fiber> old_context;
|
||||||
|
|
Loading…
Reference in a new issue