diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index bbd834a6b6..8d60f9f996 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -52,9 +52,11 @@ u32 _sys_heap_memalign(u32 heap_id, u32 align, u32 size) return (u32)Memory.Alloc(size, align); } -void sys_initialize_tls() +u128 sys_initialize_tls(u128 arg) { sysPrxForUser->Log("sys_initialize_tls()"); + + return arg; } s64 _sys_process_atexitspawn() diff --git a/rpcs3/Emu/SysCalls/SC_FUNC.h b/rpcs3/Emu/SysCalls/SC_FUNC.h index 72fd52e847..68039bf993 100644 --- a/rpcs3/Emu/SysCalls/SC_FUNC.h +++ b/rpcs3/Emu/SysCalls/SC_FUNC.h @@ -46,11 +46,11 @@ namespace detail template struct bind_arg { - static_assert(sizeof(T) == 16, "Wrong argument type for ARG_VECTOR"); + static_assert(std::is_same::value, "Wrong argument type for ARG_VECTOR"); static __forceinline T func(PPUThread& CPU) { - return (T&)CPU.VPR[v_count + 1]._u128; + return (T&)CPU.VPR[v_count + 1]; } }; @@ -69,9 +69,11 @@ namespace detail template struct bind_result { + static_assert(!std::is_pointer::value, "Invalid function result type: pointer"); + static_assert(sizeof(T) <= 8, "Invalid function result type"); + static __forceinline void func(PPUThread& CPU, T value) { - static_assert(!std::is_pointer::value, "Invalid function result type: pointer"); if (std::is_floating_point::value) { CPU.FPR[1] = (double)value; @@ -83,6 +85,15 @@ namespace detail } }; + template<> + struct bind_result + { + static __forceinline void func(PPUThread& CPU, u128 value) + { + CPU.VPR[2] = value; + } + }; + template struct call_impl { @@ -120,12 +131,13 @@ namespace detail static_assert(!std::is_pointer::value, "Invalid function argument type: pointer"); // TODO: check calculations const bool is_float = std::is_floating_point::value; + const bool is_vector = std::is_same::value; const bind_arg_type t = is_float ? ((f_count >= 12) ? ARG_STACK : ARG_FLOAT) - : ((g_count >= 8) ? ARG_STACK : ARG_GENERAL); - const int g = g_count + (is_float ? 0 : 1); + : (is_vector ? ((v_count >= 12) ? ARG_STACK : ARG_VECTOR) : ((g_count >= 8) ? ARG_STACK : ARG_GENERAL)); + const int g = g_count + (is_float || is_vector ? 0 : 1); const int f = f_count + (is_float ? 1 : 0); - const int v = v_count; // TODO: vector argument support (if possible) + const int v = v_count + (is_vector ? 1 : 0); return std::tuple_cat(std::tuple(bind_arg::func(CPU)), iterate(CPU)); }