1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00

Cleanup and move sysinfo.h -> util/sysinfo.hpp

This commit is contained in:
Nekotekina 2020-12-18 12:55:54 +03:00
parent 05099e2ae1
commit db9b7db531
24 changed files with 63 additions and 56 deletions

View File

@ -1,10 +1,10 @@
#include "util/types.hpp" #include "util/types.hpp"
#include "util/sysinfo.hpp"
#include "JIT.h" #include "JIT.h"
#include "StrFmt.h" #include "StrFmt.h"
#include "File.h" #include "File.h"
#include "util/logs.hpp" #include "util/logs.hpp"
#include "mutex.h" #include "mutex.h"
#include "sysinfo.h"
#include "util/vm.hpp" #include "util/vm.hpp"
#include <immintrin.h> #include <immintrin.h>
#include <zlib.h> #include <zlib.h>

View File

@ -7,7 +7,6 @@
#include "Emu/Cell/lv2/sys_event.h" #include "Emu/Cell/lv2/sys_event.h"
#include "Thread.h" #include "Thread.h"
#include "Utilities/JIT.h" #include "Utilities/JIT.h"
#include "sysinfo.h"
#include <typeinfo> #include <typeinfo>
#include <thread> #include <thread>
#include <sstream> #include <sstream>
@ -77,6 +76,7 @@
#include "util/vm.hpp" #include "util/vm.hpp"
#include "util/logs.hpp" #include "util/logs.hpp"
#include "util/asm.hpp" #include "util/asm.hpp"
#include "util/sysinfo.hpp"
#include "Emu/Memory/vm_locking.h" #include "Emu/Memory/vm_locking.h"
LOG_CHANNEL(sig_log, "SIG"); LOG_CHANNEL(sig_log, "SIG");

View File

@ -40,6 +40,7 @@ target_sources(rpcs3_emu PRIVATE
../util/cereal.cpp ../util/cereal.cpp
../util/vm_native.cpp ../util/vm_native.cpp
../util/dyn_lib.cpp ../util/dyn_lib.cpp
../util/sysinfo.cpp
../../Utilities/bin_patch.cpp ../../Utilities/bin_patch.cpp
../../Utilities/cheat_info.cpp ../../Utilities/cheat_info.cpp
../../Utilities/cond.cpp ../../Utilities/cond.cpp
@ -51,7 +52,6 @@ target_sources(rpcs3_emu PRIVATE
../../Utilities/rXml.cpp ../../Utilities/rXml.cpp
../../Utilities/sema.cpp ../../Utilities/sema.cpp
../../Utilities/StrFmt.cpp ../../Utilities/StrFmt.cpp
../../Utilities/sysinfo.cpp
../../Utilities/Thread.cpp ../../Utilities/Thread.cpp
../../Utilities/version.cpp ../../Utilities/version.cpp
) )

View File

@ -4,7 +4,6 @@
#include "Emu/Memory/vm_reservation.h" #include "Emu/Memory/vm_reservation.h"
#include "Emu/system_config.h" #include "Emu/system_config.h"
#include "PPUThread.h" #include "PPUThread.h"
#include "Utilities/sysinfo.h"
#include "Emu/Cell/Common.h" #include "Emu/Cell/Common.h"
#include "Emu/Cell/PPUFunction.h" #include "Emu/Cell/PPUFunction.h"
@ -13,6 +12,7 @@
#include "util/asm.hpp" #include "util/asm.hpp"
#include "util/v128.hpp" #include "util/v128.hpp"
#include "util/sysinfo.hpp"
#if !defined(_MSC_VER) && defined(__clang__) #if !defined(_MSC_VER) && defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push

View File

@ -1,5 +1,4 @@
#include "stdafx.h" #include "stdafx.h"
#include "Utilities/sysinfo.h"
#include "Utilities/JIT.h" #include "Utilities/JIT.h"
#include "Crypto/sha1.h" #include "Crypto/sha1.h"
#include "Emu/perf_meter.hpp" #include "Emu/perf_meter.hpp"

View File

@ -7,12 +7,12 @@
#include "SPUDisAsm.h" #include "SPUDisAsm.h"
#include "SPUThread.h" #include "SPUThread.h"
#include "SPUInterpreter.h" #include "SPUInterpreter.h"
#include "Utilities/sysinfo.h"
#include "PPUAnalyser.h" #include "PPUAnalyser.h"
#include "Crypto/sha1.h" #include "Crypto/sha1.h"
#include "util/asm.hpp" #include "util/asm.hpp"
#include "util/v128.hpp" #include "util/v128.hpp"
#include "util/sysinfo.hpp"
#include <cmath> #include <cmath>
#include <mutex> #include <mutex>

View File

@ -2,12 +2,12 @@
#include "SPUInterpreter.h" #include "SPUInterpreter.h"
#include "Utilities/JIT.h" #include "Utilities/JIT.h"
#include "Utilities/sysinfo.h"
#include "SPUThread.h" #include "SPUThread.h"
#include "Emu/Cell/Common.h" #include "Emu/Cell/Common.h"
#include "util/asm.hpp" #include "util/asm.hpp"
#include "util/v128.hpp" #include "util/v128.hpp"
#include "util/sysinfo.hpp"
#include <cmath> #include <cmath>
#include <cfenv> #include <cfenv>

View File

@ -7,7 +7,6 @@
#include "Crypto/sha1.h" #include "Crypto/sha1.h"
#include "Utilities/StrUtil.h" #include "Utilities/StrUtil.h"
#include "Utilities/JIT.h" #include "Utilities/JIT.h"
#include "Utilities/sysinfo.h"
#include "util/init_mutex.hpp" #include "util/init_mutex.hpp"
#include "SPUThread.h" #include "SPUThread.h"
@ -19,6 +18,7 @@
#include <thread> #include <thread>
#include "util/v128.hpp" #include "util/v128.hpp"
#include "util/sysinfo.hpp"
extern atomic_t<const char*> g_progr; extern atomic_t<const char*> g_progr;
extern atomic_t<u32> g_progr_ptotal; extern atomic_t<u32> g_progr_ptotal;

View File

@ -1,7 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "Utilities/JIT.h" #include "Utilities/JIT.h"
#include "Utilities/date_time.h" #include "Utilities/date_time.h"
#include "Utilities/sysinfo.h"
#include "Emu/Memory/vm.h" #include "Emu/Memory/vm.h"
#include "Emu/Memory/vm_ptr.h" #include "Emu/Memory/vm_ptr.h"
#include "Emu/Memory/vm_reservation.h" #include "Emu/Memory/vm_reservation.h"
@ -32,6 +31,7 @@
#include "util/vm.hpp" #include "util/vm.hpp"
#include "util/asm.hpp" #include "util/asm.hpp"
#include "util/v128.hpp" #include "util/v128.hpp"
#include "util/sysinfo.hpp"
using spu_rdata_t = decltype(spu_thread::rdata); using spu_rdata_t = decltype(spu_thread::rdata);

View File

@ -1,11 +1,11 @@
#include "stdafx.h" #include "stdafx.h"
#include "BufferUtils.h" #include "BufferUtils.h"
#include "../rsx_methods.h" #include "../rsx_methods.h"
#include "Utilities/sysinfo.h"
#include "../RSXThread.h" #include "../RSXThread.h"
#include "util/v128.hpp" #include "util/v128.hpp"
#include "util/to_endian.hpp" #include "util/to_endian.hpp"
#include "util/sysinfo.hpp"
#define DEBUG_VERTEX_STREAMING 0 #define DEBUG_VERTEX_STREAMING 0

View File

@ -4,12 +4,13 @@
#include "Emu/Cell/SPUThread.h" #include "Emu/Cell/SPUThread.h"
#include "Emu/Cell/RawSPUThread.h" #include "Emu/Cell/RawSPUThread.h"
#include "Emu/Cell/PPUThread.h" #include "Emu/Cell/PPUThread.h"
#include "Utilities/sysinfo.h"
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include <charconv> #include <charconv>
#include "util/sysinfo.hpp"
namespace rsx namespace rsx
{ {
namespace overlays namespace overlays

View File

@ -4,7 +4,6 @@
#include "Emu/RSX/GCM.h" #include "Emu/RSX/GCM.h"
#include "Common/BufferUtils.h" #include "Common/BufferUtils.h"
#include "Overlays/overlays.h" #include "Overlays/overlays.h"
#include "Utilities/sysinfo.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push, 0) #pragma warning(push, 0)
@ -24,6 +23,8 @@ extern "C"
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#include "util/sysinfo.hpp"
namespace rsx namespace rsx
{ {
atomic_t<u64> g_rsx_shared_tag{ 0 }; atomic_t<u64> g_rsx_shared_tag{ 0 };

View File

@ -28,10 +28,10 @@
#include "Loader/ELF.h" #include "Loader/ELF.h"
#include "Utilities/StrUtil.h" #include "Utilities/StrUtil.h"
#include "Utilities/sysinfo.h"
#include "../Crypto/unself.h" #include "../Crypto/unself.h"
#include "../Crypto/unpkg.h" #include "../Crypto/unpkg.h"
#include "util/sysinfo.hpp"
#include "util/yaml.hpp" #include "util/yaml.hpp"
#include "util/logs.hpp" #include "util/logs.hpp"

View File

@ -2,12 +2,13 @@
#include "util/types.hpp" #include "util/types.hpp"
#include "util/logs.hpp" #include "util/logs.hpp"
#include "Utilities/sysinfo.h"
#include "system_config.h" #include "system_config.h"
#include "IdManager.h" #include "IdManager.h"
#include <array> #include <array>
#include <cmath> #include <cmath>
#include "util/sysinfo.hpp"
LOG_CHANNEL(perf_log, "PERF"); LOG_CHANNEL(perf_log, "PERF");
// TODO: constexpr with the help of bitcast // TODO: constexpr with the help of bitcast

View File

@ -1,7 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "system_config.h" #include "system_config.h"
#include "Utilities/StrUtil.h" #include "Utilities/StrUtil.h"
#include "Utilities/sysinfo.h"
#include "util/sysinfo.hpp"
cfg_root g_cfg; cfg_root g_cfg;

View File

@ -1,7 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "title.h" #include "title.h"
#include "rpcs3_version.h" #include "rpcs3_version.h"
#include "Utilities/sysinfo.h"
#include "util/sysinfo.hpp"
namespace rpcs3 namespace rpcs3
{ {

View File

@ -165,12 +165,8 @@
<ClCompile Include="..\Utilities\StrFmt.cpp"> <ClCompile Include="..\Utilities\StrFmt.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="..\Utilities\sysinfo.cpp"> <ClCompile Include="util\sysinfo.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug - MemLeak|x64'">NotUsing</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="..\Utilities\Thread.cpp" /> <ClCompile Include="..\Utilities\Thread.cpp" />
<ClCompile Include="..\Utilities\version.cpp" /> <ClCompile Include="..\Utilities\version.cpp" />
@ -546,7 +542,7 @@
<ClInclude Include="..\Utilities\rXml.h" /> <ClInclude Include="..\Utilities\rXml.h" />
<ClInclude Include="..\Utilities\StrFmt.h" /> <ClInclude Include="..\Utilities\StrFmt.h" />
<ClInclude Include="..\Utilities\StrUtil.h" /> <ClInclude Include="..\Utilities\StrUtil.h" />
<ClInclude Include="..\Utilities\sysinfo.h" /> <ClInclude Include="util\sysinfo.hpp" />
<ClInclude Include="..\Utilities\Thread.h" /> <ClInclude Include="..\Utilities\Thread.h" />
<ClInclude Include="..\Utilities\Timer.h" /> <ClInclude Include="..\Utilities\Timer.h" />
<ClInclude Include="util\types.hpp" /> <ClInclude Include="util\types.hpp" />

View File

@ -782,7 +782,7 @@
<ClCompile Include="Emu\Cell\lv2\sys_ss.cpp"> <ClCompile Include="Emu\Cell\lv2\sys_ss.cpp">
<Filter>Emu\Cell\lv2</Filter> <Filter>Emu\Cell\lv2</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\Utilities\sysinfo.cpp"> <ClCompile Include="util\sysinfo.cpp">
<Filter>Utilities</Filter> <Filter>Utilities</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Emu\Cell\lv2\sys_gamepad.cpp"> <ClCompile Include="Emu\Cell\lv2\sys_gamepad.cpp">
@ -1624,7 +1624,7 @@
<ClInclude Include="..\Utilities\CRC.h"> <ClInclude Include="..\Utilities\CRC.h">
<Filter>Utilities</Filter> <Filter>Utilities</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Utilities\sysinfo.h"> <ClInclude Include="util\sysinfo.hpp">
<Filter>Utilities</Filter> <Filter>Utilities</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Emu\RSX\Common\GLSLCommon.h"> <ClInclude Include="Emu\RSX\Common\GLSLCommon.h">

View File

@ -37,7 +37,6 @@ DYNAMIC_IMPORT("ntdll.dll", NtSetTimerResolution, NTSTATUS(ULONG DesiredResoluti
#include <dispatch/dispatch.h> #include <dispatch/dispatch.h>
#endif #endif
#include "Utilities/sysinfo.h"
#include "Utilities/Config.h" #include "Utilities/Config.h"
#include "Utilities/Thread.h" #include "Utilities/Thread.h"
#include "rpcs3_version.h" #include "rpcs3_version.h"
@ -46,6 +45,7 @@ DYNAMIC_IMPORT("ntdll.dll", NtSetTimerResolution, NTSTATUS(ULONG DesiredResoluti
#include <charconv> #include <charconv>
#include "util/v128.hpp" #include "util/v128.hpp"
#include "util/sysinfo.hpp"
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }

View File

@ -4,7 +4,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "rpcs3_version.h" #include "rpcs3_version.h"
#include "Utilities/sysinfo.h"
#include "Utilities/mutex.h" #include "Utilities/mutex.h"
#include "Utilities/lockless.h" #include "Utilities/lockless.h"
@ -19,6 +18,8 @@
#include <deque> #include <deque>
#include <mutex> #include <mutex>
#include "util/sysinfo.hpp"
extern fs::file g_tty; extern fs::file g_tty;
extern atomic_t<s64> g_tty_size; extern atomic_t<s64> g_tty_size;
extern std::array<std::deque<std::string>, 16> g_tty_input; extern std::array<std::deque<std::string>, 16> g_tty_input;

View File

@ -28,12 +28,13 @@
#include "Emu/system_config.h" #include "Emu/system_config.h"
#include "Emu/title.h" #include "Emu/title.h"
#include "Crypto/unself.h" #include "Crypto/unself.h"
#include "Utilities/sysinfo.h"
#include <set> #include <set>
#include <unordered_set> #include <unordered_set>
#include <thread> #include <thread>
#include "util/sysinfo.hpp"
#ifdef WITH_DISCORD_RPC #ifdef WITH_DISCORD_RPC
#include "_discord_utils.h" #include "_discord_utils.h"
#endif #endif

View File

@ -1,6 +1,7 @@
#include "atomic2.hpp" #include "atomic2.hpp"
#include "Utilities/JIT.h" #include "Utilities/JIT.h"
#include "Utilities/sysinfo.h"
#include "util/sysinfo.hpp"
// //
static const bool s_use_rtm = utils::has_rtm(); static const bool s_use_rtm = utils::has_rtm();

View File

@ -1,8 +1,8 @@
#include "sysinfo.h" #include "util/sysinfo.hpp"
#include "StrFmt.h" #include "Utilities/StrFmt.h"
#include "File.h" #include "Utilities/File.h"
#include "Emu/system_config.h" #include "Emu/system_config.h"
#include "Thread.h" #include "Utilities/Thread.h"
#ifdef _WIN32 #ifdef _WIN32
#include "windows.h" #include "windows.h"
@ -15,6 +15,28 @@
#include <errno.h> #include <errno.h>
#endif #endif
inline std::array<u32, 4> utils::get_cpuid(u32 func, u32 subfunc)
{
int regs[4];
#ifdef _MSC_VER
__cpuidex(regs, func, subfunc);
#else
__asm__ volatile("cpuid" : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3]) : "a" (func), "c" (subfunc));
#endif
return {0u+regs[0], 0u+regs[1], 0u+regs[2], 0u+regs[3]};
}
inline u64 utils::get_xgetbv(u32 xcr)
{
#ifdef _MSC_VER
return _xgetbv(xcr);
#else
u32 eax, edx;
__asm__ volatile("xgetbv" : "=a"(eax), "=d"(edx) : "c"(xcr));
return eax | (u64(edx) << 32);
#endif
}
bool utils::has_ssse3() bool utils::has_ssse3()
{ {
static const bool g_value = get_cpuid(0, 0)[0] >= 0x1 && get_cpuid(1, 0)[2] & 0x200; static const bool g_value = get_cpuid(0, 0)[0] >= 0x1 && get_cpuid(1, 0)[2] & 0x200;

View File

@ -5,27 +5,9 @@
namespace utils namespace utils
{ {
inline std::array<u32, 4> get_cpuid(u32 func, u32 subfunc) std::array<u32, 4> get_cpuid(u32 func, u32 subfunc);
{
int regs[4];
#ifdef _MSC_VER
__cpuidex(regs, func, subfunc);
#else
__asm__ volatile("cpuid" : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3]) : "a" (func), "c" (subfunc));
#endif
return {0u+regs[0], 0u+regs[1], 0u+regs[2], 0u+regs[3]};
}
inline u64 get_xgetbv(u32 xcr) u64 get_xgetbv(u32 xcr);
{
#ifdef _MSC_VER
return _xgetbv(xcr);
#else
u32 eax, edx;
__asm__ volatile( "xgetbv" : "=a"(eax), "=d"(edx) : "c"(xcr));
return eax | (u64(edx) << 32);
#endif
}
bool has_ssse3(); bool has_ssse3();