Some DAS SVCs implemented
This commit is contained in:
parent
cf147f1e49
commit
cdf48b58f1
4 changed files with 151 additions and 0 deletions
45
Ryujinx.HLE/HOS/Kernel/Memory/DeviceName.cs
Normal file
45
Ryujinx.HLE/HOS/Kernel/Memory/DeviceName.cs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||||
|
{
|
||||||
|
enum DeviceName
|
||||||
|
{
|
||||||
|
Afi = 0,
|
||||||
|
Avpc = 1,
|
||||||
|
Dc = 2,
|
||||||
|
DcB = 3,
|
||||||
|
Hc = 4,
|
||||||
|
Hda = 5,
|
||||||
|
Isp2 = 6,
|
||||||
|
Msencnvenc = 7,
|
||||||
|
Nv = 8,
|
||||||
|
Nv2 = 9,
|
||||||
|
Ppcs = 10,
|
||||||
|
Sata = 11,
|
||||||
|
Vi = 12,
|
||||||
|
Vic = 13,
|
||||||
|
XusbHost = 14,
|
||||||
|
XusbDev = 15,
|
||||||
|
Tsec = 16,
|
||||||
|
Ppcs1 = 17,
|
||||||
|
Dc1 = 18,
|
||||||
|
Sdmmc1A = 19,
|
||||||
|
Sdmmc2A = 20,
|
||||||
|
Sdmmc3A = 21,
|
||||||
|
Sdmmc4A = 22,
|
||||||
|
Isp2B = 23,
|
||||||
|
Gpu = 24,
|
||||||
|
GpuB = 25,
|
||||||
|
Ppcs2 = 26,
|
||||||
|
Nvdec = 27,
|
||||||
|
Ape = 28,
|
||||||
|
Se = 29,
|
||||||
|
Nvjpg = 30,
|
||||||
|
Hc1 = 31,
|
||||||
|
Se1 = 32,
|
||||||
|
Axiap = 33,
|
||||||
|
Etr = 34,
|
||||||
|
TsecB = 35,
|
||||||
|
Tsec1 = 36,
|
||||||
|
TsecB1 = 37,
|
||||||
|
Nvdec1 = 38
|
||||||
|
}
|
||||||
|
}
|
34
Ryujinx.HLE/HOS/Kernel/Memory/KDeviceAddressSpace.cs
Normal file
34
Ryujinx.HLE/HOS/Kernel/Memory/KDeviceAddressSpace.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||||
|
{
|
||||||
|
class KDeviceAddressSpace : KAutoObject
|
||||||
|
{
|
||||||
|
private ulong _address;
|
||||||
|
private ulong _size;
|
||||||
|
|
||||||
|
private bool _hasInitialized;
|
||||||
|
|
||||||
|
public KDeviceAddressSpace(Horizon system) : base(system) { }
|
||||||
|
|
||||||
|
public KernelResult Initialize(ulong address, ulong size)
|
||||||
|
{
|
||||||
|
KernelResult result = KernelResult.Success;
|
||||||
|
|
||||||
|
if (result == KernelResult.Success)
|
||||||
|
{
|
||||||
|
_address = address;
|
||||||
|
_size = size;
|
||||||
|
|
||||||
|
_hasInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KernelResult Attach(DeviceName name)
|
||||||
|
{
|
||||||
|
return KernelResult.Success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -386,6 +386,75 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||||
return _process.MemoryManager.UnmapPhysicalMemory(address, size);
|
return _process.MemoryManager.UnmapPhysicalMemory(address, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public KernelResult CreateDeviceAddressSpace64(ulong address, ulong size, out int handle)
|
||||||
|
{
|
||||||
|
return CreateDeviceAddressSpace(address, size, out handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private KernelResult CreateDeviceAddressSpace(ulong address, ulong size, out int handle)
|
||||||
|
{
|
||||||
|
handle = 0;
|
||||||
|
|
||||||
|
if (!PageAligned(address))
|
||||||
|
{
|
||||||
|
return KernelResult.InvalidMemRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PageAligned(size) || size == 0 || address + size <= address)
|
||||||
|
{
|
||||||
|
return KernelResult.InvalidMemRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
KDeviceAddressSpace deviceAs = new KDeviceAddressSpace(_system);
|
||||||
|
|
||||||
|
KProcess currentProcess = _system.Scheduler.GetCurrentProcess();
|
||||||
|
|
||||||
|
return currentProcess.HandleTable.GenerateHandle(deviceAs, out handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public KernelResult AttachDeviceAddressSpace64(DeviceName deviceName, int handle)
|
||||||
|
{
|
||||||
|
return AttachDeviceAddressSpace(deviceName, handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private KernelResult AttachDeviceAddressSpace(DeviceName deviceName, int handle)
|
||||||
|
{
|
||||||
|
KProcess currentProcess = _system.Scheduler.GetCurrentProcess();
|
||||||
|
|
||||||
|
KDeviceAddressSpace deviceAs = currentProcess.HandleTable.GetObject<KDeviceAddressSpace>(handle);
|
||||||
|
|
||||||
|
if (deviceAs == null)
|
||||||
|
{
|
||||||
|
return KernelResult.InvalidHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceAs.Attach(deviceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public KernelResult MapDeviceAddressSpace64(
|
||||||
|
int dasHandle,
|
||||||
|
int processHandle,
|
||||||
|
ulong mapAddress,
|
||||||
|
ulong dasSize,
|
||||||
|
ulong dasAddress,
|
||||||
|
MemoryPermission permission)
|
||||||
|
{
|
||||||
|
return MapDeviceAddressSpace(dasHandle, processHandle, mapAddress, dasSize, dasAddress, permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
private KernelResult MapDeviceAddressSpace(
|
||||||
|
int dasHandle,
|
||||||
|
int processHandle,
|
||||||
|
ulong mapAddress,
|
||||||
|
ulong dasSize,
|
||||||
|
ulong dasAddress,
|
||||||
|
MemoryPermission permission)
|
||||||
|
{
|
||||||
|
//TODO.
|
||||||
|
|
||||||
|
return KernelResult.Success;
|
||||||
|
}
|
||||||
|
|
||||||
private static bool PageAligned(ulong position)
|
private static bool PageAligned(ulong position)
|
||||||
{
|
{
|
||||||
return (position & (KMemoryManager.PageSize - 1)) == 0;
|
return (position & (KMemoryManager.PageSize - 1)) == 0;
|
||||||
|
|
|
@ -64,6 +64,9 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||||
{ 0x34, nameof(SvcHandler.WaitForAddress64) },
|
{ 0x34, nameof(SvcHandler.WaitForAddress64) },
|
||||||
{ 0x35, nameof(SvcHandler.SignalToAddress64) },
|
{ 0x35, nameof(SvcHandler.SignalToAddress64) },
|
||||||
{ 0x45, nameof(SvcHandler.CreateEvent64) },
|
{ 0x45, nameof(SvcHandler.CreateEvent64) },
|
||||||
|
{ 0x56, nameof(SvcHandler.CreateDeviceAddressSpace64) },
|
||||||
|
{ 0x57, nameof(SvcHandler.AttachDeviceAddressSpace64) },
|
||||||
|
{ 0x5b, nameof(SvcHandler.MapDeviceAddressSpace64) },
|
||||||
{ 0x65, nameof(SvcHandler.GetProcessList64) },
|
{ 0x65, nameof(SvcHandler.GetProcessList64) },
|
||||||
{ 0x6f, nameof(SvcHandler.GetSystemInfo64) },
|
{ 0x6f, nameof(SvcHandler.GetSystemInfo64) },
|
||||||
{ 0x70, nameof(SvcHandler.CreatePort64) },
|
{ 0x70, nameof(SvcHandler.CreatePort64) },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue