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:
gdkchan 2020-07-17 01:19:07 -03:00 committed by GitHub
parent 46f8cef6a9
commit 9f6b24edfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 705 additions and 247 deletions

View file

@ -11,10 +11,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
private bool _hasBeenInitialized;
public KSession(KernelContext context) : base(context)
public KSession(KernelContext context, KClientPort parentPort = null) : base(context)
{
ServerSession = new KServerSession(context, this);
ClientSession = new KClientSession(context, this);
ClientSession = new KClientSession(context, this, parentPort);
_hasBeenInitialized = true;
}
@ -54,10 +54,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
{
if (_hasBeenInitialized)
{
ClientSession.DisconnectFromPort();
KProcess creatorProcess = ClientSession.CreatorProcess;
creatorProcess.ResourceLimit?.Release(LimitableResource.Session, 1);
creatorProcess.DecrementReferenceCount();
}
}