Rework SVC handling (#883)

* Rework SVC handling

Prepare for 32 bits support.

* QueryMemory64 x1 is an output

* Pregenerate all SVC handler

Also clean up + 32 bits code path

* Address gdk's comments

* Simplify local setter loop

* Address jd's comments
This commit is contained in:
Thog 2020-01-13 03:04:28 +01:00 committed by jduncanator
parent 5facc0c07f
commit 892df335e6
8 changed files with 167 additions and 119 deletions

View file

@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
{
partial class SvcHandler
{
public KernelResult SetHeapSize64(ulong size, out ulong position)
public KernelResult SetHeapSize64([R(1)] ulong size, [R(1)] out ulong position)
{
return SetHeapSize(size, out position);
}
@ -24,10 +24,10 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
public KernelResult SetMemoryAttribute64(
ulong position,
ulong size,
MemoryAttribute attributeMask,
MemoryAttribute attributeValue)
[R(0)] ulong position,
[R(1)] ulong size,
[R(2)] MemoryAttribute attributeMask,
[R(3)] MemoryAttribute attributeValue)
{
return SetMemoryAttribute(position, size, attributeMask, attributeValue);
}
@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return result;
}
public KernelResult MapMemory64(ulong dst, ulong src, ulong size)
public KernelResult MapMemory64([R(0)] ulong dst, [R(1)] ulong src, [R(2)] ulong size)
{
return MapMemory(dst, src, size);
}
@ -104,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return _process.MemoryManager.Map(dst, src, size);
}
public KernelResult UnmapMemory64(ulong dst, ulong src, ulong size)
public KernelResult UnmapMemory64([R(0)] ulong dst, [R(1)] ulong src, [R(2)] ulong size)
{
return UnmapMemory(dst, src, size);
}
@ -143,12 +143,12 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return _process.MemoryManager.Unmap(dst, src, size);
}
public KernelResult QueryMemory64(ulong infoPtr, ulong x1, ulong position)
public KernelResult QueryMemory64([R(0)] ulong infoPtr, [R(2)] ulong position, [R(1)] out ulong pageInfo)
{
return QueryMemory(infoPtr, position);
return QueryMemory(infoPtr, position, out pageInfo);
}
private KernelResult QueryMemory(ulong infoPtr, ulong position)
private KernelResult QueryMemory(ulong infoPtr, ulong position, out ulong pageInfo)
{
KMemoryInfo blkInfo = _process.MemoryManager.QueryMemory(position);
@ -161,10 +161,12 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
_process.CpuMemory.WriteInt32 ((long)infoPtr + 0x20, blkInfo.DeviceRefCount);
_process.CpuMemory.WriteInt32 ((long)infoPtr + 0x24, 0);
pageInfo = 0;
return KernelResult.Success;
}
public KernelResult MapSharedMemory64(int handle, ulong address, ulong size, MemoryPermission permission)
public KernelResult MapSharedMemory64([R(0)] int handle, [R(1)] ulong address, [R(2)] ulong size, [R(3)] MemoryPermission permission)
{
return MapSharedMemory(handle, address, size, permission);
}
@ -215,7 +217,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
permission);
}
public KernelResult UnmapSharedMemory64(int handle, ulong address, ulong size)
public KernelResult UnmapSharedMemory64([R(0)] int handle, [R(1)] ulong address, [R(2)] ulong size)
{
return UnmapSharedMemory(handle, address, size);
}
@ -261,10 +263,10 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
public KernelResult CreateTransferMemory64(
ulong address,
ulong size,
MemoryPermission permission,
out int handle)
[R(1)] ulong address,
[R(2)] ulong size,
[R(3)] MemoryPermission permission,
[R(1)] out int handle)
{
return CreateTransferMemory(address, size, permission, out handle);
}
@ -305,7 +307,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return _process.HandleTable.GenerateHandle(transferMemory, out handle);
}
public KernelResult MapPhysicalMemory64(ulong address, ulong size)
public KernelResult MapPhysicalMemory64([R(0)] ulong address, [R(1)] ulong size)
{
return MapPhysicalMemory(address, size);
}
@ -343,7 +345,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return _process.MemoryManager.MapPhysicalMemory(address, size);
}
public KernelResult UnmapPhysicalMemory64(ulong address, ulong size)
public KernelResult UnmapPhysicalMemory64([R(0)] ulong address, [R(1)] ulong size)
{
return UnmapPhysicalMemory(address, size);
}
@ -381,7 +383,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return _process.MemoryManager.UnmapPhysicalMemory(address, size);
}
public KernelResult MapProcessCodeMemory64(int handle, ulong dst, ulong src, ulong size)
public KernelResult MapProcessCodeMemory64([R(0)] int handle, [R(1)] ulong dst, [R(2)] ulong src, [R(3)] ulong size)
{
return MapProcessCodeMemory(handle, dst, src, size);
}
@ -423,7 +425,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return targetProcess.MemoryManager.MapProcessCodeMemory(dst, src, size);
}
public KernelResult UnmapProcessCodeMemory64(int handle, ulong dst, ulong src, ulong size)
public KernelResult UnmapProcessCodeMemory64([R(0)] int handle, [R(1)] ulong dst, [R(2)] ulong src, [R(3)] ulong size)
{
return UnmapProcessCodeMemory(handle, dst, src, size);
}
@ -465,7 +467,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
return targetProcess.MemoryManager.UnmapProcessCodeMemory(dst, src, size);
}
public KernelResult SetProcessMemoryPermission64(int handle, ulong src, ulong size, MemoryPermission permission)
public KernelResult SetProcessMemoryPermission64([R(0)] int handle, [R(1)] ulong src, [R(2)] ulong size, [R(3)] MemoryPermission permission)
{
return SetProcessMemoryPermission(handle, src, size, permission);
}