Ensure we iterate all private allocations in range

This commit is contained in:
Gabriel A 2024-02-24 21:44:58 -03:00
commit 63fc0dc57e

View file

@ -762,13 +762,15 @@ namespace Ryujinx.Cpu.Jit
public bool HasPrivateAllocation(ulong va, ulong size, ulong startVa, ulong startSize, ref PrivateRange range) public bool HasPrivateAllocation(ulong va, ulong size, ulong startVa, ulong startSize, ref PrivateRange range)
{ {
ulong endVa = va + size;
_treeLock.EnterReadLock(); _treeLock.EnterReadLock();
try try
{ {
PrivateMapping map = _privateTree.GetNode(va); for (PrivateMapping map = _privateTree.GetNode(va); map != null && map.Address < endVa; map = map.Successor)
{
if (map != null && map.PrivateAllocation.IsValid) if (map.PrivateAllocation.IsValid)
{ {
if (map.Address <= startVa && map.EndAddress >= startVa + startSize) if (map.Address <= startVa && map.EndAddress >= startVa + startSize)
{ {
@ -783,6 +785,7 @@ namespace Ryujinx.Cpu.Jit
return true; return true;
} }
} }
}
finally finally
{ {
_treeLock.ExitReadLock(); _treeLock.ExitReadLock();