summaryrefslogtreecommitdiff
path: root/src/core/core_cpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core_cpu.cpp')
-rw-r--r--src/core/core_cpu.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/core/core_cpu.cpp b/src/core/core_cpu.cpp
deleted file mode 100644
index bcfdf0198..000000000
--- a/src/core/core_cpu.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <condition_variable>
6#include <mutex>
7
8#include "common/logging/log.h"
9#ifdef ARCHITECTURE_x86_64
10#include "core/arm/dynarmic/arm_dynarmic.h"
11#endif
12#include "core/arm/exclusive_monitor.h"
13#include "core/arm/unicorn/arm_unicorn.h"
14#include "core/core.h"
15#include "core/core_cpu.h"
16#include "core/core_timing.h"
17#include "core/hle/kernel/kernel.h"
18#include "core/hle/kernel/physical_core.h"
19#include "core/hle/kernel/scheduler.h"
20#include "core/hle/kernel/thread.h"
21#include "core/hle/lock.h"
22#include "core/settings.h"
23
24namespace Core {
25
26Cpu::Cpu(System& system, std::size_t core_index)
27 : global_scheduler{system.GlobalScheduler()},
28 physical_core{system.Kernel().PhysicalCore(core_index)}, core_timing{system.CoreTiming()},
29 core_index{core_index} {
30}
31
32Cpu::~Cpu() = default;
33
34void Cpu::RunLoop(bool tight_loop) {
35 Reschedule();
36
37 // If we don't have a currently active thread then don't execute instructions,
38 // instead advance to the next event and try to yield to the next thread
39 if (Kernel::GetCurrentThread() == nullptr) {
40 LOG_TRACE(Core, "Core-{} idling", core_index);
41 core_timing.Idle();
42 } else {
43 if (tight_loop) {
44 physical_core.Run();
45 } else {
46 physical_core.Step();
47 }
48 }
49 core_timing.Advance();
50
51 Reschedule();
52}
53
54void Cpu::SingleStep() {
55 return RunLoop(false);
56}
57
58void Cpu::PrepareReschedule() {
59 physical_core.Stop();
60}
61
62void Cpu::Reschedule() {
63 // Lock the global kernel mutex when we manipulate the HLE state
64 std::lock_guard lock(HLE::g_hle_lock);
65
66 global_scheduler.SelectThread(core_index);
67
68 physical_core.Scheduler().TryDoContextSwitch();
69}
70
71} // namespace Core