HIPC: Fix reply possibly also receiving one request (#4232)
This commit is contained in:
parent
eeb2af9953
commit
6f60e102a2
2 changed files with 2 additions and 14 deletions
|
@ -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()
|
private void ThrowInvalidResult()
|
||||||
{
|
{
|
||||||
throw new InvalidResultException(this);
|
throw new InvalidResultException(this);
|
||||||
|
|
|
@ -51,22 +51,18 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
||||||
{
|
{
|
||||||
Result result = ReplyImpl(sessionHandle, messageBuffer);
|
Result result = ReplyImpl(sessionHandle, messageBuffer);
|
||||||
|
|
||||||
result.AbortOnFailureUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed);
|
result.AbortUnless(KernelResult.TimedOut, KernelResult.PortRemoteClosed);
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result ReplyImpl(int sessionHandle, ReadOnlySpan<byte> messageBuffer)
|
private static Result ReplyImpl(int sessionHandle, ReadOnlySpan<byte> messageBuffer)
|
||||||
{
|
{
|
||||||
Span<int> handles = stackalloc int[1];
|
|
||||||
|
|
||||||
handles[0] = sessionHandle;
|
|
||||||
|
|
||||||
var tlsSpan = HorizonStatic.AddressSpace.GetSpan(HorizonStatic.ThreadContext.TlsAddress, TlsMessageBufferSize);
|
var tlsSpan = HorizonStatic.AddressSpace.GetSpan(HorizonStatic.ThreadContext.TlsAddress, TlsMessageBufferSize);
|
||||||
|
|
||||||
if (messageBuffer == tlsSpan)
|
if (messageBuffer == tlsSpan)
|
||||||
{
|
{
|
||||||
return HorizonStatic.Syscall.ReplyAndReceive(out _, handles, sessionHandle, 0);
|
return HorizonStatic.Syscall.ReplyAndReceive(out _, ReadOnlySpan<int>.Empty, sessionHandle, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue