From 6f60e102a29aa04fff5c6bcdec37213b2d8ac646 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 8 Jan 2023 15:34:49 -0300 Subject: [PATCH] HIPC: Fix reply possibly also receiving one request (#4232) --- Ryujinx.Horizon.Common/Result.cs | 8 -------- Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs | 8 ++------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Ryujinx.Horizon.Common/Result.cs b/Ryujinx.Horizon.Common/Result.cs index ac843688..28056310 100644 --- a/Ryujinx.Horizon.Common/Result.cs +++ b/Ryujinx.Horizon.Common/Result.cs @@ -100,14 +100,6 @@ namespace Ryujinx.Horizon.Common } } - public void AbortOnFailureUnless(Result result, Result result2) - { - if (this != Success && this != result && this != result2) - { - ThrowInvalidResult(); - } - } - private void ThrowInvalidResult() { throw new InvalidResultException(this); diff --git a/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs b/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs index 822a4b4a..33c42825 100644 --- a/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs +++ b/Ryujinx.Horizon/Sdk/Sf/Hipc/Api.cs @@ -51,22 +51,18 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc { Result result = ReplyImpl(sessionHandle, messageBuffer); - result.AbortOnFailureUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed); + result.AbortUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed); return Result.Success; } private static Result ReplyImpl(int sessionHandle, ReadOnlySpan messageBuffer) { - Span handles = stackalloc int[1]; - - handles[0] = sessionHandle; - var tlsSpan = HorizonStatic.AddressSpace.GetSpan(HorizonStatic.ThreadContext.TlsAddress, TlsMessageBufferSize); if (messageBuffer == tlsSpan) { - return HorizonStatic.Syscall.ReplyAndReceive(out _, handles, sessionHandle, 0); + return HorizonStatic.Syscall.ReplyAndReceive(out _, ReadOnlySpan.Empty, sessionHandle, 0); } else {