diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-06-21 23:05:42 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-21 23:05:42 -0300 |
| commit | 3e6afeb5134fc699158e8c4d1646a138a947a93d (patch) | |
| tree | 961d66741cf0833c86b6013a653e33e23fc2cbc9 /ChocolArm64/Instruction | |
| parent | a4020bb398c72166cecd1457c973e0bebf9d2060 (diff) | |
Fix some thread sync issues (#172)
* Fix some thread sync issues
* Remove some debug stuff
* Ensure that writes to the mutex address clears the exclusive monitor
Diffstat (limited to 'ChocolArm64/Instruction')
| -rw-r--r-- | ChocolArm64/Instruction/AInstEmitMemoryEx.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitMemoryEx.cs b/ChocolArm64/Instruction/AInstEmitMemoryEx.cs index a339bb69..ba8eeceb 100644 --- a/ChocolArm64/Instruction/AInstEmitMemoryEx.cs +++ b/ChocolArm64/Instruction/AInstEmitMemoryEx.cs @@ -48,6 +48,16 @@ namespace ChocolArm64.Instruction { AOpCodeMemEx Op = (AOpCodeMemEx)Context.CurrOp; + if (AccType.HasFlag(AccessType.Ordered)) + { + EmitBarrier(Context); + } + + if (AccType.HasFlag(AccessType.Exclusive)) + { + EmitMemoryCall(Context, nameof(AMemory.SetExclusive), Op.Rn); + } + Context.EmitLdarg(ATranslatedSub.MemoryArgIdx); Context.EmitLdint(Op.Rn); @@ -67,16 +77,6 @@ namespace ChocolArm64.Instruction Context.EmitStintzr(Op.Rt2); } - - if (AccType.HasFlag(AccessType.Exclusive)) - { - EmitMemoryCall(Context, nameof(AMemory.SetExclusive), Op.Rn); - } - - if (AccType.HasFlag(AccessType.Ordered)) - { - EmitBarrier(Context); - } } public static void Pfrm(AILEmitterCtx Context) @@ -150,7 +150,7 @@ namespace ChocolArm64.Instruction Context.EmitLdc_I8(0); Context.EmitStintzr(Op.Rs); - Clrex(Context); + EmitMemoryCall(Context, nameof(AMemory.ClearExclusiveForStore)); } Context.MarkLabel(LblEnd); |
