From ab89ced244db69616d29c91470d870b73b09cc69 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 24 Jan 2020 15:38:20 -0400 Subject: Kernel: Implement Physical Core. --- src/core/hle/kernel/physical_core.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/core/hle/kernel/physical_core.cpp (limited to 'src/core/hle/kernel/physical_core.cpp') diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp new file mode 100644 index 000000000..17faef348 --- /dev/null +++ b/src/core/hle/kernel/physical_core.cpp @@ -0,0 +1,19 @@ +// Copyright 2020 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +namespace Kernel { + +PhysicalCore::PhysicalCore(KernelCore& kernel, std::size_t id, ExclusiveMonitor& exclusive_monitor) + : core_index{id}, kernel{kernel} { +#ifdef ARCHITECTURE_x86_64 + arm_interface = std::make_unique(system, exclusive_monitor, core_index); +#else + arm_interface = std::make_unique(system); + LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); +#endif + + scheduler = std::make_unique(system, *arm_interface, core_index); +} + +} // namespace Kernel -- cgit v1.2.3 From 4d6a86b03fe6ae0d98838a21613b66d5196150af Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 25 Jan 2020 18:55:32 -0400 Subject: Core: Refactor CPU Management. This commit moves ARM Interface and Scheduler handling into the kernel. --- src/core/hle/kernel/physical_core.cpp | 36 ++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'src/core/hle/kernel/physical_core.cpp') diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp index 17faef348..7d84e3d28 100644 --- a/src/core/hle/kernel/physical_core.cpp +++ b/src/core/hle/kernel/physical_core.cpp @@ -2,18 +2,48 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/logging/log.h" +#include "core/arm/arm_interface.h" +#ifdef ARCHITECTURE_x86_64 +#include "core/arm/dynarmic/arm_dynarmic.h" +#endif +#include "core/arm/exclusive_monitor.h" +#include "core/arm/unicorn/arm_unicorn.h" +#include "core/core.h" +#include "core/hle/kernel/kernel.h" +#include "core/hle/kernel/physical_core.h" +#include "core/hle/kernel/scheduler.h" +#include "core/hle/kernel/thread.h" + namespace Kernel { -PhysicalCore::PhysicalCore(KernelCore& kernel, std::size_t id, 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(system, exclusive_monitor, core_index); + arm_interface = std::make_unique(system, exclusive_monitor, core_index); #else - arm_interface = std::make_unique(system); + arm_interface = std::make_unique(system); LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); #endif scheduler = std::make_unique(system, *arm_interface, core_index); } +void PhysicalCore::Run() { + arm_interface->Run(); + arm_interface->ClearExclusiveState(); +} + +void PhysicalCore::Step() { + arm_interface->Step(); +} + +void PhysicalCore::Stop() { + arm_interface->PrepareReschedule(); +} + +void PhysicalCore::Shutdown() { + scheduler->Shutdown(); +} + } // namespace Kernel -- cgit v1.2.3 From 2d1984c20c75e03ec79eeb3806b12efa1679b977 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 26 Jan 2020 16:14:18 -0400 Subject: System: Address Feedback --- src/core/hle/kernel/physical_core.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/core/hle/kernel/physical_core.cpp') 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(system, exclusive_monitor, core_index); + arm_interface = std::make_shared(system, exclusive_monitor, core_index); #else - arm_interface = std::make_unique(system); + arm_interface = std::make_shared(system); LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); #endif - scheduler = std::make_unique(system, *arm_interface, core_index); + scheduler = std::make_shared(system, *arm_interface, core_index); } +PhysicalCore::~PhysicalCore() = default; + void PhysicalCore::Run() { arm_interface->Run(); arm_interface->ClearExclusiveState(); -- cgit v1.2.3