Skip to content

Commit

Permalink
Merge pull request #943 from Sonicadvance1/arm32-asserts
Browse files Browse the repository at this point in the history
Add some static_asserts to the Arm32 JIT to make sure ppcState is sane.
  • Loading branch information
Sonicadvance1 committed Sep 2, 2014
2 parents e10b0d1 + 1bc2467 commit 031beca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/Core/Core/PowerPC/JitArm32/Jit.h
Expand Up @@ -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:
Expand Down

0 comments on commit 031beca

Please sign in to comment.