mirror of
https://github.com/SSimco/Cemu.git
synced 2024-11-22 21:09:38 +00:00
Implemented getting cpu brand name for arch64 linux
This commit is contained in:
parent
d2f81f30ab
commit
ac4ad1f7af
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -21,3 +21,6 @@
|
||||
[submodule "dependencies/xbyak_aarch64"]
|
||||
path = dependencies/xbyak_aarch64
|
||||
url = https://github.com/fujitsu/xbyak_aarch64
|
||||
[submodule "dependencies/cpuid"]
|
||||
path = dependencies/cpuid
|
||||
url = https://github.com/SSimco/cpuid
|
||||
|
@ -248,6 +248,7 @@ add_subdirectory("dependencies/ih264d" EXCLUDE_FROM_ALL)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(AARCH64)")
|
||||
add_subdirectory("dependencies/xbyak_aarch64" EXCLUDE_FROM_ALL)
|
||||
add_subdirectory("dependencies/cpuid" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
find_package(ZArchive)
|
||||
|
1
dependencies/cpuid
vendored
Submodule
1
dependencies/cpuid
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 45598b97c01ebf2ab760baa737350f64ee81a4c9
|
@ -85,6 +85,9 @@ endif()
|
||||
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
target_link_libraries(CemuCommon PRIVATE X11::X11 X11::Xrender X11::Xutil)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(AARCH64)")
|
||||
target_link_libraries(CemuCommon PRIVATE cpuid)
|
||||
endif()
|
||||
|
||||
# PUBLIC because:
|
||||
# - boost/predef/os.h is included in platform.h
|
||||
|
@ -27,9 +27,23 @@ inline void cpuidex(int cpuInfo[4], int functionId, int subFunctionId) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__aarch64__)
|
||||
#if BOOST_OS_LINUX
|
||||
#include "cpuid.h"
|
||||
#endif // BOOST_OS_LINUX
|
||||
#endif // defined(__aarch64__)
|
||||
|
||||
CPUFeaturesImpl::CPUFeaturesImpl()
|
||||
{
|
||||
#if defined(__aarch64__)
|
||||
#if BOOST_OS_LINUX
|
||||
#if __ANDROID__
|
||||
m_cpuBrandName = cpuid::getCpuBrandNameAndroid().value_or(cpuid::getCpuBrandNameLinux());
|
||||
#else
|
||||
m_cpuBrandName = cpuid::getCpuBrandNameLinux();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if defined(ARCH_X86_64)
|
||||
int cpuInfo[4];
|
||||
cpuid(cpuInfo, 0x80000001);
|
||||
@ -47,19 +61,21 @@ CPUFeaturesImpl::CPUFeaturesImpl()
|
||||
x86.invariant_tsc = ((cpuInfo[3] >> 8) & 1);
|
||||
// get CPU brand name
|
||||
uint32_t nExIds, i = 0;
|
||||
memset(m_cpuBrandName, 0, sizeof(m_cpuBrandName));
|
||||
char cpuBrandName[0x40]{ 0 };
|
||||
memset(cpuBrandName, 0, sizeof(cpuBrandName));
|
||||
cpuid(cpuInfo, 0x80000000);
|
||||
nExIds = (uint32_t)cpuInfo[0];
|
||||
for (uint32_t i = 0x80000000; i <= nExIds; ++i)
|
||||
{
|
||||
cpuid(cpuInfo, i);
|
||||
if (i == 0x80000002)
|
||||
memcpy(m_cpuBrandName, cpuInfo, sizeof(cpuInfo));
|
||||
memcpy(cpuBrandName, cpuInfo, sizeof(cpuInfo));
|
||||
else if (i == 0x80000003)
|
||||
memcpy(m_cpuBrandName + 16, cpuInfo, sizeof(cpuInfo));
|
||||
memcpy(cpuBrandName + 16, cpuInfo, sizeof(cpuInfo));
|
||||
else if (i == 0x80000004)
|
||||
memcpy(m_cpuBrandName + 32, cpuInfo, sizeof(cpuInfo));
|
||||
memcpy(cpuBrandName + 32, cpuInfo, sizeof(cpuInfo));
|
||||
}
|
||||
m_cpuBrandName = cpuBrandName;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
bool invariant_tsc{ false };
|
||||
}x86;
|
||||
private:
|
||||
char m_cpuBrandName[0x40]{ 0 };
|
||||
std::string m_cpuBrandName;
|
||||
};
|
||||
|
||||
extern CPUFeaturesImpl g_CPUFeatures;
|
Loading…
Reference in New Issue
Block a user