diff options
| author | 2018-07-22 12:48:44 -0400 | |
|---|---|---|
| committer | 2018-07-22 12:48:44 -0400 | |
| commit | 5fc99553d20d7d747730f7da4d12bdeb0593adb2 (patch) | |
| tree | 4f3217d3f564c47b8aeecac046e389ba6d3d07ed /src/core/core_cpu.cpp | |
| parent | Merge pull request #772 from MerryMage/dynarmic (diff) | |
| parent | Implement exclusive monitor (diff) | |
| download | yuzu-5fc99553d20d7d747730f7da4d12bdeb0593adb2.tar.gz yuzu-5fc99553d20d7d747730f7da4d12bdeb0593adb2.tar.xz yuzu-5fc99553d20d7d747730f7da4d12bdeb0593adb2.zip | |
Merge pull request #638 from MerryMage/mp
Implement exclusive monitor
Diffstat (limited to 'src/core/core_cpu.cpp')
| -rw-r--r-- | src/core/core_cpu.cpp | 19 |
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 | ||
| 51 | Cpu::Cpu(std::shared_ptr<CpuBarrier> cpu_barrier, size_t core_index) | 51 | Cpu::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 | ||
| 69 | std::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 | |||
| 68 | void Cpu::RunLoop(bool tight_loop) { | 81 | void 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()) { |