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 --- Ryujinx.Cpu/MemoryManager.cs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'Ryujinx.Cpu/MemoryManager.cs') diff --git a/Ryujinx.Cpu/MemoryManager.cs b/Ryujinx.Cpu/MemoryManager.cs index 31357508..75ecca1c 100644 --- a/Ryujinx.Cpu/MemoryManager.cs +++ b/Ryujinx.Cpu/MemoryManager.cs @@ -276,14 +276,6 @@ namespace Ryujinx.Cpu private void ThrowMemoryNotContiguous() => throw new MemoryNotContiguousException(); - // TODO: Remove that once we have proper 8-bits and 16-bits CAS. - public ref T GetRefNoChecks(ulong va) where T : unmanaged - { - MarkRegionAsModified(va, (ulong)Unsafe.SizeOf()); - - return ref _backingMemory.GetRef(GetPhysicalAddressInternal(va)); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool IsContiguousAndMapped(ulong va, int size) => IsContiguous(va, size) && IsMapped(va); @@ -497,7 +489,12 @@ namespace Ryujinx.Cpu return PteToPa(_pageTable.Read((va / PageSize) * PteSize) & ~(0xffffUL << 48)) + (va & PageMask); } - private void MarkRegionAsModified(ulong va, ulong size) + /// + /// Marks a region of memory as modified by the CPU. + /// + /// Virtual address of the region + /// Size of the region + public void MarkRegionAsModified(ulong va, ulong size) { ulong endVa = (va + size + PageMask) & ~(ulong)PageMask; @@ -532,9 +529,9 @@ namespace Ryujinx.Cpu return (ulong)((long)pte - _backingMemory.Pointer.ToInt64()); } - public void Dispose() - { - _pageTable.Dispose(); - } + /// + /// Disposes of resources used by the memory manager. + /// + public void Dispose() => _pageTable.Dispose(); } } -- cgit v1.2.3