Improve kernel IPC related syscalls (#1379)
* Implement session count decrement when the handle is closed * Remove unused field * Implement SendSyncRequestWithUserBuffer, SendAsyncRequestWithUserBuffer and ReplyAndReceiveWithUserBuffer syscalls * Nits * Fix swapped copy dst/src * Add missing pointer buffer descriptor write on reply * Fix IPC unaligned buffer copy and restoring client attributes on reply * Oops * Fix SetIpcMappingPermission * Fix unaligned copy bugs * Free memory used for temporary IPC buffers
This commit is contained in:
parent
46f8cef6a9
commit
9f6b24edfd
14 changed files with 705 additions and 247 deletions
|
@ -13,18 +13,22 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
|||
|
||||
public ChannelState State { get; set; }
|
||||
|
||||
public KClientPort ParentPort { get; }
|
||||
|
||||
// TODO: Remove that, we need it for now to allow HLE
|
||||
// services implementation to work with the new IPC system.
|
||||
public IpcService Service { get; set; }
|
||||
|
||||
public KClientSession(KernelContext context, KSession parent) : base(context)
|
||||
public KClientSession(KernelContext context, KSession parent, KClientPort parentPort) : base(context)
|
||||
{
|
||||
_parent = parent;
|
||||
_parent = parent;
|
||||
ParentPort = parentPort;
|
||||
|
||||
parentPort?.IncrementReferenceCount();
|
||||
|
||||
State = ChannelState.Open;
|
||||
|
||||
CreatorProcess = context.Scheduler.GetCurrentProcess();
|
||||
|
||||
CreatorProcess.IncrementReferenceCount();
|
||||
}
|
||||
|
||||
|
@ -51,6 +55,30 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
|||
return result;
|
||||
}
|
||||
|
||||
public KernelResult SendAsyncRequest(KWritableEvent asyncEvent, ulong customCmdBuffAddr = 0, ulong customCmdBuffSize = 0)
|
||||
{
|
||||
KThread currentThread = KernelContext.Scheduler.GetCurrentThread();
|
||||
|
||||
KSessionRequest request = new KSessionRequest(currentThread, customCmdBuffAddr, customCmdBuffSize, asyncEvent);
|
||||
|
||||
KernelContext.CriticalSection.Enter();
|
||||
|
||||
KernelResult result = _parent.ServerSession.EnqueueRequest(request);
|
||||
|
||||
KernelContext.CriticalSection.Leave();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void DisconnectFromPort()
|
||||
{
|
||||
if (ParentPort != null)
|
||||
{
|
||||
ParentPort.Disconnect();
|
||||
ParentPort.DecrementReferenceCount();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Destroy()
|
||||
{
|
||||
_parent.DisconnectClient();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue