diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-07-30 11:29:28 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-30 11:29:28 -0300 |
commit | 9878fc2d3cf4c64f56c44c2a5de013acb6bcbade (patch) | |
tree | 8f5e5cde68fec213ab61dbee0e121448f0970ca2 /Ryujinx.Cpu | |
parent | 57bb0abda3dc277dc7575250fdb080edb83abcbc (diff) |
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
Diffstat (limited to 'Ryujinx.Cpu')
-rw-r--r-- | Ryujinx.Cpu/MemoryManager.cs | 23 |
1 files changed, 10 insertions, 13 deletions
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<T>(ulong va) where T : unmanaged - { - MarkRegionAsModified(va, (ulong)Unsafe.SizeOf<T>()); - - return ref _backingMemory.GetRef<T>(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<ulong>((va / PageSize) * PteSize) & ~(0xffffUL << 48)) + (va & PageMask); } - private void MarkRegionAsModified(ulong va, ulong size) + /// <summary> + /// Marks a region of memory as modified by the CPU. + /// </summary> + /// <param name="va">Virtual address of the region</param> + /// <param name="size">Size of the region</param> + 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(); - } + /// <summary> + /// Disposes of resources used by the memory manager. + /// </summary> + public void Dispose() => _pageTable.Dispose(); } } |