1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-27 21:52:04 +00:00

[SvcSystem/SvcMemory] Implement SvcGetInfo 16, SvcMapPhysicalMemory & SvcUnmapPhysicalMemory (#126)

* [SvcSystem] Implement SvcGetInfo 16

SvcGetInfo 16 always should be 1(?)

* Implement SvcMapPhysicalMemory &  SvcUnmapPhysicalMemory

* Adjusted to review.
This commit is contained in:
Starlet 2018-05-22 16:40:46 -04:00 committed by gdkchan
parent fa4b34bd19
commit 84996ccd36
3 changed files with 28 additions and 0 deletions

View file

@ -69,6 +69,8 @@ namespace Ryujinx.Core.OsHle.Kernel
{ 0x26, SvcBreak }, { 0x26, SvcBreak },
{ 0x27, SvcOutputDebugString }, { 0x27, SvcOutputDebugString },
{ 0x29, SvcGetInfo }, { 0x29, SvcGetInfo },
{ 0x2c, SvcMapPhysicalMemory },
{ 0x2d, SvcUnmapPhysicalMemory },
{ 0x32, SvcSetThreadActivity } { 0x32, SvcSetThreadActivity }
}; };

View file

@ -250,6 +250,26 @@ namespace Ryujinx.Core.OsHle.Kernel
ThreadState.X1 = Handle; ThreadState.X1 = Handle;
} }
private void SvcMapPhysicalMemory(AThreadState ThreadState)
{
long Position = (long)ThreadState.X0;
uint Size = (uint)ThreadState.X1;
Memory.Manager.Map(Position, Size, (int)MemoryType.Heap, AMemoryPerm.RW);
ThreadState.X0 = 0;
}
private void SvcUnmapPhysicalMemory(AThreadState ThreadState)
{
long Position = (long)ThreadState.X0;
uint Size = (uint)ThreadState.X1;
Memory.Manager.Unmap(Position, Size);
ThreadState.X0 = 0;
}
private static bool IsValidPosition(long Position) private static bool IsValidPosition(long Position)
{ {
return Position >= MemoryRegions.AddrSpaceStart && return Position >= MemoryRegions.AddrSpaceStart &&

View file

@ -18,6 +18,8 @@ namespace Ryujinx.Core.OsHle.Kernel
private const bool EnableProcessDebugging = false; private const bool EnableProcessDebugging = false;
private const bool IsVirtualMemoryEnabled = true; //This is always true(?)
private void SvcExitProcess(AThreadState ThreadState) private void SvcExitProcess(AThreadState ThreadState)
{ {
Ns.Os.ExitProcess(ThreadState.ProcessId); Ns.Os.ExitProcess(ThreadState.ProcessId);
@ -351,6 +353,10 @@ namespace Ryujinx.Core.OsHle.Kernel
ThreadState.X1 = MemoryRegions.MapRegionSize; ThreadState.X1 = MemoryRegions.MapRegionSize;
break; break;
case 16:
ThreadState.X1 = IsVirtualMemoryEnabled ? 1 : 0;
break;
default: default:
Process.PrintStackTrace(ThreadState); Process.PrintStackTrace(ThreadState);