diff options
| author | Starlet <gpyron@mail.com> | 2018-05-22 16:40:46 -0400 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-05-22 17:40:46 -0300 |
| commit | 84996ccd36a5fa13892c1f02acb1c79031c35aa5 (patch) | |
| tree | 62c7e55d13588f64695b9e03a44003a433883441 | |
| parent | fa4b34bd19e201662ead605568dd47fb8f95d02a (diff) | |
[SvcSystem/SvcMemory] Implement SvcGetInfo 16, SvcMapPhysicalMemory & SvcUnmapPhysicalMemory (#126)
* [SvcSystem] Implement SvcGetInfo 16
SvcGetInfo 16 always should be 1(?)
* Implement SvcMapPhysicalMemory & SvcUnmapPhysicalMemory
* Adjusted to review.
| -rw-r--r-- | Ryujinx.Core/OsHle/Kernel/SvcHandler.cs | 2 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Kernel/SvcMemory.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Core/OsHle/Kernel/SvcSystem.cs | 6 |
3 files changed, 28 insertions, 0 deletions
diff --git a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs index 9771bc1e..3a9166e4 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs @@ -69,6 +69,8 @@ namespace Ryujinx.Core.OsHle.Kernel { 0x26, SvcBreak }, { 0x27, SvcOutputDebugString }, { 0x29, SvcGetInfo }, + { 0x2c, SvcMapPhysicalMemory }, + { 0x2d, SvcUnmapPhysicalMemory }, { 0x32, SvcSetThreadActivity } }; diff --git a/Ryujinx.Core/OsHle/Kernel/SvcMemory.cs b/Ryujinx.Core/OsHle/Kernel/SvcMemory.cs index 6609d14a..3e3cfab5 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcMemory.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcMemory.cs @@ -250,6 +250,26 @@ namespace Ryujinx.Core.OsHle.Kernel 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) { return Position >= MemoryRegions.AddrSpaceStart && diff --git a/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs b/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs index 24317bdf..77f35c19 100644 --- a/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs +++ b/Ryujinx.Core/OsHle/Kernel/SvcSystem.cs @@ -18,6 +18,8 @@ namespace Ryujinx.Core.OsHle.Kernel private const bool EnableProcessDebugging = false; + private const bool IsVirtualMemoryEnabled = true; //This is always true(?) + private void SvcExitProcess(AThreadState ThreadState) { Ns.Os.ExitProcess(ThreadState.ProcessId); @@ -350,6 +352,10 @@ namespace Ryujinx.Core.OsHle.Kernel case 15: ThreadState.X1 = MemoryRegions.MapRegionSize; break; + + case 16: + ThreadState.X1 = IsVirtualMemoryEnabled ? 1 : 0; + break; default: Process.PrintStackTrace(ThreadState); |
