diff --git a/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs b/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs index 12f1dba18c..ab8e1e3bd1 100644 --- a/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs +++ b/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs @@ -211,9 +211,12 @@ namespace ARMeilleure.Instructions // Deliberately attempts to avoid branches. var level0 = table.Levels[0]; + int clearBits0 = 64 - (level0.Index + level0.Length); - // Currently no bounds check. Maybe conditionally do this for unsafe host mapped. - Operand index = context.ShiftLeft(context.ShiftRightUI(guestAddress, Const(level0.Index)), Const(3)); + Operand index = context.ShiftLeft( + context.ShiftRightUI(context.ShiftLeft(guestAddress, Const(clearBits0)), Const(clearBits0 + level0.Index)), + Const(3) + ); Operand tableBase = !context.HasPtc ? Const(table.Base) : @@ -223,11 +226,10 @@ namespace ARMeilleure.Instructions // Second level var level1 = table.Levels[1]; - - int clearBits = 64 - (level1.Index + level1.Length); + int clearBits1 = 64 - (level1.Index + level1.Length); Operand index2 = context.ShiftLeft( - context.ShiftRightUI(context.ShiftLeft(guestAddress, Const(clearBits)), Const(clearBits + level1.Index)), + context.ShiftRightUI(context.ShiftLeft(guestAddress, Const(clearBits1)), Const(clearBits1 + level1.Index)), Const(3) ); diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs index 59ced58062..135ae73bed 100644 --- a/src/ARMeilleure/Translation/PTC/Ptc.cs +++ b/src/ARMeilleure/Translation/PTC/Ptc.cs @@ -29,7 +29,7 @@ namespace ARMeilleure.Translation.PTC private const string OuterHeaderMagicString = "PTCohd\0\0"; private const string InnerHeaderMagicString = "PTCihd\0\0"; - private const uint InternalVersion = 26957; //! To be incremented manually for each change to the ARMeilleure project. + private const uint InternalVersion = 26958; //! To be incremented manually for each change to the ARMeilleure project. private const string ActualDir = "0"; private const string BackupDir = "1";