diff options
| author | 2020-06-28 12:37:50 -0400 | |
|---|---|---|
| committer | 2020-06-28 12:37:50 -0400 | |
| commit | b05795d704e0c194215f815a5703db09e524b59a (patch) | |
| tree | ecf4023b4ee0c91555c1d8263762fcb9dcb04a17 /src/core/arm/arm_interface.h | |
| parent | Merge pull request #4196 from ogniK5377/nrr-nro-fixes (diff) | |
| parent | Core/Common: Address Feedback. (diff) | |
| download | yuzu-b05795d704e0c194215f815a5703db09e524b59a.tar.gz yuzu-b05795d704e0c194215f815a5703db09e524b59a.tar.xz yuzu-b05795d704e0c194215f815a5703db09e524b59a.zip | |
Merge pull request #3955 from FernandoS27/prometheus-2b
Remake Kernel Scheduling, CPU Management & Boot Management (Prometheus)
Diffstat (limited to 'src/core/arm/arm_interface.h')
| -rw-r--r-- | src/core/arm/arm_interface.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index cb2e640e2..1f24051e4 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/hardware_properties.h" | ||
| 10 | 11 | ||
| 11 | namespace Common { | 12 | namespace Common { |
| 12 | struct PageTable; | 13 | struct PageTable; |
| @@ -18,25 +19,29 @@ enum class VMAPermission : u8; | |||
| 18 | 19 | ||
| 19 | namespace Core { | 20 | namespace Core { |
| 20 | class System; | 21 | class System; |
| 22 | class CPUInterruptHandler; | ||
| 23 | |||
| 24 | using CPUInterrupts = std::array<CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>; | ||
| 21 | 25 | ||
| 22 | /// Generic ARMv8 CPU interface | 26 | /// Generic ARMv8 CPU interface |
| 23 | class ARM_Interface : NonCopyable { | 27 | class ARM_Interface : NonCopyable { |
| 24 | public: | 28 | public: |
| 25 | explicit ARM_Interface(System& system_) : system{system_} {} | 29 | explicit ARM_Interface(System& system_, CPUInterrupts& interrupt_handlers, bool uses_wall_clock) |
| 30 | : system{system_}, interrupt_handlers{interrupt_handlers}, uses_wall_clock{ | ||
| 31 | uses_wall_clock} {} | ||
| 26 | virtual ~ARM_Interface() = default; | 32 | virtual ~ARM_Interface() = default; |
| 27 | 33 | ||
| 28 | struct ThreadContext32 { | 34 | struct ThreadContext32 { |
| 29 | std::array<u32, 16> cpu_registers{}; | 35 | std::array<u32, 16> cpu_registers{}; |
| 36 | std::array<u32, 64> extension_registers{}; | ||
| 30 | u32 cpsr{}; | 37 | u32 cpsr{}; |
| 31 | std::array<u8, 4> padding{}; | ||
| 32 | std::array<u64, 32> fprs{}; | ||
| 33 | u32 fpscr{}; | 38 | u32 fpscr{}; |
| 34 | u32 fpexc{}; | 39 | u32 fpexc{}; |
| 35 | u32 tpidr{}; | 40 | u32 tpidr{}; |
| 36 | }; | 41 | }; |
| 37 | // Internally within the kernel, it expects the AArch32 version of the | 42 | // Internally within the kernel, it expects the AArch32 version of the |
| 38 | // thread context to be 344 bytes in size. | 43 | // thread context to be 344 bytes in size. |
| 39 | static_assert(sizeof(ThreadContext32) == 0x158); | 44 | static_assert(sizeof(ThreadContext32) == 0x150); |
| 40 | 45 | ||
| 41 | struct ThreadContext64 { | 46 | struct ThreadContext64 { |
| 42 | std::array<u64, 31> cpu_registers{}; | 47 | std::array<u64, 31> cpu_registers{}; |
| @@ -143,6 +148,8 @@ public: | |||
| 143 | */ | 148 | */ |
| 144 | virtual void SetTPIDR_EL0(u64 value) = 0; | 149 | virtual void SetTPIDR_EL0(u64 value) = 0; |
| 145 | 150 | ||
| 151 | virtual void ChangeProcessorID(std::size_t new_core_id) = 0; | ||
| 152 | |||
| 146 | virtual void SaveContext(ThreadContext32& ctx) = 0; | 153 | virtual void SaveContext(ThreadContext32& ctx) = 0; |
| 147 | virtual void SaveContext(ThreadContext64& ctx) = 0; | 154 | virtual void SaveContext(ThreadContext64& ctx) = 0; |
| 148 | virtual void LoadContext(const ThreadContext32& ctx) = 0; | 155 | virtual void LoadContext(const ThreadContext32& ctx) = 0; |
| @@ -162,6 +169,9 @@ public: | |||
| 162 | std::string name; | 169 | std::string name; |
| 163 | }; | 170 | }; |
| 164 | 171 | ||
| 172 | static std::vector<BacktraceEntry> GetBacktraceFromContext(System& system, | ||
| 173 | const ThreadContext64& ctx); | ||
| 174 | |||
| 165 | std::vector<BacktraceEntry> GetBacktrace() const; | 175 | std::vector<BacktraceEntry> GetBacktrace() const; |
| 166 | 176 | ||
| 167 | /// fp (= r29) points to the last frame record. | 177 | /// fp (= r29) points to the last frame record. |
| @@ -175,6 +185,8 @@ public: | |||
| 175 | protected: | 185 | protected: |
| 176 | /// System context that this ARM interface is running under. | 186 | /// System context that this ARM interface is running under. |
| 177 | System& system; | 187 | System& system; |
| 188 | CPUInterrupts& interrupt_handlers; | ||
| 189 | bool uses_wall_clock; | ||
| 178 | }; | 190 | }; |
| 179 | 191 | ||
| 180 | } // namespace Core | 192 | } // namespace Core |