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