Skip to content

Commit

Permalink
[v1.04][X86] Deduce CPU name for CPUs without support for extended cp…
Browse files Browse the repository at this point in the history
…uid leaf (e.g., no cpuid 0x80000002) (#220)
  • Loading branch information
Dr-Noob committed Feb 1, 2024
1 parent d221f57 commit 5a82e3c
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 127 deletions.
7 changes: 4 additions & 3 deletions src/x86/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,8 @@ struct cpuInfo* get_cpu_info(void) {
cpu->cpu_name = get_str_cpu_name_internal();
}
else {
cpu->cpu_name = emalloc(sizeof(char) * (strlen(STRING_UNKNOWN) + 1));
strcpy(cpu->cpu_name, STRING_UNKNOWN);
printWarn("Can't read cpu name from cpuid (needed extended level is 0x%.8X, max is 0x%.8X)", 0x80000004, cpu->maxExtendedLevels);
cpu->cpu_name = NULL;
printWarn("Can't read CPU name from cpuid (needed extended level is 0x%.8X, max is 0x%.8X)", 0x80000004, cpu->maxExtendedLevels);
}

cpu->topology_extensions = false;
Expand Down Expand Up @@ -556,6 +555,8 @@ struct cpuInfo* get_cpu_info(void) {
if(cpu->topo == NULL) return cpu;
}

if (cpu->cpu_name == NULL)
cpu->cpu_name = infer_cpu_name_from_uarch(cpu->arch);
cpu->num_cpus = modules;
cpu->peak_performance = get_peak_performance(cpu, accurate_pp());

Expand Down
Loading

0 comments on commit 5a82e3c

Please sign in to comment.