core: simplify sysv_abi wrappers for MinGW-w64 GCC (#4402)

Use template <auto f> 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.
This commit is contained in:
oltolm 2026-05-14 06:10:37 +02:00 committed by GitHub
parent 622cfffaf2
commit 9559468c2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View File

@ -21,11 +21,11 @@ const char* PS4_SYSV_ABI sceKernelGetFsSandboxRandomWord();
extern Core::EntryParams entry_params; extern Core::EntryParams entry_params;
template <class F, F f> template <auto f>
struct OrbisWrapperImpl; struct OrbisWrapperImpl;
template <class R, class... Args, PS4_SYSV_ABI R (*f)(Args...)> template <class R, class... Args, PS4_SYSV_ABI R (*f)(Args...)>
struct OrbisWrapperImpl<PS4_SYSV_ABI R (*)(Args...), f> { struct OrbisWrapperImpl<f> {
static R PS4_SYSV_ABI wrap(Args... args) { static R PS4_SYSV_ABI wrap(Args... args) {
u32 ret = f(args...); u32 ret = f(args...);
if (ret != 0) { if (ret != 0) {
@ -35,7 +35,7 @@ struct OrbisWrapperImpl<PS4_SYSV_ABI R (*)(Args...), f> {
} }
}; };
#define ORBIS(func) (Libraries::Kernel::OrbisWrapperImpl<decltype(&(func)), func>::wrap) #define ORBIS(func) (Libraries::Kernel::OrbisWrapperImpl<func>::wrap)
#define CURRENT_FIRMWARE_VERSION 0x13500011 #define CURRENT_FIRMWARE_VERSION 0x13500011

View File

@ -6,6 +6,7 @@
#include <functional> #include <functional>
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
#include "core/libraries/kernel/threads/pthread.h" #include "core/libraries/kernel/threads/pthread.h"
#include "core/tls.h"
namespace Core::Loader { namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;

View File

@ -45,16 +45,16 @@ Tcb* GetTcbBase();
/// Makes sure TLS is initialized for the thread before entering guest. /// Makes sure TLS is initialized for the thread before entering guest.
void InitializeTLS(); void InitializeTLS();
template <class F, F f> template <auto f>
struct HostCallWrapperImpl; struct HostCallWrapperImpl;
template <class ReturnType, class... Args, PS4_SYSV_ABI ReturnType (*func)(Args...)> template <class ReturnType, class... Args, PS4_SYSV_ABI ReturnType (*func)(Args...)>
struct HostCallWrapperImpl<PS4_SYSV_ABI ReturnType (*)(Args...), func> { struct HostCallWrapperImpl<func> {
static ReturnType PS4_SYSV_ABI wrap(Args... args) { static ReturnType PS4_SYSV_ABI wrap(Args... args) {
return func(args...); return func(args...);
} }
}; };
#define HOST_CALL(func) (Core::HostCallWrapperImpl<decltype(&(func)), func>::wrap) #define HOST_CALL(func) (Core::HostCallWrapperImpl<func>::wrap)
} // namespace Core } // namespace Core