aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/Common
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/Common')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/Common/KAutoObject.cs16
-rw-r--r--Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs16
-rw-r--r--Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs4
-rw-r--r--Ryujinx.HLE/HOS/Kernel/Common/KernelTransfer.cs20
4 files changed, 28 insertions, 28 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/Common/KAutoObject.cs b/Ryujinx.HLE/HOS/Kernel/Common/KAutoObject.cs
index 3b30dd80..812cbd30 100644
--- a/Ryujinx.HLE/HOS/Kernel/Common/KAutoObject.cs
+++ b/Ryujinx.HLE/HOS/Kernel/Common/KAutoObject.cs
@@ -4,20 +4,20 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
{
class KAutoObject
{
- protected Horizon System;
+ protected KernelContext KernelContext;
private int _referenceCount;
- public KAutoObject(Horizon system)
+ public KAutoObject(KernelContext context)
{
- System = system;
+ KernelContext = context;
_referenceCount = 1;
}
public virtual KernelResult SetName(string name)
{
- if (!System.AutoObjectNames.TryAdd(name, this))
+ if (!KernelContext.AutoObjectNames.TryAdd(name, this))
{
return KernelResult.InvalidState;
}
@@ -25,9 +25,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
return KernelResult.Success;
}
- public static KernelResult RemoveName(Horizon system, string name)
+ public static KernelResult RemoveName(KernelContext context, string name)
{
- if (!system.AutoObjectNames.TryRemove(name, out _))
+ if (!context.AutoObjectNames.TryRemove(name, out _))
{
return KernelResult.NotFound;
}
@@ -35,9 +35,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
return KernelResult.Success;
}
- public static KAutoObject FindNamedObject(Horizon system, string name)
+ public static KAutoObject FindNamedObject(KernelContext context, string name)
{
- if (system.AutoObjectNames.TryGetValue(name, out KAutoObject obj))
+ if (context.AutoObjectNames.TryGetValue(name, out KAutoObject obj))
{
return obj;
}
diff --git a/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs b/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs
index a7955d7a..91501a98 100644
--- a/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs
+++ b/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs
@@ -8,17 +8,17 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
{
private const int Time10SecondsMs = 10000;
- private long[] _current;
- private long[] _limit;
- private long[] _available;
+ private readonly long[] _current;
+ private readonly long[] _limit;
+ private readonly long[] _available;
- private object _lockObj;
+ private readonly object _lockObj;
- private LinkedList<KThread> _waitingThreads;
+ private readonly LinkedList<KThread> _waitingThreads;
private int _waitingThreadsCount;
- public KResourceLimit(Horizon system) : base(system)
+ public KResourceLimit(KernelContext context) : base(context)
{
_current = new long[(int)LimitableResource.Count];
_limit = new long[(int)LimitableResource.Count];
@@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
{
_waitingThreadsCount++;
- KConditionVariable.Wait(System, _waitingThreads, _lockObj, timeout);
+ KConditionVariable.Wait(KernelContext, _waitingThreads, _lockObj, timeout);
_waitingThreadsCount--;
@@ -101,7 +101,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
if (_waitingThreadsCount > 0)
{
- KConditionVariable.NotifyAll(System, _waitingThreads);
+ KConditionVariable.NotifyAll(KernelContext, _waitingThreads);
}
}
}
diff --git a/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs b/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs
index 77d8fbff..ddc0069d 100644
--- a/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs
+++ b/Ryujinx.HLE/HOS/Kernel/Common/KSynchronizationObject.cs
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
{
public LinkedList<KThread> WaitingThreads { get; }
- public KSynchronizationObject(Horizon system) : base(system)
+ public KSynchronizationObject(KernelContext context) : base(context)
{
WaitingThreads = new LinkedList<KThread>();
}
@@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
public virtual void Signal()
{
- System.Synchronization.SignalObject(this);
+ KernelContext.Synchronization.SignalObject(this);
}
public virtual bool IsSignaled()
diff --git a/Ryujinx.HLE/HOS/Kernel/Common/KernelTransfer.cs b/Ryujinx.HLE/HOS/Kernel/Common/KernelTransfer.cs
index cd8d6661..8b739f66 100644
--- a/Ryujinx.HLE/HOS/Kernel/Common/KernelTransfer.cs
+++ b/Ryujinx.HLE/HOS/Kernel/Common/KernelTransfer.cs
@@ -5,9 +5,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
{
static class KernelTransfer
{
- public static bool UserToKernelInt32(Horizon system, ulong address, out int value)
+ public static bool UserToKernelInt32(KernelContext context, ulong address, out int value)
{
- KProcess currentProcess = system.Scheduler.GetCurrentProcess();
+ KProcess currentProcess = context.Scheduler.GetCurrentProcess();
if (currentProcess.CpuMemory.IsMapped(address) &&
currentProcess.CpuMemory.IsMapped(address + 3))
@@ -22,9 +22,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
return false;
}
- public static bool UserToKernelInt32Array(Horizon system, ulong address, int[] values)
+ public static bool UserToKernelInt32Array(KernelContext context, ulong address, int[] values)
{
- KProcess currentProcess = system.Scheduler.GetCurrentProcess();
+ KProcess currentProcess = context.Scheduler.GetCurrentProcess();
for (int index = 0; index < values.Length; index++, address += 4)
{
@@ -42,9 +42,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
return true;
}
- public static bool UserToKernelString(Horizon system, ulong address, int size, out string value)
+ public static bool UserToKernelString(KernelContext context, ulong address, int size, out string value)
{
- KProcess currentProcess = system.Scheduler.GetCurrentProcess();
+ KProcess currentProcess = context.Scheduler.GetCurrentProcess();
if (currentProcess.CpuMemory.IsMapped(address) &&
currentProcess.CpuMemory.IsMapped(address + (ulong)size - 1))
@@ -59,9 +59,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
return false;
}
- public static bool KernelToUserInt32(Horizon system, ulong address, int value)
+ public static bool KernelToUserInt32(KernelContext context, ulong address, int value)
{
- KProcess currentProcess = system.Scheduler.GetCurrentProcess();
+ KProcess currentProcess = context.Scheduler.GetCurrentProcess();
if (currentProcess.CpuMemory.IsMapped(address) &&
currentProcess.CpuMemory.IsMapped(address + 3))
@@ -74,9 +74,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
return false;
}
- public static bool KernelToUserInt64(Horizon system, ulong address, long value)
+ public static bool KernelToUserInt64(KernelContext context, ulong address, long value)
{
- KProcess currentProcess = system.Scheduler.GetCurrentProcess();
+ KProcess currentProcess = context.Scheduler.GetCurrentProcess();
if (currentProcess.CpuMemory.IsMapped(address) &&
currentProcess.CpuMemory.IsMapped(address + 7))