summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-01-26 21:14:18 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2020-01-27 14:54:11 +0100
commit2d1984c20c75e03ec79eeb3806b12efa1679b977 (patch)
tree79a457c2fb0cabd810eac92f3cb245d344ed9c3b /src/core
parentSystem: Correct PrepareReschedule. (diff)
downloadyuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar
yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar.gz
yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar.bz2
yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar.lz
yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar.xz
yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.tar.zst
yuzu-2d1984c20c75e03ec79eeb3806b12efa1679b977.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/arm/exclusive_monitor.cpp3
-rw-r--r--src/core/arm/exclusive_monitor.h5
-rw-r--r--src/core/core.cpp4
-rw-r--r--src/core/core_manager.cpp7
-rw-r--r--src/core/core_manager.h2
-rw-r--r--src/core/cpu_manager.cpp1
-rw-r--r--src/core/cpu_manager.h2
-rw-r--r--src/core/hle/kernel/kernel.cpp5
-rw-r--r--src/core/hle/kernel/kernel.h2
-rw-r--r--src/core/hle/kernel/physical_core.cpp11
-rw-r--r--src/core/hle/kernel/physical_core.h12
11 files changed, 30 insertions, 24 deletions
diff --git a/src/core/arm/exclusive_monitor.cpp b/src/core/arm/exclusive_monitor.cpp
index 00e6a19d5..94570e520 100644
--- a/src/core/arm/exclusive_monitor.cpp
+++ b/src/core/arm/exclusive_monitor.cpp
@@ -12,7 +12,8 @@ namespace Core {
ExclusiveMonitor::~ExclusiveMonitor() = default;
-std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores) {
+std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory,
+ std::size_t num_cores) {
#ifdef ARCHITECTURE_x86_64
return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores);
#else
diff --git a/src/core/arm/exclusive_monitor.h b/src/core/arm/exclusive_monitor.h
index 18461f296..4ef418b90 100644
--- a/src/core/arm/exclusive_monitor.h
+++ b/src/core/arm/exclusive_monitor.h
@@ -1,4 +1,4 @@
-// Copyright 2020 yuzu emulator team
+// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@@ -28,6 +28,7 @@ public:
virtual bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) = 0;
};
-std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores);
+std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory,
+ std::size_t num_cores);
} // namespace Core
diff --git a/src/core/core.cpp b/src/core/core.cpp
index c2295f69c..c53d122be 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -121,8 +121,8 @@ struct System::Impl {
}
Kernel::PhysicalCore& CurrentPhysicalCore() {
- const auto i = cpu_manager.GetActiveCoreIndex();
- return kernel.PhysicalCore(i);
+ const auto index = cpu_manager.GetActiveCoreIndex();
+ return kernel.PhysicalCore(index);
}
Kernel::PhysicalCore& GetPhysicalCore(std::size_t index) {
diff --git a/src/core/core_manager.cpp b/src/core/core_manager.cpp
index bb03857d5..8eacf92dd 100644
--- a/src/core/core_manager.cpp
+++ b/src/core/core_manager.cpp
@@ -24,10 +24,9 @@
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} {
-}
+ : global_scheduler{system.GlobalScheduler()}, physical_core{system.Kernel().PhysicalCore(
+ core_index)},
+ core_timing{system.CoreTiming()}, core_index{core_index} {}
CoreManager::~CoreManager() = default;
diff --git a/src/core/core_manager.h b/src/core/core_manager.h
index 7bc9679c1..b14e723d7 100644
--- a/src/core/core_manager.h
+++ b/src/core/core_manager.h
@@ -5,10 +5,8 @@
#pragma once
#include <atomic>
-#include <condition_variable>
#include <cstddef>
#include <memory>
-#include <mutex>
#include "common/common_types.h"
namespace Kernel {
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index abc8aad9e..752534868 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -17,7 +17,6 @@ CpuManager::CpuManager(System& system) : system{system} {}
CpuManager::~CpuManager() = default;
void CpuManager::Initialize() {
-
for (std::size_t index = 0; index < core_managers.size(); ++index) {
core_managers[index] = std::make_unique<CoreManager>(system, index);
}
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h
index 5371d448e..feb619e1b 100644
--- a/src/core/cpu_manager.h
+++ b/src/core/cpu_manager.h
@@ -5,9 +5,7 @@
#pragma once
#include <array>
-#include <map>
#include <memory>
-#include <thread>
namespace Core {
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 1986cf65c..0cf3c8f70 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -135,7 +135,8 @@ struct KernelCore::Impl {
}
void InitializePhysicalCores(KernelCore& kernel) {
- exclusive_monitor = Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount());
+ exclusive_monitor =
+ Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount());
for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) {
cores.emplace_back(system, kernel, i, *exclusive_monitor);
}
@@ -284,7 +285,7 @@ void KernelCore::InvalidateAllInstructionCaches() {
}
void KernelCore::PrepareReschedule(std::size_t id) {
- if (id >= 0 && id < impl->global_scheduler.CpuCoresCount()) {
+ if (id < impl->global_scheduler.CpuCoresCount()) {
impl->cores[id].Stop();
}
}
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 536068f74..fccffaf3a 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -13,7 +13,7 @@
namespace Core {
class ExclusiveMonitor;
class System;
-}
+} // namespace Core
namespace Core::Timing {
class CoreTiming;
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index 7d84e3d28..896a1a87a 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -17,18 +17,21 @@
namespace Kernel {
-PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor)
+PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id,
+ Core::ExclusiveMonitor& exclusive_monitor)
: core_index{id}, kernel{kernel} {
#ifdef ARCHITECTURE_x86_64
- arm_interface = std::make_unique<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index);
+ arm_interface = std::make_shared<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index);
#else
- arm_interface = std::make_unique<Core::ARM_Unicorn>(system);
+ arm_interface = std::make_shared<Core::ARM_Unicorn>(system);
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
#endif
- scheduler = std::make_unique<Kernel::Scheduler>(system, *arm_interface, core_index);
+ scheduler = std::make_shared<Kernel::Scheduler>(system, *arm_interface, core_index);
}
+PhysicalCore::~PhysicalCore() = default;
+
void PhysicalCore::Run() {
arm_interface->Run();
arm_interface->ClearExclusiveState();
diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h
index a7848e030..fbef0801f 100644
--- a/src/core/hle/kernel/physical_core.h
+++ b/src/core/hle/kernel/physical_core.h
@@ -4,6 +4,9 @@
#pragma once
+#include <cstddef>
+#include <memory>
+
namespace Kernel {
class Scheduler;
} // namespace Kernel
@@ -18,7 +21,10 @@ namespace Kernel {
class PhysicalCore {
public:
- PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor);
+ PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id,
+ Core::ExclusiveMonitor& exclusive_monitor);
+
+ ~PhysicalCore();
/// Execute current jit state
void Run();
@@ -61,8 +67,8 @@ public:
private:
std::size_t core_index;
KernelCore& kernel;
- std::unique_ptr<Core::ARM_Interface> arm_interface;
- std::unique_ptr<Kernel::Scheduler> scheduler;
+ std::shared_ptr<Core::ARM_Interface> arm_interface;
+ std::shared_ptr<Kernel::Scheduler> scheduler;
};
} // namespace Kernel