aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-05-07 15:53:23 -0300
committerGitHub <noreply@github.com>2018-05-07 15:53:23 -0300
commit34037701c708cb70bbf44dea71ee0912f7b4102b (patch)
treeca4cf2bde85dea48af12033b8d0446f17b611f4f /Ryujinx.Core/OsHle/Kernel/SvcHandler.cs
parent4419e8d6b43432eae94a3a9304f7df22b34738a8 (diff)
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl * More work on NvHostCtrl * Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind * Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb) * Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks * Remove now unused code, add comment about probably wrong result codes
Diffstat (limited to 'Ryujinx.Core/OsHle/Kernel/SvcHandler.cs')
-rw-r--r--Ryujinx.Core/OsHle/Kernel/SvcHandler.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs
index e855b77d..1874360b 100644
--- a/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs
+++ b/Ryujinx.Core/OsHle/Kernel/SvcHandler.cs
@@ -5,6 +5,8 @@ using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Handles;
using System;
using System.Collections.Generic;
+using System.Collections.Concurrent;
+using System.Threading;
namespace Ryujinx.Core.OsHle.Kernel
{
@@ -18,12 +20,16 @@ namespace Ryujinx.Core.OsHle.Kernel
private Process Process;
private AMemory Memory;
+ private ConcurrentDictionary<KThread, AutoResetEvent> SyncWaits;
+
private object CondVarLock;
private HashSet<(HSharedMem, long)> MappedSharedMems;
private ulong CurrentHeapSize;
+ private const uint SelfHandle = 0xffff8001;
+
private static Random Rng;
public SvcHandler(Switch Ns, Process Process)
@@ -51,6 +57,7 @@ namespace Ryujinx.Core.OsHle.Kernel
{ 0x16, SvcCloseHandle },
{ 0x17, SvcResetSignal },
{ 0x18, SvcWaitSynchronization },
+ { 0x19, SvcCancelSynchronization },
{ 0x1a, SvcArbitrateLock },
{ 0x1b, SvcArbitrateUnlock },
{ 0x1c, SvcWaitProcessWideKeyAtomic },
@@ -70,6 +77,8 @@ namespace Ryujinx.Core.OsHle.Kernel
this.Process = Process;
this.Memory = Process.Memory;
+ SyncWaits = new ConcurrentDictionary<KThread, AutoResetEvent>();
+
CondVarLock = new object();
MappedSharedMems = new HashSet<(HSharedMem, long)>();
@@ -100,6 +109,18 @@ namespace Ryujinx.Core.OsHle.Kernel
}
}
+ private KThread GetThread(long Tpidr, int Handle)
+ {
+ if ((uint)Handle == SelfHandle)
+ {
+ return Process.GetThread(Tpidr);
+ }
+ else
+ {
+ return Process.HandleTable.GetData<KThread>(Handle);
+ }
+ }
+
public void Dispose()
{
Dispose(true);