2018-05-02 02:21:38 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2018-05-03 01:26:14 +00:00
|
|
|
#include <condition_variable>
|
|
|
|
#include <mutex>
|
|
|
|
|
2018-05-02 02:21:38 +00:00
|
|
|
#include "common/logging/log.h"
|
2018-09-17 22:15:09 +00:00
|
|
|
#include "core/arm/exclusive_monitor.h"
|
2018-05-02 02:21:38 +00:00
|
|
|
#include "core/arm/unicorn/arm_unicorn.h"
|
2019-03-04 21:02:59 +00:00
|
|
|
#include "core/core.h"
|
2020-01-26 18:07:22 +00:00
|
|
|
#include "core/core_manager.h"
|
2018-05-02 02:21:38 +00:00
|
|
|
#include "core/core_timing.h"
|
2020-01-25 22:55:32 +00:00
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
#include "core/hle/kernel/physical_core.h"
|
2018-05-02 02:21:38 +00:00
|
|
|
#include "core/hle/kernel/scheduler.h"
|
|
|
|
#include "core/hle/kernel/thread.h"
|
2018-08-12 22:50:44 +00:00
|
|
|
#include "core/hle/lock.h"
|
2018-05-02 02:21:38 +00:00
|
|
|
#include "core/settings.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
2020-01-26 18:07:22 +00:00
|
|
|
CoreManager::CoreManager(System& system, std::size_t core_index)
|
2020-01-26 20:14:18 +00:00
|
|
|
: global_scheduler{system.GlobalScheduler()}, physical_core{system.Kernel().PhysicalCore(
|
|
|
|
core_index)},
|
|
|
|
core_timing{system.CoreTiming()}, core_index{core_index} {}
|
2018-05-02 02:21:38 +00:00
|
|
|
|
2020-01-26 18:07:22 +00:00
|
|
|
CoreManager::~CoreManager() = default;
|
2018-09-17 22:15:09 +00:00
|
|
|
|
2020-01-26 18:07:22 +00:00
|
|
|
void CoreManager::RunLoop(bool tight_loop) {
|
2020-03-01 16:14:17 +00:00
|
|
|
/// Deprecated
|
2018-05-02 02:21:38 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 18:07:22 +00:00
|
|
|
void CoreManager::SingleStep() {
|
2018-05-02 02:21:38 +00:00
|
|
|
return RunLoop(false);
|
|
|
|
}
|
|
|
|
|
2020-01-26 18:07:22 +00:00
|
|
|
void CoreManager::PrepareReschedule() {
|
2020-03-01 16:14:17 +00:00
|
|
|
//physical_core.Stop();
|
2018-05-02 02:21:38 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 18:07:22 +00:00
|
|
|
void CoreManager::Reschedule() {
|
2018-08-12 22:50:44 +00:00
|
|
|
// Lock the global kernel mutex when we manipulate the HLE state
|
2019-06-19 13:11:18 +00:00
|
|
|
std::lock_guard lock(HLE::g_hle_lock);
|
2019-03-29 21:09:10 +00:00
|
|
|
|
2020-02-25 02:04:12 +00:00
|
|
|
// global_scheduler.SelectThread(core_index);
|
2018-05-02 02:21:38 +00:00
|
|
|
|
2020-01-25 22:55:32 +00:00
|
|
|
physical_core.Scheduler().TryDoContextSwitch();
|
2019-10-12 12:21:51 +00:00
|
|
|
}
|
|
|
|
|
2018-05-02 02:21:38 +00:00
|
|
|
} // namespace Core
|