Ensure we iterate all private allocations in range
This commit is contained in:
parent
efabbda088
commit
63fc0dc57e
1 changed files with 14 additions and 11 deletions
|
@ -762,25 +762,28 @@ 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.Address <= startVa && map.EndAddress >= startVa + startSize)
|
if (map.PrivateAllocation.IsValid)
|
||||||
{
|
{
|
||||||
ulong startOffset = startVa - map.Address;
|
if (map.Address <= startVa && map.EndAddress >= startVa + startSize)
|
||||||
|
{
|
||||||
|
ulong startOffset = startVa - map.Address;
|
||||||
|
|
||||||
range = new(
|
range = new(
|
||||||
map.PrivateAllocation.Memory,
|
map.PrivateAllocation.Memory,
|
||||||
map.PrivateAllocation.Offset + startOffset,
|
map.PrivateAllocation.Offset + startOffset,
|
||||||
Math.Min(map.PrivateAllocation.Size - startOffset, startSize));
|
Math.Min(map.PrivateAllocation.Size - startOffset, startSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue