1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-17 23:36:39 +00:00

Add bounds to address table on ARMeilleure

This commit is contained in:
riperiperi 2024-06-24 22:26:07 +01:00
parent 63cbd819f8
commit 76f2b3d089
2 changed files with 8 additions and 6 deletions

View file

@ -211,9 +211,12 @@ namespace ARMeilleure.Instructions
// Deliberately attempts to avoid branches. // Deliberately attempts to avoid branches.
var level0 = table.Levels[0]; 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(
Operand index = context.ShiftLeft(context.ShiftRightUI(guestAddress, Const(level0.Index)), Const(3)); context.ShiftRightUI(context.ShiftLeft(guestAddress, Const(clearBits0)), Const(clearBits0 + level0.Index)),
Const(3)
);
Operand tableBase = !context.HasPtc ? Operand tableBase = !context.HasPtc ?
Const(table.Base) : Const(table.Base) :
@ -223,11 +226,10 @@ namespace ARMeilleure.Instructions
// Second level // Second level
var level1 = table.Levels[1]; var level1 = table.Levels[1];
int clearBits1 = 64 - (level1.Index + level1.Length);
int clearBits = 64 - (level1.Index + level1.Length);
Operand index2 = context.ShiftLeft( 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) Const(3)
); );

View file

@ -29,7 +29,7 @@ namespace ARMeilleure.Translation.PTC
private const string OuterHeaderMagicString = "PTCohd\0\0"; private const string OuterHeaderMagicString = "PTCohd\0\0";
private const string InnerHeaderMagicString = "PTCihd\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 ActualDir = "0";
private const string BackupDir = "1"; private const string BackupDir = "1";