diff options
Diffstat (limited to 'src/core/arm/arm_interface.h')
| -rw-r--r-- | src/core/arm/arm_interface.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 47b964eb7..57eae839e 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -25,7 +25,20 @@ public: | |||
| 25 | explicit ARM_Interface(System& system_) : system{system_} {} | 25 | explicit ARM_Interface(System& system_) : system{system_} {} |
| 26 | virtual ~ARM_Interface() = default; | 26 | virtual ~ARM_Interface() = default; |
| 27 | 27 | ||
| 28 | struct ThreadContext { | 28 | struct ThreadContext32 { |
| 29 | std::array<u32, 16> cpu_registers; | ||
| 30 | u32 cpsr; | ||
| 31 | std::array<u8, 4> padding; | ||
| 32 | std::array<u64, 32> fprs; | ||
| 33 | u32 fpscr; | ||
| 34 | u32 fpexc; | ||
| 35 | u32 tpidr; | ||
| 36 | }; | ||
| 37 | // Internally within the kernel, it expects the AArch32 version of the | ||
| 38 | // thread context to be 344 bytes in size. | ||
| 39 | static_assert(sizeof(ThreadContext32) == 0x158); | ||
| 40 | |||
| 41 | struct ThreadContext64 { | ||
| 29 | std::array<u64, 31> cpu_registers; | 42 | std::array<u64, 31> cpu_registers; |
| 30 | u64 sp; | 43 | u64 sp; |
| 31 | u64 pc; | 44 | u64 pc; |
| @@ -38,7 +51,7 @@ public: | |||
| 38 | }; | 51 | }; |
| 39 | // Internally within the kernel, it expects the AArch64 version of the | 52 | // Internally within the kernel, it expects the AArch64 version of the |
| 40 | // thread context to be 800 bytes in size. | 53 | // thread context to be 800 bytes in size. |
| 41 | static_assert(sizeof(ThreadContext) == 0x320); | 54 | static_assert(sizeof(ThreadContext64) == 0x320); |
| 42 | 55 | ||
| 43 | /// Runs the CPU until an event happens | 56 | /// Runs the CPU until an event happens |
| 44 | virtual void Run() = 0; | 57 | virtual void Run() = 0; |
| @@ -130,17 +143,10 @@ public: | |||
| 130 | */ | 143 | */ |
| 131 | virtual void SetTPIDR_EL0(u64 value) = 0; | 144 | virtual void SetTPIDR_EL0(u64 value) = 0; |
| 132 | 145 | ||
| 133 | /** | 146 | virtual void SaveContext(ThreadContext32& ctx) = 0; |
| 134 | * Saves the current CPU context | 147 | virtual void SaveContext(ThreadContext64& ctx) = 0; |
| 135 | * @param ctx Thread context to save | 148 | virtual void LoadContext(const ThreadContext32& ctx) = 0; |
| 136 | */ | 149 | virtual void LoadContext(const ThreadContext64& ctx) = 0; |
| 137 | virtual void SaveContext(ThreadContext& ctx) = 0; | ||
| 138 | |||
| 139 | /** | ||
| 140 | * Loads a CPU context | ||
| 141 | * @param ctx Thread context to load | ||
| 142 | */ | ||
| 143 | virtual void LoadContext(const ThreadContext& ctx) = 0; | ||
| 144 | 150 | ||
| 145 | /// Clears the exclusive monitor's state. | 151 | /// Clears the exclusive monitor's state. |
| 146 | virtual void ClearExclusiveState() = 0; | 152 | virtual void ClearExclusiveState() = 0; |