diff options
| author | 2023-06-12 21:34:25 -0400 | |
|---|---|---|
| committer | 2023-06-12 22:11:51 -0400 | |
| commit | 8506915208dc2d518c821f00e4286824d778642c (patch) | |
| tree | ea4c10c78188ca6481896e698f23f4ad9675548f /src/core/arm/arm_interface.h | |
| parent | Merge pull request #10743 from FearlessTobi/translations (diff) | |
| download | yuzu-8506915208dc2d518c821f00e4286824d778642c.tar.gz yuzu-8506915208dc2d518c821f00e4286824d778642c.tar.xz yuzu-8506915208dc2d518c821f00e4286824d778642c.zip | |
core: decouple ARM interface from Dynarmic
Diffstat (limited to 'src/core/arm/arm_interface.h')
| -rw-r--r-- | src/core/arm/arm_interface.h | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 8e40702cc..d5f2fa09a 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | 10 | ||
| 11 | #include <dynarmic/interface/halt_reason.h> | ||
| 12 | |||
| 13 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 14 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 15 | #include "core/hardware_properties.h" | 13 | #include "core/hardware_properties.h" |
| @@ -30,6 +28,22 @@ class CPUInterruptHandler; | |||
| 30 | 28 | ||
| 31 | using WatchpointArray = std::array<Kernel::DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS>; | 29 | using WatchpointArray = std::array<Kernel::DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS>; |
| 32 | 30 | ||
| 31 | // NOTE: these values match the HaltReason enum in Dynarmic | ||
| 32 | enum class HaltReason : u64 { | ||
| 33 | StepThread = 0x00000001, | ||
| 34 | DataAbort = 0x00000004, | ||
| 35 | BreakLoop = 0x02000000, | ||
| 36 | SupervisorCall = 0x04000000, | ||
| 37 | InstructionBreakpoint = 0x08000000, | ||
| 38 | PrefetchAbort = 0x20000000, | ||
| 39 | }; | ||
| 40 | DECLARE_ENUM_FLAG_OPERATORS(HaltReason); | ||
| 41 | |||
| 42 | enum class Architecture { | ||
| 43 | Aarch32, | ||
| 44 | Aarch64, | ||
| 45 | }; | ||
| 46 | |||
| 33 | /// Generic ARMv8 CPU interface | 47 | /// Generic ARMv8 CPU interface |
| 34 | class ARM_Interface { | 48 | class ARM_Interface { |
| 35 | public: | 49 | public: |
| @@ -167,8 +181,9 @@ public: | |||
| 167 | */ | 181 | */ |
| 168 | virtual void SetTPIDR_EL0(u64 value) = 0; | 182 | virtual void SetTPIDR_EL0(u64 value) = 0; |
| 169 | 183 | ||
| 170 | virtual void SaveContext(ThreadContext32& ctx) = 0; | 184 | virtual Architecture GetArchitecture() const = 0; |
| 171 | virtual void SaveContext(ThreadContext64& ctx) = 0; | 185 | virtual void SaveContext(ThreadContext32& ctx) const = 0; |
| 186 | virtual void SaveContext(ThreadContext64& ctx) const = 0; | ||
| 172 | virtual void LoadContext(const ThreadContext32& ctx) = 0; | 187 | virtual void LoadContext(const ThreadContext32& ctx) = 0; |
| 173 | virtual void LoadContext(const ThreadContext64& ctx) = 0; | 188 | virtual void LoadContext(const ThreadContext64& ctx) = 0; |
| 174 | void LoadWatchpointArray(const WatchpointArray& wp); | 189 | void LoadWatchpointArray(const WatchpointArray& wp); |
| @@ -195,17 +210,9 @@ public: | |||
| 195 | static std::vector<BacktraceEntry> GetBacktraceFromContext(System& system, | 210 | static std::vector<BacktraceEntry> GetBacktraceFromContext(System& system, |
| 196 | const ThreadContext64& ctx); | 211 | const ThreadContext64& ctx); |
| 197 | 212 | ||
| 198 | virtual std::vector<BacktraceEntry> GetBacktrace() const = 0; | 213 | std::vector<BacktraceEntry> GetBacktrace() const; |
| 199 | |||
| 200 | void LogBacktrace() const; | 214 | void LogBacktrace() const; |
| 201 | 215 | ||
| 202 | static constexpr Dynarmic::HaltReason step_thread = Dynarmic::HaltReason::Step; | ||
| 203 | static constexpr Dynarmic::HaltReason break_loop = Dynarmic::HaltReason::UserDefined2; | ||
| 204 | static constexpr Dynarmic::HaltReason svc_call = Dynarmic::HaltReason::UserDefined3; | ||
| 205 | static constexpr Dynarmic::HaltReason breakpoint = Dynarmic::HaltReason::UserDefined4; | ||
| 206 | static constexpr Dynarmic::HaltReason watchpoint = Dynarmic::HaltReason::MemoryAbort; | ||
| 207 | static constexpr Dynarmic::HaltReason no_execute = Dynarmic::HaltReason::UserDefined6; | ||
| 208 | |||
| 209 | protected: | 216 | protected: |
| 210 | /// System context that this ARM interface is running under. | 217 | /// System context that this ARM interface is running under. |
| 211 | System& system; | 218 | System& system; |
| @@ -216,8 +223,8 @@ protected: | |||
| 216 | const Kernel::DebugWatchpoint* MatchingWatchpoint( | 223 | const Kernel::DebugWatchpoint* MatchingWatchpoint( |
| 217 | u64 addr, u64 size, Kernel::DebugWatchpointType access_type) const; | 224 | u64 addr, u64 size, Kernel::DebugWatchpointType access_type) const; |
| 218 | 225 | ||
| 219 | virtual Dynarmic::HaltReason RunJit() = 0; | 226 | virtual HaltReason RunJit() = 0; |
| 220 | virtual Dynarmic::HaltReason StepJit() = 0; | 227 | virtual HaltReason StepJit() = 0; |
| 221 | virtual u32 GetSvcNumber() const = 0; | 228 | virtual u32 GetSvcNumber() const = 0; |
| 222 | virtual const Kernel::DebugWatchpoint* HaltedWatchpoint() const = 0; | 229 | virtual const Kernel::DebugWatchpoint* HaltedWatchpoint() const = 0; |
| 223 | virtual void RewindBreakpointInstruction() = 0; | 230 | virtual void RewindBreakpointInstruction() = 0; |