[+] arm vendor and processor strings
This commit is contained in:
parent
de6d512bf4
commit
e7871473e7
@ -1,4 +1,4 @@
|
||||
/***
|
||||
/***
|
||||
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: AuCpuId.cpp
|
||||
@ -22,6 +22,11 @@
|
||||
#include <sys/auxv.h>
|
||||
#endif
|
||||
|
||||
namespace Aurora::SWInfo
|
||||
{
|
||||
bool Win32ReadRegistry(HKEY hKey, const wchar_t *pWideKey, AuString &strValue);
|
||||
}
|
||||
|
||||
namespace Aurora::HWInfo
|
||||
{
|
||||
static AuUInt32 gGuessedCores {};
|
||||
@ -598,8 +603,19 @@ namespace Aurora::HWInfo
|
||||
bHasSpecialRegisters = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ID_AA64SMFR0_EL1 tbd
|
||||
|
||||
// ID_AA64SMFR0_EL1 tbd. from this old ass screenshot i saw, this might be it.
|
||||
if (pRegQueryValueExW(hKey, L"CP 4100", NULL, &dwType, AuReinterpretCast<LPBYTE>(&uValue), &dwSize) == ERROR_SUCCESS)
|
||||
{
|
||||
if (dwType == REG_QWORD || dwType == REG_DWORD || dwType == REG_BINARY)
|
||||
{
|
||||
gCpuInfo.cpuId.ID_AA64SMFR0_EL1 = uValue;
|
||||
bHasSpecialRegisters = true;
|
||||
}
|
||||
}
|
||||
|
||||
AuSwInfo::Win32ReadRegistry(hKey, L"ProcessorNameString", gCpuInfo.cpuId.brand);
|
||||
AuSwInfo::Win32ReadRegistry(hKey, L"VendorIdentifier", gCpuInfo.cpuId.vendor);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1012,6 +1028,194 @@ namespace Aurora::HWInfo
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// Microsoft, ever so lovely Microsoft, guess which kernel has a vendor string and processor name keystore?
|
||||
// You guessed it, Microsoft NT.
|
||||
// Guess which shit kernel doesn't have any CPU driver reporting files? No CPU vendor string stores? No processor brand fetching?
|
||||
// Guess which shit kernel needs to be forked by every OEM to support their chipset?
|
||||
// You guessed it, linda torbalds' shit toy kernel.
|
||||
//
|
||||
// arch/arm64/kernel/cpuinfo.c contains NOTHANG of use.
|
||||
// ...thats unless you're looking at an OEMs tree, in which case, they'll probably add the following values with various formatting techniques:
|
||||
//
|
||||
// Hardware: ??? | gCpuInfo.cpuId.brand
|
||||
// ????????: ??? | gCpuInfo.cpuId.vendor, kernel string is more of a tell
|
||||
// Serial: ??? | dont care
|
||||
//
|
||||
// Raspbery Pis report:
|
||||
// Model: Raspberry Pi X Model X Rev X.X | gCpuInfo.cpuId.vendor
|
||||
//
|
||||
// Thanks OEMs for writing dogshit hacks on top of torbalds kernel and making your changes somewhat consistent with each other
|
||||
// That's more effort and community respect than what we can expect from General "Torbalds" McMutt.
|
||||
{
|
||||
AuString ah;
|
||||
|
||||
if (AuFS::ReadString("/proc/cpuinfo", ah))
|
||||
{
|
||||
// raspberry pi has double \ts, reference file only uses 1x \t
|
||||
AuReplaceAll(ah, "\t", " ");
|
||||
// cant be arsed
|
||||
AuReplaceAll(ah, " ", " ");
|
||||
// may as well delimit by `:`
|
||||
AuReplaceAll(ah, " :", ":");
|
||||
// now we might have something more parsable
|
||||
|
||||
static AuROString lookUp;
|
||||
|
||||
AuParse::SplitNewlines(ah, [](const AuROString &line)
|
||||
{
|
||||
if (AuStartsWith(line, "Model:"))
|
||||
{
|
||||
gCpuInfo.cpuId.vendor = line.SubStr(6);
|
||||
}
|
||||
if (AuStartsWith(line, "Hardware:"))
|
||||
{
|
||||
gCpuInfo.cpuId.brand = line.SubStr(9);
|
||||
}
|
||||
if (AuStartsWith(line, "CPU implementer:"))
|
||||
{
|
||||
auto optImplementer = AuParse::ParseUInt16(line.SubStr(16));
|
||||
if (optImplementer)
|
||||
{
|
||||
auto uVendorID = optImplementer.value();
|
||||
|
||||
if (uVendorID == 0x41)
|
||||
{
|
||||
// nice company stamp you got there.
|
||||
// you don't get to idnt as a british company after a chinese man stole your ip & wont let you do anything besides lolsuit qualcomm.
|
||||
gCpuInfo.cpuId.vendor = "Arm Holdings 有限公司";
|
||||
}
|
||||
if (uVendorID == 0x61)
|
||||
{
|
||||
// yea, i'm not calling you "Apple Inc"
|
||||
// <turn your brand into a religion.webp>
|
||||
// i'm thinking, no, you're still a terrible computer company and will be addressed as such.
|
||||
gCpuInfo.cpuId.vendor = "Apple Computer, Inc";
|
||||
}
|
||||
if (uVendorID == 0x51)
|
||||
{
|
||||
// finally, a respectable company.
|
||||
gCpuInfo.cpuId.vendor = "Qualcomm Technologies Inc";
|
||||
}
|
||||
if (uVendorID == 0x42 || uVendorID == 0x43)
|
||||
{
|
||||
// welp, that lasted long.
|
||||
gCpuInfo.cpuId.vendor = "Broadcom Inc";
|
||||
}
|
||||
if (uVendorID == 0xc0)
|
||||
{
|
||||
// 2 more weeks. we believe in you.
|
||||
gCpuInfo.cpuId.vendor = "Ampere Computing LLC";
|
||||
}
|
||||
if (uVendorID == 0x46)
|
||||
{
|
||||
// guess we're playing blockgame on toasters now.
|
||||
gCpuInfo.cpuId.vendor = "Fujitsu Ltd";
|
||||
}
|
||||
if (uVendorID == 0x4e)
|
||||
{
|
||||
// worthy of note, most nvidia products idnt as 0x41.
|
||||
gCpuInfo.cpuId.vendor = "Nvidia Corporation";
|
||||
}
|
||||
if (uVendorID == 0x48)
|
||||
{
|
||||
// calm down, mcmutts.
|
||||
gCpuInfo.cpuId.vendor = "Huawei Technologies Co., Ltd";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AuStartsWith(line, "CPU part:"))
|
||||
{
|
||||
static const AuBST<AuUInt16, AuROString> kDriveMap = {
|
||||
{ 0x810, "ARM810" },
|
||||
{ 0x920, "ARM920" },
|
||||
{ 0x922, "ARM922" },
|
||||
{ 0x926, "ARM926" },
|
||||
{ 0x940, "ARM940" },
|
||||
{ 0x946, "ARM946" },
|
||||
{ 0x966, "ARM966" },
|
||||
{ 0xa20, "ARM1020" },
|
||||
{ 0xa22, "ARM1022" },
|
||||
{ 0xa26, "ARM1026" },
|
||||
{ 0xb02, "ARM11 MPCore" },
|
||||
{ 0xb36, "ARM1136" },
|
||||
{ 0xb56, "ARM1156" },
|
||||
{ 0xb76, "ARM1176" },
|
||||
{ 0xc05, "Cortex-A5" },
|
||||
{ 0xc07, "Cortex-A7" },
|
||||
{ 0xc08, "Cortex-A8" },
|
||||
{ 0xc09, "Cortex-A9" },
|
||||
{ 0xc0d, "Cortex-A17" },
|
||||
{ 0xc0f, "Cortex-A15" },
|
||||
{ 0xc0e, "Cortex-A17" },
|
||||
{ 0xc14, "Cortex-R4" },
|
||||
{ 0xc15, "Cortex-R5" },
|
||||
{ 0xc17, "Cortex-R7" },
|
||||
{ 0xc18, "Cortex-R8" },
|
||||
{ 0xc20, "Cortex-M0" },
|
||||
{ 0xc21, "Cortex-M1" },
|
||||
{ 0xc23, "Cortex-M3" },
|
||||
{ 0xc24, "Cortex-M4" },
|
||||
{ 0xc27, "Cortex-M7" },
|
||||
{ 0xc60, "Cortex-M0+" },
|
||||
{ 0xd01, "Cortex-A32" },
|
||||
{ 0xd02, "Cortex-A34" },
|
||||
{ 0xd03, "Cortex-A53" },
|
||||
{ 0xd04, "Cortex-A35" },
|
||||
{ 0xd05, "Cortex-A55" },
|
||||
{ 0xd06, "Cortex-A65" },
|
||||
{ 0xd07, "Cortex-A57" },
|
||||
{ 0xd08, "Cortex-A72" },
|
||||
{ 0xd09, "Cortex-A73" },
|
||||
{ 0xd0a, "Cortex-A75" },
|
||||
{ 0xd0b, "Cortex-A76" },
|
||||
{ 0xd0c, "Neoverse-N1" },
|
||||
{ 0xd0d, "Cortex-A77" },
|
||||
{ 0xd0e, "Cortex-A76AE" },
|
||||
{ 0xd13, "Cortex-R52" },
|
||||
{ 0xd20, "Cortex-M23" },
|
||||
{ 0xd21, "Cortex-M33" },
|
||||
{ 0xd40, "Neoverse-V1" },
|
||||
{ 0xd41, "Cortex-A78" },
|
||||
{ 0xd42, "Cortex-A78AE" },
|
||||
{ 0xd43, "Cortex-A65AE" },
|
||||
{ 0xd44, "Cortex-X1" },
|
||||
{ 0xd46, "Cortex-A510" },
|
||||
{ 0xd47, "Cortex-A710" },
|
||||
{ 0xd48, "Cortex-X2" },
|
||||
{ 0xd49, "Neoverse-N2" },
|
||||
{ 0xd4a, "Neoverse-E1" },
|
||||
{ 0xd4b, "Cortex-A78C" },
|
||||
{ 0xd4c, "Cortex-X1C" },
|
||||
{ 0xd4d, "Cortex-A715" },
|
||||
{ 0xd4e, "Cortex-X3"} };
|
||||
|
||||
auto optImplementer = AuParse::ParseUInt16(line.SubStr(9));
|
||||
if (optImplementer)
|
||||
{
|
||||
auto itr = kDriveMap.find(optImplementer.value());
|
||||
if (itr != kDriveMap.end())
|
||||
{
|
||||
lookUp = itr->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!lookUp.Empty())
|
||||
{
|
||||
if (gCpuInfo.cpuId.brand.empty())
|
||||
{
|
||||
gCpuInfo.cpuId.brand = lookUp;
|
||||
}
|
||||
else
|
||||
{
|
||||
gCpuInfo.cpuId.brand = AuString(lookUp) + ": " + gCpuInfo.cpuId.brand;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user