From 781f2597e56d87ca609b01ad1a7fc5c924942475 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 17 Oct 2018 03:48:30 -0700 Subject: [PATCH] libstratosphere: Fix receive for multi-static IPC buffers --- stratosphere/fs_mitm/source/fsmitm_main.cpp | 2 +- .../libstratosphere/include/stratosphere/isession.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/stratosphere/fs_mitm/source/fsmitm_main.cpp b/stratosphere/fs_mitm/source/fsmitm_main.cpp index f2601b3a2e..ef351c94d3 100644 --- a/stratosphere/fs_mitm/source/fsmitm_main.cpp +++ b/stratosphere/fs_mitm/source/fsmitm_main.cpp @@ -117,7 +117,7 @@ int main(int argc, char **argv) } /* TODO: What's a good timeout value to use here? */ - auto server_manager = std::make_unique(1, U64_MAX, 0x20000); + auto server_manager = std::make_unique(5, U64_MAX, 0x20000); //auto server_manager = std::make_unique(U64_MAX); /* Create fsp-srv mitm. */ diff --git a/stratosphere/libstratosphere/include/stratosphere/isession.hpp b/stratosphere/libstratosphere/include/stratosphere/isession.hpp index 95156a2d02..12fc6650b1 100644 --- a/stratosphere/libstratosphere/include/stratosphere/isession.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/isession.hpp @@ -187,6 +187,10 @@ class ISession : public IWaitable { ipcAddRecvStatic(&c_for_reply, this->pointer_buffer.data(), this->pointer_buffer.size(), 0); ipcPrepareHeader(&c_for_reply, 0); + /* Fix libnx bug in serverside C descriptor handling. */ + ((u32 *)armGetTls())[1] &= 0xFFFFC3FF; + ((u32 *)armGetTls())[1] |= (2) << 10; + if (R_SUCCEEDED(rc = svcReplyAndReceive(&handle_index, &this->server_handle, 1, 0, U64_MAX))) { if (handle_index != 0) { /* TODO: Panic? */