Compare commits

..

3 Commits
i230 ... i262

Author SHA1 Message Date
Dr-Noob
dcdec28b86 [v1.05][ARM] Improve Ampere logo 2024-08-18 14:55:37 +01:00
Dr-Noob
0d7806d9f4 [v1.05] Remove filter_pci_devices 2024-08-18 14:55:21 +01:00
Dr-Noob
38f02dc22a [v1.05][ARM] Add support for Ampere Altra (#262) 2024-08-15 19:30:35 +01:00
11 changed files with 31 additions and 209 deletions

View File

@@ -30,10 +30,6 @@ ifneq ($(OS),Windows_NT)
HEADERS += $(SRC_DIR)freq/freq.h HEADERS += $(SRC_DIR)freq/freq.h
CFLAGS += -pthread CFLAGS += -pthread
endif endif
ifeq ($(os), FreeBSD)
SOURCE += $(SRC_COMMON)sysctl.c
HEADERS += $(SRC_COMMON)sysctl.h
endif
CFLAGS += -DARCH_X86 -std=c99 -fstack-protector-all CFLAGS += -DARCH_X86 -std=c99 -fstack-protector-all
else ifeq ($(arch), $(filter $(arch), ppc64le ppc64 ppcle ppc)) else ifeq ($(arch), $(filter $(arch), ppc64le ppc64 ppcle ppc))
SRC_DIR=src/ppc/ SRC_DIR=src/ppc/

View File

@@ -412,7 +412,6 @@ struct cpuInfo* get_cpu_info_mach(struct cpuInfo* cpu) {
cpu->peak_performance = get_peak_performance(cpu); cpu->peak_performance = get_peak_performance(cpu);
} }
else if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH || else if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH ||
cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_2 ||
cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO || cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO ||
cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_MAX) { cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_MAX) {
fill_cpu_info_everest_sawtooth(cpu, pcores, ecores); fill_cpu_info_everest_sawtooth(cpu, pcores, ecores);
@@ -449,7 +448,7 @@ char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_soc
char* get_str_features(struct cpuInfo* cpu) { char* get_str_features(struct cpuInfo* cpu) {
struct features* feat = cpu->feat; struct features* feat = cpu->feat;
uint32_t max_len = strlen("NEON,SHA1,SHA2,AES,CRC32,SVE,SVE2,") + 1; uint32_t max_len = strlen("NEON,SHA1,SHA2,AES,CRC32,SVE,SVE2") + 1;
uint32_t len = 0; uint32_t len = 0;
char* string = ecalloc(max_len, sizeof(char)); char* string = ecalloc(max_len, sizeof(char));

View File

@@ -895,79 +895,6 @@ struct system_on_chip* guess_soc_from_uarch(struct system_on_chip* soc, struct c
return soc; return soc;
} }
// Return the dt string without the NULL characters.
char* get_dt_str(char* dt, int filelen) {
char* dt_without_null = (char *) malloc(sizeof(char) * filelen);
memcpy(dt_without_null, dt, filelen);
for (int i=0; i < filelen-1; i++) {
if (dt_without_null[i] == '\0')
dt_without_null[i] = ',';
}
return dt_without_null;
}
bool match_dt(struct system_on_chip* soc, char* dt, int filelen, char* expected_name, char* soc_name, SOC soc_model, int32_t process) {
// The /proc/device-tree/compatible file (passed by dt) uses NULL
// to separate the strings, so we need to make an special case here
// and iterate over the NULL characters, thus iterating over each
// individual compatible strings.
if (strstr(dt, expected_name) != NULL) {
fill_soc(soc, soc_name, soc_model, process);
return true;
}
char *compatible = dt;
char *end_of_dt = dt + filelen;
while ((compatible = strchr(compatible, '\0')) != end_of_dt) {
compatible++;
if (strstr(compatible, expected_name) != NULL) {
fill_soc(soc, soc_name, soc_model, process);
return true;
}
}
return false;
}
#define DT_START if (false) {}
#define DT_EQ(dt, filelen, soc, expected_name, soc_name, soc_model, process) \
else if (match_dt(soc, dt, filelen, expected_name, soc_name, soc_model, process)) return soc;
#define DT_END(dt, filelen) else { printWarn("guess_soc_from_devtree: No match found for '%s'", get_dt_str(dt, filelen)); return soc; }
// TODO: Move this to doc
// The number of fields seems non-standard, so for now it seems wiser
// to just get the entire string with all fields and just look for the
// substring.
// TODO: Implement this by going trough NULL-separated fields rather than
// using strstr.
struct system_on_chip* guess_soc_from_devtree(struct system_on_chip* soc) {
int len;
char* dt = get_devtree_compatible(&len);
if (dt == NULL) {
return soc;
}
// The following are internal codenames of Asahi Linux
// https://github.com/AsahiLinux/docs/wiki/Codenames
DT_START
DT_EQ(dt, len, soc, "apple,t8103", "M1", SOC_APPLE_M1, 5)
DT_EQ(dt, len, soc, "apple,t6000", "M1 Pro", SOC_APPLE_M1_PRO, 5)
DT_EQ(dt, len, soc, "apple,t6001", "M1 Max", SOC_APPLE_M1_MAX, 5)
DT_EQ(dt, len, soc, "apple,t6002", "M1 Ultra", SOC_APPLE_M1_ULTRA, 5)
DT_EQ(dt, len, soc, "apple,t8112", "M2", SOC_APPLE_M2, 5)
DT_EQ(dt, len, soc, "apple,t6020", "M2 Pro", SOC_APPLE_M2_PRO, 5)
DT_EQ(dt, len, soc, "apple,t6021", "M2 Max", SOC_APPLE_M2_MAX, 5)
DT_EQ(dt, len, soc, "apple,t6022", "M2 Ultra", SOC_APPLE_M2_ULTRA, 5)
DT_EQ(dt, len, soc, "apple,t8122", "M3", SOC_APPLE_M3, 3)
DT_EQ(dt, len, soc, "apple,t6030", "M3 Pro", SOC_APPLE_M3_PRO, 3)
DT_EQ(dt, len, soc, "apple,t6031", "M3 Max", SOC_APPLE_M3_MAX, 3)
DT_EQ(dt, len, soc, "apple,t6034", "M3 Max", SOC_APPLE_M3_MAX, 3)
DT_END(dt, len)
}
struct system_on_chip* guess_soc_from_pci(struct system_on_chip* soc, struct cpuInfo* cpu) { struct system_on_chip* guess_soc_from_pci(struct system_on_chip* soc, struct cpuInfo* cpu) {
struct pci_devices * pci = get_pci_devices(); struct pci_devices * pci = get_pci_devices();
if (pci == NULL) { if (pci == NULL) {
@@ -1115,12 +1042,10 @@ struct system_on_chip* guess_soc_apple(struct system_on_chip* soc) {
} }
} }
else if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH || else if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH ||
cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_2 ||
cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO || cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO ||
cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_MAX) { cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_MAX) {
// Check M3 version // Check M3 version
if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH || if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH) {
cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_2) {
fill_soc(soc, "M3", SOC_APPLE_M3, 3); fill_soc(soc, "M3", SOC_APPLE_M3, 3);
} }
else if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO) { else if(cpu_family == CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO) {
@@ -1178,10 +1103,6 @@ struct system_on_chip* get_soc(struct cpuInfo* cpu) {
printWarn("SoC detection failed using Android: Found '%s' string", soc->raw_name); printWarn("SoC detection failed using Android: Found '%s' string", soc->raw_name);
} }
#endif // ifdef __ANDROID__ #endif // ifdef __ANDROID__
// If previous steps failed, try with the device tree
if (soc->soc_vendor == SOC_VENDOR_UNKNOWN) {
soc = guess_soc_from_devtree(soc);
}
// If previous steps failed, try with nvmem // If previous steps failed, try with nvmem
if(soc->soc_vendor == SOC_VENDOR_UNKNOWN) { if(soc->soc_vendor == SOC_VENDOR_UNKNOWN) {
soc = guess_soc_from_nvmem(soc); soc = guess_soc_from_nvmem(soc);

View File

@@ -33,7 +33,6 @@ enum {
ISA_ARMv8_3_A, ISA_ARMv8_3_A,
ISA_ARMv8_4_A, ISA_ARMv8_4_A,
ISA_ARMv8_5_A, ISA_ARMv8_5_A,
ISA_ARMv8_6_A,
ISA_ARMv9_A ISA_ARMv9_A
}; };
@@ -94,10 +93,8 @@ static const ISA isas_uarch[] = {
[UARCH_EXYNOS_M5] = ISA_ARMv8_2_A, [UARCH_EXYNOS_M5] = ISA_ARMv8_2_A,
[UARCH_ICESTORM] = ISA_ARMv8_5_A, // https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/AArch64TargetParser.def [UARCH_ICESTORM] = ISA_ARMv8_5_A, // https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/AArch64TargetParser.def
[UARCH_FIRESTORM] = ISA_ARMv8_5_A, [UARCH_FIRESTORM] = ISA_ARMv8_5_A,
[UARCH_BLIZZARD] = ISA_ARMv8_6_A, // https://github.com/llvm/llvm-project/blob/main/llvm/unittests/TargetParser/TargetParserTest.cpp [UARCH_BLIZZARD] = ISA_ARMv8_5_A, // Not confirmed
[UARCH_AVALANCHE] = ISA_ARMv8_6_A, // https://github.com/llvm/llvm-project/blob/main/llvm/unittests/TargetParser/TargetParserTest.cpp [UARCH_AVALANCHE] = ISA_ARMv8_5_A,
[UARCH_SAWTOOTH] = ISA_ARMv8_6_A, // https://github.com/llvm/llvm-project/blob/main/llvm/unittests/TargetParser/TargetParserTest.cpp
[UARCH_EVEREST] = ISA_ARMv8_6_A, // https://github.com/llvm/llvm-project/blob/main/llvm/unittests/TargetParser/TargetParserTest.cpp
[UARCH_PJ4] = ISA_ARMv7_A, [UARCH_PJ4] = ISA_ARMv7_A,
[UARCH_XIAOMI] = ISA_ARMv8_A, [UARCH_XIAOMI] = ISA_ARMv8_A,
}; };
@@ -115,7 +112,6 @@ static char* isas_string[] = {
[ISA_ARMv8_3_A] = "ARMv8.3", [ISA_ARMv8_3_A] = "ARMv8.3",
[ISA_ARMv8_4_A] = "ARMv8.4", [ISA_ARMv8_4_A] = "ARMv8.4",
[ISA_ARMv8_5_A] = "ARMv8.5", [ISA_ARMv8_5_A] = "ARMv8.5",
[ISA_ARMv8_6_A] = "ARMv8.6",
[ISA_ARMv9_A] = "ARMv9" [ISA_ARMv9_A] = "ARMv9"
}; };
@@ -252,8 +248,6 @@ struct uarch* get_uarch_from_midr(uint32_t midr, struct cpuInfo* cpu) {
CHECK_UARCH(arch, cpu, 'a', 0x022, NA, NA, "Icestorm", UARCH_ICESTORM, CPU_VENDOR_APPLE) CHECK_UARCH(arch, cpu, 'a', 0x022, NA, NA, "Icestorm", UARCH_ICESTORM, CPU_VENDOR_APPLE)
CHECK_UARCH(arch, cpu, 'a', 0x023, NA, NA, "Firestorm", UARCH_FIRESTORM, CPU_VENDOR_APPLE) CHECK_UARCH(arch, cpu, 'a', 0x023, NA, NA, "Firestorm", UARCH_FIRESTORM, CPU_VENDOR_APPLE)
CHECK_UARCH(arch, cpu, 'a', 0x024, NA, NA, "Icestorm", UARCH_ICESTORM, CPU_VENDOR_APPLE) // https://github.com/Dr-Noob/cpufetch/issues/263
CHECK_UARCH(arch, cpu, 'a', 0x025, NA, NA, "Firestorm", UARCH_FIRESTORM, CPU_VENDOR_APPLE) // https://github.com/Dr-Noob/cpufetch/issues/263
CHECK_UARCH(arch, cpu, 'a', 0x030, NA, NA, "Blizzard", UARCH_BLIZZARD, CPU_VENDOR_APPLE) CHECK_UARCH(arch, cpu, 'a', 0x030, NA, NA, "Blizzard", UARCH_BLIZZARD, CPU_VENDOR_APPLE)
CHECK_UARCH(arch, cpu, 'a', 0x031, NA, NA, "Avalanche", UARCH_AVALANCHE, CPU_VENDOR_APPLE) CHECK_UARCH(arch, cpu, 'a', 0x031, NA, NA, "Avalanche", UARCH_AVALANCHE, CPU_VENDOR_APPLE)
CHECK_UARCH(arch, cpu, 'a', 0x048, NA, NA, "Sawtooth", UARCH_SAWTOOTH, CPU_VENDOR_APPLE) CHECK_UARCH(arch, cpu, 'a', 0x048, NA, NA, "Sawtooth", UARCH_SAWTOOTH, CPU_VENDOR_APPLE)
@@ -275,7 +269,6 @@ bool is_ARMv8_or_newer(struct cpuInfo* cpu) {
cpu->arch->isa == ISA_ARMv8_3_A || cpu->arch->isa == ISA_ARMv8_3_A ||
cpu->arch->isa == ISA_ARMv8_4_A || cpu->arch->isa == ISA_ARMv8_4_A ||
cpu->arch->isa == ISA_ARMv8_5_A || cpu->arch->isa == ISA_ARMv8_5_A ||
cpu->arch->isa == ISA_ARMv8_6_A ||
cpu->arch->isa == ISA_ARMv9_A; cpu->arch->isa == ISA_ARMv9_A;
} }

View File

@@ -62,7 +62,7 @@
#endif #endif
#ifndef GIT_FULL_VERSION #ifndef GIT_FULL_VERSION
static const char* VERSION = "1.06"; static const char* VERSION = "1.05";
#endif #endif
enum { enum {

View File

@@ -90,9 +90,9 @@ void populate_pci_devices(struct pci_devices * pci) {
int path_size = strlen(PCI_PATH) + strlen(dev->path) + 2; int path_size = strlen(PCI_PATH) + strlen(dev->path) + 2;
// Read vendor_id // Read vendor_id
char *vendor_id_path = emalloc(sizeof(char) * (path_size + strlen("vendor") + 1)); char *vendor_id_path = emalloc(sizeof(char) * (path_size + strlen("vendor")));
sprintf(vendor_id_path, "%s/%s/%s", PCI_PATH, dev->path, "vendor"); sprintf(vendor_id_path, "%s/%s/%s", PCI_PATH, dev->path, "vendor");
if ((buf = read_file(vendor_id_path, &filelen)) == NULL) { if ((buf = read_file(vendor_id_path, &filelen)) == NULL) {
printWarn("read_file: %s: %s\n", vendor_id_path, strerror(errno)); printWarn("read_file: %s: %s\n", vendor_id_path, strerror(errno));
dev->vendor_id = 0; dev->vendor_id = 0;
@@ -102,7 +102,7 @@ void populate_pci_devices(struct pci_devices * pci) {
} }
// Read device_id // Read device_id
char *device_id_path = emalloc(sizeof(char) * (path_size + strlen("device") + 1)); char *device_id_path = emalloc(sizeof(char) * (path_size + strlen("device")));
sprintf(device_id_path, "%s/%s/%s", PCI_PATH, dev->path, "device"); sprintf(device_id_path, "%s/%s/%s", PCI_PATH, dev->path, "device");
if ((buf = read_file(device_id_path, &filelen)) == NULL) { if ((buf = read_file(device_id_path, &filelen)) == NULL) {

View File

@@ -21,12 +21,9 @@
#define CPUFAMILY_ARM_AVALANCHE_BLIZZARD 0xDA33D83D #define CPUFAMILY_ARM_AVALANCHE_BLIZZARD 0xDA33D83D
#endif #endif
// M3 / A16 / A17 // M3 / A16 / A17
// M3: https://ratfactor.com/zig/stdlib-browseable2/c/darwin.zig.html // https://ratfactor.com/zig/stdlib-browseable2/c/darwin.zig.html
// M3_2: https://github.com/Dr-Noob/cpufetch/issues/230 // https://github.com/Dr-Noob/cpufetch/issues/210
// PRO: https://github.com/Dr-Noob/cpufetch/issues/225
// MAX: https://github.com/Dr-Noob/cpufetch/issues/210
#define CPUFAMILY_ARM_EVEREST_SAWTOOTH 0x8765EDEA #define CPUFAMILY_ARM_EVEREST_SAWTOOTH 0x8765EDEA
#define CPUFAMILY_ARM_EVEREST_SAWTOOTH_2 0xFA33415E
#define CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO 0x5F4DEA93 #define CPUFAMILY_ARM_EVEREST_SAWTOOTH_PRO 0x5F4DEA93
#define CPUFAMILY_ARM_EVEREST_SAWTOOTH_MAX 0x72015832 #define CPUFAMILY_ARM_EVEREST_SAWTOOTH_MAX 0x72015832
@@ -43,14 +40,6 @@
#define CPUSUBFAMILY_ARM_HC_HD 5 #define CPUSUBFAMILY_ARM_HC_HD 5
#endif #endif
// For alternative way to get CPU frequency on macOS and *BSD
#ifdef __APPLE__
#define CPUFREQUENCY_SYSCTL "hw.cpufrequency_max"
#else
// For FreeBSD, not sure about other *BSD
#define CPUFREQUENCY_SYSCTL "dev.cpu.0.freq"
#endif
uint32_t get_sys_info_by_name(char* name); uint32_t get_sys_info_by_name(char* name);
#endif #endif

View File

@@ -1,10 +1,7 @@
#include "../common/global.h"
#include "udev.h" #include "udev.h"
#include "global.h" #include "global.h"
#include "cpu.h" #include "cpu.h"
#define _PATH_DEVTREE "/proc/device-tree/compatible"
// https://www.kernel.org/doc/html/latest/core-api/cpu_hotplug.html // https://www.kernel.org/doc/html/latest/core-api/cpu_hotplug.html
int get_ncores_from_cpuinfo(void) { int get_ncores_from_cpuinfo(void) {
// Examples: // Examples:
@@ -352,13 +349,3 @@ bool is_devtree_compatible(char* str) {
} }
return true; return true;
} }
char* get_devtree_compatible(int *filelen) {
char* buf;
if ((buf = read_file(_PATH_DEVTREE, filelen)) == NULL) {
printWarn("read_file: %s: %s", _PATH_DEVTREE, strerror(errno));
}
return buf;
}

View File

@@ -43,6 +43,5 @@ int get_num_sockets_package_cpus(struct topology* topo);
int get_ncores_from_cpuinfo(void); int get_ncores_from_cpuinfo(void);
char* get_field_from_cpuinfo(char* CPUINFO_FIELD); char* get_field_from_cpuinfo(char* CPUINFO_FIELD);
bool is_devtree_compatible(char* str); bool is_devtree_compatible(char* str);
char* get_devtree_compatible(int *filelen);
#endif #endif

View File

@@ -5,9 +5,6 @@
#include "../common/udev.h" #include "../common/udev.h"
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined (__FreeBSD__) || defined (__APPLE__)
#include "../common/sysctl.h"
#endif
#ifdef __linux__ #ifdef __linux__
#include "../common/freq.h" #include "../common/freq.h"
@@ -941,20 +938,10 @@ struct frequency* get_frequency_info(struct cpuInfo* cpu) {
freq->measured = false; freq->measured = false;
if(cpu->maxLevels < 0x00000016) { if(cpu->maxLevels < 0x00000016) {
#if defined (_WIN32) #if defined (_WIN32) || defined (__APPLE__)
printWarn("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X)", 0x00000016, cpu->maxLevels); printWarn("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X)", 0x00000016, cpu->maxLevels);
freq->base = UNKNOWN_DATA; freq->base = UNKNOWN_DATA;
freq->max = UNKNOWN_DATA; freq->max = UNKNOWN_DATA;
#elif defined (__FreeBSD__) || defined (__APPLE__)
printWarn("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X). Using sysctl", 0x00000016, cpu->maxLevels);
uint32_t freq_hz = get_sys_info_by_name(CPUFREQUENCY_SYSCTL);
if (freq_hz == 0) {
printWarn("Read max CPU frequency from sysctl and got 0 MHz");
freq->max = UNKNOWN_DATA;
}
freq->base = UNKNOWN_DATA;
freq->max = freq_hz;
#else #else
printWarn("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X). Using udev", 0x00000016, cpu->maxLevels); printWarn("Can't read frequency information from cpuid (needed level is 0x%.8X, max is 0x%.8X). Using udev", 0x00000016, cpu->maxLevels);
freq->base = UNKNOWN_DATA; freq->base = UNKNOWN_DATA;

View File

@@ -47,10 +47,8 @@ typedef uint32_t MICROARCH;
enum { enum {
UARCH_UNKNOWN, UARCH_UNKNOWN,
// INTEL // // INTEL //
UARCH_I486,
UARCH_P5, UARCH_P5,
UARCH_P5_MMX, UARCH_P5_MMX,
UARCH_P6_PRO,
UARCH_P6_PENTIUM_II, UARCH_P6_PENTIUM_II,
UARCH_P6_PENTIUM_III, UARCH_P6_PENTIUM_III,
UARCH_DOTHAN, UARCH_DOTHAN,
@@ -99,8 +97,6 @@ enum {
// AMD // // AMD //
UARCH_AM486, UARCH_AM486,
UARCH_AM5X86, UARCH_AM5X86,
UARCH_SSA5,
UARCH_K5,
UARCH_K6, UARCH_K6,
UARCH_K7, UARCH_K7,
UARCH_K8, UARCH_K8,
@@ -153,30 +149,16 @@ struct uarch* get_uarch_from_cpuid_intel(uint32_t ef, uint32_t f, uint32_t em, u
// ------------------------------------------------------------------------------- // // ------------------------------------------------------------------------------- //
// EF F EM M S // // EF F EM M S //
UARCH_START UARCH_START
CHECK_UARCH(arch, 0, 4, 0, 0, NA, "i80486DX", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 1, NA, "i80486DX-50", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 2, NA, "i80486SX", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 3, NA, "i80486DX2", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 4, NA, "i80486SL", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 5, NA, "i80486SX2", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 7, NA, "i80486DX2WB", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 8, NA, "i80486DX4", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 4, 0, 9, NA, "i80486DX4WB", UARCH_I486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 5, 0, 0, NA, "P5", UARCH_P5, 800) CHECK_UARCH(arch, 0, 5, 0, 0, NA, "P5", UARCH_P5, 800)
CHECK_UARCH(arch, 0, 5, 0, 1, NA, "P5", UARCH_P5, 800) CHECK_UARCH(arch, 0, 5, 0, 1, NA, "P5", UARCH_P5, 800)
CHECK_UARCH(arch, 0, 5, 0, 2, NA, "P54C", UARCH_P5, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 5, 0, 2, NA, "P5", UARCH_P5, UNK)
CHECK_UARCH(arch, 0, 5, 0, 3, NA, "P24T (Overdrive)", UARCH_P5, 600) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 5, 0, 3, NA, "P5", UARCH_P5, 600)
CHECK_UARCH(arch, 0, 5, 0, 4, NA, "P55C (MMX)", UARCH_P5_MMX, 350) // https://www.cpu-world.com/CPUs/Pentium/TYPE-Pentium%20MMX.html CHECK_UARCH(arch, 0, 5, 0, 4, NA, "P5 (MMX)", UARCH_P5_MMX, UNK)
CHECK_UARCH(arch, 0, 5, 0, 7, NA, "P54C", UARCH_P5, 350) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 5, 0, 7, NA, "P5 (MMX)", UARCH_P5_MMX, UNK)
CHECK_UARCH(arch, 0, 5, 0, 8, NA, "Tillamook", UARCH_P5_MMX, 250) // http://instlatx64.atw.hu./ CHECK_UARCH(arch, 0, 5, 0, 8, NA, "P5 (MMX)", UARCH_P5_MMX, 250)
CHECK_UARCH(arch, 0, 5, 0, 9, 0, "Lakemont", UARCH_LAKEMONT, 32) CHECK_UARCH(arch, 0, 5, 0, 9, 0, "Lakemont", UARCH_LAKEMONT, 32)
CHECK_UARCH(arch, 0, 5, 0, 9, NA, "P5 (MMX)", UARCH_P5_MMX, UNK) CHECK_UARCH(arch, 0, 5, 0, 9, NA, "P5 (MMX)", UARCH_P5_MMX, UNK)
CHECK_UARCH(arch, 0, 5, 0, 10, 0, "Lakemont", UARCH_LAKEMONT, 32) CHECK_UARCH(arch, 0, 5, 0, 10, 0, "Lakemont", UARCH_LAKEMONT, 32)
CHECK_UARCH(arch, 0, 6, 0, 1, 1, "P6", UARCH_P6_PRO, UNK)
CHECK_UARCH(arch, 0, 6, 0, 1, 2, "P6", UARCH_P6_PRO, UNK)
CHECK_UARCH(arch, 0, 6, 0, 1, 6, "P6", UARCH_P6_PRO, 350)
CHECK_UARCH(arch, 0, 6, 0, 1, 7, "P6", UARCH_P6_PRO, 350)
CHECK_UARCH(arch, 0, 6, 0, 1, 9, "P6", UARCH_P6_PRO, 350)
CHECK_UARCH(arch, 0, 6, 0, 0, NA, "P6 (Pentium II)", UARCH_P6_PENTIUM_II, UNK) CHECK_UARCH(arch, 0, 6, 0, 0, NA, "P6 (Pentium II)", UARCH_P6_PENTIUM_II, UNK)
CHECK_UARCH(arch, 0, 6, 0, 1, NA, "P6 (Pentium II)", UARCH_P6_PENTIUM_II, UNK) // process depends on core CHECK_UARCH(arch, 0, 6, 0, 1, NA, "P6 (Pentium II)", UARCH_P6_PENTIUM_II, UNK) // process depends on core
CHECK_UARCH(arch, 0, 6, 0, 2, NA, "P6 (Pentium II)", UARCH_P6_PENTIUM_II, UNK) CHECK_UARCH(arch, 0, 6, 0, 2, NA, "P6 (Pentium II)", UARCH_P6_PENTIUM_II, UNK)
@@ -297,16 +279,11 @@ struct uarch* get_uarch_from_cpuid_amd(uint32_t ef, uint32_t f, uint32_t em, uin
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- //
// EF F EM M S // // EF F EM M S //
UARCH_START UARCH_START
CHECK_UARCH(arch, 0, 4, 0, 3, NA, "Am486DX2", UARCH_AM486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 4, 0, 3, NA, "Am486", UARCH_AM486, UNK)
CHECK_UARCH(arch, 0, 4, 0, 7, NA, "Am486DX2WB", UARCH_AM486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 4, 0, 7, NA, "Am486", UARCH_AM486, UNK)
CHECK_UARCH(arch, 0, 4, 0, 8, NA, "Am486DX4", UARCH_AM486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 4, 0, 8, NA, "Am486", UARCH_AM486, UNK)
CHECK_UARCH(arch, 0, 4, 0, 9, NA, "Am486DX4WB", UARCH_AM486, UNK) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 4, 0, 9, NA, "Am486", UARCH_AM486, UNK)
CHECK_UARCH(arch, 0, 4, 0, 14, NA, "Am5x86", UARCH_AM5X86, 350) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h CHECK_UARCH(arch, 0, 4, NA, NA, NA, "Am5x86", UARCH_AM5X86, UNK)
CHECK_UARCH(arch, 0, 4, 0, 15, NA, "Am5x86WB", UARCH_AM5X86, 350) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 5, 0, 0, NA, "SSA5 (K5)", UARCH_SSA5, 350) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 5, 0, 1, NA, "K5", UARCH_K5, 350) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 5, 0, 2, NA, "K5", UARCH_K5, 350) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 5, 0, 3, NA, "K5", UARCH_K5, 350) // https://sandpile.org/x86/cpuid.htm#level_0000_0001h
CHECK_UARCH(arch, 0, 5, 0, 6, NA, "K6", UARCH_K6, 300) CHECK_UARCH(arch, 0, 5, 0, 6, NA, "K6", UARCH_K6, 300)
CHECK_UARCH(arch, 0, 5, 0, 7, NA, "K6", UARCH_K6, 250) // *p from sandpile.org CHECK_UARCH(arch, 0, 5, 0, 7, NA, "K6", UARCH_K6, 250) // *p from sandpile.org
CHECK_UARCH(arch, 0, 5, 0, 10, NA, "K7", UARCH_K7, 130) // Geode NX CHECK_UARCH(arch, 0, 5, 0, 10, NA, "K7", UARCH_K7, 130) // Geode NX
@@ -502,42 +479,16 @@ char* infer_cpu_name_from_uarch(struct uarch* arch) {
char *str = NULL; char *str = NULL;
switch (arch->uarch) { if (arch->uarch == UARCH_P5)
// Intel str = "Intel Pentium";
case UARCH_I486: else if (arch->uarch == UARCH_P5_MMX)
str = "Intel 486"; str = "Intel Pentium MMX";
break; else if (arch->uarch == UARCH_P6_PENTIUM_II)
case UARCH_P5: str = "Intel Pentium II";
str = "Intel Pentium"; else if (arch->uarch == UARCH_P6_PENTIUM_III)
break; str = "Intel Pentium III";
case UARCH_P5_MMX: else
str = "Intel Pentium MMX"; printErr("Unable to find name from uarch: %d", arch->uarch);
break;
case UARCH_P6_PRO:
str = "Intel Pentium Pro";
break;
case UARCH_P6_PENTIUM_II:
str = "Intel Pentium II";
break;
case UARCH_P6_PENTIUM_III:
str = "Intel Pentium III";
break;
// AMD
case UARCH_AM486:
str = "AMD 486";
break;
case UARCH_AM5X86:
str = "AMD 5x86";
break;
case UARCH_SSA5:
str = "AMD 5k86";
break;
default:
printErr("Unable to find name from uarch: %d", arch->uarch);
break;
}
if (str == NULL) { if (str == NULL) {
cpu_name = ecalloc(strlen(STRING_UNKNOWN) + 1, sizeof(char)); cpu_name = ecalloc(strlen(STRING_UNKNOWN) + 1, sizeof(char));