mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-29 04:01:21 -08:00
15d1cc806b
* Move kernel state from Horizon to KernelContext * Merge syscalls partial classes, split 32 and 64-bit variants * Sort usings
71 lines
1.8 KiB
C#
71 lines
1.8 KiB
C#
using Ryujinx.HLE.HOS.Kernel.Common;
|
|
|
|
namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
|
{
|
|
class KPort : KAutoObject
|
|
{
|
|
public KServerPort ServerPort { get; }
|
|
public KClientPort ClientPort { get; }
|
|
|
|
private long _nameAddress;
|
|
|
|
private ChannelState _state;
|
|
|
|
public bool IsLight { get; private set; }
|
|
|
|
public KPort(KernelContext context, int maxSessions, bool isLight, long nameAddress) : base(context)
|
|
{
|
|
ServerPort = new KServerPort(context, this);
|
|
ClientPort = new KClientPort(context, this, maxSessions);
|
|
|
|
IsLight = isLight;
|
|
_nameAddress = nameAddress;
|
|
|
|
_state = ChannelState.Open;
|
|
}
|
|
|
|
public KernelResult EnqueueIncomingSession(KServerSession session)
|
|
{
|
|
KernelResult result;
|
|
|
|
KernelContext.CriticalSection.Enter();
|
|
|
|
if (_state == ChannelState.Open)
|
|
{
|
|
ServerPort.EnqueueIncomingSession(session);
|
|
|
|
result = KernelResult.Success;
|
|
}
|
|
else
|
|
{
|
|
result = KernelResult.PortClosed;
|
|
}
|
|
|
|
KernelContext.CriticalSection.Leave();
|
|
|
|
return result;
|
|
}
|
|
|
|
public KernelResult EnqueueIncomingLightSession(KLightServerSession session)
|
|
{
|
|
KernelResult result;
|
|
|
|
KernelContext.CriticalSection.Enter();
|
|
|
|
if (_state == ChannelState.Open)
|
|
{
|
|
ServerPort.EnqueueIncomingLightSession(session);
|
|
|
|
result = KernelResult.Success;
|
|
}
|
|
else
|
|
{
|
|
result = KernelResult.PortClosed;
|
|
}
|
|
|
|
KernelContext.CriticalSection.Leave();
|
|
|
|
return result;
|
|
}
|
|
}
|
|
} |