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
This commit is contained in:
gdkchan 2020-05-04 00:41:29 -03:00 committed by GitHub
parent cd48576f58
commit 15d1cc806b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 3678 additions and 3570 deletions

View file

@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
public const int SelfThreadHandle = (0x1ffff << 15) | 0;
public const int SelfProcessHandle = (0x1ffff << 15) | 1;
private Horizon _system;
private readonly KernelContext _context;
private KHandleEntry[] _table;
@ -22,9 +22,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
private ushort _idCounter;
public KHandleTable(Horizon system)
public KHandleTable(KernelContext context)
{
_system = system;
_context = context;
}
public KernelResult Initialize(int size)
@ -136,8 +136,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
public void CancelHandleReservation(int handle)
{
int index = (handle >> 0) & 0x7fff;
int handleId = (handle >> 15);
int index = (handle >> 0) & 0x7fff;
lock (_table)
{
@ -162,7 +161,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
KHandleEntry entry = _table[index];
entry.Obj = obj;
entry.HandleId = (ushort)(handle >> 15);
entry.HandleId = (ushort)handleId;
obj.IncrementReferenceCount();
}
@ -230,14 +229,14 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
}
}
return default(T);
return default;
}
public KThread GetKThread(int handle)
{
if (handle == SelfThreadHandle)
{
return _system.Scheduler.GetCurrentThread();
return _context.Scheduler.GetCurrentThread();
}
else
{
@ -249,7 +248,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
{
if (handle == SelfProcessHandle)
{
return _system.Scheduler.GetCurrentProcess();
return _context.Scheduler.GetCurrentProcess();
}
else
{