Implement inline memory load/store exclusive and ordered (#1413)
* Implement inline memory load/store exclusive * Fix missing REX prefix on 8-bits CMPXCHG * Increment PTC version due to bugfix * Remove redundant memory checks * Address PR feedback * Increment PPTC version
This commit is contained in:
parent
57bb0abda3
commit
9878fc2d3c
19 changed files with 385 additions and 376 deletions
|
@ -15,6 +15,9 @@ namespace ARMeilleure.State
|
|||
public fixed uint FpFlags[RegisterConsts.FpFlagsCount];
|
||||
public int Counter;
|
||||
public ulong CallAddress;
|
||||
public ulong ExclusiveAddress;
|
||||
public ulong ExclusiveValueLow;
|
||||
public ulong ExclusiveValueHigh;
|
||||
}
|
||||
|
||||
private static NativeCtxStorage _dummyStorage = new NativeCtxStorage();
|
||||
|
@ -26,6 +29,8 @@ namespace ARMeilleure.State
|
|||
public NativeContext(IJitMemoryAllocator allocator)
|
||||
{
|
||||
_block = allocator.Allocate((ulong)Unsafe.SizeOf<NativeCtxStorage>());
|
||||
|
||||
GetStorage().ExclusiveAddress = ulong.MaxValue;
|
||||
}
|
||||
|
||||
public unsafe ulong GetX(int index)
|
||||
|
@ -162,6 +167,16 @@ namespace ARMeilleure.State
|
|||
return StorageOffset(ref _dummyStorage, ref _dummyStorage.CallAddress);
|
||||
}
|
||||
|
||||
public static int GetExclusiveAddressOffset()
|
||||
{
|
||||
return StorageOffset(ref _dummyStorage, ref _dummyStorage.ExclusiveAddress);
|
||||
}
|
||||
|
||||
public static int GetExclusiveValueOffset()
|
||||
{
|
||||
return StorageOffset(ref _dummyStorage, ref _dummyStorage.ExclusiveValueLow);
|
||||
}
|
||||
|
||||
private static int StorageOffset<T>(ref NativeCtxStorage storage, ref T target)
|
||||
{
|
||||
return (int)Unsafe.ByteOffset(ref Unsafe.As<NativeCtxStorage, T>(ref storage), ref target);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue