diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-01-24 20:38:20 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-01-24 20:38:20 +0100 |
commit | ab89ced244db69616d29c91470d870b73b09cc69 (patch) | |
tree | 0c45b8298ab75d60b74448aac2857f2ead2c613b | |
parent | Merge pull request #2800 from FearlessTobi/port-4049 (diff) | |
download | yuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar yuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar.gz yuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar.bz2 yuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar.lz yuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar.xz yuzu-ab89ced244db69616d29c91470d870b73b09cc69.tar.zst yuzu-ab89ced244db69616d29c91470d870b73b09cc69.zip |
-rw-r--r-- | src/core/hle/kernel/physical_core.cpp | 19 | ||||
-rw-r--r-- | src/core/hle/kernel/physical_core.h | 62 |
2 files changed, 81 insertions, 0 deletions
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<ARM_Dynarmic>(system, exclusive_monitor, core_index); +#else + arm_interface = std::make_unique<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); +} + +} // namespace Kernel diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h new file mode 100644 index 000000000..225b31d3e --- /dev/null +++ b/src/core/hle/kernel/physical_core.h @@ -0,0 +1,62 @@ +// Copyright 2020 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +namespace Kernel { +class Scheduler; +} // namespace Kernel + +class ARM_Interface; +class ExclusiveMonitor; + +namespace Kernel { + +class PhysicalCore { +public: + PhysicalCore(KernelCore& kernel, std::size_t id, ExclusiveMonitor& exclusive_monitor); + + /// Execute current jit state + void Run(); + /// Execute a single instruction in current jit. + void Step(); + /// Stop JIT execution/exit + void Stop(); + + ARM_Interface& ArmInterface() { + return *arm_interface; + } + + const ARM_Interface& ArmInterface() const { + return *arm_interface; + } + + bool IsMainCore() const { + return core_index == 0; + } + + bool IsSystemCore() const { + return core_index == 3; + } + + std::size_t CoreIndex() const { + return core_index; + } + + Scheduler& Scheduler() { + return *scheduler; + } + + const Scheduler& Scheduler() const { + return *scheduler; + } + +private: + std::size_t core_index; + std::unique_ptr<ARM_Interface> arm_interface; + std::unique_ptr<Kernel::Scheduler> scheduler; + KernelCore& kernel; +} + +} // namespace Kernel |