summaryrefslogtreecommitdiff
path: root/src/core/core_cpu.cpp
diff options
context:
space:
mode:
authorGravatar MerryMage2018-07-03 14:28:46 +0100
committerGravatar MerryMage2018-07-22 15:55:17 +0100
commit0b1c2e5505c6478ef10e65c0b002eeb242e15540 (patch)
tree187eeabceb451d3cd89b3f0fd47412a7a9e57015 /src/core/core_cpu.cpp
parentMerge pull request #765 from lioncash/file (diff)
downloadyuzu-0b1c2e5505c6478ef10e65c0b002eeb242e15540.tar.gz
yuzu-0b1c2e5505c6478ef10e65c0b002eeb242e15540.tar.xz
yuzu-0b1c2e5505c6478ef10e65c0b002eeb242e15540.zip
Implement exclusive monitor
Diffstat (limited to 'src/core/core_cpu.cpp')
-rw-r--r--src/core/core_cpu.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/core_cpu.cpp b/src/core/core_cpu.cpp
index f22d6a9d0..54e15a701 100644
--- a/src/core/core_cpu.cpp
+++ b/src/core/core_cpu.cpp
@@ -48,14 +48,15 @@ bool CpuBarrier::Rendezvous() {
48 return false; 48 return false;
49} 49}
50 50
51Cpu::Cpu(std::shared_ptr<CpuBarrier> cpu_barrier, size_t core_index) 51Cpu::Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor,
52 std::shared_ptr<CpuBarrier> cpu_barrier, size_t core_index)
52 : cpu_barrier{std::move(cpu_barrier)}, core_index{core_index} { 53 : cpu_barrier{std::move(cpu_barrier)}, core_index{core_index} {
53 54
54 if (Settings::values.use_cpu_jit) { 55 if (Settings::values.use_cpu_jit) {
55#ifdef ARCHITECTURE_x86_64 56#ifdef ARCHITECTURE_x86_64
56 arm_interface = std::make_shared<ARM_Dynarmic>(); 57 arm_interface = std::make_shared<ARM_Dynarmic>(exclusive_monitor, core_index);
57#else 58#else
58 cpu_core = std::make_shared<ARM_Unicorn>(); 59 arm_interface = std::make_shared<ARM_Unicorn>();
59 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); 60 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
60#endif 61#endif
61 } else { 62 } else {
@@ -65,6 +66,18 @@ Cpu::Cpu(std::shared_ptr<CpuBarrier> cpu_barrier, size_t core_index)
65 scheduler = std::make_shared<Kernel::Scheduler>(arm_interface.get()); 66 scheduler = std::make_shared<Kernel::Scheduler>(arm_interface.get());
66} 67}
67 68
69std::shared_ptr<ExclusiveMonitor> Cpu::MakeExclusiveMonitor(size_t num_cores) {
70 if (Settings::values.use_cpu_jit) {
71#ifdef ARCHITECTURE_x86_64
72 return std::make_shared<DynarmicExclusiveMonitor>(num_cores);
73#else
74 return nullptr; // TODO(merry): Passthrough exclusive monitor
75#endif
76 } else {
77 return nullptr; // TODO(merry): Passthrough exclusive monitor
78 }
79}
80
68void Cpu::RunLoop(bool tight_loop) { 81void Cpu::RunLoop(bool tight_loop) {
69 // Wait for all other CPU cores to complete the previous slice, such that they run in lock-step 82 // Wait for all other CPU cores to complete the previous slice, such that they run in lock-step
70 if (!cpu_barrier->Rendezvous()) { 83 if (!cpu_barrier->Rendezvous()) {