diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-29 18:58:50 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-27 17:35:56 +0200 |
commit | 1b82ccec2220a69711ba75cf51ee98cbcfe6a510 (patch) | |
tree | 281ad19080ec4e6e14caa50b073acdfac005212b /src/core/arm | |
parent | X64 Clock: Reduce accuracy to be less or equal to guest accuracy. (diff) | |
download | yuzu-1b82ccec2220a69711ba75cf51ee98cbcfe6a510.tar yuzu-1b82ccec2220a69711ba75cf51ee98cbcfe6a510.tar.gz yuzu-1b82ccec2220a69711ba75cf51ee98cbcfe6a510.tar.bz2 yuzu-1b82ccec2220a69711ba75cf51ee98cbcfe6a510.tar.lz yuzu-1b82ccec2220a69711ba75cf51ee98cbcfe6a510.tar.xz yuzu-1b82ccec2220a69711ba75cf51ee98cbcfe6a510.tar.zst yuzu-1b82ccec2220a69711ba75cf51ee98cbcfe6a510.zip |
Diffstat (limited to 'src/core/arm')
-rw-r--r-- | src/core/arm/arm_interface.h | 9 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_32.cpp | 6 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_32.h | 2 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_64.cpp | 13 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_64.h | 2 | ||||
-rw-r--r-- | src/core/arm/unicorn/arm_unicorn.cpp | 7 | ||||
-rw-r--r-- | src/core/arm/unicorn/arm_unicorn.h | 5 |
7 files changed, 26 insertions, 18 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index e701ddf21..dc9b2ff7b 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -7,6 +7,7 @@ #include <array> #include <vector> #include "common/common_types.h" +#include "core/hardware_properties.h" namespace Common { struct PageTable; @@ -20,11 +21,13 @@ namespace Core { class System; class CPUInterruptHandler; +using CPUInterrupts = std::array<CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>; + /// Generic ARMv8 CPU interface class ARM_Interface : NonCopyable { public: - explicit ARM_Interface(System& system_, CPUInterruptHandler& interrupt_handler) - : system{system_}, interrupt_handler{interrupt_handler} {} + explicit ARM_Interface(System& system_, CPUInterrupts& interrupt_handlers) + : system{system_}, interrupt_handlers{interrupt_handlers} {} virtual ~ARM_Interface() = default; struct ThreadContext32 { @@ -180,7 +183,7 @@ public: protected: /// System context that this ARM interface is running under. System& system; - CPUInterruptHandler& interrupt_handler; + CPUInterrupts& interrupt_handlers; }; } // namespace Core diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index c8a1ce6e7..f36c5f401 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -76,7 +76,7 @@ public: } u64 GetTicksRemaining() override { - if (!parent.interrupt_handler.IsInterrupted()) { + if (!parent.interrupt_handlers[parent.core_index].IsInterrupted()) { return std::max<s64>(ticks, 0); } return 0ULL; @@ -111,9 +111,9 @@ void ARM_Dynarmic_32::Step() { jit->Step(); } -ARM_Dynarmic_32::ARM_Dynarmic_32(System& system, CPUInterruptHandler& interrupt_handler, +ARM_Dynarmic_32::ARM_Dynarmic_32(System& system, CPUInterrupts& interrupt_handlers, ExclusiveMonitor& exclusive_monitor, std::size_t core_index) - : ARM_Interface{system, interrupt_handler}, cb(std::make_unique<DynarmicCallbacks32>(*this)), + : ARM_Interface{system, interrupt_handlers}, cb(std::make_unique<DynarmicCallbacks32>(*this)), cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index}, exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {} diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.h b/src/core/arm/dynarmic/arm_dynarmic_32.h index 1e7e17e64..2dd9a4df0 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.h +++ b/src/core/arm/dynarmic/arm_dynarmic_32.h @@ -29,7 +29,7 @@ class System; class ARM_Dynarmic_32 final : public ARM_Interface { public: - ARM_Dynarmic_32(System& system, CPUInterruptHandler& interrupt_handler, + ARM_Dynarmic_32(System& system, CPUInterrupts& interrupt_handlers, ExclusiveMonitor& exclusive_monitor, std::size_t core_index); ~ARM_Dynarmic_32() override; diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 3f18dede2..8401ba631 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -128,7 +128,7 @@ public: } u64 GetTicksRemaining() override { - if (!parent.interrupt_handler.IsInterrupted()) { + if (!parent.interrupt_handlers[parent.core_index].IsInterrupted()) { return std::max<s64>(ticks, 0); } return 0ULL; @@ -199,11 +199,14 @@ void ARM_Dynarmic_64::Step() { cb->InterpreterFallback(jit->GetPC(), 1); } -ARM_Dynarmic_64::ARM_Dynarmic_64(System& system, CPUInterruptHandler& interrupt_handler, +ARM_Dynarmic_64::ARM_Dynarmic_64(System& system, CPUInterrupts& interrupt_handlers, ExclusiveMonitor& exclusive_monitor, std::size_t core_index) - : ARM_Interface{system, interrupt_handler}, cb(std::make_unique<DynarmicCallbacks64>(*this)), - inner_unicorn{system, interrupt_handler, ARM_Unicorn::Arch::AArch64}, core_index{core_index}, - exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {} + : ARM_Interface{system, interrupt_handler}, + cb(std::make_unique<DynarmicCallbacks64>(*this)), inner_unicorn{system, interrupt_handler, + ARM_Unicorn::Arch::AArch64, + core_index}, + core_index{core_index}, exclusive_monitor{ + dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {} ARM_Dynarmic_64::~ARM_Dynarmic_64() = default; diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.h b/src/core/arm/dynarmic/arm_dynarmic_64.h index 5560578ad..1c6791d4e 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.h +++ b/src/core/arm/dynarmic/arm_dynarmic_64.h @@ -28,7 +28,7 @@ class System; class ARM_Dynarmic_64 final : public ARM_Interface { public: - ARM_Dynarmic_64(System& system, CPUInterruptHandler& interrupt_handler, + ARM_Dynarmic_64(System& system, CPUInterrupts& interrupt_handlers, ExclusiveMonitor& exclusive_monitor, std::size_t core_index); ~ARM_Dynarmic_64() override; diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index 0393fe641..d81d1b5b0 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp @@ -63,8 +63,9 @@ static bool UnmappedMemoryHook(uc_engine* uc, uc_mem_type type, u64 addr, int si return false; } -ARM_Unicorn::ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture) - : ARM_Interface{system, interrupt_handler} { +ARM_Unicorn::ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture, + std::size_t core_index) + : ARM_Interface{system, interrupt_handler}, core_index{core_index} { const auto arch = architecture == Arch::AArch32 ? UC_ARCH_ARM : UC_ARCH_ARM64; CHECKED(uc_open(arch, UC_MODE_ARM, &uc)); @@ -163,7 +164,7 @@ void ARM_Unicorn::Run() { ExecuteInstructions(std::max(4000000U, 0U)); } else { while (true) { - if (interrupt_handler.IsInterrupted()) { + if (interrupt_handlers[core_index].IsInterrupted()) { return; } ExecuteInstructions(10); diff --git a/src/core/arm/unicorn/arm_unicorn.h b/src/core/arm/unicorn/arm_unicorn.h index 0a4c087cd..e3da368de 100644 --- a/src/core/arm/unicorn/arm_unicorn.h +++ b/src/core/arm/unicorn/arm_unicorn.h @@ -11,7 +11,6 @@ namespace Core { -class CPUInterruptHandler; class System; class ARM_Unicorn final : public ARM_Interface { @@ -21,7 +20,8 @@ public: AArch64, // 64-bit ARM }; - explicit ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture); + explicit ARM_Unicorn(System& system, CPUInterruptHandler& interrupt_handler, Arch architecture, + std::size_t core_index); ~ARM_Unicorn() override; void SetPC(u64 pc) override; @@ -56,6 +56,7 @@ private: uc_engine* uc{}; GDBStub::BreakpointAddress last_bkpt{}; bool last_bkpt_hit = false; + std::size_t core_index; }; } // namespace Core |