diff options
author | Liam <byteslice@airmail.cc> | 2022-07-08 02:06:46 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-07-25 18:14:15 +0200 |
commit | 6523854dd6ac2d202dacb2110bc83b8e61621e9a (patch) | |
tree | d3d5c5d3048ef0d316692e5f74a78575666114de /src/core/arm | |
parent | Merge pull request #8549 from liamwhite/kscheduler-sc (diff) | |
download | yuzu-6523854dd6ac2d202dacb2110bc83b8e61621e9a.tar yuzu-6523854dd6ac2d202dacb2110bc83b8e61621e9a.tar.gz yuzu-6523854dd6ac2d202dacb2110bc83b8e61621e9a.tar.bz2 yuzu-6523854dd6ac2d202dacb2110bc83b8e61621e9a.tar.lz yuzu-6523854dd6ac2d202dacb2110bc83b8e61621e9a.tar.xz yuzu-6523854dd6ac2d202dacb2110bc83b8e61621e9a.tar.zst yuzu-6523854dd6ac2d202dacb2110bc83b8e61621e9a.zip |
Diffstat (limited to 'src/core/arm')
-rw-r--r-- | src/core/arm/arm_interface.h | 11 | ||||
-rw-r--r-- | src/core/arm/cpu_interrupt_handler.cpp | 24 | ||||
-rw-r--r-- | src/core/arm/cpu_interrupt_handler.h | 39 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_32.cpp | 13 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_32.h | 5 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_64.cpp | 12 | ||||
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_64.h | 6 |
7 files changed, 25 insertions, 85 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index c092db9ff..d0c9f8857 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -28,7 +28,6 @@ namespace Core { class System; class CPUInterruptHandler; -using CPUInterrupts = std::array<CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>; using WatchpointArray = std::array<Kernel::DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS>; /// Generic ARMv8 CPU interface @@ -37,10 +36,8 @@ public: YUZU_NON_COPYABLE(ARM_Interface); YUZU_NON_MOVEABLE(ARM_Interface); - explicit ARM_Interface(System& system_, CPUInterrupts& interrupt_handlers_, - bool uses_wall_clock_) - : system{system_}, interrupt_handlers{interrupt_handlers_}, uses_wall_clock{ - uses_wall_clock_} {} + explicit ARM_Interface(System& system_, bool uses_wall_clock_) + : system{system_}, uses_wall_clock{uses_wall_clock_} {} virtual ~ARM_Interface() = default; struct ThreadContext32 { @@ -182,6 +179,9 @@ public: /// Signal an interrupt and ask the core to halt as soon as possible. virtual void SignalInterrupt() = 0; + /// Clear a previous interrupt. + virtual void ClearInterrupt() = 0; + struct BacktraceEntry { std::string module; u64 address; @@ -209,7 +209,6 @@ public: protected: /// System context that this ARM interface is running under. System& system; - CPUInterrupts& interrupt_handlers; const WatchpointArray* watchpoints; bool uses_wall_clock; diff --git a/src/core/arm/cpu_interrupt_handler.cpp b/src/core/arm/cpu_interrupt_handler.cpp deleted file mode 100644 index 77b6194d7..000000000 --- a/src/core/arm/cpu_interrupt_handler.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "common/thread.h" -#include "core/arm/cpu_interrupt_handler.h" - -namespace Core { - -CPUInterruptHandler::CPUInterruptHandler() : interrupt_event{std::make_unique<Common::Event>()} {} - -CPUInterruptHandler::~CPUInterruptHandler() = default; - -void CPUInterruptHandler::SetInterrupt(bool is_interrupted_) { - if (is_interrupted_) { - interrupt_event->Set(); - } - is_interrupted = is_interrupted_; -} - -void CPUInterruptHandler::AwaitInterrupt() { - interrupt_event->Wait(); -} - -} // namespace Core diff --git a/src/core/arm/cpu_interrupt_handler.h b/src/core/arm/cpu_interrupt_handler.h deleted file mode 100644 index 286e12e53..000000000 --- a/src/core/arm/cpu_interrupt_handler.h +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include <atomic> -#include <memory> - -namespace Common { -class Event; -} - -namespace Core { - -class CPUInterruptHandler { -public: - CPUInterruptHandler(); - ~CPUInterruptHandler(); - - CPUInterruptHandler(const CPUInterruptHandler&) = delete; - CPUInterruptHandler& operator=(const CPUInterruptHandler&) = delete; - - CPUInterruptHandler(CPUInterruptHandler&&) = delete; - CPUInterruptHandler& operator=(CPUInterruptHandler&&) = delete; - - bool IsInterrupted() const { - return is_interrupted; - } - - void SetInterrupt(bool is_interrupted); - - void AwaitInterrupt(); - -private: - std::unique_ptr<Common::Event> interrupt_event; - std::atomic_bool is_interrupted{false}; -}; - -} // namespace Core diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index b8d2ce224..7b2a3b369 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -11,7 +11,6 @@ #include "common/logging/log.h" #include "common/page_table.h" #include "common/settings.h" -#include "core/arm/cpu_interrupt_handler.h" #include "core/arm/dynarmic/arm_dynarmic_32.h" #include "core/arm/dynarmic/arm_dynarmic_cp15.h" #include "core/arm/dynarmic/arm_exclusive_monitor.h" @@ -311,11 +310,9 @@ void ARM_Dynarmic_32::RewindBreakpointInstruction() { LoadContext(breakpoint_context); } -ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, CPUInterrupts& interrupt_handlers_, - bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_, - std::size_t core_index_) - : ARM_Interface{system_, interrupt_handlers_, uses_wall_clock_}, - cb(std::make_unique<DynarmicCallbacks32>(*this)), +ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, + ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_) + : ARM_Interface{system_, uses_wall_clock_}, cb(std::make_unique<DynarmicCallbacks32>(*this)), cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index_}, exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)}, null_jit{MakeJit(nullptr)}, jit{null_jit.get()} {} @@ -394,6 +391,10 @@ void ARM_Dynarmic_32::SignalInterrupt() { jit.load()->HaltExecution(break_loop); } +void ARM_Dynarmic_32::ClearInterrupt() { + jit.load()->ClearHalt(break_loop); +} + void ARM_Dynarmic_32::ClearInstructionCache() { jit.load()->ClearCache(); } diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.h b/src/core/arm/dynarmic/arm_dynarmic_32.h index 346e9abf8..d24ba2289 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.h +++ b/src/core/arm/dynarmic/arm_dynarmic_32.h @@ -28,8 +28,8 @@ class System; class ARM_Dynarmic_32 final : public ARM_Interface { public: - ARM_Dynarmic_32(System& system_, CPUInterrupts& interrupt_handlers_, bool uses_wall_clock_, - ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_); + ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_, + std::size_t core_index_); ~ARM_Dynarmic_32() override; void SetPC(u64 pc) override; @@ -56,6 +56,7 @@ public: void LoadContext(const ThreadContext64& ctx) override {} void SignalInterrupt() override; + void ClearInterrupt() override; void ClearExclusiveState() override; void ClearInstructionCache() override; diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 1a4d37cbc..17d631b2e 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -10,7 +10,6 @@ #include "common/logging/log.h" #include "common/page_table.h" #include "common/settings.h" -#include "core/arm/cpu_interrupt_handler.h" #include "core/arm/dynarmic/arm_dynarmic_64.h" #include "core/arm/dynarmic/arm_exclusive_monitor.h" #include "core/core.h" @@ -371,10 +370,9 @@ void ARM_Dynarmic_64::RewindBreakpointInstruction() { LoadContext(breakpoint_context); } -ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_, - bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_, - std::size_t core_index_) - : ARM_Interface{system_, interrupt_handlers_, uses_wall_clock_}, +ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, + ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_) + : ARM_Interface{system_, uses_wall_clock_}, cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index_}, exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)}, null_jit{MakeJit(nullptr, 48)}, jit{null_jit.get()} {} @@ -461,6 +459,10 @@ void ARM_Dynarmic_64::SignalInterrupt() { jit.load()->HaltExecution(break_loop); } +void ARM_Dynarmic_64::ClearInterrupt() { + jit.load()->ClearHalt(break_loop); +} + void ARM_Dynarmic_64::ClearInstructionCache() { jit.load()->ClearCache(); } diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.h b/src/core/arm/dynarmic/arm_dynarmic_64.h index c77a83ad7..ed1a5eb96 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.h +++ b/src/core/arm/dynarmic/arm_dynarmic_64.h @@ -20,14 +20,13 @@ class Memory; namespace Core { class DynarmicCallbacks64; -class CPUInterruptHandler; class DynarmicExclusiveMonitor; class System; class ARM_Dynarmic_64 final : public ARM_Interface { public: - ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_, bool uses_wall_clock_, - ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_); + ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_, + std::size_t core_index_); ~ARM_Dynarmic_64() override; void SetPC(u64 pc) override; @@ -50,6 +49,7 @@ public: void LoadContext(const ThreadContext64& ctx) override; void SignalInterrupt() override; + void ClearInterrupt() override; void ClearExclusiveState() override; void ClearInstructionCache() override; |