summaryrefslogtreecommitdiffstats
path: root/src/core/core_manager.cpp
blob: 82d7acb4065eeccde03d4aa2096f6e25b5dca859 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#include <condition_variable>
#include <mutex>

#include "common/logging/log.h"
#include "core/arm/exclusive_monitor.h"
#include "core/arm/unicorn/arm_unicorn.h"
#include "core/core.h"
#include "core/core_manager.h"
#include "core/core_timing.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/lock.h"
#include "core/settings.h"

namespace Core {

CoreManager::CoreManager(System& system, std::size_t core_index)
    : global_scheduler{system.GlobalScheduler()}, physical_core{system.Kernel().PhysicalCore(
                                                      core_index)},
      core_timing{system.CoreTiming()}, core_index{core_index} {}

CoreManager::~CoreManager() = default;

void CoreManager::RunLoop(bool tight_loop) {
    /// Deprecated
}

void CoreManager::SingleStep() {
    return RunLoop(false);
}

void CoreManager::PrepareReschedule() {
    //physical_core.Stop();
}

void CoreManager::Reschedule() {
    // Lock the global kernel mutex when we manipulate the HLE state
    std::lock_guard lock(HLE::g_hle_lock);

    // global_scheduler.SelectThread(core_index);

    physical_core.Scheduler().TryDoContextSwitch();
}

} // namespace Core