|
@@ -10,14 +10,14 @@
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
namespace Kernel {
|
|
|
|
|
|
|
|
-PhysicalCore::PhysicalCore(std::size_t core_index_, Core::System& system_, KScheduler& scheduler_)
|
|
|
|
|
- : core_index{core_index_}, system{system_}, scheduler{scheduler_} {
|
|
|
|
|
|
|
+PhysicalCore::PhysicalCore(std::size_t core_index, Core::System& system, KScheduler& scheduler)
|
|
|
|
|
+ : m_core_index{core_index}, m_system{system}, m_scheduler{scheduler} {
|
|
|
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
|
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
|
|
// TODO(bunnei): Initialization relies on a core being available. We may later replace this with
|
|
// TODO(bunnei): Initialization relies on a core being available. We may later replace this with
|
|
|
// a 32-bit instance of Dynarmic. This should be abstracted out to a CPU manager.
|
|
// a 32-bit instance of Dynarmic. This should be abstracted out to a CPU manager.
|
|
|
auto& kernel = system.Kernel();
|
|
auto& kernel = system.Kernel();
|
|
|
- arm_interface = std::make_unique<Core::ARM_Dynarmic_64>(
|
|
|
|
|
- system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), core_index);
|
|
|
|
|
|
|
+ m_arm_interface = std::make_unique<Core::ARM_Dynarmic_64>(
|
|
|
|
|
+ system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index);
|
|
|
#else
|
|
#else
|
|
|
#error Platform not supported yet.
|
|
#error Platform not supported yet.
|
|
|
#endif
|
|
#endif
|
|
@@ -25,13 +25,13 @@ PhysicalCore::PhysicalCore(std::size_t core_index_, Core::System& system_, KSche
|
|
|
|
|
|
|
|
PhysicalCore::~PhysicalCore() = default;
|
|
PhysicalCore::~PhysicalCore() = default;
|
|
|
|
|
|
|
|
-void PhysicalCore::Initialize([[maybe_unused]] bool is_64_bit) {
|
|
|
|
|
|
|
+void PhysicalCore::Initialize(bool is_64_bit) {
|
|
|
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
|
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
|
|
- auto& kernel = system.Kernel();
|
|
|
|
|
|
|
+ auto& kernel = m_system.Kernel();
|
|
|
if (!is_64_bit) {
|
|
if (!is_64_bit) {
|
|
|
// We already initialized a 64-bit core, replace with a 32-bit one.
|
|
// We already initialized a 64-bit core, replace with a 32-bit one.
|
|
|
- arm_interface = std::make_unique<Core::ARM_Dynarmic_32>(
|
|
|
|
|
- system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), core_index);
|
|
|
|
|
|
|
+ m_arm_interface = std::make_unique<Core::ARM_Dynarmic_32>(
|
|
|
|
|
+ m_system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index);
|
|
|
}
|
|
}
|
|
|
#else
|
|
#else
|
|
|
#error Platform not supported yet.
|
|
#error Platform not supported yet.
|
|
@@ -39,31 +39,30 @@ void PhysicalCore::Initialize([[maybe_unused]] bool is_64_bit) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void PhysicalCore::Run() {
|
|
void PhysicalCore::Run() {
|
|
|
- arm_interface->Run();
|
|
|
|
|
- arm_interface->ClearExclusiveState();
|
|
|
|
|
|
|
+ m_arm_interface->Run();
|
|
|
|
|
+ m_arm_interface->ClearExclusiveState();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void PhysicalCore::Idle() {
|
|
void PhysicalCore::Idle() {
|
|
|
- std::unique_lock lk{guard};
|
|
|
|
|
- on_interrupt.wait(lk, [this] { return is_interrupted; });
|
|
|
|
|
|
|
+ std::unique_lock lk{m_guard};
|
|
|
|
|
+ m_on_interrupt.wait(lk, [this] { return m_is_interrupted; });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool PhysicalCore::IsInterrupted() const {
|
|
bool PhysicalCore::IsInterrupted() const {
|
|
|
- return is_interrupted;
|
|
|
|
|
|
|
+ return m_is_interrupted;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void PhysicalCore::Interrupt() {
|
|
void PhysicalCore::Interrupt() {
|
|
|
- std::unique_lock lk{guard};
|
|
|
|
|
- is_interrupted = true;
|
|
|
|
|
- arm_interface->SignalInterrupt();
|
|
|
|
|
- on_interrupt.notify_all();
|
|
|
|
|
|
|
+ std::unique_lock lk{m_guard};
|
|
|
|
|
+ m_is_interrupted = true;
|
|
|
|
|
+ m_arm_interface->SignalInterrupt();
|
|
|
|
|
+ m_on_interrupt.notify_all();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void PhysicalCore::ClearInterrupt() {
|
|
void PhysicalCore::ClearInterrupt() {
|
|
|
- std::unique_lock lk{guard};
|
|
|
|
|
- is_interrupted = false;
|
|
|
|
|
- arm_interface->ClearInterrupt();
|
|
|
|
|
- on_interrupt.notify_all();
|
|
|
|
|
|
|
+ std::unique_lock lk{m_guard};
|
|
|
|
|
+ m_is_interrupted = false;
|
|
|
|
|
+ m_arm_interface->ClearInterrupt();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} // namespace Kernel
|
|
} // namespace Kernel
|