From 15d1cc806b1b978bab83d8bb426a124d9f0f788c Mon Sep 17 00:00:00 2001
From: gdkchan <gab.dark.100@gmail.com>
Date: Mon, 4 May 2020 00:41:29 -0300
Subject: Move kernel state out of the Horizon class (#1107)

* Move kernel state from Horizon to KernelContext

* Merge syscalls partial classes, split 32 and 64-bit variants

* Sort usings
---
 Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs')

diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs
index 901b0222..9c542ca0 100644
--- a/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs
+++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs
@@ -8,19 +8,19 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
     {
         private int _sessionsCount;
         private int _currentCapacity;
-        private int _maxSessions;
+        private readonly int _maxSessions;
 
-        private KPort _parent;
+        private readonly KPort _parent;
 
         public bool IsLight => _parent.IsLight;
 
-        private object _countIncLock;
+        private readonly object _countIncLock;
 
         // TODO: Remove that, we need it for now to allow HLE
         // SM implementation to work with the new IPC system.
         public IpcService Service { get; set; }
 
-        public KClientPort(Horizon system, KPort parent, int maxSessions) : base(system)
+        public KClientPort(KernelContext context, KPort parent, int maxSessions) : base(context)
         {
             _maxSessions = maxSessions;
             _parent      = parent;
@@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
         {
             clientSession = null;
 
-            KProcess currentProcess = System.Scheduler.GetCurrentProcess();
+            KProcess currentProcess = KernelContext.Scheduler.GetCurrentProcess();
 
             if (currentProcess.ResourceLimit != null &&
                !currentProcess.ResourceLimit.Reserve(LimitableResource.Session, 1))
@@ -59,7 +59,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
                 }
             }
 
-            KSession session = new KSession(System);
+            KSession session = new KSession(KernelContext);
 
             if (Service != null)
             {
@@ -85,7 +85,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
         {
             clientSession = null;
 
-            KProcess currentProcess = System.Scheduler.GetCurrentProcess();
+            KProcess currentProcess = KernelContext.Scheduler.GetCurrentProcess();
 
             if (currentProcess.ResourceLimit != null &&
                !currentProcess.ResourceLimit.Reserve(LimitableResource.Session, 1))
@@ -107,7 +107,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
                 }
             }
 
-            KLightSession session = new KLightSession(System);
+            KLightSession session = new KLightSession(KernelContext);
 
             KernelResult result = _parent.EnqueueIncomingLightSession(session.ServerSession);
 
@@ -124,16 +124,16 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
             return result;
         }
 
-        public new static KernelResult RemoveName(Horizon system, string name)
+        public new static KernelResult RemoveName(KernelContext context, string name)
         {
-            KAutoObject foundObj = FindNamedObject(system, name);
+            KAutoObject foundObj = FindNamedObject(context, name);
 
             if (!(foundObj is KClientPort))
             {
                 return KernelResult.NotFound;
             }
 
-            return KAutoObject.RemoveName(system, name);
+            return KAutoObject.RemoveName(context, name);
         }
     }
 }
\ No newline at end of file
-- 
cgit v1.2.3-70-g09d2