mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-27 09:59:33 +01:00
86fd0643c2
* Implement support for page sizes > 4KB * Check and work around more alignment issues * Was not meant to change this * Use MemoryBlock.GetPageSize() value for signal handler code * Do not take the path for private allocations if host supports 4KB pages * Add Flags attribute on MemoryMapFlags * Fix dirty region size with 16kb pages Would accidentally report a size that was too high (generally 16k instead of 4k, uploading 4x as much data) Co-authored-by: riperiperi <rhy3756547@hotmail.com>
109 lines
2.9 KiB
C#
109 lines
2.9 KiB
C#
using Ryujinx.Memory.Range;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Ryujinx.Memory.Tests
|
|
{
|
|
public class MockVirtualMemoryManager : IVirtualMemoryManager
|
|
{
|
|
public bool Supports4KBPages => true;
|
|
|
|
public bool NoMappings = false;
|
|
|
|
public event Action<ulong, ulong, MemoryPermission> OnProtect;
|
|
|
|
public MockVirtualMemoryManager(ulong size, int pageSize)
|
|
{
|
|
}
|
|
|
|
public void Map(ulong va, ulong pa, ulong size, MemoryMapFlags flags)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void MapForeign(ulong va, nuint hostAddress, ulong size)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void Unmap(ulong va, ulong size)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public T Read<T>(ulong va) where T : unmanaged
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void Read(ulong va, Span<byte> data)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void Write<T>(ulong va, T value) where T : unmanaged
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void Write(ulong va, ReadOnlySpan<byte> data)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public bool WriteWithRedundancyCheck(ulong va, ReadOnlySpan<byte> data)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public ReadOnlySpan<byte> GetSpan(ulong va, int size, bool tracked = false)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public WritableRegion GetWritableRegion(ulong va, int size, bool tracked = false)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public ref T GetRef<T>(ulong va) where T : unmanaged
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
IEnumerable<HostMemoryRange> IVirtualMemoryManager.GetHostRegions(ulong va, ulong size)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
IEnumerable<MemoryRange> IVirtualMemoryManager.GetPhysicalRegions(ulong va, ulong size)
|
|
{
|
|
return NoMappings ? new MemoryRange[0] : new MemoryRange[] { new MemoryRange(va, size) };
|
|
}
|
|
|
|
public bool IsMapped(ulong va)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public bool IsRangeMapped(ulong va, ulong size)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public ulong GetPhysicalAddress(ulong va)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void SignalMemoryTracking(ulong va, ulong size, bool write, bool precise = false)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
|
{
|
|
OnProtect?.Invoke(va, size, protection);
|
|
}
|
|
}
|
|
}
|