System: Address Feedback
This commit is contained in:
parent
de4b01f75d
commit
2d1984c20c
|
@ -12,7 +12,8 @@ namespace Core {
|
||||||
|
|
||||||
ExclusiveMonitor::~ExclusiveMonitor() = default;
|
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
|
#ifdef ARCHITECTURE_x86_64
|
||||||
return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores);
|
return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020 yuzu emulator team
|
// Copyright 2018 yuzu emulator team
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// 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;
|
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
|
} // namespace Core
|
||||||
|
|
|
@ -121,8 +121,8 @@ struct System::Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel::PhysicalCore& CurrentPhysicalCore() {
|
Kernel::PhysicalCore& CurrentPhysicalCore() {
|
||||||
const auto i = cpu_manager.GetActiveCoreIndex();
|
const auto index = cpu_manager.GetActiveCoreIndex();
|
||||||
return kernel.PhysicalCore(i);
|
return kernel.PhysicalCore(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel::PhysicalCore& GetPhysicalCore(std::size_t index) {
|
Kernel::PhysicalCore& GetPhysicalCore(std::size_t index) {
|
||||||
|
|
|
@ -24,10 +24,9 @@
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
CoreManager::CoreManager(System& system, std::size_t core_index)
|
CoreManager::CoreManager(System& system, std::size_t core_index)
|
||||||
: global_scheduler{system.GlobalScheduler()},
|
: global_scheduler{system.GlobalScheduler()}, physical_core{system.Kernel().PhysicalCore(
|
||||||
physical_core{system.Kernel().PhysicalCore(core_index)}, core_timing{system.CoreTiming()},
|
core_index)},
|
||||||
core_index{core_index} {
|
core_timing{system.CoreTiming()}, core_index{core_index} {}
|
||||||
}
|
|
||||||
|
|
||||||
CoreManager::~CoreManager() = default;
|
CoreManager::~CoreManager() = default;
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <condition_variable>
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
|
@ -17,7 +17,6 @@ CpuManager::CpuManager(System& system) : system{system} {}
|
||||||
CpuManager::~CpuManager() = default;
|
CpuManager::~CpuManager() = default;
|
||||||
|
|
||||||
void CpuManager::Initialize() {
|
void CpuManager::Initialize() {
|
||||||
|
|
||||||
for (std::size_t index = 0; index < core_managers.size(); ++index) {
|
for (std::size_t index = 0; index < core_managers.size(); ++index) {
|
||||||
core_managers[index] = std::make_unique<CoreManager>(system, index);
|
core_managers[index] = std::make_unique<CoreManager>(system, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,8 @@ struct KernelCore::Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializePhysicalCores(KernelCore& kernel) {
|
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++) {
|
for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) {
|
||||||
cores.emplace_back(system, kernel, i, *exclusive_monitor);
|
cores.emplace_back(system, kernel, i, *exclusive_monitor);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +285,7 @@ void KernelCore::InvalidateAllInstructionCaches() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelCore::PrepareReschedule(std::size_t id) {
|
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();
|
impl->cores[id].Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class ExclusiveMonitor;
|
class ExclusiveMonitor;
|
||||||
class System;
|
class System;
|
||||||
}
|
} // namespace Core
|
||||||
|
|
||||||
namespace Core::Timing {
|
namespace Core::Timing {
|
||||||
class CoreTiming;
|
class CoreTiming;
|
||||||
|
|
|
@ -17,18 +17,21 @@
|
||||||
|
|
||||||
namespace Kernel {
|
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} {
|
: core_index{id}, kernel{kernel} {
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#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
|
#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");
|
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
|
||||||
#endif
|
#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() {
|
void PhysicalCore::Run() {
|
||||||
arm_interface->Run();
|
arm_interface->Run();
|
||||||
arm_interface->ClearExclusiveState();
|
arm_interface->ClearExclusiveState();
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
class Scheduler;
|
class Scheduler;
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
@ -18,7 +21,10 @@ namespace Kernel {
|
||||||
|
|
||||||
class PhysicalCore {
|
class PhysicalCore {
|
||||||
public:
|
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
|
/// Execute current jit state
|
||||||
void Run();
|
void Run();
|
||||||
|
@ -61,8 +67,8 @@ public:
|
||||||
private:
|
private:
|
||||||
std::size_t core_index;
|
std::size_t core_index;
|
||||||
KernelCore& kernel;
|
KernelCore& kernel;
|
||||||
std::unique_ptr<Core::ARM_Interface> arm_interface;
|
std::shared_ptr<Core::ARM_Interface> arm_interface;
|
||||||
std::unique_ptr<Kernel::Scheduler> scheduler;
|
std::shared_ptr<Kernel::Scheduler> scheduler;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
Loading…
Reference in New Issue