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
This commit is contained in:
parent
a4020bb398
commit
3e6afeb513
8 changed files with 239 additions and 189 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue