Signal memory tracking before/after mapping into another process (#1785)
* Signal memory tracking before/after mapping into another process * Wording. * Add missing method.
This commit is contained in:
parent
36f6bbf5b9
commit
4594c3b310
4 changed files with 19 additions and 0 deletions
|
@ -1656,6 +1656,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
}
|
||||
}
|
||||
|
||||
// Signal a read for any resources tracking reads in the region, as the other process is likely to use their data.
|
||||
_cpuMemory.SignalMemoryTracking(addressTruncated, endAddrRounded - addressTruncated, false);
|
||||
|
||||
lock (_blocks)
|
||||
{
|
||||
KernelResult result;
|
||||
|
@ -2036,6 +2039,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
ulong endAddr = address + size;
|
||||
|
||||
ulong addressRounded = BitUtils.AlignUp (address, PageSize);
|
||||
ulong addressTruncated = BitUtils.AlignDown(address, PageSize);
|
||||
ulong endAddrRounded = BitUtils.AlignUp (endAddr, PageSize);
|
||||
ulong endAddrTruncated = BitUtils.AlignDown(endAddr, PageSize);
|
||||
|
||||
ulong pagesCount = addressRounded < endAddrTruncated ? (endAddrTruncated - addressRounded) / PageSize : 0;
|
||||
|
@ -2071,6 +2076,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
|||
return KernelResult.OutOfResource;
|
||||
}
|
||||
|
||||
// Anything on the client side should see this memory as modified.
|
||||
_cpuMemory.SignalMemoryTracking(addressTruncated, endAddrRounded - addressTruncated, true);
|
||||
|
||||
lock (_blocks)
|
||||
{
|
||||
foreach (KMemoryInfo info in IterateOverRange(addressRounded, endAddrTruncated))
|
||||
|
|
|
@ -75,6 +75,11 @@ namespace Ryujinx.Memory.Tests
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SignalMemoryTracking(ulong va, ulong size, bool write)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -545,5 +545,10 @@ namespace Ryujinx.Memory
|
|||
_pageTable[l0] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SignalMemoryTracking(ulong va, ulong size, bool write)
|
||||
{
|
||||
// Only the ARM Memory Manager has tracking for now.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Ryujinx.Memory
|
|||
bool IsRangeMapped(ulong va, ulong size);
|
||||
ulong GetPhysicalAddress(ulong va);
|
||||
|
||||
void SignalMemoryTracking(ulong va, ulong size, bool write);
|
||||
void TrackingReprotect(ulong va, ulong size, MemoryPermission protection);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue