From 9559468c2e9d6422da89ea81b08db00e3111e6e1 Mon Sep 17 00:00:00 2001 From: oltolm Date: Thu, 14 May 2026 06:10:37 +0200 Subject: [PATCH] core: simplify sysv_abi wrappers for MinGW-w64 GCC (#4402) Use template for HostCallWrapperImpl and OrbisWrapperImpl instead of passing the function type and value separately. This keeps the wrapper behavior the same while matching the form MinGW-w64 GCC accepts. --- src/core/libraries/kernel/kernel.h | 6 +++--- src/core/libraries/kernel/threads.h | 1 + src/core/tls.h | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/libraries/kernel/kernel.h b/src/core/libraries/kernel/kernel.h index d400844d4..57a338f6f 100644 --- a/src/core/libraries/kernel/kernel.h +++ b/src/core/libraries/kernel/kernel.h @@ -21,11 +21,11 @@ const char* PS4_SYSV_ABI sceKernelGetFsSandboxRandomWord(); extern Core::EntryParams entry_params; -template +template struct OrbisWrapperImpl; template -struct OrbisWrapperImpl { +struct OrbisWrapperImpl { static R PS4_SYSV_ABI wrap(Args... args) { u32 ret = f(args...); if (ret != 0) { @@ -35,7 +35,7 @@ struct OrbisWrapperImpl { } }; -#define ORBIS(func) (Libraries::Kernel::OrbisWrapperImpl::wrap) +#define ORBIS(func) (Libraries::Kernel::OrbisWrapperImpl::wrap) #define CURRENT_FIRMWARE_VERSION 0x13500011 diff --git a/src/core/libraries/kernel/threads.h b/src/core/libraries/kernel/threads.h index 46b36fa54..04e9743d7 100644 --- a/src/core/libraries/kernel/threads.h +++ b/src/core/libraries/kernel/threads.h @@ -6,6 +6,7 @@ #include #include "common/polyfill_thread.h" #include "core/libraries/kernel/threads/pthread.h" +#include "core/tls.h" namespace Core::Loader { class SymbolsResolver; diff --git a/src/core/tls.h b/src/core/tls.h index 2d94488f7..86361e3e2 100644 --- a/src/core/tls.h +++ b/src/core/tls.h @@ -45,16 +45,16 @@ Tcb* GetTcbBase(); /// Makes sure TLS is initialized for the thread before entering guest. void InitializeTLS(); -template +template struct HostCallWrapperImpl; template -struct HostCallWrapperImpl { +struct HostCallWrapperImpl { static ReturnType PS4_SYSV_ABI wrap(Args... args) { return func(args...); } }; -#define HOST_CALL(func) (Core::HostCallWrapperImpl::wrap) +#define HOST_CALL(func) (Core::HostCallWrapperImpl::wrap) } // namespace Core