From 1bc246735bcabc7dfbcf8ce8219144ba8d76f3f2 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 2 Sep 2014 18:38:42 -0500 Subject: [PATCH] Add some static_asserts to the Arm32 JIT to make sure ppcState is sane. --- Source/Core/Core/PowerPC/JitArm32/Jit.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Core/PowerPC/JitArm32/Jit.h b/Source/Core/Core/PowerPC/JitArm32/Jit.h index 214ff31971..62fb26b90d 100644 --- a/Source/Core/Core/PowerPC/JitArm32/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm32/Jit.h @@ -27,6 +27,12 @@ #include "Core/PowerPC/JitCommon/JitBase.h" #define PPCSTATE_OFF(elem) ((s32)STRUCT_OFF(PowerPC::ppcState, elem) - (s32)STRUCT_OFF(PowerPC::ppcState, spr[0])) + +// Some asserts to make sure we will be able to load everything +static_assert(PPCSTATE_OFF(spr[1023]) > -4096 && PPCSTATE_OFF(spr[1023]) < 4096, "LDR can't reach all of the SPRs"); +static_assert(PPCSTATE_OFF(ps[0][0]) >= -1020 && PPCSTATE_OFF(ps[0][0]) <= 1020, "VLDR can't reach all of the FPRs"); +static_assert((PPCSTATE_OFF(ps[0][0]) % 4) == 0, "VLDR requires FPRs to be 4 byte aligned"); + class JitArm : public JitBase, public ArmGen::ARMCodeBlock { private: