1
0
Fork 0
forked from suyu/suyu

arm_interface: Ensure ThreadContext is zero'd out.

This commit is contained in:
bunnei 2020-03-20 22:37:42 -04:00
parent 86f9c9aa1c
commit 0f4f90cd04

View file

@ -26,28 +26,28 @@ public:
virtual ~ARM_Interface() = default; virtual ~ARM_Interface() = default;
struct ThreadContext32 { struct ThreadContext32 {
std::array<u32, 16> cpu_registers; std::array<u32, 16> cpu_registers{};
u32 cpsr; u32 cpsr{};
std::array<u8, 4> padding; std::array<u8, 4> padding{};
std::array<u64, 32> fprs; std::array<u64, 32> fprs{};
u32 fpscr; u32 fpscr{};
u32 fpexc; u32 fpexc{};
u32 tpidr; u32 tpidr{};
}; };
// Internally within the kernel, it expects the AArch32 version of the // Internally within the kernel, it expects the AArch32 version of the
// thread context to be 344 bytes in size. // thread context to be 344 bytes in size.
static_assert(sizeof(ThreadContext32) == 0x158); static_assert(sizeof(ThreadContext32) == 0x158);
struct ThreadContext64 { struct ThreadContext64 {
std::array<u64, 31> cpu_registers; std::array<u64, 31> cpu_registers{};
u64 sp; u64 sp{};
u64 pc; u64 pc{};
u32 pstate; u32 pstate{};
std::array<u8, 4> padding; std::array<u8, 4> padding{};
std::array<u128, 32> vector_registers; std::array<u128, 32> vector_registers{};
u32 fpcr; u32 fpcr{};
u32 fpsr; u32 fpsr{};
u64 tpidr; u64 tpidr{};
}; };
// Internally within the kernel, it expects the AArch64 version of the // Internally within the kernel, it expects the AArch64 version of the
// thread context to be 800 bytes in size. // thread context to be 800 bytes in size.