diff --git a/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp b/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp index 389e266bf..061e9d002 100644 --- a/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp +++ b/libraries/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp @@ -42,7 +42,14 @@ namespace ams::tipc { template class ServerManagerImpl { private: + static constexpr inline size_t NumPorts = sizeof...(PortInfos); + static constexpr inline size_t MaxSessions = (PortInfos::MaxSessions + ...); + + /* Verify that it's possible to service this many sessions, with our port manager count. */ + static_assert(MaxSessions <= NumPorts * svc::ArgumentHandleCountMax); + static_assert(util::IsAligned(ThreadStackSize, os::ThreadStackAlignment)); + alignas(os::ThreadStackAlignment) static constinit inline u8 s_port_stacks[ThreadStackSize * (NumPorts - 1)]; static constexpr inline bool IsDeferralSupported = !std::same_as; using ResumeKey = typename DeferralManagerType::Key; @@ -67,12 +74,6 @@ namespace ams::tipc { return converted; } - static constexpr inline size_t NumPorts = sizeof...(PortInfos); - static constexpr inline size_t MaxSessions = (PortInfos::MaxSessions + ...); - - /* Verify that it's possible to service this many sessions, with our port manager count. */ - static_assert(MaxSessions <= NumPorts * svc::ArgumentHandleCountMax); - template requires (Ix < NumPorts) static constexpr inline size_t SessionsPerPortManager = (Ix == NumPorts - 1) ? ((MaxSessions / NumPorts) + MaxSessions % NumPorts) : ((MaxSessions / NumPorts)); @@ -353,7 +354,6 @@ namespace ams::tipc { PortManagerTuple m_port_managers; PortAllocatorTuple m_port_allocators; os::ThreadType m_port_threads[NumPorts - 1]; - alignas(os::ThreadStackAlignment) u8 m_port_stacks[ThreadStackSize * (NumPorts - 1)]; private: template ALWAYS_INLINE auto &GetPortManager() { @@ -378,7 +378,7 @@ namespace ams::tipc { template void InitializePortThread(s32 priority) { /* Create the thread. */ - R_ABORT_UNLESS(os::CreateThread(m_port_threads + Ix, &LoopAutoForPortThreadFunction, this, m_port_stacks + Ix, ThreadStackSize, priority)); + R_ABORT_UNLESS(os::CreateThread(m_port_threads + Ix, &LoopAutoForPortThreadFunction, this, s_port_stacks + Ix, ThreadStackSize, priority)); /* Start the thread. */ os::StartThread(m_port_threads + Ix);