From 9878fc2d3cf4c64f56c44c2a5de013acb6bcbade Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 30 Jul 2020 11:29:28 -0300 Subject: 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 --- ARMeilleure/State/NativeContext.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ARMeilleure/State/NativeContext.cs') diff --git a/ARMeilleure/State/NativeContext.cs b/ARMeilleure/State/NativeContext.cs index 9df69a4e..09ec6cde 100644 --- a/ARMeilleure/State/NativeContext.cs +++ b/ARMeilleure/State/NativeContext.cs @@ -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()); + + 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(ref NativeCtxStorage storage, ref T target) { return (int)Unsafe.ByteOffset(ref Unsafe.As(ref storage), ref target); -- cgit v1.2.3