Fix address space reserve alignment
This commit is contained in:
parent
c23dc434f8
commit
6d1929f2bf
2 changed files with 31 additions and 20 deletions
|
@ -64,7 +64,7 @@ namespace Ryujinx.HLE.Gpu.Memory
|
||||||
{
|
{
|
||||||
if (GetPte(VA + Offset) != PteReserved)
|
if (GetPte(VA + Offset) != PteReserved)
|
||||||
{
|
{
|
||||||
return Map(PA, Size);
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ namespace Ryujinx.HLE.Gpu.Memory
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long Reserve(long VA, long Size, long Align)
|
public long ReserveFixed(long VA, long Size)
|
||||||
{
|
{
|
||||||
lock (PageTable)
|
lock (PageTable)
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ namespace Ryujinx.HLE.Gpu.Memory
|
||||||
{
|
{
|
||||||
if (IsPageInUse(VA + Offset))
|
if (IsPageInUse(VA + Offset))
|
||||||
{
|
{
|
||||||
return Reserve(Size, Align);
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS
|
||||||
case 0x4106: return MapBufferEx (Context);
|
case 0x4106: return MapBufferEx (Context);
|
||||||
case 0x4108: return GetVaRegions(Context);
|
case 0x4108: return GetVaRegions(Context);
|
||||||
case 0x4109: return InitializeEx(Context);
|
case 0x4109: return InitializeEx(Context);
|
||||||
case 0x4114: return Remap (Context);
|
case 0x4114: return Remap (Context, Cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NotImplementedException(Cmd.ToString("x8"));
|
throw new NotImplementedException(Cmd.ToString("x8"));
|
||||||
|
@ -59,11 +59,11 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS
|
||||||
|
|
||||||
if ((Args.Flags & FlagFixedOffset) != 0)
|
if ((Args.Flags & FlagFixedOffset) != 0)
|
||||||
{
|
{
|
||||||
Args.Offset = Vmm.Reserve(Args.Offset, (long)Size, 1);
|
Args.Offset = Vmm.ReserveFixed(Args.Offset, (long)Size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Args.Offset = Vmm.Reserve((long)Size, 1);
|
Args.Offset = Vmm.Reserve((long)Size, Args.Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Result = NvResult.Success;
|
int Result = NvResult.Success;
|
||||||
|
@ -206,10 +206,14 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS
|
||||||
return NvResult.Success;
|
return NvResult.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Remap(ServiceCtx Context)
|
private static int Remap(ServiceCtx Context, int Cmd)
|
||||||
{
|
{
|
||||||
|
int Count = ((Cmd >> 16) & 0xff) / 0x14;
|
||||||
|
|
||||||
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
long InputPosition = Context.Request.GetBufferType0x21().Position;
|
||||||
|
|
||||||
|
for (int Index = 0; Index < Count; Index++, InputPosition += 0x14)
|
||||||
|
{
|
||||||
NvGpuASRemap Args = AMemoryHelper.Read<NvGpuASRemap>(Context.Memory, InputPosition);
|
NvGpuASRemap Args = AMemoryHelper.Read<NvGpuASRemap>(Context.Memory, InputPosition);
|
||||||
|
|
||||||
NvGpuVmm Vmm = GetVmm(Context);
|
NvGpuVmm Vmm = GetVmm(Context);
|
||||||
|
@ -223,10 +227,17 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvGpuAS
|
||||||
return NvResult.InvalidInput;
|
return NvResult.InvalidInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: This is most likely wrong...
|
long Result = Vmm.Map(Map.Address, (long)(uint)Args.Offset << 16,
|
||||||
Vmm.Map(Map.Address, (long)(uint)Args.Offset << 16,
|
|
||||||
(long)(uint)Args.Pages << 16);
|
(long)(uint)Args.Pages << 16);
|
||||||
|
|
||||||
|
if (Result < 0)
|
||||||
|
{
|
||||||
|
Context.Ns.Log.PrintWarning(LogClass.ServiceNv, $"Page 0x{Args.Offset:x16} size 0x{Args.Pages:x16} not allocated!");
|
||||||
|
|
||||||
|
return NvResult.InvalidInput;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NvResult.Success;
|
return NvResult.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue