From 770be310303dd92e596a4cf3a096e225d0f6e7f7 Mon Sep 17 00:00:00 2001 From: lizzie Date: Tue, 27 Jan 2026 23:42:34 +0100 Subject: [PATCH] [fiber] fix windows 11 regression with DefaultSettings due to fiber stack corruption (#3400) Signed-off-by: lizzie Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3400 Reviewed-by: crueter Reviewed-by: Maufeat Co-authored-by: lizzie Co-committed-by: lizzie --- src/common/fiber.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index ea3da3d053..69eca732eb 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project @@ -15,15 +15,20 @@ namespace Common { +#ifdef __OPENORBIS__ constexpr size_t DEFAULT_STACK_SIZE = 128 * 4096; +#else +constexpr size_t DEFAULT_STACK_SIZE = 512 * 4096; +#endif constexpr u32 CANARY_VALUE = 0xDEADBEEF; struct Fiber::FiberImpl { FiberImpl() {} + u32 canary_1 = CANARY_VALUE; std::array stack{}; std::array rewind_stack{}; - u32 canary = CANARY_VALUE; + u32 canary_2 = CANARY_VALUE; boost::context::detail::fcontext_t context{}; boost::context::detail::fcontext_t rewind_context{}; @@ -51,7 +56,8 @@ Fiber::Fiber(std::function&& entry_point_func) : impl{std::make_uniquecontext = boost::context::detail::make_fcontext(stack_base, impl->stack.size(), [](boost::context::detail::transfer_t transfer) -> void { auto* fiber = static_cast(transfer.data); ASSERT(fiber && fiber->impl && fiber->impl->previous_fiber && fiber->impl->previous_fiber->impl); - ASSERT(fiber->impl->canary == CANARY_VALUE); + ASSERT(fiber->impl->canary_1 == CANARY_VALUE); + ASSERT(fiber->impl->canary_2 == CANARY_VALUE); fiber->impl->previous_fiber->impl->context = transfer.fctx; fiber->impl->previous_fiber->impl->guard.unlock(); fiber->impl->previous_fiber.reset();