0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 13:05:46 +00:00

Fix register read after write on STREX implementation (#1801)

* Fix register read after write on STREX implementation

* PTC version update
This commit is contained in:
gdkchan 2020-12-13 12:19:38 -03:00 committed by GitHub
parent 6bc2733c17
commit c8bb3cc50e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -48,6 +48,18 @@ namespace ARMeilleure.Instructions
Operand exValuePtr = context.Add(arg0, Const((long)NativeContext.GetExclusiveValueOffset())); Operand exValuePtr = context.Add(arg0, Const((long)NativeContext.GetExclusiveValueOffset()));
context.Store(exAddrPtr, context.BitwiseAnd(address, Const(address.Type, GetExclusiveAddressMask()))); context.Store(exAddrPtr, context.BitwiseAnd(address, Const(address.Type, GetExclusiveAddressMask())));
// Make sure the unused higher bits of the value are cleared.
if (size < 3)
{
context.Store(exValuePtr, Const(0UL));
}
if (size < 4)
{
context.Store(context.Add(exValuePtr, Const(exValuePtr.Type, 8L)), Const(0UL));
}
// Store the new exclusive value.
context.Store(exValuePtr, value); context.Store(exValuePtr, value);
return value; return value;
@ -74,6 +86,11 @@ namespace ARMeilleure.Instructions
if (exclusive) if (exclusive)
{ {
// We overwrite one of the register (Rs),
// keep a copy of the values to ensure we are working with the correct values.
address = context.Copy(address);
value = context.Copy(value);
void SetRs(Operand value) void SetRs(Operand value)
{ {
if (a32) if (a32)
@ -98,7 +115,7 @@ namespace ARMeilleure.Instructions
Operand lblExit = Label(); Operand lblExit = Label();
SetRs(exFailed); SetRs(Const(1));
context.BranchIfTrue(lblExit, exFailed); context.BranchIfTrue(lblExit, exFailed);

View file

@ -21,7 +21,7 @@ namespace ARMeilleure.Translation.PTC
{ {
private const string HeaderMagic = "PTChd"; private const string HeaderMagic = "PTChd";
private const int InternalVersion = 1783; //! To be incremented manually for each change to the ARMeilleure project. private const int InternalVersion = 1801; //! 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";